test 10 bulan lalu
induk
melakukan
1b19c8118a
2 mengubah file dengan 2 tambahan dan 4 penghapusan
  1. 1 1
      src/comm/utils.ts
  2. 1 3
      src/modules/dj/service/channels/sunpay.ts

+ 1 - 1
src/comm/utils.ts

@@ -235,6 +235,6 @@ export class Utils {
     // 更新hash对象与传入的数据
     hmac.update(data);
     // 生成哈希值
-    return hmac.digest().toString('base64');
+    return hmac.digest('base64');
   }
 }

+ 1 - 3
src/modules/dj/service/channels/sunpay.ts

@@ -242,8 +242,6 @@ export class SunPayService extends BaseService {
     const nonce = headers['sunpay-nonce'];
     const str = timestamp + nonce + JSON.stringify(payload);
     const validSign = this.utils.signBySha256(str, API_SERECT).toUpperCase();
-    console.log(sign, str)
-    console.log(validSign)
     if (sign !== validSign) {
       throw new Error('sign error');
     }
@@ -251,7 +249,7 @@ export class SunPayService extends BaseService {
       throw new Error('order no success');
     }
     return {
-      date: moment(),
+      date: new Date(),
       orderNo: data.out_order_no,
       traceNo: data.order_no,
     };