oak-pay-business 1.0.0 → 1.0.1
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/package.json +5 -1
- package/src/aspects/AspectDict.ts +0 -6
- package/src/aspects/index.ts +0 -12
- package/src/aspects/sample.ts +0 -6
- package/src/checkers/account.ts +0 -8
- package/src/checkers/accountOper.ts +0 -79
- package/src/checkers/index.ts +0 -14
- package/src/checkers/order.ts +0 -23
- package/src/checkers/pay.ts +0 -120
- package/src/components/AbstractComponents.ts +0 -45
- package/src/components/account/deposit/index.json +0 -1
- package/src/components/account/deposit/index.ts +0 -32
- package/src/components/account/deposit/locales/zh-CN.json +0 -7
- package/src/components/account/deposit/web.pc.module.less +0 -0
- package/src/components/account/deposit/web.pc.tsx +0 -63
- package/src/components/account/deposit/web.tsx +0 -71
- package/src/components/account/detail/index.json +0 -1
- package/src/components/account/detail/index.ts +0 -94
- package/src/components/account/detail/locales/zh-CN.json +0 -16
- package/src/components/account/detail/web.pc.module.less +0 -69
- package/src/components/account/detail/web.pc.tsx +0 -160
- package/src/components/account/detail/web.tsx +0 -15
- package/src/components/accountOper/list/index.json +0 -1
- package/src/components/accountOper/list/index.ts +0 -16
- package/src/components/accountOper/list/locales/zh-CN.json +0 -1
- package/src/components/accountOper/list/web.pc.tsx +0 -14
- package/src/components/accountOper/list/web.tsx +0 -14
- package/src/components/accountOper/pure/List.pc.tsx +0 -38
- package/src/components/order/pay/index.json +0 -1
- package/src/components/order/pay/index.ts +0 -130
- package/src/components/order/pay/info.module.less +0 -25
- package/src/components/order/pay/info.tsx +0 -14
- package/src/components/order/pay/locales/zh-CN.json +0 -8
- package/src/components/order/pay/web.mobile.module.less +0 -36
- package/src/components/order/pay/web.pc.module.less +0 -36
- package/src/components/order/pay/web.pc.tsx +0 -166
- package/src/components/order/pay/web.tsx +0 -167
- package/src/components/pay/channelPicker/index.json +0 -1
- package/src/components/pay/channelPicker/index.ts +0 -34
- package/src/components/pay/channelPicker/index.xml +0 -0
- package/src/components/pay/channelPicker/locales/zh-CN.json +0 -5
- package/src/components/pay/channelPicker/web.mobile.module.less +0 -8
- package/src/components/pay/channelPicker/web.pc.module.less +0 -7
- package/src/components/pay/channelPicker/web.pc.tsx +0 -91
- package/src/components/pay/channelPicker/web.tsx +0 -98
- package/src/components/pay/detail/index.json +0 -1
- package/src/components/pay/detail/index.ts +0 -51
- package/src/components/pay/detail/locales/zh-CN.json +0 -26
- package/src/components/pay/detail/web.mobile.module.less +0 -35
- package/src/components/pay/detail/web.pc.module.less +0 -35
- package/src/components/pay/detail/web.pc.tsx +0 -258
- package/src/components/pay/detail/web.tsx +0 -264
- package/src/components/pay/list/index.json +0 -1
- package/src/components/pay/list/index.ts +0 -75
- package/src/components/pay/list/locales/zh-CN.json +0 -23
- package/src/components/pay/list/web.pc.module.less +0 -11
- package/src/components/pay/list/web.pc.tsx +0 -162
- package/src/components/payConfig/system/index.json +0 -1
- package/src/components/payConfig/system/index.ts +0 -24
- package/src/components/payConfig/system/locales/zh-CN.json +0 -5
- package/src/components/payConfig/system/web.pc.module.less +0 -17
- package/src/components/payConfig/system/web.pc.tsx +0 -158
- package/src/components/payConfig/upsert/account/index.tsx +0 -12
- package/src/components/payConfig/upsert/account/locales/zh-CN.json +0 -3
- package/src/components/payConfig/upsert/index.tsx +0 -153
- package/src/components/payConfig/upsert/locales/zh-CN.json +0 -4
- package/src/components/payConfig/upsert/offline/index.tsx +0 -127
- package/src/components/payConfig/upsert/offline/locales/zh-CN.json +0 -8
- package/src/components/payConfig/upsert/offline/web.pc.module.less +0 -5
- package/src/components/payConfig/upsert/web.pc.module.less +0 -11
- package/src/components/payConfig/upsert/wechatPay/index.tsx +0 -49
- package/src/components/payConfig/upsert/wechatPay/locales/zh-CN.json +0 -10
- package/src/config/constants.ts +0 -1
- package/src/config/message.ts +0 -1
- package/src/config/styles/mp/index.less +0 -2
- package/src/config/styles/mp/mixins.less +0 -7
- package/src/config/styles/web/index.less +0 -1
- package/src/configuration/access.dev.ts +0 -10
- package/src/configuration/access.prod.ts +0 -11
- package/src/configuration/access.ts +0 -3
- package/src/configuration/attrUpdateMatrix.ts +0 -33
- package/src/configuration/cache.ts +0 -4
- package/src/configuration/dependency.ts +0 -3
- package/src/configuration/index.ts +0 -19
- package/src/configuration/relation.ts +0 -19
- package/src/configuration/render.ts +0 -7
- package/src/context/BackendRuntimeContext.ts +0 -13
- package/src/context/DependentContext.ts +0 -1
- package/src/context/FrontendRuntimeContext.ts +0 -22
- package/src/context/RuntimeContext.ts +0 -5
- package/src/data/i18n.ts +0 -291
- package/src/data/index.ts +0 -5
- package/src/entities/Account.ts +0 -75
- package/src/entities/AccountOper.ts +0 -64
- package/src/entities/Application.ts +0 -54
- package/src/entities/Order.ts +0 -128
- package/src/entities/Pay.ts +0 -151
- package/src/entities/System.ts +0 -28
- package/src/entities/User.ts +0 -167
- package/src/entities/Withdraw.ts +0 -72
- package/src/entities/WithdrawChannel.ts +0 -43
- package/src/features/Pay.ts +0 -26
- package/src/features/index.ts +0 -48
- package/src/hooks/useFeatures.ts +0 -9
- package/src/index.ts +0 -12
- package/src/locales/common/zh_CN.json +0 -53
- package/src/locales/payChannel/zh-CN.json +0 -18
- package/src/page.mp.ts +0 -1
- package/src/page.native.ts +0 -1
- package/src/page.ts +0 -2
- package/src/page.web.ts +0 -1
- package/src/ports/index.ts +0 -15
- package/src/routines/start.ts +0 -28
- package/src/timers/index.ts +0 -30
- package/src/triggers/accountOper.ts +0 -46
- package/src/triggers/index.ts +0 -14
- package/src/triggers/order.ts +0 -9
- package/src/triggers/pay.ts +0 -314
- package/src/triggers/userSystem.ts +0 -33
- package/src/types/DependentExceptions.ts +0 -13
- package/src/types/Exception.ts +0 -19
- package/src/types/PayClazz.ts +0 -22
- package/src/types/PayConfig.ts +0 -37
- package/src/types/RuntimeCxt.ts +0 -12
- package/src/utils/pay.ts +0 -16
- package/src/utils/payClazz/Account.ts +0 -44
- package/src/utils/payClazz/Offline.ts +0 -26
- package/src/utils/payClazz/WechatPay.frontend.ts +0 -80
- package/src/utils/payClazz/WechatPay.ts +0 -27
- package/src/utils/payClazz/index.ts +0 -96
- package/src/watchers/index.ts +0 -16
- package/src/watchers/order.ts +0 -22
- package/src/watchers/pay.ts +0 -86
- package/tsconfig.es.json +0 -94
- package/tsconfig.json +0 -44
- package/tsconfig.lib.json +0 -95
- package/tsconfig.paths.json +0 -16
- package/typings/index.d.ts +0 -5
- package/typings/polyfill.d.ts +0 -13
- package/typings/react-app-env.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
|
+
"files": [
|
|
6
|
+
"lib/**/*",
|
|
7
|
+
"es/**/*"
|
|
8
|
+
],
|
|
5
9
|
"scripts": {
|
|
6
10
|
"make:locale": "oak-cli make:locale -a",
|
|
7
11
|
"make:domain": "cross-env COMPLING_AS_LIB=yes oak-cli make:domain",
|
package/src/aspects/index.ts
DELETED
package/src/aspects/sample.ts
DELETED
package/src/checkers/account.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import assert from 'assert';
|
|
2
|
-
import { Checker } from 'oak-domain/lib/types/Auth';
|
|
3
|
-
import { EntityDict } from '../oak-app-domain';
|
|
4
|
-
import { RuntimeCxt } from '../types/RuntimeCxt';
|
|
5
|
-
import { OakInputIllegalException } from 'oak-domain/lib/types';
|
|
6
|
-
|
|
7
|
-
const checkers: Checker<EntityDict, 'accountOper', RuntimeCxt>[] = [
|
|
8
|
-
{
|
|
9
|
-
entity: 'accountOper',
|
|
10
|
-
action: 'create',
|
|
11
|
-
type: 'row',
|
|
12
|
-
filter: {
|
|
13
|
-
account: {
|
|
14
|
-
ableState: 'enabled',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
errMsg: 'account.update.accountDisabled',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
entity: 'accountOper',
|
|
21
|
-
action: 'create',
|
|
22
|
-
type: 'data',
|
|
23
|
-
checker(data, context) {
|
|
24
|
-
assert(!(data instanceof Array));
|
|
25
|
-
const { type, totalPlus, availPlus } = data;
|
|
26
|
-
if (typeof totalPlus !== 'number') {
|
|
27
|
-
throw new OakInputIllegalException('accountOper', ['totalPlus'], 'accountOper中的totalPlus不是数字');
|
|
28
|
-
}
|
|
29
|
-
if (typeof availPlus !== 'number') {
|
|
30
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper中的availPlus不是数字');
|
|
31
|
-
}
|
|
32
|
-
switch (type) {
|
|
33
|
-
case 'consume': {
|
|
34
|
-
if (totalPlus >= 0 || availPlus > 0 || totalPlus > availPlus) {
|
|
35
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为consume时,其totalPlus/availPlus必须为0或负数,且totalPlus的绝对值要更大');
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
case 'deposit': {
|
|
40
|
-
if (totalPlus < 0 || availPlus < 0 || totalPlus !== availPlus) {
|
|
41
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为deposit时,其totalPlus/availPlus必须为正数且相等');
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
case 'loan': {
|
|
46
|
-
if (totalPlus !== 0 || availPlus >= 0) {
|
|
47
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为loan时,其totalPlus必须为0,且availPlus必须为负数');
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
case 'repay': {
|
|
52
|
-
if (totalPlus !== 0 || availPlus <= 0) {
|
|
53
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为repay时,其totalPlus必须为0,且availPlus必须为正数');
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case 'withdraw': {
|
|
58
|
-
if (totalPlus >= 0 || availPlus >= 0 || totalPlus !== availPlus) {
|
|
59
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为withdraw时,其totalPlus和availPlus必须为不相等的负数');
|
|
60
|
-
}
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
case 'withdrawBack': {
|
|
64
|
-
if (totalPlus <= 0 || availPlus <= 0 || totalPlus !== availPlus) {
|
|
65
|
-
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为withdraw时,其totalPlus和availPlus必须为不相等的正数');
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
default: {
|
|
70
|
-
assert(false);
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
];
|
|
78
|
-
|
|
79
|
-
export default checkers;
|
package/src/checkers/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { EntityDict } from '@oak-app-domain';
|
|
2
|
-
import { Checker } from 'oak-domain/lib/types';
|
|
3
|
-
import { RuntimeCxt } from '../types/RuntimeCxt';
|
|
4
|
-
import aoCheckers from './accountOper';
|
|
5
|
-
import payCheckers from './pay';
|
|
6
|
-
import orderCheckers from './order';
|
|
7
|
-
|
|
8
|
-
const checkers = [
|
|
9
|
-
...aoCheckers,
|
|
10
|
-
...payCheckers,
|
|
11
|
-
...orderCheckers,
|
|
12
|
-
] as Checker<EntityDict, keyof EntityDict, RuntimeCxt>[];
|
|
13
|
-
|
|
14
|
-
export default checkers;
|
package/src/checkers/order.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Checker } from 'oak-domain/lib/types/Auth';
|
|
2
|
-
import { EntityDict } from '../oak-app-domain';
|
|
3
|
-
import { RuntimeCxt } from '../types/RuntimeCxt';
|
|
4
|
-
|
|
5
|
-
const checkers: Checker<EntityDict, 'order', RuntimeCxt>[] = [
|
|
6
|
-
{
|
|
7
|
-
type: 'logical',
|
|
8
|
-
entity: 'order',
|
|
9
|
-
action: 'create',
|
|
10
|
-
checker: (operation, context) => {
|
|
11
|
-
const { data } = operation as EntityDict['order']['CreateSingle'];
|
|
12
|
-
if (!data.creatorId) {
|
|
13
|
-
data.creatorId = context.getCurrentUserId()!;
|
|
14
|
-
}
|
|
15
|
-
data.paid = 0;
|
|
16
|
-
data.refunded = 0;
|
|
17
|
-
|
|
18
|
-
return 1;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export default checkers;
|
package/src/checkers/pay.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Checker } from 'oak-domain/lib/types/Auth';
|
|
2
|
-
import { EntityDict } from '@project/oak-app-domain';
|
|
3
|
-
import { RuntimeCxt } from '../types/RuntimeCxt';
|
|
4
|
-
import { OakInputIllegalException } from 'oak-domain/lib/types';
|
|
5
|
-
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
|
6
|
-
import assert from 'assert';
|
|
7
|
-
import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '@project/types/PayConfig';
|
|
8
|
-
|
|
9
|
-
const checkers: Checker<EntityDict, 'pay', RuntimeCxt>[] = [
|
|
10
|
-
{
|
|
11
|
-
entity: 'pay',
|
|
12
|
-
type: 'logical',
|
|
13
|
-
action: 'create',
|
|
14
|
-
checker(operation, context) {
|
|
15
|
-
const { data } = operation as EntityDict['pay']['CreateSingle'];
|
|
16
|
-
data.refunded = 0;
|
|
17
|
-
data.paid = 0;
|
|
18
|
-
data.applicationId = context.getApplicationId()!;
|
|
19
|
-
data.creatorId = context.getCurrentUserId()!;
|
|
20
|
-
if (!data.meta) {
|
|
21
|
-
data.meta = {};
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
entity: 'pay',
|
|
27
|
-
type: 'data',
|
|
28
|
-
action: 'create',
|
|
29
|
-
checker(data) {
|
|
30
|
-
const { channel, price, orderId, accountId } = data as EntityDict['pay']['CreateSingle']['data'];
|
|
31
|
-
if (price! <= 0) {
|
|
32
|
-
throw new OakInputIllegalException('pay', ['price'], '支付金额必须大于0');
|
|
33
|
-
}
|
|
34
|
-
if (!orderId) {
|
|
35
|
-
// 充值类订单
|
|
36
|
-
if (!accountId) {
|
|
37
|
-
throw new OakInputIllegalException('pay', ['accountId'], '充值类支付必须指定accountId');
|
|
38
|
-
}
|
|
39
|
-
else if (channel === PAY_CHANNEL_ACCOUNT_NAME) {
|
|
40
|
-
throw new OakInputIllegalException('pay', ['channel'], '充值类支付不能使用帐户支付');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
if (channel === PAY_CHANNEL_ACCOUNT_NAME) {
|
|
45
|
-
if (!accountId) {
|
|
46
|
-
throw new OakInputIllegalException('pay', ['accountId'], '使用account支付必须指向accountId');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
entity: 'pay',
|
|
54
|
-
type: 'logicalData',
|
|
55
|
-
action: 'create',
|
|
56
|
-
checker(operation, context) {
|
|
57
|
-
const { data } = operation as EntityDict['pay']['CreateSingle'];
|
|
58
|
-
const { orderId, price } = data;
|
|
59
|
-
|
|
60
|
-
if (orderId) {
|
|
61
|
-
// 所有已经支付和正在支付的pay之和不能超过订单总和
|
|
62
|
-
const order = context.select('order', {
|
|
63
|
-
data: {
|
|
64
|
-
id: 1,
|
|
65
|
-
price: 1,
|
|
66
|
-
pay$order: {
|
|
67
|
-
$entity: 'pay',
|
|
68
|
-
data: {
|
|
69
|
-
id: 1,
|
|
70
|
-
price: 1,
|
|
71
|
-
},
|
|
72
|
-
filter: {
|
|
73
|
-
iState: {
|
|
74
|
-
$in: ['paying', 'paid'],
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
filter: {
|
|
80
|
-
id: orderId,
|
|
81
|
-
}
|
|
82
|
-
}, {});
|
|
83
|
-
|
|
84
|
-
const checkPays = (order: Partial<EntityDict['order']['Schema']>) => {
|
|
85
|
-
const { price: orderPrice, pay$order: pays } = order;
|
|
86
|
-
let pricePaying = 0;
|
|
87
|
-
pays!.forEach(
|
|
88
|
-
(pay) => pricePaying += pay.price!
|
|
89
|
-
);
|
|
90
|
-
if (pricePaying + price! > orderPrice!) {
|
|
91
|
-
throw new OakInputIllegalException('pay', ['price'], 'pay.create.priceOverflow');
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
if (order instanceof Promise) {
|
|
95
|
-
return order.then(
|
|
96
|
-
([o]) => checkPays(o)
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
return checkPays(order[0]);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
entity: 'pay',
|
|
105
|
-
action: 'succeedPaying',
|
|
106
|
-
type: 'row',
|
|
107
|
-
filter(operation, context) {
|
|
108
|
-
const isRoot = context.isRoot();
|
|
109
|
-
if (isRoot) {
|
|
110
|
-
return {};
|
|
111
|
-
}
|
|
112
|
-
// 非root用户只能手动成功offline类型的pay
|
|
113
|
-
return {
|
|
114
|
-
channel: PAY_CHANNEL_OFFLINE_NAME,
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
];
|
|
119
|
-
|
|
120
|
-
export default checkers;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 抽象组件在业务层根据EntityDict的重新声明
|
|
3
|
-
* by Xc 20230807
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { EntityDict } from '@project/oak-app-domain';
|
|
7
|
-
|
|
8
|
-
import { TableProps, PaginationProps } from 'antd';
|
|
9
|
-
import { ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps,
|
|
10
|
-
OakAbsAttrDef, onActionFnDef, ListButtonProps, OakAbsAttrUpsertDef, ColumnMapType } from 'oak-frontend-base';
|
|
11
|
-
import AbsFilterPanel from 'oak-frontend-base/es/components/filterPanel';
|
|
12
|
-
import AbsList from 'oak-frontend-base/es/components/list';
|
|
13
|
-
import AbsListPro from 'oak-frontend-base/es/components/listPro';
|
|
14
|
-
import AbsDetail from 'oak-frontend-base/es/components/detail';
|
|
15
|
-
import AbsUpsert from 'oak-frontend-base/es/components/upsert';
|
|
16
|
-
|
|
17
|
-
const FilterPanel = AbsFilterPanel as <T extends keyof EntityDict>(
|
|
18
|
-
...props: Parameters<typeof AbsFilterPanel<EntityDict, T>>
|
|
19
|
-
) => React.ReactElement;
|
|
20
|
-
|
|
21
|
-
const List = AbsList as <T extends keyof EntityDict>(
|
|
22
|
-
...props: Parameters<typeof AbsList<EntityDict, T>>
|
|
23
|
-
) => React.ReactElement;
|
|
24
|
-
|
|
25
|
-
const ListPro = AbsListPro as <T extends keyof EntityDict>(
|
|
26
|
-
...props: Parameters<typeof AbsListPro<EntityDict, T>>
|
|
27
|
-
) => React.ReactElement;
|
|
28
|
-
|
|
29
|
-
const Detail = AbsDetail as <T extends keyof EntityDict>(
|
|
30
|
-
...props: Parameters<typeof AbsDetail<EntityDict, T>>
|
|
31
|
-
) => React.ReactElement;
|
|
32
|
-
|
|
33
|
-
const Upsert = AbsUpsert as <T extends keyof EntityDict>(
|
|
34
|
-
...props: Parameters<typeof AbsUpsert<EntityDict, T>>
|
|
35
|
-
) => React.ReactElement;
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
FilterPanel,
|
|
39
|
-
List,
|
|
40
|
-
ListPro,
|
|
41
|
-
Detail,
|
|
42
|
-
Upsert,
|
|
43
|
-
|
|
44
|
-
ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef,
|
|
45
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AccountPayConfig, OfflinePayConfig,
|
|
2
|
-
PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../../../types/PayConfig';
|
|
3
|
-
export default OakComponent({
|
|
4
|
-
properties: {
|
|
5
|
-
depositMax: 10000,
|
|
6
|
-
onSetPrice: (price: null | number) => undefined as void,
|
|
7
|
-
onSetChannel: (channel: string) => undefined as void,
|
|
8
|
-
onSetMeta: (meta: any) => undefined as void,
|
|
9
|
-
price: null as number | null,
|
|
10
|
-
channel: '',
|
|
11
|
-
meta: {} as any,
|
|
12
|
-
},
|
|
13
|
-
formData({ data }) {
|
|
14
|
-
const payConfig2 = this.features.pay.getPayConfigs();
|
|
15
|
-
let accountConfig: AccountPayConfig | undefined;
|
|
16
|
-
const payConfig: typeof payConfig2 = [];
|
|
17
|
-
for (const config of payConfig2) {
|
|
18
|
-
if (config.channel === PAY_CHANNEL_ACCOUNT_NAME) {
|
|
19
|
-
accountConfig = config;
|
|
20
|
-
}
|
|
21
|
-
else if (config.channel !== PAY_CHANNEL_OFFLINE_NAME || (<OfflinePayConfig>config).allowUser) {
|
|
22
|
-
payConfig.push(config);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
account: data,
|
|
27
|
-
payConfig,
|
|
28
|
-
// accountConfig,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
features: ['application'],
|
|
32
|
-
})
|
|
File without changes
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Form, InputNumber } from 'antd';
|
|
3
|
-
import { WebComponentProps } from 'oak-frontend-base';
|
|
4
|
-
import { EntityDict } from '@project/oak-app-domain';
|
|
5
|
-
import ChannelPicker from '../../pay/channelPicker';
|
|
6
|
-
import { AccountPayConfig, PayConfig } from '@project/types/PayConfig';
|
|
7
|
-
import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
|
|
11
|
-
depositMax: number;
|
|
12
|
-
payConfig: PayConfig;
|
|
13
|
-
accountConfig?: AccountPayConfig;
|
|
14
|
-
onSetPrice: (price: null | number) => void;
|
|
15
|
-
onSetChannel: (channel: string) => void;
|
|
16
|
-
onSetMeta: (meta: any) => void;
|
|
17
|
-
price: number;
|
|
18
|
-
channel: string;
|
|
19
|
-
meta: any;
|
|
20
|
-
}>) {
|
|
21
|
-
const { depositMax, payConfig, price, channel, meta,
|
|
22
|
-
onSetChannel, onSetMeta, onSetPrice } = props.data;
|
|
23
|
-
const { t } = props.methods;
|
|
24
|
-
|
|
25
|
-
if (payConfig) {
|
|
26
|
-
return (
|
|
27
|
-
<Form
|
|
28
|
-
labelCol={{ span: 4 }}
|
|
29
|
-
wrapperCol={{ span: 14 }}
|
|
30
|
-
layout="horizontal"
|
|
31
|
-
style={{ minWidth: 600 }}
|
|
32
|
-
colon={false}
|
|
33
|
-
>
|
|
34
|
-
<Form.Item label={<span>{t("label.depPrice")}:</span>}>
|
|
35
|
-
<InputNumber
|
|
36
|
-
placeholder={t('placeholder', { max: depositMax })}
|
|
37
|
-
max={depositMax}
|
|
38
|
-
min={1}
|
|
39
|
-
value={typeof price == 'number' ? ToYuan(price) : null}
|
|
40
|
-
addonAfter={t('common::pay.symbol')}
|
|
41
|
-
onChange={(value) => {
|
|
42
|
-
onSetPrice(ToCent(value || 0));
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
45
|
-
</Form.Item>
|
|
46
|
-
{price > 0 ? <Form.Item label={<span style={{ marginTop: 10 }}>
|
|
47
|
-
{t('label.channel')}:
|
|
48
|
-
</span>}>
|
|
49
|
-
<ChannelPicker
|
|
50
|
-
payConfig={payConfig}
|
|
51
|
-
onPick={(channel) => {
|
|
52
|
-
onSetChannel(channel);
|
|
53
|
-
}}
|
|
54
|
-
channel={channel}
|
|
55
|
-
meta={meta}
|
|
56
|
-
onSetMeta={(meta) => onSetMeta(meta)}
|
|
57
|
-
/>
|
|
58
|
-
</Form.Item> : <div style={{ height: 120 }} />}
|
|
59
|
-
</Form>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { WebComponentProps } from 'oak-frontend-base';
|
|
3
|
-
import { EntityDict } from '@project/oak-app-domain';
|
|
4
|
-
import ChannelPicker from '../../pay/channelPicker';
|
|
5
|
-
import { AccountPayConfig, PayConfig } from '@project/types/PayConfig';
|
|
6
|
-
import { Form, Input } from 'antd-mobile';
|
|
7
|
-
import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
|
|
11
|
-
depositMax: number;
|
|
12
|
-
payConfig: PayConfig;
|
|
13
|
-
accountConfig?: AccountPayConfig;
|
|
14
|
-
onSetPrice: (price: null | number) => void;
|
|
15
|
-
onSetChannel: (channel: string) => void;
|
|
16
|
-
onSetMeta: (meta: any) => void;
|
|
17
|
-
price: number;
|
|
18
|
-
channel: string;
|
|
19
|
-
meta: any;
|
|
20
|
-
}>) {
|
|
21
|
-
const { depositMax, payConfig, price, channel, meta,
|
|
22
|
-
onSetChannel, onSetMeta, onSetPrice } = props.data;
|
|
23
|
-
const { t } = props.methods;
|
|
24
|
-
|
|
25
|
-
if (payConfig) {
|
|
26
|
-
return (
|
|
27
|
-
<Form
|
|
28
|
-
layout="horizontal"
|
|
29
|
-
>
|
|
30
|
-
<Form.Item
|
|
31
|
-
label={<span>{t("label.depPrice")}:</span>}
|
|
32
|
-
extra={t('common::pay.symbol')}
|
|
33
|
-
>
|
|
34
|
-
<Input
|
|
35
|
-
type='number'
|
|
36
|
-
placeholder={t('placeholder', { max: depositMax })}
|
|
37
|
-
max={depositMax}
|
|
38
|
-
min={1}
|
|
39
|
-
value={typeof price == 'number' ? `${ToYuan(price)}` : undefined}
|
|
40
|
-
onChange={(value) => {
|
|
41
|
-
if (value === '' || value === null) {
|
|
42
|
-
onSetPrice(null);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const v = parseInt(value);
|
|
46
|
-
if (!isNaN(v)) {
|
|
47
|
-
onSetPrice(ToCent(v));
|
|
48
|
-
}
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
51
|
-
</Form.Item>
|
|
52
|
-
{price > 0 && <Form.Item label={
|
|
53
|
-
<span>
|
|
54
|
-
{t('label.channel')}:
|
|
55
|
-
</span>
|
|
56
|
-
}>
|
|
57
|
-
<ChannelPicker
|
|
58
|
-
payConfig={payConfig}
|
|
59
|
-
onPick={(channel) => {
|
|
60
|
-
onSetChannel(channel);
|
|
61
|
-
}}
|
|
62
|
-
channel={channel}
|
|
63
|
-
meta={meta}
|
|
64
|
-
onSetMeta={(meta) => onSetMeta(meta)}
|
|
65
|
-
/>
|
|
66
|
-
</Form.Item>}
|
|
67
|
-
</Form>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { generateNewIdAsync } from "oak-domain/lib/utils/uuid";
|
|
2
|
-
|
|
3
|
-
export default OakComponent({
|
|
4
|
-
entity: 'account',
|
|
5
|
-
isList: false,
|
|
6
|
-
projection: {
|
|
7
|
-
id: 1,
|
|
8
|
-
total: 1,
|
|
9
|
-
avail: 1,
|
|
10
|
-
systemId: 1,
|
|
11
|
-
entity: 1,
|
|
12
|
-
entityId: 1,
|
|
13
|
-
pay$account: {
|
|
14
|
-
$entity: 'pay',
|
|
15
|
-
data: {
|
|
16
|
-
id: 1,
|
|
17
|
-
},
|
|
18
|
-
filter: {
|
|
19
|
-
iState: {
|
|
20
|
-
$in: ['unpaid', 'paying'],
|
|
21
|
-
},
|
|
22
|
-
orderId: {
|
|
23
|
-
$exists: false,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
indexFrom: 0,
|
|
27
|
-
count: 1,
|
|
28
|
-
},
|
|
29
|
-
accountOper$account: {
|
|
30
|
-
$entity: 'accountOper',
|
|
31
|
-
data: {
|
|
32
|
-
id: 1,
|
|
33
|
-
type: 1,
|
|
34
|
-
totalPlus: 1,
|
|
35
|
-
availPlus: 1,
|
|
36
|
-
},
|
|
37
|
-
sorter: [
|
|
38
|
-
{
|
|
39
|
-
$attr: {
|
|
40
|
-
$$createAt$$: 1,
|
|
41
|
-
},
|
|
42
|
-
$direction: 'desc',
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
indexFrom: 0,
|
|
46
|
-
count: 10,
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
properties: {
|
|
50
|
-
depositMax: 10000,
|
|
51
|
-
onDepositPayId: (payId: string) => undefined as void,
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
formData({ data }) {
|
|
55
|
-
const unfinishedPayId = data?.pay$account?.[0]?.id;
|
|
56
|
-
return {
|
|
57
|
-
account: data,
|
|
58
|
-
unfinishedPayId,
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
actions: ['deposit', 'withdraw'],
|
|
62
|
-
methods: {
|
|
63
|
-
async createDepositPay(price: number, channel: string, meta: object) {
|
|
64
|
-
const payId = await generateNewIdAsync();
|
|
65
|
-
const { oakId } = this.props;
|
|
66
|
-
await this.execute(undefined, undefined, undefined, [
|
|
67
|
-
{
|
|
68
|
-
entity: 'account',
|
|
69
|
-
operation: {
|
|
70
|
-
id: await generateNewIdAsync(),
|
|
71
|
-
action: 'deposit',
|
|
72
|
-
data: {
|
|
73
|
-
pay$account: {
|
|
74
|
-
id: await generateNewIdAsync(),
|
|
75
|
-
action: 'create',
|
|
76
|
-
data: {
|
|
77
|
-
id: payId,
|
|
78
|
-
channel,
|
|
79
|
-
price,
|
|
80
|
-
meta,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
filter: {
|
|
85
|
-
id: oakId!,
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
}
|
|
89
|
-
]);
|
|
90
|
-
|
|
91
|
-
return payId;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
})
|