Переглянути джерело

change: 修改用户的身份认证2

max 7 місяців тому
батько
коміт
34160aa3d2

+ 1 - 0
src/modules/payment/adapter/sunpay.adapter.ts

@@ -130,6 +130,7 @@ export class SunPayAdapter implements ChannelAdapter {
     } catch (error) {
       // console.log(error.response.data);
       if (axios.isAxiosError(error) && error.response) {
+        console.log(error.response.data);
         throw new Error(`FusionPay API Network ${error.response.data.msg}`);
       }
       throw error;

+ 14 - 7
src/modules/payment/service/business.ts

@@ -39,7 +39,7 @@ export class BusinessService extends BaseService {
    * @param params
    * @returns
    */
-  async add(params) {    
+  async add(params) {
     const { merchant } = this.ctx.admin;
     const merchantId = merchant.mchId;
     const custom = {
@@ -48,18 +48,25 @@ export class BusinessService extends BaseService {
       webhook_url: this.getWebhook_url(params),
       customer_type: 'COMPANY',
       openApi: this.ctx.admin?.openApi || false
-    };    
+    };
     let res = await this.paymentService
       .setChannel('SUNPAY')
       .setCustomerInfo(custom);
+
     if (merchantId) {
       params.merchantId = params?.mch_id || params?.mchId || merchantId
     }
-    await super.add({
-      ...params,
-      ...params.company,
-      customer_id: res.data.customer_id,
-    });
+     try {
+       await super.add({
+         ...params,
+         ...params.company,
+         status: 0,
+         customer_id: res.data.customer_id,
+       });
+     } catch (e) {
+       console.log(e)
+     }
+
     return res;
   }
   async update(param) {

+ 10 - 4
src/modules/payment/service/individual.ts

@@ -56,10 +56,16 @@ export class IndividualService extends BaseService {
     if (merchantId) {
       params.merchantId = params?.mch_id || params?.mchId || merchantId
     }
-    await super.add({
-      ...params,
-      customer_id: res.data.customer_id,
-    });
+    try {
+      await super.add({
+        ...params,
+        ...params.individual,
+        status: 0,
+        customer_id: res.data.customer_id,
+      });
+    } catch (e) {
+      console.log(e)
+    }
     return res;
   }
   async update(param) {