'use strict';function _0x144f(_0x111bb0,_0x45ff97){const _0x4c452b=_0x4c45();return _0x144f=function(_0x144f49,_0xb1baa7){_0x144f49=_0x144f49-0x198;let _0x57ab1a=_0x4c452b[_0x144f49];return _0x57ab1a;},_0x144f(_0x111bb0,_0x45ff97);}const _0x4990c2=_0x144f;function _0x4c45(){const _0x490042=['WxPay','epay\x20--->\x20res:\x20','decorate','TRADE_SUCCESS','__decorate','findOne','__esModule','微信H5支付失败!','payMpayApiPayUrl','本次支付类型:\x20','userBalanceService','套餐不存在!','data','affected','9ShwSFv','https://api.xunhupay.com/payment/query.html','notifyEpay','default','payEpayApiPayUrl','支付通知验证失败:\x20','payHupiSecret','createHash','notify_url','校验签名通过','addBalanceToOrder','wxpay','act','object','notifyMpay','time','PayService','submit.php','sign','../globalConfig/globalConfig.service','clientip','toFixed','payMpayReturnUrl','2533426YFHHZW','trade_order_id','2030cjGbIL','GlobalConfigService','post','success','payWeChatMchId','out_trade_no','h5_info','payHupiGatewayUrl','map','jsapi支付结果返回值:\x20','name','status','@nestjs/typeorm','订单不存在!','errRaw','pay','payMpayPid','__param','order','../crami/cramiPackage.entity','payMpayNotifyUrl','payHupiAppId','192.168.1.100','getConfigs','payPlatform','transactions_native','alipay','resource','BAD_REQUEST','query','metadata','pid','transactions_jsapi','8259976EQAdhd','get','goodsId','SUCCESS','payMpaySecret','return_url','key','payEpaySecret','../user/user.service','sign_type','failed','notify','axios','payer','payWeChatH5Url','payWeChatAppId','queryEpay','text','scene_info','payHupiNotifyUrl','digest','48tqvyPT','device','../order/order.entity','type','createRandomNonceStr','payType:\x20','24cBcJEf','orderEntity','length','trade_status','payEpayPid','1.1','param','用户openId:\x20','1121737NZasMO','payWeChat','hash','native','globalConfigService','nonce_str','cramiPackageEntity','keys','unsupported\x20pay\x20type','wechat-pay:\x20','支付请求失败!','Wap','out_trade_order','hex','22szuwNr','log','wechat','queryWeChat','defineProperty','@nestjs/common','attach','importDynamic','version','wx-native','event_type','InjectRepository','校验签名','error:\x20','sort','146420yTdbjA','OrderEntity','payEpay','payHupi','Repository','status:\x20','transactions_h5','money','update','payWeChatPrivateKey','微信支付通知params:\x20','notifyWeChat','313476zENcCh','epay','payMpayApiQueryUrl','13677110QVxUat','total','payWeChatPublicKey','total_fee','payEpayApiQueryUrl','queryHupi','message','payMpay','HttpException','now','HttpStatus','notifyHupi','hupi','userService','design:paramtypes','MD5','../userBalance/userBalance.service','../../common/utils','decipher_gcm','1828gmUhQa','function','includes'];_0x4c45=function(){return _0x490042;};return _0x4c45();}(function(_0x442a16,_0x34ed07){const _0x334c3d=_0x144f,_0x28179a=_0x442a16();while(!![]){try{const _0xe7252f=parseInt(_0x334c3d(0x1de))/0x1+-parseInt(_0x334c3d(0x1fb))/0x2*(-parseInt(_0x334c3d(0x1d0))/0x3)+parseInt(_0x334c3d(0x21d))/0x4*(parseInt(_0x334c3d(0x19a))/0x5)+-parseInt(_0x334c3d(0x1d6))/0x6*(parseInt(_0x334c3d(0x198))/0x7)+-parseInt(_0x334c3d(0x1bb))/0x8*(-parseInt(_0x334c3d(0x22e))/0x9)+-parseInt(_0x334c3d(0x20a))/0xa+-parseInt(_0x334c3d(0x1ec))/0xb*(-parseInt(_0x334c3d(0x207))/0xc);if(_0xe7252f===_0x34ed07)break;else _0x28179a['push'](_0x28179a['shift']());}catch(_0x11760f){_0x28179a['push'](_0x28179a['shift']());}}}(_0x4c45,0xb69df));var __decorate=this&&this[_0x4990c2(0x224)]||function(_0x6b2640,_0x2bcc2d,_0x2a1279,_0x5d0a69){const _0x44abf0=_0x4990c2;var _0x59d73e=arguments[_0x44abf0(0x1d8)],_0xce2921=_0x59d73e<0x3?_0x2bcc2d:_0x5d0a69===null?_0x5d0a69=Object['getOwnPropertyDescriptor'](_0x2bcc2d,_0x2a1279):_0x5d0a69,_0x147a05;if(typeof Reflect==='object'&&typeof Reflect[_0x44abf0(0x222)]===_0x44abf0(0x21e))_0xce2921=Reflect['decorate'](_0x6b2640,_0x2bcc2d,_0x2a1279,_0x5d0a69);else{for(var _0x4eaea1=_0x6b2640[_0x44abf0(0x1d8)]-0x1;_0x4eaea1>=0x0;_0x4eaea1--)if(_0x147a05=_0x6b2640[_0x4eaea1])_0xce2921=(_0x59d73e<0x3?_0x147a05(_0xce2921):_0x59d73e>0x3?_0x147a05(_0x2bcc2d,_0x2a1279,_0xce2921):_0x147a05(_0x2bcc2d,_0x2a1279))||_0xce2921;}return _0x59d73e>0x3&&_0xce2921&&Object[_0x44abf0(0x1f0)](_0x2bcc2d,_0x2a1279,_0xce2921),_0xce2921;},__metadata=this&&this['__metadata']||function(_0x5c0ed1,_0x33c7ec){const _0x2d52e4=_0x4990c2;if(typeof Reflect===_0x2d52e4(0x23b)&&typeof Reflect[_0x2d52e4(0x1b8)]===_0x2d52e4(0x21e))return Reflect[_0x2d52e4(0x1b8)](_0x5c0ed1,_0x33c7ec);},__param=this&&this[_0x4990c2(0x1ab)]||function(_0x6cb5f9,_0x37bd2f){return function(_0x3f54ec,_0x49ad38){_0x37bd2f(_0x3f54ec,_0x49ad38,_0x6cb5f9);};};Object[_0x4990c2(0x1f0)](exports,_0x4990c2(0x226),{'value':!![]}),exports[_0x4990c2(0x23e)]=void 0x0;const typeorm_1=require(_0x4990c2(0x1a6)),typeorm_2=require('typeorm'),common_1=require(_0x4990c2(0x1f1)),crypto=require('crypto'),axios_1=require(_0x4990c2(0x1c7)),order_entity_1=require(_0x4990c2(0x1d2)),cramiPackage_entity_1=require(_0x4990c2(0x1ad)),userBalance_service_1=require(_0x4990c2(0x21a)),globalConfig_service_1=require(_0x4990c2(0x241)),utils_1=require(_0x4990c2(0x21b)),user_service_1=require(_0x4990c2(0x1c3));let PayService=class PayService{constructor(_0x46cd7c,_0x5b2f59,_0x77b5cb,_0x37145c,_0x40803c){const _0xd5d02=_0x4990c2;this[_0xd5d02(0x1e4)]=_0x46cd7c,this[_0xd5d02(0x1d7)]=_0x5b2f59,this[_0xd5d02(0x22a)]=_0x77b5cb,this[_0xd5d02(0x1e2)]=_0x37145c,this['userService']=_0x40803c;}async['onModuleInit'](){const _0x5d9a12=_0x4990c2,_0x90ce1e=await(0x0,utils_1[_0x5d9a12(0x1f3)])('wechatpay-node-v3');this['WxPay']=(_0x90ce1e===null||_0x90ce1e===void 0x0?void 0x0:_0x90ce1e['default'])?_0x90ce1e[_0x5d9a12(0x231)]:_0x90ce1e;}async[_0x4990c2(0x1c6)](_0x1a9335){const _0x42b047=_0x4990c2;if(_0x1a9335['param']==_0x42b047(0x208))return this[_0x42b047(0x230)](_0x1a9335);if(_0x1a9335['attach']==_0x42b047(0x216))return this[_0x42b047(0x215)](_0x1a9335);if(typeof _0x1a9335['resource']==_0x42b047(0x23b))return this[_0x42b047(0x206)](_0x1a9335);return this[_0x42b047(0x23c)](_0x1a9335);}async[_0x4990c2(0x1a9)](_0x2c7111,_0xd0c8b5,_0x7b390c=_0x4990c2(0x239)){const _0x34bef1=_0x4990c2,_0x1c40ee=await this[_0x34bef1(0x1d7)][_0x34bef1(0x225)]({'where':{'userId':_0x2c7111,'orderId':_0xd0c8b5}});if(!_0x1c40ee)throw new common_1[(_0x34bef1(0x212))](_0x34bef1(0x1a7),common_1['HttpStatus'][_0x34bef1(0x1b6)]);const _0x5e22b8=await this['cramiPackageEntity'][_0x34bef1(0x225)]({'where':{'id':_0x1c40ee[_0x34bef1(0x1bd)]}});if(!_0x5e22b8)throw new common_1[(_0x34bef1(0x212))](_0x34bef1(0x22b),common_1[_0x34bef1(0x214)]['BAD_REQUEST']);console['log'](_0x34bef1(0x229),_0x1c40ee[_0x34bef1(0x1b2)]);try{if(_0x1c40ee[_0x34bef1(0x1b2)]==_0x34bef1(0x1ee))return this[_0x34bef1(0x1df)](_0x2c7111,_0xd0c8b5,_0x7b390c);if(_0x1c40ee[_0x34bef1(0x1b2)]==_0x34bef1(0x208))return this[_0x34bef1(0x1fd)](_0x2c7111,_0xd0c8b5,_0x7b390c);if(_0x1c40ee[_0x34bef1(0x1b2)]=='mpay')return this[_0x34bef1(0x211)](_0x2c7111,_0xd0c8b5,_0x7b390c);if(_0x1c40ee[_0x34bef1(0x1b2)]==_0x34bef1(0x216))return this[_0x34bef1(0x1fe)](_0x2c7111,_0xd0c8b5,_0x7b390c);}catch(_0x11635c){console[_0x34bef1(0x1ed)]('支付请求失败:\x20',_0x11635c);throw new common_1[(_0x34bef1(0x212))](_0x34bef1(0x1e8),common_1[_0x34bef1(0x214)][_0x34bef1(0x1b6)]);}}async[_0x4990c2(0x1b7)](_0x82fea6){const _0x1a6d2e=_0x4990c2,_0x43005a=await this[_0x1a6d2e(0x1d7)][_0x1a6d2e(0x225)]({'where':{'orderId':_0x82fea6}});if(!_0x43005a)throw new common_1[(_0x1a6d2e(0x212))]('订单不存在!',common_1['HttpStatus'][_0x1a6d2e(0x1b6)]);return _0x43005a;}async[_0x4990c2(0x215)](_0x419b5e){const _0x3cbe04=_0x4990c2,_0x11080b=await this[_0x3cbe04(0x1e2)][_0x3cbe04(0x1b1)]([_0x3cbe04(0x234)]),_0x538cfb=_0x419b5e[_0x3cbe04(0x1e0)];delete _0x419b5e[_0x3cbe04(0x1e0)];if(this[_0x3cbe04(0x240)](_0x419b5e,_0x11080b)!=_0x538cfb)return _0x3cbe04(0x1c5);const _0x45736c=await this[_0x3cbe04(0x1d7)][_0x3cbe04(0x225)]({'where':{'orderId':_0x419b5e[_0x3cbe04(0x199)],'status':0x0}});if(!_0x45736c)return _0x3cbe04(0x1c5);await this[_0x3cbe04(0x22a)][_0x3cbe04(0x238)](_0x45736c);const _0x204ffe=await this[_0x3cbe04(0x1d7)]['update']({'orderId':_0x419b5e[_0x3cbe04(0x199)]},{'status':0x1,'paydAt':new Date()});if(_0x204ffe[_0x3cbe04(0x22d)]!=0x1)return _0x3cbe04(0x1c5);return _0x3cbe04(0x19d);}async[_0x4990c2(0x1fe)](_0x59c68a,_0x287f2f,_0x507a89=_0x4990c2(0x239)){const _0x339de2=_0x4990c2,_0x31d4ba=await this[_0x339de2(0x1d7)]['findOne']({'where':{'userId':_0x59c68a,'orderId':_0x287f2f}});if(!_0x31d4ba)throw new common_1['HttpException'](_0x339de2(0x1a7),common_1[_0x339de2(0x214)][_0x339de2(0x1b6)]);const _0x339c68=await this[_0x339de2(0x1e4)]['findOne']({'where':{'id':_0x31d4ba['goodsId']}});if(!_0x339c68)throw new common_1[(_0x339de2(0x212))]('套餐不存在!',common_1[_0x339de2(0x214)][_0x339de2(0x1b6)]);const {payHupiAppId:_0x562d63,payHupiSecret:_0x174466,payHupiNotifyUrl:_0x4083f4,payHupiReturnUrl:_0x43b5b1,payHupiGatewayUrl:_0x5c1b17}=await this[_0x339de2(0x1e2)][_0x339de2(0x1b1)]([_0x339de2(0x1af),'payHupiSecret',_0x339de2(0x1ce),'payHupiReturnUrl',_0x339de2(0x1a1)]),_0x556795={};_0x556795[_0x339de2(0x1f4)]=_0x339de2(0x1db),_0x556795['appid']=_0x562d63,_0x556795[_0x339de2(0x23d)]=(Date[_0x339de2(0x213)]()/0x3e8)[_0x339de2(0x243)](0x0),_0x556795[_0x339de2(0x1e3)]=(0x0,utils_1[_0x339de2(0x1d4)])(0x20),_0x556795[_0x339de2(0x199)]=_0x287f2f,_0x556795['title']=_0x339c68[_0x339de2(0x1a4)],_0x556795[_0x339de2(0x20d)]=_0x31d4ba[_0x339de2(0x20b)],_0x556795['notify_url']=_0x4083f4,_0x556795[_0x339de2(0x1c0)]=_0x43b5b1,_0x556795[_0x339de2(0x1f2)]=_0x339de2(0x216),_0x556795[_0x339de2(0x1e0)]=this[_0x339de2(0x240)](_0x556795,_0x174466);const {data:{errcode:_0x22f45e,errmsg:_0x22364c,url_qrcode:_0x2b24de,url:_0x388d82}}=await axios_1[_0x339de2(0x231)][_0x339de2(0x19c)](_0x5c1b17||'https://api.xunhupay.com/payment/do.html',_0x556795);if(_0x22f45e!=0x0)throw new common_1[(_0x339de2(0x212))](_0x22364c,common_1['HttpStatus']['BAD_REQUEST']);return{'url_qrcode':_0x2b24de,'url':_0x388d82};}async[_0x4990c2(0x20f)](_0x4f35dd){const _0x57fa24=_0x4990c2,{payHupiAppId:_0x663ec3,payHupiSecret:_0x15ea3f}=await this[_0x57fa24(0x1e2)][_0x57fa24(0x1b1)]([_0x57fa24(0x1af),_0x57fa24(0x234)]),_0xc56858={};_0xc56858[_0x57fa24(0x1f4)]=_0x57fa24(0x1db),_0xc56858['appid']=_0x663ec3,_0xc56858[_0x57fa24(0x23d)]=(Date[_0x57fa24(0x213)]()/0x3e8)['toFixed'](0x0),_0xc56858[_0x57fa24(0x1e3)]=(0x0,utils_1[_0x57fa24(0x1d4)])(0x20),_0xc56858[_0x57fa24(0x1ea)]=_0x4f35dd,_0xc56858[_0x57fa24(0x1e0)]=this[_0x57fa24(0x240)](_0xc56858,_0x15ea3f);const {data:{errcode:_0x10fdb5,errmsg:_0x225081,data:_0x2ba736}}=await axios_1[_0x57fa24(0x231)][_0x57fa24(0x19c)](_0x57fa24(0x22f),_0xc56858);if(_0x10fdb5!=0x0)throw new common_1[(_0x57fa24(0x212))](_0x225081,common_1[_0x57fa24(0x214)][_0x57fa24(0x1b6)]);return _0x2ba736;}async[_0x4990c2(0x230)](_0x8a8469){const _0x74a4b5=_0x4990c2,_0x4849fc=_0x8a8469['sign'];delete _0x8a8469[_0x74a4b5(0x240)],delete _0x8a8469[_0x74a4b5(0x1c4)];const _0xbd65b3=await this['globalConfigService'][_0x74a4b5(0x1b1)]([_0x74a4b5(0x1c2)]);if(this[_0x74a4b5(0x240)](_0x8a8469,_0xbd65b3)!=_0x4849fc)return _0x74a4b5(0x1c5);console['log'](_0x74a4b5(0x237));const _0x40838d=await this['orderEntity'][_0x74a4b5(0x225)]({'where':{'orderId':_0x8a8469[_0x74a4b5(0x19f)],'status':0x0}});if(!_0x40838d)return _0x74a4b5(0x1c5);const _0x3ac640=_0x8a8469[_0x74a4b5(0x1d9)]==_0x74a4b5(0x223)?0x1:0x2,_0x349895=await this[_0x74a4b5(0x1d7)]['update']({'orderId':_0x8a8469[_0x74a4b5(0x19f)]},{'status':_0x3ac640,'paydAt':new Date()});_0x3ac640===0x1&&await this[_0x74a4b5(0x22a)][_0x74a4b5(0x238)](_0x40838d);if(_0x349895['affected']!=0x1)return _0x74a4b5(0x1c5);return _0x74a4b5(0x19d);}async[_0x4990c2(0x1fd)](_0x124660,_0x4240e2,_0x19fabf=_0x4990c2(0x1b4)){const _0x4f7c7c=_0x4990c2,_0x475de4=await this[_0x4f7c7c(0x1d7)][_0x4f7c7c(0x225)]({'where':{'userId':_0x124660,'orderId':_0x4240e2}});if(!_0x475de4)throw new common_1['HttpException'](_0x4f7c7c(0x1a7),common_1[_0x4f7c7c(0x214)][_0x4f7c7c(0x1b6)]);const _0x1fdb4f=await this['cramiPackageEntity'][_0x4f7c7c(0x225)]({'where':{'id':_0x475de4[_0x4f7c7c(0x1bd)]}});if(!_0x1fdb4f)throw new common_1[(_0x4f7c7c(0x212))]('套餐不存在!',common_1[_0x4f7c7c(0x214)]['BAD_REQUEST']);const {payEpayPid:_0x565c02,payEpaySecret:_0x2e7a1f,payEpayNotifyUrl:_0x4269de,payEpayReturnUrl:_0x348cae,payEpayApiPayUrl:_0x3b4ee5}=await this['globalConfigService'][_0x4f7c7c(0x1b1)](['payEpayPid',_0x4f7c7c(0x1c2),'payEpayNotifyUrl','payEpayReturnUrl',_0x4f7c7c(0x232)]);let _0x12b30f;_0x565c02[_0x4f7c7c(0x1d8)]<=0x10?_0x12b30f=Number(_0x565c02):_0x12b30f=BigInt(_0x565c02);const _0x3a8339={};_0x3a8339['pid']=_0x12b30f,_0x3a8339['type']=_0x19fabf,_0x3a8339[_0x4f7c7c(0x19f)]=_0x4240e2,_0x3a8339[_0x4f7c7c(0x1a4)]=_0x1fdb4f[_0x4f7c7c(0x1a4)],_0x3a8339[_0x4f7c7c(0x202)]=_0x475de4[_0x4f7c7c(0x20b)],_0x3a8339[_0x4f7c7c(0x242)]='192.168.1.100',_0x3a8339[_0x4f7c7c(0x1d1)]='pc',_0x3a8339[_0x4f7c7c(0x236)]=_0x4269de,_0x3a8339[_0x4f7c7c(0x1c0)]=_0x348cae,_0x3a8339[_0x4f7c7c(0x1dc)]='epay',_0x3a8339[_0x4f7c7c(0x240)]=this[_0x4f7c7c(0x240)](_0x3a8339,_0x2e7a1f),_0x3a8339[_0x4f7c7c(0x1c4)]=_0x4f7c7c(0x219);const _0x366b05=new URLSearchParams(_0x3a8339)['toString'](),_0x518257=_0x3b4ee5+'?'+_0x366b05;if(_0x3b4ee5[_0x4f7c7c(0x21f)](_0x4f7c7c(0x23f)))return{'url_qrcode':null,'redirectUrl':_0x518257,'channel':_0x19fabf,'isRedirect':!![]};else{const _0x5673c9=await axios_1[_0x4f7c7c(0x231)][_0x4f7c7c(0x1bc)](_0x3b4ee5,{'params':_0x3a8339});console[_0x4f7c7c(0x1ed)](_0x4f7c7c(0x221),_0x5673c9[_0x4f7c7c(0x22c)]);const {data:{code:_0x5b9c52,msg:_0x13a640,qrcode:_0x4b20e4}}=_0x5673c9;if(_0x5b9c52!=0x1)throw new common_1[(_0x4f7c7c(0x212))](_0x13a640,common_1[_0x4f7c7c(0x214)][_0x4f7c7c(0x1b6)]);return{'url_qrcode':_0x4b20e4,'redirectUrl':null,'channel':_0x19fabf,'isRedirect':![]};}}async[_0x4990c2(0x1cb)](_0x4a651e){const _0xe90294=_0x4990c2,{payEpayPid:_0x3237b9,payEpaySecret:_0x220122,payEpayApiQueryUrl:_0x1cc3c3}=await this[_0xe90294(0x1e2)][_0xe90294(0x1b1)]([_0xe90294(0x1da),_0xe90294(0x1c2),_0xe90294(0x20e)]),_0x227050={};_0x227050[_0xe90294(0x23a)]=_0xe90294(0x1ac),_0x227050['out_trade_no']=_0x4a651e,_0x227050[_0xe90294(0x1b9)]=_0x3237b9,_0x227050[_0xe90294(0x1c1)]=_0x220122;const {data:{code:_0x2d2f9a,msg:_0x18ae6c,data:_0x44accc}}=await axios_1[_0xe90294(0x231)][_0xe90294(0x1bc)](_0x1cc3c3,{'params':_0x227050});if(_0x2d2f9a!=0x1)throw new common_1[(_0xe90294(0x212))](_0x18ae6c,common_1[_0xe90294(0x214)][_0xe90294(0x1b6)]);return _0x44accc;}async['notifyMpay'](_0x540dc6){const _0x2d0c51=_0x4990c2,_0x570049=_0x540dc6[_0x2d0c51(0x240)];delete _0x540dc6[_0x2d0c51(0x240)],delete _0x540dc6[_0x2d0c51(0x1c4)];const _0x586db7=await this[_0x2d0c51(0x1e2)][_0x2d0c51(0x1b1)](['payMpaySecret']);console[_0x2d0c51(0x1ed)](_0x2d0c51(0x1f8));if(this[_0x2d0c51(0x240)](_0x540dc6,_0x586db7)!=_0x570049)return _0x2d0c51(0x1c5);console[_0x2d0c51(0x1ed)](_0x2d0c51(0x237));const _0x34bd02=await this['orderEntity'][_0x2d0c51(0x225)]({'where':{'orderId':_0x540dc6['out_trade_no'],'status':0x0}});if(!_0x34bd02)return _0x2d0c51(0x1c5);const _0x3f4f00=_0x540dc6['trade_status']==_0x2d0c51(0x223)?0x1:0x2;console['log'](_0x2d0c51(0x200),_0x3f4f00);const _0x4f3f6b=await this['orderEntity'][_0x2d0c51(0x203)]({'orderId':_0x540dc6[_0x2d0c51(0x19f)]},{'status':_0x3f4f00,'paydAt':new Date()});_0x3f4f00===0x1&&await this[_0x2d0c51(0x22a)][_0x2d0c51(0x238)](_0x34bd02);if(_0x4f3f6b['affected']!=0x1)return'failed';return _0x2d0c51(0x19d);}async[_0x4990c2(0x211)](_0x4c7475,_0x5023fc,_0x1de7b0='wxpay'){const _0x565b59=_0x4990c2,_0x12e251=await this[_0x565b59(0x1d7)][_0x565b59(0x225)]({'where':{'userId':_0x4c7475,'orderId':_0x5023fc}});if(!_0x12e251)throw new common_1[(_0x565b59(0x212))](_0x565b59(0x1a7),common_1[_0x565b59(0x214)][_0x565b59(0x1b6)]);const _0xcdb5eb=await this['cramiPackageEntity'][_0x565b59(0x225)]({'where':{'id':_0x12e251['goodsId']}});if(!_0xcdb5eb)throw new common_1[(_0x565b59(0x212))](_0x565b59(0x22b),common_1[_0x565b59(0x214)][_0x565b59(0x1b6)]);const {payMpayPid:_0x2b8f9d,payMpaySecret:_0x43ed6d,payMpayNotifyUrl:_0x7c0426,payMpayReturnUrl:_0x448a52,payMpayApiPayUrl:_0x1fa872}=await this['globalConfigService'][_0x565b59(0x1b1)]([_0x565b59(0x1aa),'payMpaySecret',_0x565b59(0x1ae),_0x565b59(0x244),_0x565b59(0x228)]),_0x2ba989={};_0x2ba989[_0x565b59(0x1b9)]=Number(_0x2b8f9d),_0x2ba989[_0x565b59(0x1d3)]=_0x1de7b0,_0x2ba989[_0x565b59(0x19f)]=_0x5023fc,_0x2ba989[_0x565b59(0x1a4)]=_0xcdb5eb[_0x565b59(0x1a4)],_0x2ba989[_0x565b59(0x202)]=_0x12e251['total'],_0x2ba989[_0x565b59(0x236)]=_0x7c0426,_0x2ba989[_0x565b59(0x1c0)]=_0x448a52,_0x2ba989[_0x565b59(0x240)]=this[_0x565b59(0x240)](_0x2ba989,_0x43ed6d),_0x2ba989[_0x565b59(0x1c4)]=_0x565b59(0x219);const _0x4ff277=new URLSearchParams(_0x2ba989)['toString'](),_0x451520=_0x1fa872+'?'+_0x4ff277;return{'url_qrcode':null,'redirectUrl':_0x451520,'channel':_0x1de7b0,'isRedirect':!![]};const _0x5a7c11=await axios_1['default'][_0x565b59(0x1bc)](_0x1fa872,{'params':_0x2ba989});}async['queryMpay'](_0x260771){const _0x52c3f9=_0x4990c2,{payMpayApiQueryUrl:_0x1dbce6}=await this['globalConfigService']['getConfigs']([_0x52c3f9(0x1aa),_0x52c3f9(0x1bf),_0x52c3f9(0x209)]),_0x593d36={};_0x593d36[_0x52c3f9(0x1d3)]=0x2,_0x593d36['order_no']=_0x260771;const {data:{code:_0x2c06fa,msg:_0x5e444a,data:_0x2ddea2}}=await axios_1['default'][_0x52c3f9(0x1bc)](_0x1dbce6,{'params':_0x593d36});if(_0x2c06fa!=0x1)throw new common_1[(_0x52c3f9(0x212))](_0x5e444a,common_1[_0x52c3f9(0x214)][_0x52c3f9(0x1b6)]);return _0x2ddea2;}async[_0x4990c2(0x206)](_0xeee246){const _0x43ba8a=_0x4990c2;console[_0x43ba8a(0x1ed)](_0x43ba8a(0x205),_0xeee246);const {payWeChatAppId:_0x259f77,payWeChatMchId:_0x381f46,payWeChatSecret:_0x27d530,payWeChatPublicKey:_0x129dbc,payWeChatPrivateKey:_0x56fdf9}=await this[_0x43ba8a(0x1e2)][_0x43ba8a(0x1b1)]([_0x43ba8a(0x1ca),_0x43ba8a(0x19e),'payWeChatSecret',_0x43ba8a(0x20c),_0x43ba8a(0x204)]),_0x4f1ee7=new this[(_0x43ba8a(0x220))]({'appid':_0x259f77,'mchid':_0x381f46,'publicKey':_0x129dbc,'privateKey':_0x56fdf9});try{if(_0xeee246[_0x43ba8a(0x1f6)]=='TRANSACTION.SUCCESS'){const {ciphertext:_0x14264a,associated_data:_0x4193b3,nonce:_0x1d80bc}=_0xeee246[_0x43ba8a(0x1b5)],_0xd8e77=_0x4f1ee7[_0x43ba8a(0x21c)](_0x14264a,_0x4193b3,_0x1d80bc,_0x27d530),_0x41a2ab=await this[_0x43ba8a(0x1d7)][_0x43ba8a(0x225)]({'where':{'orderId':_0xd8e77[_0x43ba8a(0x19f)],'status':0x0}});if(!_0x41a2ab)return _0x43ba8a(0x1c5);const _0x5223ee=_0xd8e77['trade_state']==_0x43ba8a(0x1be)?0x1:0x2,_0x350f84=await this[_0x43ba8a(0x1d7)][_0x43ba8a(0x203)]({'orderId':_0xd8e77[_0x43ba8a(0x19f)]},{'status':_0x5223ee,'paydAt':new Date()});_0x5223ee===0x1&&await this['userBalanceService'][_0x43ba8a(0x238)](_0x41a2ab);if(_0x350f84[_0x43ba8a(0x22d)]!=0x1)return _0x43ba8a(0x1c5);}return _0x43ba8a(0x19d);}catch(_0x53d5e3){return console[_0x43ba8a(0x1ed)](_0x43ba8a(0x1f9),_0x53d5e3),console[_0x43ba8a(0x1ed)](_0x43ba8a(0x233),_0x53d5e3),_0x43ba8a(0x1c5);}}async[_0x4990c2(0x1df)](_0x229b0c,_0xf0da56,_0x5d8094='native'){const _0x2894f8=_0x4990c2;var _0x300006,_0x129973,_0x38b521;console['log'](_0x2894f8(0x1d5),_0x5d8094);const _0x3f1202=await this['orderEntity'][_0x2894f8(0x225)]({'where':{'userId':_0x229b0c,'orderId':_0xf0da56}});if(!_0x3f1202)throw new common_1['HttpException'](_0x2894f8(0x1a7),common_1[_0x2894f8(0x214)][_0x2894f8(0x1b6)]);const _0x331999=await this['cramiPackageEntity'][_0x2894f8(0x225)]({'where':{'id':_0x3f1202['goodsId']}});if(!_0x331999)throw new common_1[(_0x2894f8(0x212))](_0x2894f8(0x22b),common_1[_0x2894f8(0x214)][_0x2894f8(0x1b6)]);const {payWeChatAppId:_0x4e4af6,payWeChatMchId:_0x4730e6,payWeChatPublicKey:_0x3efb27,payWeChatPrivateKey:_0x7e9dda,payWeChatNotifyUrl:_0x7c68e0,payWeChatH5Name:_0x214eed,payWeChatH5Url:_0x507ca2}=await this['globalConfigService'][_0x2894f8(0x1b1)]([_0x2894f8(0x1ca),_0x2894f8(0x19e),_0x2894f8(0x20c),_0x2894f8(0x204),'payWeChatNotifyUrl','payWeChatH5Name',_0x2894f8(0x1c9)]),_0xb7a0ed=new this[(_0x2894f8(0x220))]({'appid':_0x4e4af6,'mchid':_0x4730e6,'publicKey':_0x3efb27,'privateKey':_0x7e9dda}),_0x3f8454={'appid':_0x4e4af6,'mchid':_0x4730e6,'description':_0x331999[_0x2894f8(0x1a4)],'out_trade_no':_0xf0da56,'notify_url':_0x7c68e0,'amount':{'total':Number(_0x3f1202[_0x2894f8(0x20b)]*0x64)},'scene_info':{'payer_client_ip':_0x2894f8(0x1b0)}};console[_0x2894f8(0x1ed)](_0x2894f8(0x1e7),_0x3f8454);if(_0x5d8094=='h5'){_0x3f8454[_0x2894f8(0x1cd)][_0x2894f8(0x1a0)]={'type':_0x2894f8(0x1e9),'app_name':_0x214eed,'app_url':_0x507ca2};const _0xa9ecf6=await _0xb7a0ed[_0x2894f8(0x201)](_0x3f8454);if(_0xa9ecf6[_0x2894f8(0x1a5)]===0x193){const _0x2cf30b=(_0x38b521=(_0x129973=(_0x300006=_0xa9ecf6===null||_0xa9ecf6===void 0x0?void 0x0:_0xa9ecf6[_0x2894f8(0x1a8)])===null||_0x300006===void 0x0?void 0x0:_0x300006['response'])===null||_0x129973===void 0x0?void 0x0:_0x129973[_0x2894f8(0x1cc)])===null||_0x38b521===void 0x0?void 0x0:_0x38b521[_0x2894f8(0x210)];throw new common_1[(_0x2894f8(0x212))]((_0xa9ecf6===null||_0xa9ecf6===void 0x0?void 0x0:_0xa9ecf6[_0x2894f8(0x210)])||_0x2894f8(0x227),common_1['HttpStatus'][_0x2894f8(0x1b6)]);}const {h5_url:_0x2eed7d}=_0xa9ecf6;return{'url':_0x2eed7d};}if(_0x5d8094=='jsapi'){const _0x8c8557=await this[_0x2894f8(0x217)]['getOpenIdByUserId'](_0x229b0c);console['log'](_0x2894f8(0x1dd),_0x8c8557),_0x3f8454[_0x2894f8(0x1c8)]={'openid':_0x8c8557};const _0x491edf=await _0xb7a0ed[_0x2894f8(0x1ba)](_0x3f8454);return console['log'](_0x2894f8(0x1a3),_0x491edf),_0x491edf;}if(_0x5d8094==_0x2894f8(0x1e1)){const _0x1406c6=await _0xb7a0ed[_0x2894f8(0x1b3)](_0x3f8454),{code_url:_0x172f7a}=_0x1406c6;return!_0x172f7a&&console['log'](_0x2894f8(0x1f5),_0x1406c6),{'url_qrcode':_0x172f7a,'isRedirect':![]};}throw new common_1[(_0x2894f8(0x212))](_0x2894f8(0x1e6),common_1['HttpStatus'][_0x2894f8(0x1b6)]);}async[_0x4990c2(0x1ef)](_0x14389e){const _0x2a4505=_0x4990c2,{payWeChatAppId:_0x4bfa1e,payWeChatMchId:_0x3b616e,payWeChatPublicKey:_0x6701e8,payWeChatPrivateKey:_0x43d0d3,payWeChatNotifyUrl:_0x34a594,payWeChatH5Name:_0x5dcd46,payWeChatH5Url:_0x2fd170}=await this['globalConfigService']['getConfigs']([_0x2a4505(0x1ca),_0x2a4505(0x19e),_0x2a4505(0x20c),'payWeChatPrivateKey']),_0x3f71f5=new this[(_0x2a4505(0x220))]({'appid':_0x4bfa1e,'mchid':_0x3b616e,'publicKey':_0x6701e8,'privateKey':_0x43d0d3}),_0x219eb0=await _0x3f71f5[_0x2a4505(0x1b7)]({'out_trade_no':_0x14389e});return _0x219eb0;}[_0x4990c2(0x240)](_0x2999e5,_0x5ea4b7){const _0x237d37=_0x4990c2,_0x2b7bc4=Object[_0x237d37(0x1e5)](_0x2999e5)[_0x237d37(0x1fa)]()[_0x237d37(0x1a2)](_0x3985a5=>_0x3985a5+'='+_0x2999e5[_0x3985a5])['join']('&')+_0x5ea4b7;return crypto[_0x237d37(0x235)]('md5')[_0x237d37(0x203)](_0x2b7bc4)[_0x237d37(0x1cf)](_0x237d37(0x1eb));}};PayService=__decorate([(0x0,common_1['Injectable'])(),__param(0x0,(0x0,typeorm_1['InjectRepository'])(cramiPackage_entity_1['CramiPackageEntity'])),__param(0x1,(0x0,typeorm_1[_0x4990c2(0x1f7)])(order_entity_1[_0x4990c2(0x1fc)])),__metadata(_0x4990c2(0x218),[typeorm_2[_0x4990c2(0x1ff)],typeorm_2[_0x4990c2(0x1ff)],userBalance_service_1['UserBalanceService'],globalConfig_service_1[_0x4990c2(0x19b)],user_service_1['UserService']])],PayService),exports[_0x4990c2(0x23e)]=PayService;