oak-pay-business 2.2.10 → 2.3.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/aspects/withdraw.d.ts +8 -8
- package/es/components/AbstractComponents.d.ts +3 -8
- package/es/components/account/detail/index.js +8 -5
- package/es/components/pay/detail/index.js +8 -5
- package/es/configuration/attrUpdateMatrix.js +8 -0
- package/es/context/BackendRuntimeContext.d.ts +1 -1
- package/es/entities/Order.d.ts +1 -1
- package/es/oak-app-domain/Application/Schema.d.ts +2 -2
- package/es/oak-app-domain/Application/Storage.js +0 -1
- package/es/oak-app-domain/Article/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/ArticleMenu/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/ExtraFile/Schema.d.ts +2 -2
- package/es/oak-app-domain/ExtraFile/Storage.js +1 -1
- package/es/oak-app-domain/Order/Action.d.ts +1 -1
- package/es/oak-app-domain/Order/Storage.js +1 -1
- package/es/oak-app-domain/Platform/Schema.d.ts +2 -2
- package/es/oak-app-domain/Platform/Storage.js +0 -1
- package/es/oak-app-domain/SmsTemplate/Schema.d.ts +6 -5
- package/es/oak-app-domain/SmsTemplate/Storage.js +2 -4
- package/es/oak-app-domain/SmsTemplate/Style.d.ts +3 -0
- package/es/oak-app-domain/SmsTemplate/Style.js +10 -0
- package/es/oak-app-domain/SmsTemplate/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/StyleDict.js +2 -0
- package/es/oak-app-domain/System/Schema.d.ts +4 -4
- package/es/oak-app-domain/System/Storage.js +0 -2
- package/es/oak-app-domain/WechatTemplate/locales/zh_CN.json +1 -1
- package/es/triggers/pay.js +50 -47
- package/es/triggers/withdraw.d.ts +1 -1
- package/es/utils/application.d.ts +1 -1
- package/es/utils/pay.js +4 -1
- package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
- package/es/watchers/pay.js +1 -1
- package/lib/aspects/withdraw.d.ts +12 -12
- package/lib/components/pay/detail/index.js +8 -5
- package/lib/configuration/attrUpdateMatrix.js +8 -0
- package/lib/entities/Order.d.ts +1 -1
- package/lib/oak-app-domain/Application/Schema.d.ts +2 -2
- package/lib/oak-app-domain/Application/Storage.js +0 -1
- package/lib/oak-app-domain/Article/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/ArticleMenu/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/ExtraFile/Schema.d.ts +2 -2
- package/lib/oak-app-domain/ExtraFile/Storage.js +1 -1
- package/lib/oak-app-domain/Order/Action.d.ts +1 -1
- package/lib/oak-app-domain/Order/Storage.js +1 -1
- package/lib/oak-app-domain/Platform/Schema.d.ts +2 -2
- package/lib/oak-app-domain/Platform/Storage.js +0 -1
- package/lib/oak-app-domain/SmsTemplate/Schema.d.ts +6 -5
- package/lib/oak-app-domain/SmsTemplate/Storage.js +2 -4
- package/lib/oak-app-domain/SmsTemplate/Style.d.ts +3 -0
- package/lib/oak-app-domain/SmsTemplate/Style.js +13 -0
- package/lib/oak-app-domain/SmsTemplate/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/StyleDict.js +52 -50
- package/lib/oak-app-domain/System/Schema.d.ts +4 -4
- package/lib/oak-app-domain/System/Storage.js +0 -2
- package/lib/oak-app-domain/WechatTemplate/locales/zh_CN.json +1 -1
- package/lib/triggers/pay.js +50 -47
- package/lib/utils/pay.js +4 -1
- package/lib/utils/payClazz/WechatPay/index.d.ts +1 -1
- package/lib/watchers/pay.js +1 -1
- package/package.json +4 -4
- package/src/entities/Order.ts +1 -1
package/lib/triggers/pay.js
CHANGED
|
@@ -270,8 +270,7 @@ const triggers = [
|
|
|
270
270
|
priority: 99,
|
|
271
271
|
fn: async ({ operation }, context, option) => {
|
|
272
272
|
const { data, filter, action, id } = operation;
|
|
273
|
-
|
|
274
|
-
const [pay] = await context.select('pay', {
|
|
273
|
+
const pays = await context.select('pay', {
|
|
275
274
|
data: {
|
|
276
275
|
id: 1,
|
|
277
276
|
orderId: 1,
|
|
@@ -291,11 +290,14 @@ const triggers = [
|
|
|
291
290
|
},
|
|
292
291
|
filter,
|
|
293
292
|
}, { dontCollect: true });
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
for (const pay of pays) {
|
|
294
|
+
const { orderId, depositId, iState, deposit, application } = pay;
|
|
295
|
+
context.saveOperationToEvent(id, `${constants_1.DATA_SUBSCRIBER_KEYS.payStateChanged}-${filter.id}`);
|
|
296
|
+
if (orderId) {
|
|
297
|
+
await changeOrderStateByPay({ id: orderId }, context, option);
|
|
298
|
+
}
|
|
298
299
|
}
|
|
300
|
+
return pays.length;
|
|
299
301
|
},
|
|
300
302
|
},
|
|
301
303
|
{
|
|
@@ -332,26 +334,26 @@ const triggers = [
|
|
|
332
334
|
data: pay_1.fullPayProjection,
|
|
333
335
|
filter,
|
|
334
336
|
}, {});
|
|
335
|
-
(0, assert_1.default)(pays.length === 1);
|
|
336
|
-
const [pay] = pays;
|
|
337
|
-
const { applicationId, entity, entityId, iState, depositId } = pay;
|
|
338
|
-
(0, assert_1.default)(iState === 'unpaid' || iState === 'paying');
|
|
339
337
|
let cnt = 0;
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
338
|
+
for (const pay of pays) {
|
|
339
|
+
const { applicationId, entity, entityId, iState, depositId } = pay;
|
|
340
|
+
(0, assert_1.default)(iState === 'unpaid' || iState === 'paying');
|
|
341
|
+
if (iState === 'paying') {
|
|
342
|
+
const payClazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context);
|
|
343
|
+
await payClazz.close(pay);
|
|
344
|
+
cnt++;
|
|
345
|
+
}
|
|
346
|
+
if (depositId) {
|
|
347
|
+
await context.operate('deposit', {
|
|
348
|
+
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
349
|
+
action: 'fail',
|
|
350
|
+
data: {},
|
|
351
|
+
filter: {
|
|
352
|
+
id: depositId,
|
|
353
|
+
},
|
|
354
|
+
}, {});
|
|
355
|
+
cnt++;
|
|
356
|
+
}
|
|
355
357
|
}
|
|
356
358
|
return cnt;
|
|
357
359
|
},
|
|
@@ -591,9 +593,7 @@ const triggers = [
|
|
|
591
593
|
when: 'after',
|
|
592
594
|
fn: async ({ operation }, context, option) => {
|
|
593
595
|
const { filter } = operation;
|
|
594
|
-
const
|
|
595
|
-
(0, assert_1.default)(ids.length === 1);
|
|
596
|
-
const [pay] = await context.select('pay', {
|
|
596
|
+
const pays = await context.select('pay', {
|
|
597
597
|
data: {
|
|
598
598
|
id: 1,
|
|
599
599
|
price: 1,
|
|
@@ -601,28 +601,31 @@ const triggers = [
|
|
|
601
601
|
entity: 1,
|
|
602
602
|
entityId: 1,
|
|
603
603
|
},
|
|
604
|
-
filter
|
|
605
|
-
id: ids[0],
|
|
606
|
-
},
|
|
604
|
+
filter,
|
|
607
605
|
}, {});
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
data: {
|
|
606
|
+
let cnt = 0;
|
|
607
|
+
for (const pay of pays) {
|
|
608
|
+
if (pay.entity === 'account') {
|
|
609
|
+
await context.operate('accountOper', {
|
|
613
610
|
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
611
|
+
action: 'create',
|
|
612
|
+
data: {
|
|
613
|
+
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
614
|
+
accountId: pay.entityId,
|
|
615
|
+
entity: 'pay',
|
|
616
|
+
entityId: pay.id,
|
|
617
|
+
type: 'consumeBack',
|
|
618
|
+
totalPlus: pay.paid,
|
|
619
|
+
availPlus: pay.paid,
|
|
620
|
+
},
|
|
621
|
+
}, {});
|
|
622
|
+
cnt++;
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
cnt += await tryCompleteAccountPay(pay.id, context);
|
|
626
|
+
}
|
|
625
627
|
}
|
|
628
|
+
return cnt;
|
|
626
629
|
}
|
|
627
630
|
},
|
|
628
631
|
/* 影响的地方有点多,先不做了
|
package/lib/utils/pay.js
CHANGED
|
@@ -161,7 +161,10 @@ async function refreshPayState(pay, context) {
|
|
|
161
161
|
filter: {
|
|
162
162
|
id: pay.id,
|
|
163
163
|
}
|
|
164
|
-
}, {
|
|
164
|
+
}, {
|
|
165
|
+
blockTrigger: true,
|
|
166
|
+
forUpdate: true,
|
|
167
|
+
});
|
|
165
168
|
pay2 = pays[0];
|
|
166
169
|
}
|
|
167
170
|
const { entity, entityId, timeoutAt, price } = pay2;
|
package/lib/watchers/pay.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "2.2
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"classnames": "^2.3.1",
|
|
31
31
|
"dayjs": "^1.11.5",
|
|
32
|
-
"oak-domain": "~5.0.
|
|
33
|
-
"oak-frontend-base": "~5.
|
|
34
|
-
"oak-general-business": "~5.2.
|
|
32
|
+
"oak-domain": "~5.0.19",
|
|
33
|
+
"oak-frontend-base": "~5.3.4",
|
|
34
|
+
"oak-general-business": "~5.2.11",
|
|
35
35
|
"wechat-pay-nodejs": "^0.2.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
package/src/entities/Order.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface Schema extends EntityShape {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export type IAction = 'startPaying' | 'payAll' | 'payPartially' | 'payNone' | 'timeout' | 'cancel' | 'startRefunding' | 'refundAll' | 'refundPartially' | 'refundNone';
|
|
31
|
-
export type IState = '
|
|
31
|
+
export type IState = 'unpaid' | 'timeout' | 'cancelled' | 'paying' | 'partiallyPaid' | 'paid' | 'refunding' | 'partiallyRefunded' | 'refunded';
|
|
32
32
|
|
|
33
33
|
export const IActionDef: ActionDef<IAction, IState> = {
|
|
34
34
|
stm: {
|