mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-09-26 21:26:38 +08:00
1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
'use strict';const _0x2e801a=_0x4ade;(function(_0x4502bc,_0x4df5ae){const _0x2ef8b4=_0x4ade,_0x4e04dd=_0x4502bc();while(!![]){try{const _0x2a43cd=parseInt(_0x2ef8b4(0x14f))/0x1+-parseInt(_0x2ef8b4(0x175))/0x2+-parseInt(_0x2ef8b4(0x16a))/0x3+parseInt(_0x2ef8b4(0x147))/0x4*(-parseInt(_0x2ef8b4(0x17c))/0x5)+parseInt(_0x2ef8b4(0xff))/0x6+-parseInt(_0x2ef8b4(0x144))/0x7*(-parseInt(_0x2ef8b4(0x174))/0x8)+-parseInt(_0x2ef8b4(0x100))/0x9;if(_0x2a43cd===_0x4df5ae)break;else _0x4e04dd['push'](_0x4e04dd['shift']());}catch(_0x5746f3){_0x4e04dd['push'](_0x4e04dd['shift']());}}}(_0x4c0e,0xd2470));var __decorate=this&&this[_0x2e801a(0xe7)]||function(_0x34b180,_0xedbbe5,_0x292272,_0x42353b){const _0x660551=_0x2e801a;var _0xf127b5=arguments[_0x660551(0x131)],_0x1bb382=_0xf127b5<0x3?_0xedbbe5:_0x42353b===null?_0x42353b=Object[_0x660551(0x177)](_0xedbbe5,_0x292272):_0x42353b,_0x838c7c;if(typeof Reflect===_0x660551(0x119)&&typeof Reflect['decorate']===_0x660551(0xeb))_0x1bb382=Reflect[_0x660551(0x179)](_0x34b180,_0xedbbe5,_0x292272,_0x42353b);else{for(var _0x99c231=_0x34b180[_0x660551(0x131)]-0x1;_0x99c231>=0x0;_0x99c231--)if(_0x838c7c=_0x34b180[_0x99c231])_0x1bb382=(_0xf127b5<0x3?_0x838c7c(_0x1bb382):_0xf127b5>0x3?_0x838c7c(_0xedbbe5,_0x292272,_0x1bb382):_0x838c7c(_0xedbbe5,_0x292272))||_0x1bb382;}return _0xf127b5>0x3&&_0x1bb382&&Object[_0x660551(0x12e)](_0xedbbe5,_0x292272,_0x1bb382),_0x1bb382;},__metadata=this&&this[_0x2e801a(0x143)]||function(_0x57d598,_0x68b19b){const _0x2a5793=_0x2e801a;if(typeof Reflect===_0x2a5793(0x119)&&typeof Reflect['metadata']===_0x2a5793(0xeb))return Reflect['metadata'](_0x57d598,_0x68b19b);},__param=this&&this[_0x2e801a(0x104)]||function(_0x15e5c4,_0x465ec2){return function(_0x4f6e94,_0x1c62e0){_0x465ec2(_0x4f6e94,_0x1c62e0,_0x15e5c4);};};Object[_0x2e801a(0x12e)](exports,_0x2e801a(0x167),{'value':!![]}),exports[_0x2e801a(0x10c)]=void 0x0;function _0x4c0e(){const _0x578118=['2335424dqAHDC','cramiPackageEntity','attach','payWeChatAppId','payEpayApiPayUrl','digest','BAD_REQUEST','TRADE_SUCCESS','862244jadgMH','payHupiSecret','time','orderEntity','resource','failed','CramiPackageEntity','微信支付通知params:\x20','notifyHupi','pay','axios','trade_order_id','hupi','md5','log','join','return_url','payMpaySecret','order_no','decipher_gcm','get','h5_info','套餐不存在!','alipay','__esModule','payWeChatSecret','UserBalanceService','1149261qQTvyE','OrderEntity','MD5','payMpay','notify_url','message','title','appid','epay','default','3300296fflkCN','467528zKqbVs','payWeChatPublicKey','getOwnPropertyDescriptor','out_trade_no','decorate','name','onModuleInit','5mBJTTS','../globalConfig/globalConfig.service','userService','text','payEpaySecret','@nestjs/common','clientip','wx-native','param','success','payEpayNotifyUrl','order','now','toFixed','payHupiGatewayUrl','payEpayApiQueryUrl','payPlatform','notifyMpay','sign','wechatpay-node-v3','event_type','__decorate','importDynamic','crypto','../order/order.entity','function','errRaw','design:paramtypes','queryHupi','../user/user.service','scene_info','订单不存在!','微信H5支付失败!','addBalanceToOrder','toString','1.1','data','../../common/utils','update','pid','Repository','payEpayPid','payWeChatH5Name','getConfigs','hash','6213906zjZQgL','5948694bdzNmi','sign_type','createHash','payWeChatH5Url','__param','jsapi','Wap','payMpayReturnUrl','支付请求失败:\x20','findOne','type','payWeChatMchId','PayService','globalConfigService','wechat','wxpay','createRandomNonceStr','trade_status','InjectRepository','payer','HttpStatus','UserService','TRANSACTION.SUCCESS','submit.php','192.168.1.100','object','payWeChatPrivateKey','https://api.xunhupay.com/payment/do.html','校验签名通过','transactions_h5','GlobalConfigService','HttpException','payHupiNotifyUrl','post','sort','notifyWeChat','Injectable','wechat-pay:\x20','payWeChat','typeorm','response','query','epay\x20--->\x20res:\x20','nonce_str','hex','userBalanceService','defineProperty','payEpayReturnUrl','affected','length','goodsId','total','payType:\x20','mpay','支付请求失败!','payHupi','jsapi支付结果返回值:\x20','notify','out_trade_order','WxPay','payHupiAppId','payMpayApiPayUrl','money','../userBalance/userBalance.service','queryWeChat','status:\x20','version','__metadata','14WEerjQ','device','用户openId:\x20'];_0x4c0e=function(){return _0x578118;};return _0x4c0e();}function _0x4ade(_0x481d26,_0xcaa451){const _0x4c0e8f=_0x4c0e();return _0x4ade=function(_0x4adef2,_0x1c8582){_0x4adef2=_0x4adef2-0xd9;let _0x14d5da=_0x4c0e8f[_0x4adef2];return _0x14d5da;},_0x4ade(_0x481d26,_0xcaa451);}const typeorm_1=require('@nestjs/typeorm'),typeorm_2=require(_0x2e801a(0x127)),common_1=require(_0x2e801a(0x181)),crypto=require(_0x2e801a(0xe9)),axios_1=require(_0x2e801a(0x159)),order_entity_1=require(_0x2e801a(0xea)),cramiPackage_entity_1=require('../crami/cramiPackage.entity'),userBalance_service_1=require(_0x2e801a(0x13f)),globalConfig_service_1=require(_0x2e801a(0x17d)),utils_1=require(_0x2e801a(0xf7)),user_service_1=require(_0x2e801a(0xef));let PayService=class PayService{constructor(_0x4fe148,_0x1d8f66,_0x4ae5f2,_0x46cb4c,_0x4b7aa5){const _0x7e684f=_0x2e801a;this[_0x7e684f(0x148)]=_0x4fe148,this[_0x7e684f(0x152)]=_0x1d8f66,this['userBalanceService']=_0x4ae5f2,this[_0x7e684f(0x10d)]=_0x46cb4c,this[_0x7e684f(0x17e)]=_0x4b7aa5;}async[_0x2e801a(0x17b)](){const _0x4422c6=_0x2e801a,_0x4f3a1e=await(0x0,utils_1[_0x4422c6(0xe8)])(_0x4422c6(0xe5));this['WxPay']=(_0x4f3a1e===null||_0x4f3a1e===void 0x0?void 0x0:_0x4f3a1e[_0x4422c6(0x173)])?_0x4f3a1e['default']:_0x4f3a1e;}async[_0x2e801a(0x139)](_0x3eb1fa){const _0x3e653e=_0x2e801a;if(_0x3eb1fa['param']==_0x3e653e(0x172))return this['notifyEpay'](_0x3eb1fa);if(_0x3eb1fa[_0x3e653e(0x149)]==_0x3e653e(0x15b))return this['notifyHupi'](_0x3eb1fa);if(typeof _0x3eb1fa['resource']==_0x3e653e(0x119))return this['notifyWeChat'](_0x3eb1fa);return this[_0x3e653e(0xe3)](_0x3eb1fa);}async[_0x2e801a(0x158)](_0x4322fe,_0x5580eb,_0x3b05=_0x2e801a(0x10f)){const _0x200da2=_0x2e801a,_0x17e1b8=await this[_0x200da2(0x152)]['findOne']({'where':{'userId':_0x4322fe,'orderId':_0x5580eb}});if(!_0x17e1b8)throw new common_1[(_0x200da2(0x11f))](_0x200da2(0xf1),common_1[_0x200da2(0x114)][_0x200da2(0x14d)]);const _0x11e21f=await this['cramiPackageEntity'][_0x200da2(0x109)]({'where':{'id':_0x17e1b8[_0x200da2(0x132)]}});if(!_0x11e21f)throw new common_1['HttpException'](_0x200da2(0x165),common_1['HttpStatus'][_0x200da2(0x14d)]);console['log']('本次支付类型:\x20',_0x17e1b8['payPlatform']);try{if(_0x17e1b8[_0x200da2(0xe2)]==_0x200da2(0x10e))return this[_0x200da2(0x126)](_0x4322fe,_0x5580eb,_0x3b05);if(_0x17e1b8[_0x200da2(0xe2)]==_0x200da2(0x172))return this['payEpay'](_0x4322fe,_0x5580eb,_0x3b05);if(_0x17e1b8[_0x200da2(0xe2)]==_0x200da2(0x135))return this[_0x200da2(0x16d)](_0x4322fe,_0x5580eb,_0x3b05);if(_0x17e1b8['payPlatform']==_0x200da2(0x15b))return this[_0x200da2(0x137)](_0x4322fe,_0x5580eb,_0x3b05);}catch(_0x246605){console[_0x200da2(0x15d)](_0x200da2(0x108),_0x246605);throw new common_1[(_0x200da2(0x11f))](_0x200da2(0x136),common_1[_0x200da2(0x114)]['BAD_REQUEST']);}}async[_0x2e801a(0x129)](_0xe0ce5e){const _0x155532=_0x2e801a,_0x273a8d=await this[_0x155532(0x152)]['findOne']({'where':{'orderId':_0xe0ce5e}});if(!_0x273a8d)throw new common_1['HttpException']('订单不存在!',common_1[_0x155532(0x114)][_0x155532(0x14d)]);return _0x273a8d;}async[_0x2e801a(0x157)](_0x73a611){const _0x363960=_0x2e801a,_0x117e84=await this[_0x363960(0x10d)][_0x363960(0xfd)](['payHupiSecret']),_0xadce6f=_0x73a611['hash'];delete _0x73a611[_0x363960(0xfe)];if(this[_0x363960(0xe4)](_0x73a611,_0x117e84)!=_0xadce6f)return _0x363960(0x154);const _0x544a90=await this[_0x363960(0x152)][_0x363960(0x109)]({'where':{'orderId':_0x73a611['trade_order_id'],'status':0x0}});if(!_0x544a90)return'failed';await this[_0x363960(0x12d)]['addBalanceToOrder'](_0x544a90);const _0x28cd1c=await this[_0x363960(0x152)][_0x363960(0xf8)]({'orderId':_0x73a611[_0x363960(0x15a)]},{'status':0x1,'paydAt':new Date()});if(_0x28cd1c['affected']!=0x1)return _0x363960(0x154);return'success';}async[_0x2e801a(0x137)](_0x1a21d0,_0x5d1f3f,_0x148f89='wxpay'){const _0x5ddf07=_0x2e801a,_0x1152e6=await this['orderEntity']['findOne']({'where':{'userId':_0x1a21d0,'orderId':_0x5d1f3f}});if(!_0x1152e6)throw new common_1[(_0x5ddf07(0x11f))](_0x5ddf07(0xf1),common_1[_0x5ddf07(0x114)]['BAD_REQUEST']);const _0x2366fc=await this[_0x5ddf07(0x148)][_0x5ddf07(0x109)]({'where':{'id':_0x1152e6['goodsId']}});if(!_0x2366fc)throw new common_1['HttpException'](_0x5ddf07(0x165),common_1[_0x5ddf07(0x114)][_0x5ddf07(0x14d)]);const {payHupiAppId:_0x4f0119,payHupiSecret:_0x590e3a,payHupiNotifyUrl:_0x4085f1,payHupiReturnUrl:_0x4b40e9,payHupiGatewayUrl:_0x1b9172}=await this['globalConfigService']['getConfigs']([_0x5ddf07(0x13c),_0x5ddf07(0x150),_0x5ddf07(0x120),'payHupiReturnUrl',_0x5ddf07(0xe0)]),_0x1e4609={};_0x1e4609[_0x5ddf07(0x142)]='1.1',_0x1e4609[_0x5ddf07(0x171)]=_0x4f0119,_0x1e4609[_0x5ddf07(0x151)]=(Date['now']()/0x3e8)['toFixed'](0x0),_0x1e4609[_0x5ddf07(0x12b)]=(0x0,utils_1[_0x5ddf07(0x110)])(0x20),_0x1e4609['trade_order_id']=_0x5d1f3f,_0x1e4609[_0x5ddf07(0x170)]=_0x2366fc[_0x5ddf07(0x17a)],_0x1e4609['total_fee']=_0x1152e6[_0x5ddf07(0x133)],_0x1e4609[_0x5ddf07(0x16e)]=_0x4085f1,_0x1e4609[_0x5ddf07(0x15f)]=_0x4b40e9,_0x1e4609[_0x5ddf07(0x149)]=_0x5ddf07(0x15b),_0x1e4609[_0x5ddf07(0xfe)]=this[_0x5ddf07(0xe4)](_0x1e4609,_0x590e3a);const {data:{errcode:_0x4d1558,errmsg:_0x4e635d,url_qrcode:_0x4cf288,url:_0xfcb5ad}}=await axios_1[_0x5ddf07(0x173)]['post'](_0x1b9172||_0x5ddf07(0x11b),_0x1e4609);if(_0x4d1558!=0x0)throw new common_1[(_0x5ddf07(0x11f))](_0x4e635d,common_1['HttpStatus'][_0x5ddf07(0x14d)]);return{'url_qrcode':_0x4cf288,'url':_0xfcb5ad};}async[_0x2e801a(0xee)](_0x296275){const _0x43b8a6=_0x2e801a,{payHupiAppId:_0x443594,payHupiSecret:_0x3181c1}=await this[_0x43b8a6(0x10d)][_0x43b8a6(0xfd)]([_0x43b8a6(0x13c),_0x43b8a6(0x150)]),_0x1b3331={};_0x1b3331['version']=_0x43b8a6(0xf5),_0x1b3331['appid']=_0x443594,_0x1b3331[_0x43b8a6(0x151)]=(Date[_0x43b8a6(0xde)]()/0x3e8)[_0x43b8a6(0xdf)](0x0),_0x1b3331[_0x43b8a6(0x12b)]=(0x0,utils_1[_0x43b8a6(0x110)])(0x20),_0x1b3331[_0x43b8a6(0x13a)]=_0x296275,_0x1b3331[_0x43b8a6(0xfe)]=this['sign'](_0x1b3331,_0x3181c1);const {data:{errcode:_0x1ffcce,errmsg:_0x2f9938,data:_0x4f7b7d}}=await axios_1[_0x43b8a6(0x173)][_0x43b8a6(0x121)]('https://api.xunhupay.com/payment/query.html',_0x1b3331);if(_0x1ffcce!=0x0)throw new common_1[(_0x43b8a6(0x11f))](_0x2f9938,common_1[_0x43b8a6(0x114)][_0x43b8a6(0x14d)]);return _0x4f7b7d;}async['notifyEpay'](_0x12fde6){const _0x1a68d7=_0x2e801a,_0x48f6d2=_0x12fde6[_0x1a68d7(0xe4)];delete _0x12fde6['sign'],delete _0x12fde6[_0x1a68d7(0x101)];const _0x3c86ca=await this[_0x1a68d7(0x10d)]['getConfigs']([_0x1a68d7(0x180)]);if(this[_0x1a68d7(0xe4)](_0x12fde6,_0x3c86ca)!=_0x48f6d2)return _0x1a68d7(0x154);console[_0x1a68d7(0x15d)](_0x1a68d7(0x11c));const _0x320c3e=await this[_0x1a68d7(0x152)]['findOne']({'where':{'orderId':_0x12fde6[_0x1a68d7(0x178)],'status':0x0}});if(!_0x320c3e)return'failed';const _0x4e4cd7=_0x12fde6[_0x1a68d7(0x111)]=='TRADE_SUCCESS'?0x1:0x2,_0x2bb297=await this[_0x1a68d7(0x152)][_0x1a68d7(0xf8)]({'orderId':_0x12fde6[_0x1a68d7(0x178)]},{'status':_0x4e4cd7,'paydAt':new Date()});_0x4e4cd7===0x1&&await this[_0x1a68d7(0x12d)][_0x1a68d7(0xf3)](_0x320c3e);if(_0x2bb297[_0x1a68d7(0x130)]!=0x1)return'failed';return'success';}async['payEpay'](_0x48b333,_0x3fb390,_0x23f6e9=_0x2e801a(0x166)){const _0x5efd34=_0x2e801a,_0x9039b3=await this[_0x5efd34(0x152)]['findOne']({'where':{'userId':_0x48b333,'orderId':_0x3fb390}});if(!_0x9039b3)throw new common_1[(_0x5efd34(0x11f))](_0x5efd34(0xf1),common_1[_0x5efd34(0x114)][_0x5efd34(0x14d)]);const _0xe1d6fd=await this[_0x5efd34(0x148)]['findOne']({'where':{'id':_0x9039b3[_0x5efd34(0x132)]}});if(!_0xe1d6fd)throw new common_1[(_0x5efd34(0x11f))](_0x5efd34(0x165),common_1['HttpStatus'][_0x5efd34(0x14d)]);const {payEpayPid:_0x2823f5,payEpaySecret:_0x5475df,payEpayNotifyUrl:_0x24ce2c,payEpayReturnUrl:_0x165590,payEpayApiPayUrl:_0x2f7e70}=await this[_0x5efd34(0x10d)]['getConfigs']([_0x5efd34(0xfb),_0x5efd34(0x180),_0x5efd34(0xdc),_0x5efd34(0x12f),_0x5efd34(0x14b)]);let _0x3edeef;_0x2823f5['length']<=0x10?_0x3edeef=Number(_0x2823f5):_0x3edeef=BigInt(_0x2823f5);const _0x4d279a={};_0x4d279a[_0x5efd34(0xf9)]=_0x3edeef,_0x4d279a[_0x5efd34(0x10a)]=_0x23f6e9,_0x4d279a[_0x5efd34(0x178)]=_0x3fb390,_0x4d279a[_0x5efd34(0x17a)]=_0xe1d6fd['name'],_0x4d279a[_0x5efd34(0x13e)]=_0x9039b3['total'],_0x4d279a[_0x5efd34(0x182)]=_0x5efd34(0x118),_0x4d279a[_0x5efd34(0x145)]='pc',_0x4d279a['notify_url']=_0x24ce2c,_0x4d279a[_0x5efd34(0x15f)]=_0x165590,_0x4d279a[_0x5efd34(0xda)]='epay',_0x4d279a[_0x5efd34(0xe4)]=this[_0x5efd34(0xe4)](_0x4d279a,_0x5475df),_0x4d279a[_0x5efd34(0x101)]=_0x5efd34(0x16c);const _0x1ad97a=new URLSearchParams(_0x4d279a)['toString'](),_0x19666d=_0x2f7e70+'?'+_0x1ad97a;if(_0x2f7e70['includes'](_0x5efd34(0x117)))return{'url_qrcode':null,'redirectUrl':_0x19666d,'channel':_0x23f6e9,'isRedirect':!![]};else{const _0x1353aa=await axios_1[_0x5efd34(0x173)][_0x5efd34(0x163)](_0x2f7e70,{'params':_0x4d279a});console[_0x5efd34(0x15d)](_0x5efd34(0x12a),_0x1353aa[_0x5efd34(0xf6)]);const {data:{code:_0x79e833,msg:_0x2d719e,qrcode:_0x559950}}=_0x1353aa;if(_0x79e833!=0x1)throw new common_1[(_0x5efd34(0x11f))](_0x2d719e,common_1[_0x5efd34(0x114)]['BAD_REQUEST']);return{'url_qrcode':_0x559950,'redirectUrl':null,'channel':_0x23f6e9,'isRedirect':![]};}}async['queryEpay'](_0x5b3d30){const _0x270bed=_0x2e801a,{payEpayPid:_0x4e6857,payEpaySecret:_0x37c21c,payEpayApiQueryUrl:_0x181762}=await this[_0x270bed(0x10d)][_0x270bed(0xfd)]([_0x270bed(0xfb),_0x270bed(0x180),_0x270bed(0xe1)]),_0x284b7f={};_0x284b7f['act']=_0x270bed(0xdd),_0x284b7f['out_trade_no']=_0x5b3d30,_0x284b7f['pid']=_0x4e6857,_0x284b7f['key']=_0x37c21c;const {data:{code:_0x5540f3,msg:_0x42229f,data:_0xec375d}}=await axios_1[_0x270bed(0x173)][_0x270bed(0x163)](_0x181762,{'params':_0x284b7f});if(_0x5540f3!=0x1)throw new common_1[(_0x270bed(0x11f))](_0x42229f,common_1[_0x270bed(0x114)][_0x270bed(0x14d)]);return _0xec375d;}async[_0x2e801a(0xe3)](_0x478c3a){const _0x2ae0f9=_0x2e801a,_0x2209e7=_0x478c3a[_0x2ae0f9(0xe4)];delete _0x478c3a[_0x2ae0f9(0xe4)],delete _0x478c3a[_0x2ae0f9(0x101)];const _0x260ffa=await this['globalConfigService']['getConfigs']([_0x2ae0f9(0x160)]);console[_0x2ae0f9(0x15d)]('校验签名');if(this['sign'](_0x478c3a,_0x260ffa)!=_0x2209e7)return _0x2ae0f9(0x154);console[_0x2ae0f9(0x15d)](_0x2ae0f9(0x11c));const _0x4bb48c=await this[_0x2ae0f9(0x152)][_0x2ae0f9(0x109)]({'where':{'orderId':_0x478c3a['out_trade_no'],'status':0x0}});if(!_0x4bb48c)return _0x2ae0f9(0x154);const _0x2fbe03=_0x478c3a[_0x2ae0f9(0x111)]==_0x2ae0f9(0x14e)?0x1:0x2;console[_0x2ae0f9(0x15d)](_0x2ae0f9(0x141),_0x2fbe03);const _0x564c67=await this['orderEntity'][_0x2ae0f9(0xf8)]({'orderId':_0x478c3a[_0x2ae0f9(0x178)]},{'status':_0x2fbe03,'paydAt':new Date()});_0x2fbe03===0x1&&await this[_0x2ae0f9(0x12d)][_0x2ae0f9(0xf3)](_0x4bb48c);if(_0x564c67[_0x2ae0f9(0x130)]!=0x1)return _0x2ae0f9(0x154);return'success';}async[_0x2e801a(0x16d)](_0x402a07,_0x46d0ae,_0x582782='wxpay'){const _0x4676b7=_0x2e801a,_0x10aafd=await this['orderEntity']['findOne']({'where':{'userId':_0x402a07,'orderId':_0x46d0ae}});if(!_0x10aafd)throw new common_1[(_0x4676b7(0x11f))](_0x4676b7(0xf1),common_1[_0x4676b7(0x114)]['BAD_REQUEST']);const _0x44def5=await this[_0x4676b7(0x148)]['findOne']({'where':{'id':_0x10aafd['goodsId']}});if(!_0x44def5)throw new common_1['HttpException'](_0x4676b7(0x165),common_1['HttpStatus']['BAD_REQUEST']);const {payMpayPid:_0x46e9a5,payMpaySecret:_0x10cb1f,payMpayNotifyUrl:_0x4822e6,payMpayReturnUrl:_0x4fba22,payMpayApiPayUrl:_0x167aab}=await this['globalConfigService'][_0x4676b7(0xfd)](['payMpayPid',_0x4676b7(0x160),'payMpayNotifyUrl',_0x4676b7(0x107),_0x4676b7(0x13d)]),_0x4e5f3f={};_0x4e5f3f[_0x4676b7(0xf9)]=Number(_0x46e9a5),_0x4e5f3f[_0x4676b7(0x10a)]=_0x582782,_0x4e5f3f[_0x4676b7(0x178)]=_0x46d0ae,_0x4e5f3f['name']=_0x44def5[_0x4676b7(0x17a)],_0x4e5f3f[_0x4676b7(0x13e)]=_0x10aafd[_0x4676b7(0x133)],_0x4e5f3f['notify_url']=_0x4822e6,_0x4e5f3f['return_url']=_0x4fba22,_0x4e5f3f[_0x4676b7(0xe4)]=this['sign'](_0x4e5f3f,_0x10cb1f),_0x4e5f3f[_0x4676b7(0x101)]='MD5';const _0x247aee=new URLSearchParams(_0x4e5f3f)[_0x4676b7(0xf4)](),_0x18b220=_0x167aab+'?'+_0x247aee;return{'url_qrcode':null,'redirectUrl':_0x18b220,'channel':_0x582782,'isRedirect':!![]};const _0x242244=await axios_1[_0x4676b7(0x173)][_0x4676b7(0x163)](_0x167aab,{'params':_0x4e5f3f});}async['queryMpay'](_0x114bbd){const _0x15506f=_0x2e801a,{payMpayApiQueryUrl:_0x192940}=await this['globalConfigService'][_0x15506f(0xfd)](['payMpayPid',_0x15506f(0x160),'payMpayApiQueryUrl']),_0x5a658c={};_0x5a658c[_0x15506f(0x10a)]=0x2,_0x5a658c[_0x15506f(0x161)]=_0x114bbd;const {data:{code:_0x49d6a4,msg:_0x46c71e,data:_0x4fe42a}}=await axios_1[_0x15506f(0x173)]['get'](_0x192940,{'params':_0x5a658c});if(_0x49d6a4!=0x1)throw new common_1[(_0x15506f(0x11f))](_0x46c71e,common_1[_0x15506f(0x114)][_0x15506f(0x14d)]);return _0x4fe42a;}async[_0x2e801a(0x123)](_0x1de0dc){const _0x121f9c=_0x2e801a;console['log'](_0x121f9c(0x156),_0x1de0dc);const {payWeChatAppId:_0x1ebb3e,payWeChatMchId:_0x291f22,payWeChatSecret:_0x1ffe96,payWeChatPublicKey:_0x1cfa0b,payWeChatPrivateKey:_0x1c228c}=await this[_0x121f9c(0x10d)]['getConfigs']([_0x121f9c(0x14a),_0x121f9c(0x10b),_0x121f9c(0x168),_0x121f9c(0x176),_0x121f9c(0x11a)]),_0x1c5e1b=new this[(_0x121f9c(0x13b))]({'appid':_0x1ebb3e,'mchid':_0x291f22,'publicKey':_0x1cfa0b,'privateKey':_0x1c228c});try{if(_0x1de0dc[_0x121f9c(0xe6)]==_0x121f9c(0x116)){const {ciphertext:_0x5bdf35,associated_data:_0x2f2118,nonce:_0x4e45e5}=_0x1de0dc[_0x121f9c(0x153)],_0x5d50c0=_0x1c5e1b[_0x121f9c(0x162)](_0x5bdf35,_0x2f2118,_0x4e45e5,_0x1ffe96),_0x25ff8f=await this[_0x121f9c(0x152)][_0x121f9c(0x109)]({'where':{'orderId':_0x5d50c0[_0x121f9c(0x178)],'status':0x0}});if(!_0x25ff8f)return'failed';const _0x107b59=_0x5d50c0['trade_state']=='SUCCESS'?0x1:0x2,_0x3199dc=await this[_0x121f9c(0x152)]['update']({'orderId':_0x5d50c0['out_trade_no']},{'status':_0x107b59,'paydAt':new Date()});_0x107b59===0x1&&await this['userBalanceService']['addBalanceToOrder'](_0x25ff8f);if(_0x3199dc['affected']!=0x1)return _0x121f9c(0x154);}return _0x121f9c(0xdb);}catch(_0x34981d){return console[_0x121f9c(0x15d)]('error:\x20',_0x34981d),console[_0x121f9c(0x15d)]('支付通知验证失败:\x20',_0x34981d),'failed';}}async['payWeChat'](_0x33be9f,_0x97a0e2,_0xc27ae9='native'){const _0x5b87dc=_0x2e801a;var _0x41061e,_0x1bb6a8,_0x475085;console[_0x5b87dc(0x15d)](_0x5b87dc(0x134),_0xc27ae9);const _0x25a456=await this['orderEntity']['findOne']({'where':{'userId':_0x33be9f,'orderId':_0x97a0e2}});if(!_0x25a456)throw new common_1[(_0x5b87dc(0x11f))]('订单不存在!',common_1['HttpStatus'][_0x5b87dc(0x14d)]);const _0x28c216=await this[_0x5b87dc(0x148)][_0x5b87dc(0x109)]({'where':{'id':_0x25a456[_0x5b87dc(0x132)]}});if(!_0x28c216)throw new common_1[(_0x5b87dc(0x11f))]('套餐不存在!',common_1[_0x5b87dc(0x114)][_0x5b87dc(0x14d)]);const {payWeChatAppId:_0x256ded,payWeChatMchId:_0x5735a6,payWeChatPublicKey:_0x2b9957,payWeChatPrivateKey:_0x490700,payWeChatNotifyUrl:_0x335968,payWeChatH5Name:_0x53f0ba,payWeChatH5Url:_0x209dd6}=await this[_0x5b87dc(0x10d)][_0x5b87dc(0xfd)](['payWeChatAppId','payWeChatMchId',_0x5b87dc(0x176),_0x5b87dc(0x11a),'payWeChatNotifyUrl',_0x5b87dc(0xfc),_0x5b87dc(0x103)]),_0xdb9ca5=new this[(_0x5b87dc(0x13b))]({'appid':_0x256ded,'mchid':_0x5735a6,'publicKey':_0x2b9957,'privateKey':_0x490700}),_0x15a637={'appid':_0x256ded,'mchid':_0x5735a6,'description':_0x28c216['name'],'out_trade_no':_0x97a0e2,'notify_url':_0x335968,'amount':{'total':Number(_0x25a456[_0x5b87dc(0x133)]*0x64)},'scene_info':{'payer_client_ip':_0x5b87dc(0x118)}};console[_0x5b87dc(0x15d)](_0x5b87dc(0x125),_0x15a637);if(_0xc27ae9=='h5'){_0x15a637[_0x5b87dc(0xf0)][_0x5b87dc(0x164)]={'type':_0x5b87dc(0x106),'app_name':_0x53f0ba,'app_url':_0x209dd6};const _0x121e37=await _0xdb9ca5[_0x5b87dc(0x11d)](_0x15a637);if(_0x121e37['status']===0x193){const _0x7c1ed8=(_0x475085=(_0x1bb6a8=(_0x41061e=_0x121e37===null||_0x121e37===void 0x0?void 0x0:_0x121e37[_0x5b87dc(0xec)])===null||_0x41061e===void 0x0?void 0x0:_0x41061e[_0x5b87dc(0x128)])===null||_0x1bb6a8===void 0x0?void 0x0:_0x1bb6a8[_0x5b87dc(0x17f)])===null||_0x475085===void 0x0?void 0x0:_0x475085[_0x5b87dc(0x16f)];throw new common_1['HttpException']((_0x121e37===null||_0x121e37===void 0x0?void 0x0:_0x121e37[_0x5b87dc(0x16f)])||_0x5b87dc(0xf2),common_1['HttpStatus'][_0x5b87dc(0x14d)]);}const {h5_url:_0x2edd38}=_0x121e37;return{'url':_0x2edd38};}if(_0xc27ae9==_0x5b87dc(0x105)){const _0x4fd587=await this[_0x5b87dc(0x17e)]['getOpenIdByUserId'](_0x33be9f);console[_0x5b87dc(0x15d)](_0x5b87dc(0x146),_0x4fd587),_0x15a637[_0x5b87dc(0x113)]={'openid':_0x4fd587};const _0x2e6f3b=await _0xdb9ca5['transactions_jsapi'](_0x15a637);return console[_0x5b87dc(0x15d)](_0x5b87dc(0x138),_0x2e6f3b),_0x2e6f3b;}if(_0xc27ae9=='native'){const _0x1562cb=await _0xdb9ca5['transactions_native'](_0x15a637),{code_url:_0x5a687b}=_0x1562cb;return!_0x5a687b&&console[_0x5b87dc(0x15d)](_0x5b87dc(0xd9),_0x1562cb),{'url_qrcode':_0x5a687b,'isRedirect':![]};}throw new common_1[(_0x5b87dc(0x11f))]('unsupported\x20pay\x20type',common_1[_0x5b87dc(0x114)][_0x5b87dc(0x14d)]);}async[_0x2e801a(0x140)](_0x29f85b){const _0x469809=_0x2e801a,{payWeChatAppId:_0x3bcab9,payWeChatMchId:_0x51dd5c,payWeChatPublicKey:_0x5249db,payWeChatPrivateKey:_0x303b74,payWeChatNotifyUrl:_0x44b9c1,payWeChatH5Name:_0x67af05,payWeChatH5Url:_0x5b9f80}=await this[_0x469809(0x10d)][_0x469809(0xfd)](['payWeChatAppId',_0x469809(0x10b),'payWeChatPublicKey','payWeChatPrivateKey']),_0x1f2315=new this[(_0x469809(0x13b))]({'appid':_0x3bcab9,'mchid':_0x51dd5c,'publicKey':_0x5249db,'privateKey':_0x303b74}),_0x71d829=await _0x1f2315[_0x469809(0x129)]({'out_trade_no':_0x29f85b});return _0x71d829;}[_0x2e801a(0xe4)](_0x554904,_0x2ab14){const _0x4afea8=_0x2e801a,_0x288165=Object['keys'](_0x554904)[_0x4afea8(0x122)]()['map'](_0xd1348=>_0xd1348+'='+_0x554904[_0xd1348])[_0x4afea8(0x15e)]('&')+_0x2ab14;return crypto[_0x4afea8(0x102)](_0x4afea8(0x15c))[_0x4afea8(0xf8)](_0x288165)[_0x4afea8(0x14c)](_0x4afea8(0x12c));}};PayService=__decorate([(0x0,common_1[_0x2e801a(0x124)])(),__param(0x0,(0x0,typeorm_1['InjectRepository'])(cramiPackage_entity_1[_0x2e801a(0x155)])),__param(0x1,(0x0,typeorm_1[_0x2e801a(0x112)])(order_entity_1[_0x2e801a(0x16b)])),__metadata(_0x2e801a(0xed),[typeorm_2[_0x2e801a(0xfa)],typeorm_2[_0x2e801a(0xfa)],userBalance_service_1[_0x2e801a(0x169)],globalConfig_service_1[_0x2e801a(0x11e)],user_service_1[_0x2e801a(0x115)]])],PayService),exports['PayService']=PayService; |