mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 05:06:39 +08:00
1 line
23 KiB
JavaScript
1 line
23 KiB
JavaScript
'use strict';const _0x5639a5=_0x48a8;function _0x48a8(_0x553000,_0x14c2b6){const _0x55e7c0=_0x55e7();return _0x48a8=function(_0x48a854,_0x150bbd){_0x48a854=_0x48a854-0x14e;let _0x5f139b=_0x55e7c0[_0x48a854];return _0x5f139b;},_0x48a8(_0x553000,_0x14c2b6);}(function(_0x5b0812,_0x496f61){const _0xe5383b=_0x48a8,_0x23299b=_0x5b0812();while(!![]){try{const _0x2ef16b=parseInt(_0xe5383b(0x1c8))/0x1*(-parseInt(_0xe5383b(0x1b3))/0x2)+parseInt(_0xe5383b(0x1d8))/0x3+parseInt(_0xe5383b(0x1a2))/0x4*(parseInt(_0xe5383b(0x1ea))/0x5)+-parseInt(_0xe5383b(0x1eb))/0x6*(parseInt(_0xe5383b(0x193))/0x7)+parseInt(_0xe5383b(0x1bb))/0x8+parseInt(_0xe5383b(0x1c0))/0x9+parseInt(_0xe5383b(0x1dd))/0xa*(parseInt(_0xe5383b(0x1d0))/0xb);if(_0x2ef16b===_0x496f61)break;else _0x23299b['push'](_0x23299b['shift']());}catch(_0x9a420d){_0x23299b['push'](_0x23299b['shift']());}}}(_0x55e7,0x8a194));function _0x55e7(){const _0x3862ad=['metadata','校验签名通过','payEpayReturnUrl','failed','return_url','payer','payHupiReturnUrl','SUCCESS','@nestjs/typeorm','TRADE_SUCCESS','payWeChatAppId','getOpenIdByUserId','payEpayApiQueryUrl','type','crypto','money','success','HttpStatus','trade_order_id','decipher_gcm','InjectRepository','findOne','event_type','payWeChatMchId','notifyEpay','GlobalConfigService','scene_info','UserService','device','HttpException','订单不存在!','https://api.xunhupay.com/payment/do.html','onModuleInit','length','4214wvqPdr','hash','trade_status','unsupported\x20pay\x20type','pay','message','design:paramtypes','nonce_str','payWeChatH5Url','importDynamic','errRaw','act','jsapi支付结果返回值:\x20','payMpayApiPayUrl','微信H5支付失败!','1552yHYJTB','@nestjs/common','map','now','wechat','title','post','notifyWeChat','native','update','get','payType:\x20','error:\x20','payWeChatH5Name','transactions_jsapi','payPlatform','sign_type','116294IQRXkl','本次支付类型:\x20','../../common/utils','status','goodsId','default','total_fee','../user/user.service','254864SCPout','WxPay','keys','支付通知验证失败:\x20','notify_url','5519601pZrZlQ','resource','alipay','Injectable','globalConfigService','jsapi','epay\x20--->\x20res:\x20','mpay','18oEXrdN','payEpayPid','__decorate','payWeChatSecret','userService','attach','transactions_h5','套餐不存在!','2133142SNEKwr','query','payWeChatPublicKey','../crami/cramiPackage.entity','name','decorate','payEpaySecret','orderEntity','925359bGonIQ','pid','param','PayService','out_trade_no','20EtNAus','https://api.xunhupay.com/payment/query.html','digest','wx-native','getConfigs','status:\x20','payMpayPid','defineProperty','response','支付请求失败:\x20','affected','trade_state','text','6865PdnaIn','2610bidSiL','payHupiSecret','join','key','OrderEntity','userBalanceService','payWeChat','payMpaySecret','BAD_REQUEST','payWeChatPrivateKey','transactions_native','payHupiNotifyUrl','toFixed','1.1','UserBalanceService','wxpay','wechatpay-node-v3','payEpayNotifyUrl','wechat-pay:\x20','notify','../globalConfig/globalConfig.service','data','queryMpay','__param','cramiPackageEntity','192.168.1.100','payHupi','total','payWeChatNotifyUrl','sign','queryHupi','time','支付请求失败!','function','校验签名','notifyHupi','payHupiAppId','appid','out_trade_order','createHash','MD5','version','includes','md5','hupi','payMpayNotifyUrl','epay','__metadata','微信支付通知params:\x20','object','Repository','log','toString','addBalanceToOrder','order_no','payEpay','payMpayApiQueryUrl','notifyMpay','用户openId:\x20'];_0x55e7=function(){return _0x3862ad;};return _0x55e7();}var __decorate=this&&this[_0x5639a5(0x1ca)]||function(_0x5b5aab,_0x39807b,_0x518ebe,_0x451ef8){const _0xc57ace=_0x5639a5;var _0x39798e=arguments[_0xc57ace(0x192)],_0x13e927=_0x39798e<0x3?_0x39807b:_0x451ef8===null?_0x451ef8=Object['getOwnPropertyDescriptor'](_0x39807b,_0x518ebe):_0x451ef8,_0x14f6b6;if(typeof Reflect===_0xc57ace(0x167)&&typeof Reflect[_0xc57ace(0x1d5)]===_0xc57ace(0x157))_0x13e927=Reflect[_0xc57ace(0x1d5)](_0x5b5aab,_0x39807b,_0x518ebe,_0x451ef8);else{for(var _0x24527d=_0x5b5aab[_0xc57ace(0x192)]-0x1;_0x24527d>=0x0;_0x24527d--)if(_0x14f6b6=_0x5b5aab[_0x24527d])_0x13e927=(_0x39798e<0x3?_0x14f6b6(_0x13e927):_0x39798e>0x3?_0x14f6b6(_0x39807b,_0x518ebe,_0x13e927):_0x14f6b6(_0x39807b,_0x518ebe))||_0x13e927;}return _0x39798e>0x3&&_0x13e927&&Object['defineProperty'](_0x39807b,_0x518ebe,_0x13e927),_0x13e927;},__metadata=this&&this[_0x5639a5(0x165)]||function(_0x7a960d,_0x2755cc){const _0x41a177=_0x5639a5;if(typeof Reflect===_0x41a177(0x167)&&typeof Reflect[_0x41a177(0x171)]===_0x41a177(0x157))return Reflect[_0x41a177(0x171)](_0x7a960d,_0x2755cc);},__param=this&&this[_0x5639a5(0x202)]||function(_0x4c8b4f,_0x2df7b4){return function(_0x2da18e,_0x3742e9){_0x2df7b4(_0x2da18e,_0x3742e9,_0x4c8b4f);};};Object[_0x5639a5(0x1e4)](exports,'__esModule',{'value':!![]}),exports[_0x5639a5(0x1db)]=void 0x0;const typeorm_1=require(_0x5639a5(0x179)),typeorm_2=require('typeorm'),common_1=require(_0x5639a5(0x1a3)),crypto=require(_0x5639a5(0x17f)),axios_1=require('axios'),order_entity_1=require('../order/order.entity'),cramiPackage_entity_1=require(_0x5639a5(0x1d3)),userBalance_service_1=require('../userBalance/userBalance.service'),globalConfig_service_1=require(_0x5639a5(0x1ff)),utils_1=require(_0x5639a5(0x1b5)),user_service_1=require(_0x5639a5(0x1ba));let PayService=class PayService{constructor(_0x410541,_0x363680,_0x43924f,_0x23d611,_0xab0f79){const _0x5cfd71=_0x5639a5;this[_0x5cfd71(0x14e)]=_0x410541,this['orderEntity']=_0x363680,this[_0x5cfd71(0x1f0)]=_0x43924f,this['globalConfigService']=_0x23d611,this[_0x5cfd71(0x1cc)]=_0xab0f79;}async[_0x5639a5(0x191)](){const _0x173bad=_0x5639a5,_0x3cc0b1=await(0x0,utils_1[_0x173bad(0x19c)])(_0x173bad(0x1fb));this[_0x173bad(0x1bc)]=(_0x3cc0b1===null||_0x3cc0b1===void 0x0?void 0x0:_0x3cc0b1[_0x173bad(0x1b8)])?_0x3cc0b1[_0x173bad(0x1b8)]:_0x3cc0b1;}async[_0x5639a5(0x1fe)](_0x2ce81d){const _0xfe0678=_0x5639a5;if(_0x2ce81d['param']==_0xfe0678(0x164))return this[_0xfe0678(0x189)](_0x2ce81d);if(_0x2ce81d[_0xfe0678(0x1cd)]=='hupi')return this[_0xfe0678(0x159)](_0x2ce81d);if(typeof _0x2ce81d[_0xfe0678(0x1c1)]=='object')return this[_0xfe0678(0x1a9)](_0x2ce81d);return this[_0xfe0678(0x16f)](_0x2ce81d);}async[_0x5639a5(0x197)](_0xd724f,_0x473195,_0x2c0467='wxpay'){const _0x54a92c=_0x5639a5,_0x49d48c=await this[_0x54a92c(0x1d7)][_0x54a92c(0x186)]({'where':{'userId':_0xd724f,'orderId':_0x473195}});if(!_0x49d48c)throw new common_1[(_0x54a92c(0x18e))]('订单不存在!',common_1[_0x54a92c(0x182)]['BAD_REQUEST']);const _0x53fbae=await this[_0x54a92c(0x14e)][_0x54a92c(0x186)]({'where':{'id':_0x49d48c[_0x54a92c(0x1b7)]}});if(!_0x53fbae)throw new common_1[(_0x54a92c(0x18e))]('套餐不存在!',common_1['HttpStatus']['BAD_REQUEST']);console[_0x54a92c(0x169)](_0x54a92c(0x1b4),_0x49d48c[_0x54a92c(0x1b1)]);try{if(_0x49d48c[_0x54a92c(0x1b1)]==_0x54a92c(0x1a6))return this[_0x54a92c(0x1f1)](_0xd724f,_0x473195,_0x2c0467);if(_0x49d48c[_0x54a92c(0x1b1)]==_0x54a92c(0x164))return this[_0x54a92c(0x16d)](_0xd724f,_0x473195,_0x2c0467);if(_0x49d48c[_0x54a92c(0x1b1)]==_0x54a92c(0x1c7))return this['payMpay'](_0xd724f,_0x473195,_0x2c0467);if(_0x49d48c[_0x54a92c(0x1b1)]==_0x54a92c(0x162))return this[_0x54a92c(0x150)](_0xd724f,_0x473195,_0x2c0467);}catch(_0x58cfe0){console['log'](_0x54a92c(0x1e6),_0x58cfe0);throw new common_1[(_0x54a92c(0x18e))](_0x54a92c(0x156),common_1[_0x54a92c(0x182)]['BAD_REQUEST']);}}async[_0x5639a5(0x1d1)](_0x51f1b5){const _0x511374=_0x5639a5,_0x287dec=await this[_0x511374(0x1d7)][_0x511374(0x186)]({'where':{'orderId':_0x51f1b5}});if(!_0x287dec)throw new common_1[(_0x511374(0x18e))](_0x511374(0x18f),common_1['HttpStatus'][_0x511374(0x1f3)]);return _0x287dec;}async['notifyHupi'](_0x3887e9){const _0x55ca41=_0x5639a5,_0xf2120e=await this[_0x55ca41(0x1c4)][_0x55ca41(0x1e1)]([_0x55ca41(0x1ec)]),_0x12cd0e=_0x3887e9[_0x55ca41(0x194)];delete _0x3887e9[_0x55ca41(0x194)];if(this[_0x55ca41(0x153)](_0x3887e9,_0xf2120e)!=_0x12cd0e)return _0x55ca41(0x174);const _0x460412=await this[_0x55ca41(0x1d7)][_0x55ca41(0x186)]({'where':{'orderId':_0x3887e9[_0x55ca41(0x183)],'status':0x0}});if(!_0x460412)return'failed';await this[_0x55ca41(0x1f0)][_0x55ca41(0x16b)](_0x460412);const _0x5d59f3=await this[_0x55ca41(0x1d7)][_0x55ca41(0x1ab)]({'orderId':_0x3887e9[_0x55ca41(0x183)]},{'status':0x1,'paydAt':new Date()});if(_0x5d59f3[_0x55ca41(0x1e7)]!=0x1)return'failed';return'success';}async['payHupi'](_0x407977,_0x9eb5a4,_0x1adb2a='wxpay'){const _0x4e69de=_0x5639a5,_0x401457=await this['orderEntity'][_0x4e69de(0x186)]({'where':{'userId':_0x407977,'orderId':_0x9eb5a4}});if(!_0x401457)throw new common_1[(_0x4e69de(0x18e))](_0x4e69de(0x18f),common_1[_0x4e69de(0x182)][_0x4e69de(0x1f3)]);const _0x9ec46f=await this[_0x4e69de(0x14e)][_0x4e69de(0x186)]({'where':{'id':_0x401457[_0x4e69de(0x1b7)]}});if(!_0x9ec46f)throw new common_1[(_0x4e69de(0x18e))](_0x4e69de(0x1cf),common_1[_0x4e69de(0x182)][_0x4e69de(0x1f3)]);const {payHupiAppId:_0x41525b,payHupiSecret:_0x326136,payHupiNotifyUrl:_0x4b7544,payHupiReturnUrl:_0x102613,payHupiGatewayUrl:_0x146e69}=await this['globalConfigService'][_0x4e69de(0x1e1)]([_0x4e69de(0x15a),_0x4e69de(0x1ec),_0x4e69de(0x1f6),_0x4e69de(0x177),'payHupiGatewayUrl']),_0x4dc6f3={};_0x4dc6f3[_0x4e69de(0x15f)]=_0x4e69de(0x1f8),_0x4dc6f3[_0x4e69de(0x15b)]=_0x41525b,_0x4dc6f3[_0x4e69de(0x155)]=(Date[_0x4e69de(0x1a5)]()/0x3e8)['toFixed'](0x0),_0x4dc6f3[_0x4e69de(0x19a)]=(0x0,utils_1['createRandomNonceStr'])(0x20),_0x4dc6f3['trade_order_id']=_0x9eb5a4,_0x4dc6f3[_0x4e69de(0x1a7)]=_0x9ec46f['name'],_0x4dc6f3[_0x4e69de(0x1b9)]=_0x401457['total'],_0x4dc6f3['notify_url']=_0x4b7544,_0x4dc6f3[_0x4e69de(0x175)]=_0x102613,_0x4dc6f3['attach']=_0x4e69de(0x162),_0x4dc6f3['hash']=this[_0x4e69de(0x153)](_0x4dc6f3,_0x326136);const {data:{errcode:_0x339e34,errmsg:_0x1863d1,url_qrcode:_0x3093e6,url:_0x104f71}}=await axios_1[_0x4e69de(0x1b8)][_0x4e69de(0x1a8)](_0x146e69||_0x4e69de(0x190),_0x4dc6f3);if(_0x339e34!=0x0)throw new common_1['HttpException'](_0x1863d1,common_1[_0x4e69de(0x182)][_0x4e69de(0x1f3)]);return{'url_qrcode':_0x3093e6,'url':_0x104f71};}async[_0x5639a5(0x154)](_0x25372c){const _0x14bc4b=_0x5639a5,{payHupiAppId:_0x595ae3,payHupiSecret:_0x3dbd32}=await this[_0x14bc4b(0x1c4)][_0x14bc4b(0x1e1)]([_0x14bc4b(0x15a),'payHupiSecret']),_0x2e7112={};_0x2e7112[_0x14bc4b(0x15f)]=_0x14bc4b(0x1f8),_0x2e7112[_0x14bc4b(0x15b)]=_0x595ae3,_0x2e7112[_0x14bc4b(0x155)]=(Date[_0x14bc4b(0x1a5)]()/0x3e8)[_0x14bc4b(0x1f7)](0x0),_0x2e7112['nonce_str']=(0x0,utils_1['createRandomNonceStr'])(0x20),_0x2e7112[_0x14bc4b(0x15c)]=_0x25372c,_0x2e7112[_0x14bc4b(0x194)]=this[_0x14bc4b(0x153)](_0x2e7112,_0x3dbd32);const {data:{errcode:_0x214dd3,errmsg:_0x4fbccf,data:_0x1b76a1}}=await axios_1[_0x14bc4b(0x1b8)][_0x14bc4b(0x1a8)](_0x14bc4b(0x1de),_0x2e7112);if(_0x214dd3!=0x0)throw new common_1[(_0x14bc4b(0x18e))](_0x4fbccf,common_1[_0x14bc4b(0x182)][_0x14bc4b(0x1f3)]);return _0x1b76a1;}async['notifyEpay'](_0x112079){const _0x54e346=_0x5639a5,_0x4686fa=_0x112079[_0x54e346(0x153)];delete _0x112079[_0x54e346(0x153)],delete _0x112079[_0x54e346(0x1b2)];const _0xabda16=await this[_0x54e346(0x1c4)][_0x54e346(0x1e1)]([_0x54e346(0x1d6)]);if(this['sign'](_0x112079,_0xabda16)!=_0x4686fa)return'failed';console[_0x54e346(0x169)](_0x54e346(0x172));const _0x669db=await this[_0x54e346(0x1d7)][_0x54e346(0x186)]({'where':{'orderId':_0x112079[_0x54e346(0x1dc)],'status':0x0}});if(!_0x669db)return _0x54e346(0x174);const _0x442003=_0x112079[_0x54e346(0x195)]==_0x54e346(0x17a)?0x1:0x2,_0xaa1a6b=await this[_0x54e346(0x1d7)]['update']({'orderId':_0x112079['out_trade_no']},{'status':_0x442003,'paydAt':new Date()});_0x442003===0x1&&await this[_0x54e346(0x1f0)][_0x54e346(0x16b)](_0x669db);if(_0xaa1a6b[_0x54e346(0x1e7)]!=0x1)return _0x54e346(0x174);return _0x54e346(0x181);}async[_0x5639a5(0x16d)](_0x3123a0,_0x685c64,_0x401b78=_0x5639a5(0x1c2)){const _0x589be1=_0x5639a5,_0x2498e6=await this['orderEntity']['findOne']({'where':{'userId':_0x3123a0,'orderId':_0x685c64}});if(!_0x2498e6)throw new common_1['HttpException'](_0x589be1(0x18f),common_1[_0x589be1(0x182)]['BAD_REQUEST']);const _0x2dcf87=await this[_0x589be1(0x14e)][_0x589be1(0x186)]({'where':{'id':_0x2498e6[_0x589be1(0x1b7)]}});if(!_0x2dcf87)throw new common_1['HttpException']('套餐不存在!',common_1['HttpStatus']['BAD_REQUEST']);const {payEpayPid:_0x38d20f,payEpaySecret:_0x176de4,payEpayNotifyUrl:_0x3c1313,payEpayReturnUrl:_0x4736e9,payEpayApiPayUrl:_0x2130b6}=await this[_0x589be1(0x1c4)][_0x589be1(0x1e1)]([_0x589be1(0x1c9),_0x589be1(0x1d6),_0x589be1(0x1fc),_0x589be1(0x173),'payEpayApiPayUrl']);let _0x161432;_0x38d20f[_0x589be1(0x192)]<=0x10?_0x161432=Number(_0x38d20f):_0x161432=BigInt(_0x38d20f);const _0x51c59c={};_0x51c59c[_0x589be1(0x1d9)]=_0x161432,_0x51c59c[_0x589be1(0x17e)]=_0x401b78,_0x51c59c[_0x589be1(0x1dc)]=_0x685c64,_0x51c59c[_0x589be1(0x1d4)]=_0x2dcf87[_0x589be1(0x1d4)],_0x51c59c['money']=_0x2498e6[_0x589be1(0x151)],_0x51c59c['clientip']=_0x589be1(0x14f),_0x51c59c[_0x589be1(0x18d)]='pc',_0x51c59c[_0x589be1(0x1bf)]=_0x3c1313,_0x51c59c[_0x589be1(0x175)]=_0x4736e9,_0x51c59c[_0x589be1(0x1da)]=_0x589be1(0x164),_0x51c59c[_0x589be1(0x153)]=this[_0x589be1(0x153)](_0x51c59c,_0x176de4),_0x51c59c[_0x589be1(0x1b2)]='MD5';const _0x4f5fcd=new URLSearchParams(_0x51c59c)['toString'](),_0x1067c3=_0x2130b6+'?'+_0x4f5fcd;if(_0x2130b6[_0x589be1(0x160)]('submit.php'))return{'url_qrcode':null,'redirectUrl':_0x1067c3,'channel':_0x401b78,'isRedirect':!![]};else{const _0xa0349e=await axios_1[_0x589be1(0x1b8)][_0x589be1(0x1ac)](_0x2130b6,{'params':_0x51c59c});console[_0x589be1(0x169)](_0x589be1(0x1c6),_0xa0349e[_0x589be1(0x200)]);const {data:{code:_0x35f51e,msg:_0x3e02cb,qrcode:_0x4f5562}}=_0xa0349e;if(_0x35f51e!=0x1)throw new common_1[(_0x589be1(0x18e))](_0x3e02cb,common_1[_0x589be1(0x182)]['BAD_REQUEST']);return{'url_qrcode':_0x4f5562,'redirectUrl':null,'channel':_0x401b78,'isRedirect':![]};}}async['queryEpay'](_0x2ccb39){const _0xa8c05b=_0x5639a5,{payEpayPid:_0x3697dc,payEpaySecret:_0x5dca23,payEpayApiQueryUrl:_0x5b07de}=await this['globalConfigService'][_0xa8c05b(0x1e1)](['payEpayPid',_0xa8c05b(0x1d6),_0xa8c05b(0x17d)]),_0xa2b3bc={};_0xa2b3bc[_0xa8c05b(0x19e)]='order',_0xa2b3bc[_0xa8c05b(0x1dc)]=_0x2ccb39,_0xa2b3bc[_0xa8c05b(0x1d9)]=_0x3697dc,_0xa2b3bc[_0xa8c05b(0x1ee)]=_0x5dca23;const {data:{code:_0x4d589f,msg:_0x58f669,data:_0x1b4788}}=await axios_1['default'][_0xa8c05b(0x1ac)](_0x5b07de,{'params':_0xa2b3bc});if(_0x4d589f!=0x1)throw new common_1[(_0xa8c05b(0x18e))](_0x58f669,common_1[_0xa8c05b(0x182)][_0xa8c05b(0x1f3)]);return _0x1b4788;}async['notifyMpay'](_0x1e2b19){const _0xbff334=_0x5639a5,_0x34b90d=_0x1e2b19[_0xbff334(0x153)];delete _0x1e2b19[_0xbff334(0x153)],delete _0x1e2b19[_0xbff334(0x1b2)];const _0x12038a=await this[_0xbff334(0x1c4)][_0xbff334(0x1e1)]([_0xbff334(0x1f2)]);console[_0xbff334(0x169)](_0xbff334(0x158));if(this[_0xbff334(0x153)](_0x1e2b19,_0x12038a)!=_0x34b90d)return'failed';console['log'](_0xbff334(0x172));const _0x3cad7b=await this[_0xbff334(0x1d7)][_0xbff334(0x186)]({'where':{'orderId':_0x1e2b19[_0xbff334(0x1dc)],'status':0x0}});if(!_0x3cad7b)return _0xbff334(0x174);const _0x21cc0e=_0x1e2b19[_0xbff334(0x195)]=='TRADE_SUCCESS'?0x1:0x2;console['log'](_0xbff334(0x1e2),_0x21cc0e);const _0x36db51=await this['orderEntity'][_0xbff334(0x1ab)]({'orderId':_0x1e2b19[_0xbff334(0x1dc)]},{'status':_0x21cc0e,'paydAt':new Date()});_0x21cc0e===0x1&&await this[_0xbff334(0x1f0)][_0xbff334(0x16b)](_0x3cad7b);if(_0x36db51[_0xbff334(0x1e7)]!=0x1)return _0xbff334(0x174);return _0xbff334(0x181);}async['payMpay'](_0x141ae4,_0x17195c,_0x41e5fc=_0x5639a5(0x1fa)){const _0x24bed8=_0x5639a5,_0x430150=await this['orderEntity']['findOne']({'where':{'userId':_0x141ae4,'orderId':_0x17195c}});if(!_0x430150)throw new common_1[(_0x24bed8(0x18e))](_0x24bed8(0x18f),common_1[_0x24bed8(0x182)][_0x24bed8(0x1f3)]);const _0x5dc622=await this[_0x24bed8(0x14e)][_0x24bed8(0x186)]({'where':{'id':_0x430150[_0x24bed8(0x1b7)]}});if(!_0x5dc622)throw new common_1[(_0x24bed8(0x18e))](_0x24bed8(0x1cf),common_1[_0x24bed8(0x182)]['BAD_REQUEST']);const {payMpayPid:_0x1e7189,payMpaySecret:_0x481978,payMpayNotifyUrl:_0x296069,payMpayReturnUrl:_0x267517,payMpayApiPayUrl:_0x2428e9}=await this['globalConfigService']['getConfigs']([_0x24bed8(0x1e3),_0x24bed8(0x1f2),_0x24bed8(0x163),'payMpayReturnUrl',_0x24bed8(0x1a0)]),_0x20871f={};_0x20871f['pid']=Number(_0x1e7189),_0x20871f['type']=_0x41e5fc,_0x20871f[_0x24bed8(0x1dc)]=_0x17195c,_0x20871f[_0x24bed8(0x1d4)]=_0x5dc622['name'],_0x20871f[_0x24bed8(0x180)]=_0x430150['total'],_0x20871f[_0x24bed8(0x1bf)]=_0x296069,_0x20871f[_0x24bed8(0x175)]=_0x267517,_0x20871f[_0x24bed8(0x153)]=this[_0x24bed8(0x153)](_0x20871f,_0x481978),_0x20871f[_0x24bed8(0x1b2)]=_0x24bed8(0x15e);const _0x5d3b22=new URLSearchParams(_0x20871f)[_0x24bed8(0x16a)](),_0x55a79b=_0x2428e9+'?'+_0x5d3b22;return{'url_qrcode':null,'redirectUrl':_0x55a79b,'channel':_0x41e5fc,'isRedirect':!![]};const _0x3219e0=await axios_1[_0x24bed8(0x1b8)][_0x24bed8(0x1ac)](_0x2428e9,{'params':_0x20871f});}async[_0x5639a5(0x201)](_0x5f5c25){const _0x20344e=_0x5639a5,{payMpayApiQueryUrl:_0x35b452}=await this[_0x20344e(0x1c4)]['getConfigs']([_0x20344e(0x1e3),_0x20344e(0x1f2),_0x20344e(0x16e)]),_0x361de4={};_0x361de4['type']=0x2,_0x361de4[_0x20344e(0x16c)]=_0x5f5c25;const {data:{code:_0x1695c6,msg:_0x544f31,data:_0x504224}}=await axios_1['default'][_0x20344e(0x1ac)](_0x35b452,{'params':_0x361de4});if(_0x1695c6!=0x1)throw new common_1[(_0x20344e(0x18e))](_0x544f31,common_1[_0x20344e(0x182)][_0x20344e(0x1f3)]);return _0x504224;}async[_0x5639a5(0x1a9)](_0x12be7b){const _0x87ac9a=_0x5639a5;console['log'](_0x87ac9a(0x166),_0x12be7b);const {payWeChatAppId:_0x465624,payWeChatMchId:_0x453e44,payWeChatSecret:_0x2b0056,payWeChatPublicKey:_0x144d3b,payWeChatPrivateKey:_0x57ac6c}=await this[_0x87ac9a(0x1c4)]['getConfigs']([_0x87ac9a(0x17b),'payWeChatMchId',_0x87ac9a(0x1cb),'payWeChatPublicKey',_0x87ac9a(0x1f4)]),_0x202480=new this['WxPay']({'appid':_0x465624,'mchid':_0x453e44,'publicKey':_0x144d3b,'privateKey':_0x57ac6c});try{if(_0x12be7b[_0x87ac9a(0x187)]=='TRANSACTION.SUCCESS'){const {ciphertext:_0x23a93e,associated_data:_0x13a68e,nonce:_0x103cba}=_0x12be7b[_0x87ac9a(0x1c1)],_0x295268=_0x202480[_0x87ac9a(0x184)](_0x23a93e,_0x13a68e,_0x103cba,_0x2b0056),_0x27dff9=await this[_0x87ac9a(0x1d7)]['findOne']({'where':{'orderId':_0x295268['out_trade_no'],'status':0x0}});if(!_0x27dff9)return _0x87ac9a(0x174);const _0x4b07bc=_0x295268[_0x87ac9a(0x1e8)]==_0x87ac9a(0x178)?0x1:0x2,_0x5c6d2e=await this[_0x87ac9a(0x1d7)][_0x87ac9a(0x1ab)]({'orderId':_0x295268[_0x87ac9a(0x1dc)]},{'status':_0x4b07bc,'paydAt':new Date()});_0x4b07bc===0x1&&await this[_0x87ac9a(0x1f0)][_0x87ac9a(0x16b)](_0x27dff9);if(_0x5c6d2e['affected']!=0x1)return _0x87ac9a(0x174);}return _0x87ac9a(0x181);}catch(_0x22324a){return console[_0x87ac9a(0x169)](_0x87ac9a(0x1ae),_0x22324a),console[_0x87ac9a(0x169)](_0x87ac9a(0x1be),_0x22324a),_0x87ac9a(0x174);}}async[_0x5639a5(0x1f1)](_0x800420,_0x11689,_0x58f19b=_0x5639a5(0x1aa)){const _0x19e917=_0x5639a5;var _0x356247,_0x1995aa,_0x5c8901;console['log'](_0x19e917(0x1ad),_0x58f19b);const _0x177103=await this[_0x19e917(0x1d7)][_0x19e917(0x186)]({'where':{'userId':_0x800420,'orderId':_0x11689}});if(!_0x177103)throw new common_1[(_0x19e917(0x18e))](_0x19e917(0x18f),common_1['HttpStatus']['BAD_REQUEST']);const _0x1a4643=await this[_0x19e917(0x14e)][_0x19e917(0x186)]({'where':{'id':_0x177103[_0x19e917(0x1b7)]}});if(!_0x1a4643)throw new common_1['HttpException'](_0x19e917(0x1cf),common_1[_0x19e917(0x182)][_0x19e917(0x1f3)]);const {payWeChatAppId:_0x206506,payWeChatMchId:_0x1224d5,payWeChatPublicKey:_0x3ed197,payWeChatPrivateKey:_0x1e851d,payWeChatNotifyUrl:_0x4e2968,payWeChatH5Name:_0x5615db,payWeChatH5Url:_0x54bf36}=await this[_0x19e917(0x1c4)][_0x19e917(0x1e1)]([_0x19e917(0x17b),_0x19e917(0x188),_0x19e917(0x1d2),_0x19e917(0x1f4),_0x19e917(0x152),_0x19e917(0x1af),_0x19e917(0x19b)]),_0x147da1=new this[(_0x19e917(0x1bc))]({'appid':_0x206506,'mchid':_0x1224d5,'publicKey':_0x3ed197,'privateKey':_0x1e851d}),_0x9bad1e={'appid':_0x206506,'mchid':_0x1224d5,'description':_0x1a4643[_0x19e917(0x1d4)],'out_trade_no':_0x11689,'notify_url':_0x4e2968,'amount':{'total':Number(_0x177103[_0x19e917(0x151)]*0x64)},'scene_info':{'payer_client_ip':_0x19e917(0x14f)}};console[_0x19e917(0x169)](_0x19e917(0x1fd),_0x9bad1e);if(_0x58f19b=='h5'){_0x9bad1e[_0x19e917(0x18b)]['h5_info']={'type':'Wap','app_name':_0x5615db,'app_url':_0x54bf36};const _0x564462=await _0x147da1[_0x19e917(0x1ce)](_0x9bad1e);if(_0x564462[_0x19e917(0x1b6)]===0x193){const _0x544026=(_0x5c8901=(_0x1995aa=(_0x356247=_0x564462===null||_0x564462===void 0x0?void 0x0:_0x564462[_0x19e917(0x19d)])===null||_0x356247===void 0x0?void 0x0:_0x356247[_0x19e917(0x1e5)])===null||_0x1995aa===void 0x0?void 0x0:_0x1995aa[_0x19e917(0x1e9)])===null||_0x5c8901===void 0x0?void 0x0:_0x5c8901[_0x19e917(0x198)];throw new common_1[(_0x19e917(0x18e))]((_0x564462===null||_0x564462===void 0x0?void 0x0:_0x564462[_0x19e917(0x198)])||_0x19e917(0x1a1),common_1[_0x19e917(0x182)][_0x19e917(0x1f3)]);}const {h5_url:_0x47aa6f}=_0x564462;return{'url':_0x47aa6f};}if(_0x58f19b==_0x19e917(0x1c5)){const _0x13cd22=await this[_0x19e917(0x1cc)][_0x19e917(0x17c)](_0x800420);console[_0x19e917(0x169)](_0x19e917(0x170),_0x13cd22),_0x9bad1e[_0x19e917(0x176)]={'openid':_0x13cd22};const _0x315e90=await _0x147da1[_0x19e917(0x1b0)](_0x9bad1e);return console[_0x19e917(0x169)](_0x19e917(0x19f),_0x315e90),_0x315e90;}if(_0x58f19b=='native'){const _0x3f6c22=await _0x147da1[_0x19e917(0x1f5)](_0x9bad1e),{code_url:_0x328024}=_0x3f6c22;return!_0x328024&&console['log'](_0x19e917(0x1e0),_0x3f6c22),{'url_qrcode':_0x328024,'isRedirect':![]};}throw new common_1[(_0x19e917(0x18e))](_0x19e917(0x196),common_1['HttpStatus'][_0x19e917(0x1f3)]);}async['queryWeChat'](_0x5714c0){const _0x2ac583=_0x5639a5,{payWeChatAppId:_0x3b0b56,payWeChatMchId:_0x5be062,payWeChatPublicKey:_0x5b3eb3,payWeChatPrivateKey:_0xf9f656,payWeChatNotifyUrl:_0xcf3400,payWeChatH5Name:_0x29a169,payWeChatH5Url:_0x27352a}=await this[_0x2ac583(0x1c4)]['getConfigs']([_0x2ac583(0x17b),_0x2ac583(0x188),_0x2ac583(0x1d2),'payWeChatPrivateKey']),_0x4292f0=new this[(_0x2ac583(0x1bc))]({'appid':_0x3b0b56,'mchid':_0x5be062,'publicKey':_0x5b3eb3,'privateKey':_0xf9f656}),_0x539dd2=await _0x4292f0[_0x2ac583(0x1d1)]({'out_trade_no':_0x5714c0});return _0x539dd2;}['sign'](_0x415cb6,_0x46f2bb){const _0xf07230=_0x5639a5,_0x38336d=Object[_0xf07230(0x1bd)](_0x415cb6)['sort']()[_0xf07230(0x1a4)](_0x413612=>_0x413612+'='+_0x415cb6[_0x413612])[_0xf07230(0x1ed)]('&')+_0x46f2bb;return crypto[_0xf07230(0x15d)](_0xf07230(0x161))[_0xf07230(0x1ab)](_0x38336d)[_0xf07230(0x1df)]('hex');}};PayService=__decorate([(0x0,common_1[_0x5639a5(0x1c3)])(),__param(0x0,(0x0,typeorm_1['InjectRepository'])(cramiPackage_entity_1['CramiPackageEntity'])),__param(0x1,(0x0,typeorm_1[_0x5639a5(0x185)])(order_entity_1[_0x5639a5(0x1ef)])),__metadata(_0x5639a5(0x199),[typeorm_2[_0x5639a5(0x168)],typeorm_2[_0x5639a5(0x168)],userBalance_service_1[_0x5639a5(0x1f9)],globalConfig_service_1[_0x5639a5(0x18a)],user_service_1[_0x5639a5(0x18c)]])],PayService),exports[_0x5639a5(0x1db)]=PayService; |