|
@@ -167,7 +167,7 @@ export class SunPayService extends BaseService {
|
|
|
const param = {
|
|
|
out_order_no: payload.orderNo,
|
|
|
customer_id: payload.customerId,
|
|
|
- currency: 'USD',
|
|
|
+ currency: payload.currency,
|
|
|
amount: +payload.amount,
|
|
|
payment_type: "CARD",
|
|
|
client_ip: payload.userIp || "127.0.0.0",
|
|
@@ -223,7 +223,7 @@ export class SunPayService extends BaseService {
|
|
|
});
|
|
|
this.logger.info('查询接口返回', JSON.stringify(res.data));
|
|
|
const { is_success, msg } = res.data;
|
|
|
- if (is_success && res.data.data.order_status === 'SUCCESS ') {
|
|
|
+ if (is_success && res.data.data.order_status === 'SUCCESS') {
|
|
|
return {
|
|
|
status: 1,
|
|
|
};
|
|
@@ -237,12 +237,13 @@ export class SunPayService extends BaseService {
|
|
|
|
|
|
async handleOrderNotify(payload, headers) {
|
|
|
const { data } = payload;
|
|
|
- const sign = headers['SunPay-Sign'];
|
|
|
- const timestamp = headers['SunPay-Timestamp'];
|
|
|
- const nonce = headers['SunPay-Nonce'];
|
|
|
- const key = headers['SunPay-Key'];
|
|
|
- const str = timestamp + nonce + JSON.stringify(data);
|
|
|
+ const sign = headers['sunpay-sign'];
|
|
|
+ const timestamp = headers['sunpay-timestamp'];
|
|
|
+ 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');
|
|
|
}
|
|
@@ -255,6 +256,4 @@ export class SunPayService extends BaseService {
|
|
|
traceNo: data.order_no,
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+}
|