Forráskód Böngészése

feat: 记录手续费的流水ID,防止重复收取

max 4 hónapja
szülő
commit
55e632b886

+ 4 - 4
src/modules/api/service/admin/applications.ts

@@ -292,12 +292,12 @@ export class applicationsService extends BaseService {
   async payments(params) {
     // 余额 判断是否足以支持交易手续费
     // 获取指定币种的余额
-    /* 
+    /*
       amount : 12312
       beneficiary_id : 10
       comment : "123"
       currency : "AUD"
-      purpose : "123123" 
+      purpose : "123123"
     */
     const merchantInfo = await this.getMerchantInfo();
     // 获取收款地址
@@ -363,10 +363,10 @@ export class applicationsService extends BaseService {
   }
 
   // 获取商户信息
-  async getMerchantInfo(mch_id = 'ep001@fusion.com') {
+  async getMerchantInfo(mch_id = this.ctx.admin.merchant.mchId) {
     const merchantInfo = await this.openAccountEntity.findOne({
       where: {
-        mch_id: this.ctx.admin.merchant.mchId,
+        mch_id: mch_id,
         // mch_id: 'easypay@qq.com',
         // mch_id: 'ep001@fusion.com',
         // mch_id: 'easypay003@fusion.com',

+ 4 - 4
src/modules/api/service/webhook_utils/transfer_success.ts

@@ -98,7 +98,7 @@ export class TransferSuccessService extends BaseService {
       // 获取余额
       const { before_balance, balance } =
         await this.webHookCommonService.getBalanceDiffByCurrency({
-          account_id: params.data.account_id,
+          account_id: params.data.from_account_id,
           currency: params.data.currency,
           amount: params.data.amount,
           order_type: OrderType.TRANSFER,
@@ -133,7 +133,7 @@ export class TransferSuccessService extends BaseService {
         // /v1/transfers
         const transfers_params = {
           request_id: md5(`${accountInfo.mch_id}_${params.data.id}`),
-          from_account_id: params.data.account_id,
+          from_account_id: params.data.from_account_id,
           to_account_id: this.easyPayAdapter.baseInfo.account_id,
           currency: params.data.currency,
           amount: withdrawChannelFee * 100,
@@ -153,8 +153,8 @@ export class TransferSuccessService extends BaseService {
           request_id: transfers_params.request_id,
           mch_id: accountInfo.mch_id,
           amount: withdrawChannelFee,
-          account_id: params.data.account_id,
-          from_account_id: params.data.account_id,
+          account_id: params.data.from_account_id,
+          from_account_id: params.data.from_account_id,
           to_account_id: this.easyPayAdapter.baseInfo.account_id,
           event_id: res.data.id,
           currency: params.data.currency,