oak-pay-business 3.0.1 → 3.0.2
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/components/AbstractComponents.js +4 -0
- package/es/components/deposit/new/index.js +2 -2
- package/es/components/order/pay/index.js +3 -3
- package/es/oak-app-domain/Passport/_baseSchema.d.ts +1 -0
- package/es/triggers/order.js +14 -0
- package/es/types/Exception.d.ts +1 -0
- package/es/utils/shipClazz/WechatMpShip/WechatMpShip.debug.js +7 -6
- package/lib/aspects/withdraw.js +1 -2
- package/lib/oak-app-domain/Passport/_baseSchema.d.ts +1 -0
- package/lib/triggers/order.js +14 -0
- package/lib/types/Exception.d.ts +1 -0
- package/lib/types/Exception.js +2 -2
- package/lib/utils/payClazz/WechatPay/WechatPay.debug.js +1 -2
- package/lib/utils/shipClazz/WechatMpShip/WechatMpShip.debug.js +7 -6
- package/package.json +4 -4
|
@@ -87,9 +87,9 @@ export default OakComponent({
|
|
|
87
87
|
this.onPriceChange(value);
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
|
-
const price2 =
|
|
90
|
+
const price2 = Number(value);
|
|
91
91
|
if (!isNaN(price2)) {
|
|
92
|
-
this.onPriceChange(price2);
|
|
92
|
+
this.onPriceChange(Math.round(price2 * 100) / 100);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -24,10 +24,10 @@ export default OakComponent({
|
|
|
24
24
|
},
|
|
25
25
|
isList: false,
|
|
26
26
|
properties: {
|
|
27
|
-
accountId: '',
|
|
28
|
-
accountAvailMax: 0,
|
|
27
|
+
accountId: '', // 是否可以使用帐户中的余额抵扣
|
|
28
|
+
accountAvailMax: 0, // 本次交易可以使用的帐户中的Avail max值,调用者自己保证此数值的一致性,不要扣成负数
|
|
29
29
|
onSetPays: (pays) => undefined,
|
|
30
|
-
accountTips: '',
|
|
30
|
+
accountTips: '', // 使用余额支付的提示说明
|
|
31
31
|
autoStartPay: false,
|
|
32
32
|
},
|
|
33
33
|
formData({ data }) {
|
package/es/triggers/order.js
CHANGED
|
@@ -10,6 +10,17 @@ const triggers = [
|
|
|
10
10
|
asRoot: true,
|
|
11
11
|
fn: async ({ ids }, context, option) => {
|
|
12
12
|
for (const id of ids) {
|
|
13
|
+
const [order] = await context.select('order', {
|
|
14
|
+
data: {
|
|
15
|
+
id: 1,
|
|
16
|
+
price: 1,
|
|
17
|
+
paid: 1,
|
|
18
|
+
}, filter: {
|
|
19
|
+
id,
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
forUpdate: true,
|
|
23
|
+
});
|
|
13
24
|
const settlements = await context.select('settlement', {
|
|
14
25
|
data: {
|
|
15
26
|
id: 1,
|
|
@@ -26,8 +37,10 @@ const triggers = [
|
|
|
26
37
|
forUpdate: true,
|
|
27
38
|
});
|
|
28
39
|
assert(settlements && settlements.length > 0);
|
|
40
|
+
let amount = 0;
|
|
29
41
|
for (const settlement of settlements) {
|
|
30
42
|
const { id: settlementId, price, accountId } = settlement;
|
|
43
|
+
amount += price;
|
|
31
44
|
//创建对应的accountOper
|
|
32
45
|
await context.operate('settlement', {
|
|
33
46
|
id: await generateNewIdAsync(),
|
|
@@ -50,6 +63,7 @@ const triggers = [
|
|
|
50
63
|
}
|
|
51
64
|
}, {});
|
|
52
65
|
}
|
|
66
|
+
assert(order.price === amount);
|
|
53
67
|
}
|
|
54
68
|
return;
|
|
55
69
|
}
|
package/es/types/Exception.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
|
|
|
11
11
|
name: string;
|
|
12
12
|
message: string;
|
|
13
13
|
_module: string | undefined;
|
|
14
|
+
params: Record<string, any> | undefined;
|
|
14
15
|
opRecords: OpRecord<ED>[];
|
|
15
16
|
tag1: string | undefined;
|
|
16
17
|
tag2: boolean | undefined;
|
|
@@ -156,16 +156,17 @@ export default class WechatMpShipDebug {
|
|
|
156
156
|
sender: {
|
|
157
157
|
name: from.name,
|
|
158
158
|
mobile: from.phone,
|
|
159
|
-
country: from
|
|
160
|
-
province: from.area.parent.name,
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
// country: from!.area!.parent!.parent!.name!, //国家
|
|
160
|
+
province: from.area.parent.parent.name, //省份
|
|
161
|
+
city: from.area.parent.name, //市
|
|
162
|
+
area: from.area.name, // 区
|
|
163
|
+
address: from.detail, //详细地址
|
|
163
164
|
},
|
|
164
165
|
receiver: {
|
|
165
166
|
name: to.name,
|
|
166
167
|
mobile: to.phone,
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
province: to.area.parent.parent.name,
|
|
169
|
+
city: to.area.parent.name,
|
|
169
170
|
area: to.area.name,
|
|
170
171
|
address: to.detail,
|
|
171
172
|
},
|
package/lib/aspects/withdraw.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWithdrawCreateData =
|
|
3
|
+
exports.getWithdrawCreateData = getWithdrawCreateData;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const types_1 = require("oak-domain/lib/types");
|
|
6
6
|
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
|
@@ -211,4 +211,3 @@ async function getWithdrawCreateData(params, context) {
|
|
|
211
211
|
data.loss = totalLoss;
|
|
212
212
|
return data;
|
|
213
213
|
}
|
|
214
|
-
exports.getWithdrawCreateData = getWithdrawCreateData;
|
package/lib/triggers/order.js
CHANGED
|
@@ -13,6 +13,17 @@ const triggers = [
|
|
|
13
13
|
asRoot: true,
|
|
14
14
|
fn: async ({ ids }, context, option) => {
|
|
15
15
|
for (const id of ids) {
|
|
16
|
+
const [order] = await context.select('order', {
|
|
17
|
+
data: {
|
|
18
|
+
id: 1,
|
|
19
|
+
price: 1,
|
|
20
|
+
paid: 1,
|
|
21
|
+
}, filter: {
|
|
22
|
+
id,
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
forUpdate: true,
|
|
26
|
+
});
|
|
16
27
|
const settlements = await context.select('settlement', {
|
|
17
28
|
data: {
|
|
18
29
|
id: 1,
|
|
@@ -29,8 +40,10 @@ const triggers = [
|
|
|
29
40
|
forUpdate: true,
|
|
30
41
|
});
|
|
31
42
|
(0, assert_1.default)(settlements && settlements.length > 0);
|
|
43
|
+
let amount = 0;
|
|
32
44
|
for (const settlement of settlements) {
|
|
33
45
|
const { id: settlementId, price, accountId } = settlement;
|
|
46
|
+
amount += price;
|
|
34
47
|
//创建对应的accountOper
|
|
35
48
|
await context.operate('settlement', {
|
|
36
49
|
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
@@ -53,6 +66,7 @@ const triggers = [
|
|
|
53
66
|
}
|
|
54
67
|
}, {});
|
|
55
68
|
}
|
|
69
|
+
(0, assert_1.default)(order.price === amount);
|
|
56
70
|
}
|
|
57
71
|
return;
|
|
58
72
|
}
|
package/lib/types/Exception.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
|
|
|
11
11
|
name: string;
|
|
12
12
|
message: string;
|
|
13
13
|
_module: string | undefined;
|
|
14
|
+
params: Record<string, any> | undefined;
|
|
14
15
|
opRecords: OpRecord<ED>[];
|
|
15
16
|
tag1: string | undefined;
|
|
16
17
|
tag2: boolean | undefined;
|
package/lib/types/Exception.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.StartPayFailure = exports.PayUnRefundable = exports.RefundExceedMax = exports.ExternalPayUtilException = exports.UploadShipException = void 0;
|
|
4
|
+
exports.makeException = makeException;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const types_1 = require("oak-domain/lib/types");
|
|
6
7
|
const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions"));
|
|
@@ -68,4 +69,3 @@ function makeException(msg) {
|
|
|
68
69
|
}
|
|
69
70
|
return exception;
|
|
70
71
|
}
|
|
71
|
-
exports.makeException = makeException;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerGetPayStateResult =
|
|
3
|
+
exports.registerGetPayStateResult = registerGetPayStateResult;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
6
|
let _PAY_STATE = '';
|
|
7
7
|
function registerGetPayStateResult(payState) {
|
|
8
8
|
_PAY_STATE = payState;
|
|
9
9
|
}
|
|
10
|
-
exports.registerGetPayStateResult = registerGetPayStateResult;
|
|
11
10
|
class WechatPay {
|
|
12
11
|
wpProduct;
|
|
13
12
|
constructor(wpProduct) {
|
|
@@ -159,16 +159,17 @@ class WechatMpShipDebug {
|
|
|
159
159
|
sender: {
|
|
160
160
|
name: from.name,
|
|
161
161
|
mobile: from.phone,
|
|
162
|
-
country: from
|
|
163
|
-
province: from.area.parent.name,
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
// country: from!.area!.parent!.parent!.name!, //国家
|
|
163
|
+
province: from.area.parent.parent.name, //省份
|
|
164
|
+
city: from.area.parent.name, //市
|
|
165
|
+
area: from.area.name, // 区
|
|
166
|
+
address: from.detail, //详细地址
|
|
166
167
|
},
|
|
167
168
|
receiver: {
|
|
168
169
|
name: to.name,
|
|
169
170
|
mobile: to.phone,
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
province: to.area.parent.parent.name,
|
|
172
|
+
city: to.area.parent.name,
|
|
172
173
|
area: to.area.name,
|
|
173
174
|
address: to.detail,
|
|
174
175
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"classnames": "^2.3.1",
|
|
32
32
|
"dayjs": "^1.11.5",
|
|
33
|
-
"oak-domain": "^5.1.
|
|
33
|
+
"oak-domain": "^5.1.24",
|
|
34
34
|
"oak-external-sdk": "^2.3.6",
|
|
35
|
-
"oak-frontend-base": "^5.3.
|
|
36
|
-
"oak-general-business": "~5.7.
|
|
35
|
+
"oak-frontend-base": "^5.3.31",
|
|
36
|
+
"oak-general-business": "~5.7.4",
|
|
37
37
|
"react-markdown": "^9.0.3",
|
|
38
38
|
"wechat-pay-nodejs": "^0.2.3"
|
|
39
39
|
},
|