oak-pay-business 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/aspects/withdraw.d.ts +4 -4
- package/es/components/AbstractComponents.d.ts +5 -8
- package/es/components/account/detail/index.json +1 -0
- package/es/components/account/detail/index.less +1 -1
- package/es/components/account/detail/index.xml +6 -3
- package/es/components/accountOper/list/index.js +13 -1
- package/es/components/deposit/new/index.xml +0 -1
- package/es/components/order/list/web.pc.js +1 -1
- package/es/components/pay/list/web.pc.js +1 -1
- package/es/components/refund/list/web.pc.js +1 -1
- package/es/components/sysAccount/transferList/web.pc.js +1 -1
- package/es/components/withdrawTransfer/list/web.pc.js +2 -2
- package/es/context/BackendRuntimeContext.d.ts +1 -1
- package/es/entities/Refund.d.ts +2 -1
- package/es/entities/Refund.js +2 -1
- package/es/oak-app-domain/Refund/Schema.d.ts +7 -1
- package/es/oak-app-domain/Refund/Storage.js +3 -0
- package/es/oak-app-domain/Refund/locales/zh_CN.json +1 -1
- package/es/triggers/refund.js +1 -1
- package/es/types/Exception.d.ts +4 -1
- package/es/types/Exception.js +3 -3
- package/es/types/PayClazz.d.ts +8 -2
- package/es/utils/application.d.ts +1 -1
- package/es/utils/payClazz/Account.d.ts +6 -1
- package/es/utils/payClazz/Account.js +3 -3
- package/es/utils/payClazz/Offline.d.ts +6 -1
- package/es/utils/payClazz/Offline.js +3 -4
- package/es/utils/payClazz/WechatPay/WechatPay.d.ts +10 -5
- package/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts +7 -2
- package/es/utils/payClazz/WechatPay/WechatPay.debug.js +4 -4
- package/es/utils/payClazz/WechatPay/WechatPay.js +98 -14
- package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
- package/lib/aspects/withdraw.d.ts +8 -8
- package/lib/context/BackendRuntimeContext.d.ts +1 -1
- package/lib/entities/Refund.d.ts +2 -1
- package/lib/entities/Refund.js +2 -1
- package/lib/oak-app-domain/Refund/Schema.d.ts +7 -1
- package/lib/oak-app-domain/Refund/Storage.js +3 -0
- package/lib/oak-app-domain/Refund/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/System/Storage.js +2 -1
- package/lib/triggers/refund.js +1 -1
- package/lib/types/Exception.d.ts +4 -1
- package/lib/types/Exception.js +5 -5
- package/lib/types/PayClazz.d.ts +8 -2
- package/lib/utils/application.d.ts +1 -1
- package/lib/utils/payClazz/Account.d.ts +6 -1
- package/lib/utils/payClazz/Account.js +3 -3
- package/lib/utils/payClazz/Offline.d.ts +6 -1
- package/lib/utils/payClazz/Offline.js +3 -4
- package/lib/utils/payClazz/WechatPay/WechatPay.d.ts +10 -5
- package/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts +7 -2
- package/lib/utils/payClazz/WechatPay/WechatPay.debug.js +4 -4
- package/lib/utils/payClazz/WechatPay/WechatPay.js +97 -13
- package/package.json +4 -4
- package/src/entities/Refund.ts +3 -1
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import dayJs from 'dayjs';
|
|
3
3
|
import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs';
|
|
4
4
|
import { compressTo32, decompressFrom32 } from 'oak-domain/lib/utils/uuid';
|
|
5
|
-
import {
|
|
5
|
+
import { ExternalPayUtilException } from "../../../types/Exception";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import { omit } from "oak-domain/lib/utils/lodash";
|
|
8
8
|
import WechatPayDebug from './WechatPay.debug';
|
|
@@ -14,6 +14,12 @@ const TRADE_STATE_MATRIX = {
|
|
|
14
14
|
'PAYERROR': 'closed',
|
|
15
15
|
'REVOKED': 'closed',
|
|
16
16
|
};
|
|
17
|
+
const REFUND_STATE_MATRIX = {
|
|
18
|
+
'SUCCESS': "successful",
|
|
19
|
+
'CLOSED': "failed",
|
|
20
|
+
"ABNORMAL": "refunding",
|
|
21
|
+
"PROCESSING": 'refunding',
|
|
22
|
+
};
|
|
17
23
|
export default class WechatPay extends WechatPayDebug {
|
|
18
24
|
wechatPay;
|
|
19
25
|
refundGapDays;
|
|
@@ -45,20 +51,45 @@ export default class WechatPay extends WechatPayDebug {
|
|
|
45
51
|
cert_public_content: fs.readFileSync(this.publicKeyFilePath),
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
|
-
refund(refund) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
async refund(refund, context) {
|
|
55
|
+
const { id, price, pay } = refund;
|
|
56
|
+
const serverUrl = context.composeAccessPath();
|
|
57
|
+
const endpoint = this.refundNotifyUrl;
|
|
58
|
+
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${pay.id}`;
|
|
59
|
+
const result = await this.wechatPay.createRefund({
|
|
60
|
+
out_trade_no: compressTo32(pay.id),
|
|
61
|
+
out_refund_no: compressTo32(id),
|
|
62
|
+
notify_url: refundNotifyUrl,
|
|
63
|
+
amount: {
|
|
64
|
+
refund: price,
|
|
65
|
+
total: pay.price,
|
|
66
|
+
currency: 'CNY',
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const { refund_id } = this.analyzeResult(result);
|
|
70
|
+
return {
|
|
71
|
+
externalId: refund_id,
|
|
72
|
+
};
|
|
53
73
|
}
|
|
54
|
-
getRefundState(refund) {
|
|
55
|
-
|
|
74
|
+
async getRefundState(refund) {
|
|
75
|
+
const result = await this.wechatPay.queryRefundByOutRefundNo(compressTo32(refund.id));
|
|
76
|
+
const { status, success_time } = this.analyzeResult(result);
|
|
77
|
+
/**
|
|
78
|
+
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
|
79
|
+
可选取值:
|
|
80
|
+
SUCCESS: 退款成功
|
|
81
|
+
CLOSED: 退款关闭
|
|
82
|
+
PROCESSING: 退款处理中
|
|
83
|
+
ABNORMAL: 退款异常
|
|
84
|
+
*/
|
|
85
|
+
const iState = REFUND_STATE_MATRIX[status];
|
|
86
|
+
return [iState, success_time ? { successAt: dayJs(success_time).millisecond() } : undefined];
|
|
56
87
|
}
|
|
57
|
-
|
|
88
|
+
analyzeResult(result) {
|
|
58
89
|
const { success, data, } = result;
|
|
59
90
|
if (!success) {
|
|
60
91
|
console.error(JSON.stringify(result));
|
|
61
|
-
throw new
|
|
92
|
+
throw new ExternalPayUtilException(result);
|
|
62
93
|
}
|
|
63
94
|
return data;
|
|
64
95
|
}
|
|
@@ -88,7 +119,7 @@ export default class WechatPay extends WechatPayDebug {
|
|
|
88
119
|
total: pay.price,
|
|
89
120
|
},
|
|
90
121
|
});
|
|
91
|
-
const { code_url } = this.
|
|
122
|
+
const { code_url } = this.analyzeResult(result);
|
|
92
123
|
data.externalId = code_url;
|
|
93
124
|
data.meta = {
|
|
94
125
|
codeUrl: code_url,
|
|
@@ -119,7 +150,7 @@ export default class WechatPay extends WechatPayDebug {
|
|
|
119
150
|
openid: wechatUser.openId,
|
|
120
151
|
}
|
|
121
152
|
});
|
|
122
|
-
const prepayMeta = this.
|
|
153
|
+
const prepayMeta = this.analyzeResult(result);
|
|
123
154
|
const prepayId = prepayMeta.package.slice(11); // `prepay_id=${prepay_id}`
|
|
124
155
|
data.externalId = prepayId;
|
|
125
156
|
data.meta = {
|
|
@@ -152,7 +183,7 @@ export default class WechatPay extends WechatPayDebug {
|
|
|
152
183
|
* USERPAYING:用户支付中(仅付款码支付会返回)
|
|
153
184
|
* PAYERROR:支付失败(仅付款码支付会返回)
|
|
154
185
|
*/
|
|
155
|
-
const { trade_state: tradeState, success_time } = this.
|
|
186
|
+
const { trade_state: tradeState, success_time } = this.analyzeResult(result);
|
|
156
187
|
const iState = TRADE_STATE_MATRIX[tradeState];
|
|
157
188
|
assert(iState);
|
|
158
189
|
const updateData = {
|
|
@@ -168,7 +199,7 @@ export default class WechatPay extends WechatPayDebug {
|
|
|
168
199
|
async close(pay) {
|
|
169
200
|
const outTradeNo = compressTo32(pay.id);
|
|
170
201
|
const result = await this.wechatPay.closeOrder(outTradeNo);
|
|
171
|
-
this.
|
|
202
|
+
this.analyzeResult(result);
|
|
172
203
|
}
|
|
173
204
|
async decodePayNotification(params, body) {
|
|
174
205
|
const { resource } = body;
|
|
@@ -285,6 +316,59 @@ export default class WechatPay extends WechatPayDebug {
|
|
|
285
316
|
extra,
|
|
286
317
|
};
|
|
287
318
|
}
|
|
319
|
+
async decodeRefundNotification(params, body) {
|
|
320
|
+
const { resource } = body;
|
|
321
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
322
|
+
console.log('decodeRefundNotification-resource', JSON.stringify(resource));
|
|
323
|
+
}
|
|
324
|
+
const { ciphertext, nonce, associated_data } = resource;
|
|
325
|
+
const result2 = this.wechatPay.decryptAesGcm({
|
|
326
|
+
ciphertext,
|
|
327
|
+
nonce,
|
|
328
|
+
apiV3Key: this.apiV3Key,
|
|
329
|
+
associatedData: associated_data,
|
|
330
|
+
});
|
|
331
|
+
const result = JSON.parse(result2);
|
|
332
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
333
|
+
console.log('decodeRefundNotification-decrypt', JSON.stringify(result));
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* 对resource对象进行解密后,得到的资源对象示例
|
|
337
|
+
* https://pay.weixin.qq.com/docs/merchant/apis/jsapi-payment/refund-result-notice.html
|
|
338
|
+
* {
|
|
339
|
+
"mchid": "1900000100",
|
|
340
|
+
"transaction_id": "1008450740201411110005820873",
|
|
341
|
+
"out_trade_no": "20150806125346",
|
|
342
|
+
"refund_id": "50200207182018070300011301001",
|
|
343
|
+
"out_refund_no": "7752501201407033233368018",
|
|
344
|
+
"refund_status": "SUCCESS",
|
|
345
|
+
"success_time": "2018-06-08T10:34:56+08:00",
|
|
346
|
+
"user_received_account": "招商银行信用卡0403",
|
|
347
|
+
"amount" : {
|
|
348
|
+
"total": 999,
|
|
349
|
+
"refund": 999,
|
|
350
|
+
"payer_total": 999,
|
|
351
|
+
"payer_refund": 999
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
*/
|
|
355
|
+
const { out_refund_no, mchid, refund_status, success_time, } = result;
|
|
356
|
+
const refundId = decompressFrom32(out_refund_no);
|
|
357
|
+
assert(mchid === this.mchId);
|
|
358
|
+
const iState = REFUND_STATE_MATRIX[refund_status];
|
|
359
|
+
assert(iState);
|
|
360
|
+
const extra = {
|
|
361
|
+
meta: omit(result, ['mchid',]),
|
|
362
|
+
};
|
|
363
|
+
if (iState === 'successful') {
|
|
364
|
+
extra.successAt = success_time;
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
refundId,
|
|
368
|
+
iState,
|
|
369
|
+
extra,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
288
372
|
getRefundableAt(successAt) {
|
|
289
373
|
return this.caclRefundDeadline(successAt);
|
|
290
374
|
}
|
|
@@ -12,8 +12,8 @@ export declare function getWithdrawCreateData(params: {
|
|
|
12
12
|
creatorId: string;
|
|
13
13
|
creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
|
|
14
14
|
} & {
|
|
15
|
-
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "
|
|
16
|
-
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "
|
|
15
|
+
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
16
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
17
17
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
18
18
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
19
19
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
@@ -26,8 +26,8 @@ export declare function getWithdrawCreateData(params: {
|
|
|
26
26
|
creator?: undefined;
|
|
27
27
|
creatorId: string;
|
|
28
28
|
} & {
|
|
29
|
-
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "
|
|
30
|
-
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "
|
|
29
|
+
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
30
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
31
31
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
32
32
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
33
33
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
@@ -40,8 +40,8 @@ export declare function getWithdrawCreateData(params: {
|
|
|
40
40
|
creatorId: string;
|
|
41
41
|
creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
|
|
42
42
|
} & {
|
|
43
|
-
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "
|
|
44
|
-
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "
|
|
43
|
+
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
44
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
45
45
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
46
46
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
47
47
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
@@ -54,8 +54,8 @@ export declare function getWithdrawCreateData(params: {
|
|
|
54
54
|
creator?: undefined;
|
|
55
55
|
creatorId: string;
|
|
56
56
|
} & {
|
|
57
|
-
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "
|
|
58
|
-
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "
|
|
57
|
+
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
58
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
|
59
59
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
60
60
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
61
61
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
|
@@ -15,7 +15,7 @@ export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDic
|
|
|
15
15
|
type?: number | undefined;
|
|
16
16
|
systemId?: number | undefined;
|
|
17
17
|
system?: import("../oak-app-domain/System/Schema").Projection | undefined;
|
|
18
|
-
config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").
|
|
18
|
+
config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
|
|
19
19
|
style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
|
|
20
20
|
domainId?: number | undefined;
|
|
21
21
|
domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
|
package/lib/entities/Refund.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { String, Text, Price } from 'oak-domain/lib/types/DataType';
|
|
1
|
+
import { String, Text, Price, Datetime } from 'oak-domain/lib/types/DataType';
|
|
2
2
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
|
3
3
|
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
|
|
4
4
|
import { Schema as User } from './User';
|
|
@@ -14,6 +14,7 @@ export interface Schema extends EntityShape {
|
|
|
14
14
|
price: Price;
|
|
15
15
|
creator: User;
|
|
16
16
|
reason?: Text;
|
|
17
|
+
successAt?: Datetime;
|
|
17
18
|
opers: AccountOper[];
|
|
18
19
|
}
|
|
19
20
|
export type IAction = 'succeed' | 'fail';
|
package/lib/entities/Refund.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFil
|
|
|
3
3
|
import { OneOf } from "oak-domain/lib/types/Polyfill";
|
|
4
4
|
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
|
|
5
5
|
import { Action, ParticularAction, IState } from "./Action";
|
|
6
|
-
import { Price, String, Text } from "oak-domain/lib/types/DataType";
|
|
6
|
+
import { Price, String, Text, Datetime } from "oak-domain/lib/types/DataType";
|
|
7
7
|
import * as Withdraw from "../Withdraw/Schema";
|
|
8
8
|
import * as Pay from "../Pay/Schema";
|
|
9
9
|
import * as User from "../User/Schema";
|
|
@@ -18,6 +18,7 @@ export type OpSchema = EntityShape & {
|
|
|
18
18
|
price: Price;
|
|
19
19
|
creatorId: ForeignKey<"user">;
|
|
20
20
|
reason?: Text | null;
|
|
21
|
+
successAt?: Datetime | null;
|
|
21
22
|
iState?: IState | null;
|
|
22
23
|
};
|
|
23
24
|
export type OpAttr = keyof OpSchema;
|
|
@@ -30,6 +31,7 @@ export type Schema = EntityShape & {
|
|
|
30
31
|
price: Price;
|
|
31
32
|
creatorId: ForeignKey<"user">;
|
|
32
33
|
reason?: Text | null;
|
|
34
|
+
successAt?: Datetime | null;
|
|
33
35
|
iState?: IState | null;
|
|
34
36
|
withdraw?: Withdraw.Schema | null;
|
|
35
37
|
pay: Pay.Schema;
|
|
@@ -57,6 +59,7 @@ type AttrFilter = {
|
|
|
57
59
|
creatorId: Q_StringValue;
|
|
58
60
|
creator: User.Filter;
|
|
59
61
|
reason: Q_StringValue;
|
|
62
|
+
successAt: Q_DateValue;
|
|
60
63
|
iState: Q_EnumValue<IState>;
|
|
61
64
|
sysAccountOper$refund: SysAccountOper.Filter & SubQueryPredicateMetadata;
|
|
62
65
|
accountOper$entity: AccountOper.Filter & SubQueryPredicateMetadata;
|
|
@@ -80,6 +83,7 @@ export type Projection = {
|
|
|
80
83
|
creatorId?: number;
|
|
81
84
|
creator?: User.Projection;
|
|
82
85
|
reason?: number;
|
|
86
|
+
successAt?: number;
|
|
83
87
|
iState?: number;
|
|
84
88
|
sysAccountOper$refund?: SysAccountOper.Selection & {
|
|
85
89
|
$entity: "sysAccountOper";
|
|
@@ -134,6 +138,8 @@ export type SortAttr = {
|
|
|
134
138
|
creator: User.SortAttr;
|
|
135
139
|
} | {
|
|
136
140
|
reason: number;
|
|
141
|
+
} | {
|
|
142
|
+
successAt: number;
|
|
137
143
|
} | {
|
|
138
144
|
iState: number;
|
|
139
145
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
|
1
|
+
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作", "successAt": "退款成功时间" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
package/lib/triggers/refund.js
CHANGED
package/lib/types/Exception.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OakException, OpRecord } from 'oak-domain/lib/types';
|
|
2
2
|
import { EntityDict } from '../oak-app-domain/index';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
|
|
4
4
|
reason: any;
|
|
5
5
|
constructor(reason: any, message?: string);
|
|
6
6
|
getSerialData(): {
|
|
@@ -8,6 +8,9 @@ export declare class ExternalPrePayException<ED extends EntityDict> extends OakE
|
|
|
8
8
|
name: string;
|
|
9
9
|
message: string;
|
|
10
10
|
opRecords: OpRecord<ED>[];
|
|
11
|
+
tag1: string | undefined;
|
|
12
|
+
tag2: boolean | undefined;
|
|
13
|
+
tag3: any;
|
|
11
14
|
};
|
|
12
15
|
}
|
|
13
16
|
export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
|
package/lib/types/Exception.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeException = exports.RefundExceedMax = exports.
|
|
3
|
+
exports.makeException = exports.RefundExceedMax = exports.ExternalPayUtilException = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const types_1 = require("oak-domain/lib/types");
|
|
6
6
|
const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions"));
|
|
7
|
-
class
|
|
7
|
+
class ExternalPayUtilException extends types_1.OakException {
|
|
8
8
|
reason;
|
|
9
9
|
constructor(reason, message) {
|
|
10
|
-
super(message || '
|
|
10
|
+
super(message || '调用外部支付渠道接口失败');
|
|
11
11
|
this.reason = reason;
|
|
12
12
|
}
|
|
13
13
|
getSerialData() {
|
|
@@ -18,7 +18,7 @@ class ExternalPrePayException extends types_1.OakException {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
exports.
|
|
21
|
+
exports.ExternalPayUtilException = ExternalPayUtilException;
|
|
22
22
|
class RefundExceedMax extends types_1.OakException {
|
|
23
23
|
constructor(message) {
|
|
24
24
|
super(message || '可退款的总额不足');
|
|
@@ -34,7 +34,7 @@ function makeException(msg) {
|
|
|
34
34
|
const { name, message } = data;
|
|
35
35
|
switch (name) {
|
|
36
36
|
case 'ExternalPrePayException': {
|
|
37
|
-
exception = new
|
|
37
|
+
exception = new ExternalPayUtilException(data.reason, message);
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
case 'RefundExceedMax': {
|
package/lib/types/PayClazz.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EntityDict } from '../oak-app-domain';
|
|
2
2
|
import { BRC } from '../types/RuntimeCxt';
|
|
3
3
|
type IState = EntityDict['pay']['OpSchema']['iState'];
|
|
4
|
+
type RefundIState = EntityDict['refund']['OpSchema']['iState'];
|
|
4
5
|
export default interface PayClazz {
|
|
5
6
|
getAccountEntity(): [string, string];
|
|
6
7
|
getAccountAmount(context: BRC): Promise<number>;
|
|
@@ -16,8 +17,13 @@ export default interface PayClazz {
|
|
|
16
17
|
extra?: EntityDict['pay']['Update']['data'];
|
|
17
18
|
price?: number;
|
|
18
19
|
}>;
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
21
|
+
refundId: string;
|
|
22
|
+
iState: RefundIState;
|
|
23
|
+
extra?: EntityDict['refund']['Update']['data'];
|
|
24
|
+
price?: number;
|
|
25
|
+
}>;
|
|
26
|
+
refund(refund: EntityDict['refund']['Schema'], context: BRC): Promise<EntityDict['refund']['Update']['data'] | undefined>;
|
|
21
27
|
getRefundableAt(successAt: number): number;
|
|
22
28
|
getRefundState(refund: EntityDict['refund']['OpSchema']): Promise<[EntityDict['refund']['OpSchema']['iState'], EntityDict['refund']['Update']['data'] | undefined]>;
|
|
23
29
|
}
|
|
@@ -14,7 +14,7 @@ export declare const mergedProjection: {
|
|
|
14
14
|
type?: number | undefined;
|
|
15
15
|
systemId?: number | undefined;
|
|
16
16
|
system?: import("../oak-app-domain/System/Schema").Projection | undefined;
|
|
17
|
-
config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").
|
|
17
|
+
config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
|
|
18
18
|
style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
|
|
19
19
|
domainId?: number | undefined;
|
|
20
20
|
domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
|
|
@@ -9,13 +9,18 @@ export default class Account implements PayClazz {
|
|
|
9
9
|
calcPayTax(): [number, string, string];
|
|
10
10
|
getRefundableAt(successAt: number): number;
|
|
11
11
|
refund(refund: EntityDict['refund']['Schema']): Promise<undefined>;
|
|
12
|
-
closeRefund(refund: EntityDict['refund']['Schema']): Promise<void>;
|
|
13
12
|
getRefundState(refund: EntityDict['refund']['Schema']): Promise<[EntityDict['refund']['Schema']['iState'], undefined]>;
|
|
14
13
|
decodePayNotification(params: Record<string, any>, body: any): Promise<{
|
|
15
14
|
payId: string;
|
|
16
15
|
iState: string | null | undefined;
|
|
17
16
|
extra?: EntityDict['pay']['Update']['data'] | undefined;
|
|
18
17
|
}>;
|
|
18
|
+
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
19
|
+
refundId: string;
|
|
20
|
+
iState: string | null | undefined;
|
|
21
|
+
extra?: EntityDict['refund']['Update']['data'] | undefined;
|
|
22
|
+
price?: number | undefined;
|
|
23
|
+
}>;
|
|
19
24
|
prepay(pay: EntityDict['pay']['Schema'], data: EntityDict['pay']['Update']['data'], context: BRC): Promise<void>;
|
|
20
25
|
getState(pay: EntityDict['pay']['Schema']): Promise<[string, EntityDict['pay']['Update']['data']]>;
|
|
21
26
|
close(pay: EntityDict['pay']['Schema']): Promise<void>;
|
|
@@ -26,15 +26,15 @@ class Account {
|
|
|
26
26
|
async refund(refund) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
async closeRefund(refund) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
29
|
async getRefundState(refund) {
|
|
33
30
|
return ['refuding', undefined];
|
|
34
31
|
}
|
|
35
32
|
decodePayNotification(params, body) {
|
|
36
33
|
throw new Error("account类型的pay不需调用此接口");
|
|
37
34
|
}
|
|
35
|
+
decodeRefundNotification(params, body) {
|
|
36
|
+
throw new Error("account类型的pay不需调用此接口");
|
|
37
|
+
}
|
|
38
38
|
async prepay(pay, data, context) {
|
|
39
39
|
const { entity, entityId, price } = pay;
|
|
40
40
|
(0, assert_1.default)(entity === 'account' && entityId);
|
|
@@ -13,13 +13,18 @@ export default class Offline implements PayClazz {
|
|
|
13
13
|
calcPayTax(price: number): [number, string, string];
|
|
14
14
|
getRefundableAt(successTime: number): number;
|
|
15
15
|
refund(refund: RefundOpSchema): Promise<UpdateOperationData | undefined>;
|
|
16
|
-
closeRefund(refund: RefundOpSchema): Promise<void>;
|
|
17
16
|
getRefundState(refund: RefundOpSchema): Promise<[PayOpSchema['iState'], PayUpdateData | undefined]>;
|
|
18
17
|
decodePayNotification(params: Record<string, any>, body: any): Promise<{
|
|
19
18
|
payId: string;
|
|
20
19
|
iState: string | null | undefined;
|
|
21
20
|
extra?: PayUpdateData | undefined;
|
|
22
21
|
}>;
|
|
22
|
+
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
23
|
+
refundId: string;
|
|
24
|
+
iState: string | null | undefined;
|
|
25
|
+
extra?: EntityDict['refund']['Update']['data'] | undefined;
|
|
26
|
+
price?: number | undefined;
|
|
27
|
+
}>;
|
|
23
28
|
prepay(pay: PayOpSchema, data: PayUpdateData, context: BRC): Promise<void>;
|
|
24
29
|
getState(pay: PayOpSchema): Promise<[string, PayUpdateData]>;
|
|
25
30
|
close(pay: PayOpSchema): Promise<void>;
|
|
@@ -52,10 +52,6 @@ class Offline {
|
|
|
52
52
|
// 啥也不做
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
async closeRefund(refund) {
|
|
56
|
-
// 啥也不做
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
55
|
async getRefundState(refund) {
|
|
60
56
|
const { iState } = refund;
|
|
61
57
|
(0, assert_1.default)(iState === 'refunding');
|
|
@@ -64,6 +60,9 @@ class Offline {
|
|
|
64
60
|
decodePayNotification(params, body) {
|
|
65
61
|
throw new Error("offline类型的pay不需调用此接口");
|
|
66
62
|
}
|
|
63
|
+
decodeRefundNotification(params, body) {
|
|
64
|
+
throw new Error("offline类型的pay不需调用此接口");
|
|
65
|
+
}
|
|
67
66
|
async prepay(pay, data, context) {
|
|
68
67
|
data.phantom3 = Math.ceil(Math.random() * 1000000);
|
|
69
68
|
return;
|
|
@@ -3,7 +3,7 @@ import PayClazz from "../../../types/PayClazz";
|
|
|
3
3
|
import { BRC } from "../../../types/RuntimeCxt";
|
|
4
4
|
import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs';
|
|
5
5
|
import { EntityDict } from "../../../oak-app-domain";
|
|
6
|
-
import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData } from "../../../oak-app-domain/Refund/Schema";
|
|
6
|
+
import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData, Schema as Refund } from "../../../oak-app-domain/Refund/Schema";
|
|
7
7
|
import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema';
|
|
8
8
|
import WechatPayDebug from './WechatPay.debug';
|
|
9
9
|
export default class WechatPay extends WechatPayDebug implements PayClazz {
|
|
@@ -19,10 +19,9 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
|
|
|
19
19
|
static MIN_REFUND_DAYS_GAP: number;
|
|
20
20
|
static DEFAULT_REFUND_DAYS_GAP: number;
|
|
21
21
|
constructor(wpProduct: WpProduct, appId: string);
|
|
22
|
-
refund(refund:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
private analyzePrepayResult;
|
|
22
|
+
refund(refund: Refund, context: BRC): Promise<RefundUpdateData | undefined>;
|
|
23
|
+
getRefundState(refund: OpRefund): Promise<[string | null | undefined, RefundUpdateData | undefined]>;
|
|
24
|
+
private analyzeResult;
|
|
26
25
|
private caclRefundDeadline;
|
|
27
26
|
prepay(pay: Pay, data: PayUpdateData, context: BRC): Promise<void>;
|
|
28
27
|
getState(pay: OpPay): Promise<[EntityDict['pay']['OpSchema']['iState'], PayUpdateData]>;
|
|
@@ -32,5 +31,11 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
|
|
|
32
31
|
iState: EntityDict['pay']['OpSchema']['iState'];
|
|
33
32
|
extra?: PayUpdateData;
|
|
34
33
|
}>;
|
|
34
|
+
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
35
|
+
refundId: string;
|
|
36
|
+
iState: string | null | undefined;
|
|
37
|
+
extra?: RefundUpdateData | undefined;
|
|
38
|
+
price?: number | undefined;
|
|
39
|
+
}>;
|
|
35
40
|
getRefundableAt(successAt: number): number;
|
|
36
41
|
}
|
|
@@ -8,13 +8,18 @@ export declare function registerGetPayStateResult(payState: NonNullable<EntityDi
|
|
|
8
8
|
export default class WechatPay implements PayClazz {
|
|
9
9
|
wpProduct: WpProduct;
|
|
10
10
|
constructor(wpProduct: WpProduct);
|
|
11
|
+
decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
|
|
12
|
+
refundId: string;
|
|
13
|
+
iState: string | null | undefined;
|
|
14
|
+
extra?: RefundUpdateData | undefined;
|
|
15
|
+
price?: number | undefined;
|
|
16
|
+
}>;
|
|
11
17
|
getAccountEntity(): [string, string];
|
|
12
18
|
getAccountAmount(context: BRC): Promise<number>;
|
|
13
19
|
calcTransferTax(price: number): [number, string, string];
|
|
14
20
|
calcRefundTax(price: number): [number, string, string];
|
|
15
21
|
calcPayTax(price: number): [number, string, string];
|
|
16
|
-
refund(refund: Refund): Promise<RefundUpdateData | undefined>;
|
|
17
|
-
closeRefund(refund: Refund): Promise<void>;
|
|
22
|
+
refund(refund: Refund, context: BRC): Promise<RefundUpdateData | undefined>;
|
|
18
23
|
getRefundState(refund: Refund): Promise<[string | null | undefined, PayUpdateData | undefined]>;
|
|
19
24
|
decodePayNotification(params: Record<string, any>, body: any): Promise<{
|
|
20
25
|
payId: string;
|