oak-pay-business 1.0.8 → 1.0.10
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/checkers/accountOper.js +6 -0
- package/es/components/AbstractComponents.d.ts +4 -4
- package/es/components/accountOper/pure/List.pc.js +7 -7
- package/es/components/pay/detail/index.d.ts +1 -0
- package/es/components/pay/detail/index.js +50 -14
- package/es/components/pay/detail/locales/zh-CN.json +5 -1
- package/es/configuration/attrUpdateMatrix.js +2 -0
- package/es/context/BackendRuntimeContext.js +1 -0
- package/es/data/i18n.js +5 -1
- package/es/entities/AccountOper.d.ts +1 -1
- package/es/entities/AccountOper.js +2 -0
- package/es/entities/Refund.d.ts +20 -0
- package/es/entities/Refund.js +48 -0
- package/es/oak-app-domain/AccountOper/Schema.d.ts +1 -1
- package/es/oak-app-domain/AccountOper/Storage.js +1 -1
- package/es/oak-app-domain/AccountOper/Style.js +1 -0
- package/es/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/ActionDefDict.d.ts +3 -0
- package/es/oak-app-domain/ActionDefDict.js +2 -0
- package/es/oak-app-domain/EntityDict.d.ts +2 -0
- package/es/oak-app-domain/Pay/Schema.d.ts +12 -0
- package/es/oak-app-domain/Pay/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/Refund/Action.d.ts +11 -0
- package/es/oak-app-domain/Refund/Action.js +11 -0
- package/es/oak-app-domain/Refund/Schema.d.ts +154 -0
- package/es/oak-app-domain/Refund/Schema.js +1 -0
- package/es/oak-app-domain/Refund/Storage.d.ts +3 -0
- package/es/oak-app-domain/Refund/Storage.js +41 -0
- package/es/oak-app-domain/Refund/Style.d.ts +3 -0
- package/es/oak-app-domain/Refund/Style.js +13 -0
- package/es/oak-app-domain/Refund/locales/zh_CN.json +1 -0
- package/es/oak-app-domain/Storage.js +2 -0
- package/es/oak-app-domain/StyleDict.js +2 -0
- package/es/oak-app-domain/Token/Schema.d.ts +6 -0
- package/es/oak-app-domain/Token/Storage.js +6 -0
- package/es/oak-app-domain/Token/Style.js +1 -1
- package/es/oak-app-domain/Token/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/_SubQuery.d.ts +9 -1
- package/es/triggers/account.d.ts +5 -0
- package/es/triggers/account.js +20 -0
- package/es/triggers/accountOper.js +57 -1
- package/es/triggers/index.js +1 -1
- package/es/triggers/refund.d.ts +5 -0
- package/es/triggers/refund.js +37 -0
- package/es/types/PayClazz.d.ts +3 -0
- package/es/types/PayConfig.d.ts +13 -9
- package/es/types/PayConfig.js +10 -0
- package/es/utils/pay.d.ts +7 -0
- package/es/utils/pay.js +23 -0
- package/es/utils/payClazz/Account.d.ts +9 -5
- package/es/utils/payClazz/Account.js +9 -0
- package/es/utils/payClazz/Offline.d.ts +9 -5
- package/es/utils/payClazz/Offline.js +13 -0
- package/es/utils/payClazz/WechatPay/WechatPay.d.ts +9 -5
- package/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts +9 -5
- package/es/utils/payClazz/WechatPay/WechatPay.debug.js +13 -0
- package/es/utils/payClazz/WechatPay/WechatPay.js +14 -5
- package/lib/checkers/accountOper.js +6 -0
- package/lib/configuration/attrUpdateMatrix.js +2 -0
- package/lib/context/BackendRuntimeContext.js +1 -0
- package/lib/data/i18n.js +5 -1
- package/lib/entities/AccountOper.d.ts +1 -1
- package/lib/entities/AccountOper.js +2 -0
- package/lib/entities/Refund.d.ts +20 -0
- package/lib/entities/Refund.js +51 -0
- package/lib/oak-app-domain/AccountOper/Schema.d.ts +1 -1
- package/lib/oak-app-domain/AccountOper/Storage.js +1 -1
- package/lib/oak-app-domain/AccountOper/Style.js +1 -0
- package/lib/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/ActionDefDict.d.ts +3 -0
- package/lib/oak-app-domain/ActionDefDict.js +6 -4
- package/lib/oak-app-domain/EntityDict.d.ts +2 -0
- package/lib/oak-app-domain/Pay/Schema.d.ts +12 -0
- package/lib/oak-app-domain/Pay/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/Refund/Action.d.ts +11 -0
- package/lib/oak-app-domain/Refund/Action.js +14 -0
- package/lib/oak-app-domain/Refund/Schema.d.ts +154 -0
- package/lib/oak-app-domain/Refund/Schema.js +2 -0
- package/lib/oak-app-domain/Refund/Storage.d.ts +3 -0
- package/lib/oak-app-domain/Refund/Storage.js +44 -0
- package/lib/oak-app-domain/Refund/Style.d.ts +3 -0
- package/lib/oak-app-domain/Refund/Style.js +16 -0
- package/lib/oak-app-domain/Refund/locales/zh_CN.json +1 -0
- package/lib/oak-app-domain/Storage.js +6 -4
- package/lib/oak-app-domain/StyleDict.js +6 -4
- package/lib/oak-app-domain/Token/Schema.d.ts +6 -0
- package/lib/oak-app-domain/Token/Storage.js +6 -0
- package/lib/oak-app-domain/Token/Style.js +1 -1
- package/lib/oak-app-domain/Token/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/_SubQuery.d.ts +9 -1
- package/lib/triggers/account.d.ts +5 -0
- package/lib/triggers/account.js +23 -0
- package/lib/triggers/accountOper.js +57 -1
- package/lib/triggers/index.js +2 -2
- package/lib/triggers/refund.d.ts +5 -0
- package/lib/triggers/refund.js +39 -0
- package/lib/types/PayClazz.d.ts +3 -0
- package/lib/types/PayConfig.d.ts +13 -9
- package/lib/types/PayConfig.js +11 -1
- package/lib/utils/pay.d.ts +7 -0
- package/lib/utils/pay.js +25 -1
- package/lib/utils/payClazz/Account.d.ts +9 -5
- package/lib/utils/payClazz/Account.js +9 -0
- package/lib/utils/payClazz/Offline.d.ts +9 -5
- package/lib/utils/payClazz/Offline.js +13 -0
- package/lib/utils/payClazz/WechatPay/WechatPay.d.ts +9 -5
- package/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts +9 -5
- package/lib/utils/payClazz/WechatPay/WechatPay.debug.js +13 -0
- package/lib/utils/payClazz/WechatPay/WechatPay.js +13 -4
- package/package.json +1 -1
- package/src/entities/AccountOper.ts +65 -63
- package/src/entities/Refund.ts +77 -0
|
@@ -62,6 +62,12 @@ const checkers = [
|
|
|
62
62
|
}
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
+
case 'loss': {
|
|
66
|
+
if (totalPlus >= 0 || availPlus > 0 || totalPlus !== availPlus) {
|
|
67
|
+
throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为consume时,其totalPlus/availPlus必须为0或负数,且totalPlus的绝对值要更大');
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
65
71
|
default: {
|
|
66
72
|
assert(false);
|
|
67
73
|
break;
|
|
@@ -20,7 +20,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
|
|
|
20
20
|
rowSelection?: any;
|
|
21
21
|
hideHeader?: boolean | undefined;
|
|
22
22
|
disableSerialNumber?: boolean | undefined;
|
|
23
|
-
size?: "small" | "
|
|
23
|
+
size?: "small" | "middle" | "large" | undefined;
|
|
24
24
|
scroll?: ({
|
|
25
25
|
x?: string | number | true | undefined;
|
|
26
26
|
y?: string | number | undefined;
|
|
@@ -46,7 +46,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
|
|
|
46
46
|
tablePagination?: any;
|
|
47
47
|
rowSelection?: any;
|
|
48
48
|
disableSerialNumber?: boolean | undefined;
|
|
49
|
-
size?: "small" | "
|
|
49
|
+
size?: "small" | "middle" | "large" | undefined;
|
|
50
50
|
scroll?: any;
|
|
51
51
|
locale?: any;
|
|
52
52
|
opWidth?: number | undefined;
|
|
@@ -58,14 +58,14 @@ declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<En
|
|
|
58
58
|
data: Partial<EntityDict[T]["Schema"]>;
|
|
59
59
|
title?: string | undefined;
|
|
60
60
|
bordered?: boolean | undefined;
|
|
61
|
-
layout?: "
|
|
61
|
+
layout?: "vertical" | "horizontal" | undefined;
|
|
62
62
|
}>) => React.ReactElement;
|
|
63
63
|
declare const Upsert: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
|
|
64
64
|
helps: Record<string, string>;
|
|
65
65
|
entity: T;
|
|
66
66
|
attributes: OakAbsAttrUpsertDef<EntityDict, T, string | number>[];
|
|
67
67
|
data: EntityDict[T]["Schema"];
|
|
68
|
-
layout: "
|
|
68
|
+
layout: "vertical" | "horizontal";
|
|
69
69
|
mode: "default" | "card";
|
|
70
70
|
}>) => React.ReactElement;
|
|
71
71
|
export { FilterPanel, List, ListPro, Detail, Upsert, ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, };
|
|
@@ -6,16 +6,16 @@ export default function Render(props) {
|
|
|
6
6
|
return (<List itemLayout="horizontal" dataSource={accountOpers} renderItem={(item, index) => {
|
|
7
7
|
const { $$createAt$$, type, totalPlus, availPlus } = item;
|
|
8
8
|
const plus = ToYuan(totalPlus || availPlus);
|
|
9
|
-
const sign = plus > 0 ? '+' : '
|
|
9
|
+
const sign = plus > 0 ? '+' : '';
|
|
10
10
|
const d = dayjs($$createAt$$);
|
|
11
|
-
return (<List.Item key={index}>
|
|
12
|
-
<List.Item.Meta avatar={<Avatar>{t(`accountOper:v.type.${type}`).at(0)}</Avatar>} title={t(`accountOper:v.type.${type}`)} description={d.format('M月D日 HH时mm分')}/>
|
|
11
|
+
return (<List.Item key={index}>
|
|
12
|
+
<List.Item.Meta avatar={<Avatar>{t(`accountOper:v.type.${type}`).at(0)}</Avatar>} title={t(`accountOper:v.type.${type}`)} description={d.format('M月D日 HH时mm分')}/>
|
|
13
13
|
<div style={{
|
|
14
14
|
fontSize: 'x-large',
|
|
15
|
-
color: sign ? 'gold' : '
|
|
16
|
-
}}>
|
|
17
|
-
{sign}{ThousandCont(plus)}
|
|
18
|
-
</div>
|
|
15
|
+
color: sign ? 'gold' : 'rosybrown'
|
|
16
|
+
}}>
|
|
17
|
+
{sign}{ThousandCont(plus, 2)}
|
|
18
|
+
</div>
|
|
19
19
|
</List.Item>);
|
|
20
20
|
}}/>);
|
|
21
21
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CentToString } from "oak-domain/lib/utils/money";
|
|
2
|
-
import { PAY_CHANNEL_OFFLINE_NAME, PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_WECHAT_APP_NAME, PAY_CHANNEL_WECHAT_H5_NAME, PAY_CHANNEL_WECHAT_JS_NAME, PAY_CHANNEL_WECHAT_MP_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME } from "../../../types/PayConfig";
|
|
2
|
+
import { PAY_CHANNEL_OFFLINE_NAME, PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_WECHAT_APP_NAME, PAY_CHANNEL_WECHAT_H5_NAME, PAY_CHANNEL_WECHAT_JS_NAME, PAY_CHANNEL_WECHAT_MP_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME, PAY_ORG_CHANNELS } from "../../../types/PayConfig";
|
|
3
3
|
import { DATA_SUBSCRIBER_KEYS } from "../../../config/constants";
|
|
4
4
|
import assert from "assert";
|
|
5
|
+
import { isWeiXin } from 'oak-frontend-base/es/utils/utils';
|
|
5
6
|
export default OakComponent({
|
|
6
7
|
entity: 'pay',
|
|
7
8
|
isList: false,
|
|
@@ -32,6 +33,7 @@ export default OakComponent({
|
|
|
32
33
|
},
|
|
33
34
|
properties: {
|
|
34
35
|
onClose: () => undefined,
|
|
36
|
+
disableAutoPay: false,
|
|
35
37
|
},
|
|
36
38
|
data: {
|
|
37
39
|
PAY_CHANNEL_OFFLINE_NAME,
|
|
@@ -48,12 +50,10 @@ export default OakComponent({
|
|
|
48
50
|
const iState = data?.iState;
|
|
49
51
|
const iStateColor = iState && this.features.style.getColor('pay', 'iState', iState);
|
|
50
52
|
const payConfig = this.features.pay.getPayConfigs();
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
PAY_CHANNEL_WECHAT_JS_NAME
|
|
56
|
-
].includes(data.channel);
|
|
53
|
+
const { meta, channel } = data || {};
|
|
54
|
+
const userId = this.features.token.getUserId();
|
|
55
|
+
const startPayable = iState === 'paying' && meta && PAY_ORG_CHANNELS.includes(channel) && ([PAY_CHANNEL_WECHAT_APP_NAME, PAY_CHANNEL_WECHAT_H5_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME].includes(channel) ||
|
|
56
|
+
[PAY_CHANNEL_WECHAT_JS_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME].includes(channel) && meta.payId === userId);
|
|
57
57
|
return {
|
|
58
58
|
type: data?.orderId ? 'order' : 'account',
|
|
59
59
|
pay: data,
|
|
@@ -124,23 +124,59 @@ export default OakComponent({
|
|
|
124
124
|
const { iState, channel, meta } = pay;
|
|
125
125
|
switch (channel) {
|
|
126
126
|
case PAY_CHANNEL_WECHAT_MP_NAME: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
|
128
|
+
const { prepayMeta } = meta;
|
|
129
|
+
if (prepayMeta) {
|
|
130
|
+
const result = await wx.requestPayment(prepayMeta);
|
|
131
|
+
process.env.NODE_ENV === 'development' && console.log(result);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.setMessage({
|
|
135
|
+
type: 'warning',
|
|
136
|
+
content: this.t('startPayError.illegaPayData'),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
131
139
|
}
|
|
132
140
|
else {
|
|
133
141
|
this.setMessage({
|
|
134
142
|
type: 'warning',
|
|
135
|
-
content: '
|
|
143
|
+
content: this.t('startPayError.falseEnv', { env: 'wechatMp' }),
|
|
136
144
|
});
|
|
137
145
|
}
|
|
138
|
-
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
case PAY_CHANNEL_WECHAT_JS_NAME: {
|
|
149
|
+
if (process.env.OAK_PLATFORM === 'web' && isWeiXin) {
|
|
150
|
+
const { prepayMeta } = meta;
|
|
151
|
+
if (prepayMeta) {
|
|
152
|
+
await this.features.wechatSdk.loadWxAPi('chooseWXPay', prepayMeta);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.setMessage({
|
|
156
|
+
type: 'warning',
|
|
157
|
+
content: this.t('startPayError.illegaPayData'),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
139
161
|
}
|
|
140
162
|
default: {
|
|
141
163
|
assert('尚未实现');
|
|
142
164
|
}
|
|
143
165
|
}
|
|
166
|
+
},
|
|
167
|
+
async onWxBridgeReady(payMetaData) {
|
|
168
|
+
return new Promise((resolve, reject) => {
|
|
169
|
+
WeixinJSBridge.invoke('getBrandWCPayRequest', payMetaData, function (res) {
|
|
170
|
+
if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
171
|
+
// 使用以上方式判断前端返回,微信团队郑重提示:
|
|
172
|
+
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
173
|
+
resolve(undefined);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
reject(res.err_msg);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
144
180
|
}
|
|
145
181
|
},
|
|
146
182
|
lifetimes: {
|
|
@@ -157,7 +193,7 @@ export default OakComponent({
|
|
|
157
193
|
},
|
|
158
194
|
listeners: {
|
|
159
195
|
startPayable(prev, next) {
|
|
160
|
-
if (next.startPayable) {
|
|
196
|
+
if (next.startPayable && !this.props.disableAutoPay) {
|
|
161
197
|
this.startPay();
|
|
162
198
|
}
|
|
163
199
|
}
|
package/es/data/i18n.js
CHANGED
|
@@ -120,7 +120,11 @@ const i18ns = [
|
|
|
120
120
|
},
|
|
121
121
|
"success": "支付成功",
|
|
122
122
|
"pay": "支付",
|
|
123
|
-
"wechatPay": "微信支付"
|
|
123
|
+
"wechatPay": "微信支付",
|
|
124
|
+
"startPayError": {
|
|
125
|
+
"illegalPrepayData": "没有有效的预支付数据,可能后台是运行在开发环境,请检查",
|
|
126
|
+
"falseEnv": "该订单渠道【%{env}】不匹配当前环境"
|
|
127
|
+
}
|
|
124
128
|
}
|
|
125
129
|
},
|
|
126
130
|
{
|
|
@@ -2,7 +2,7 @@ import { String, Price } from 'oak-domain/lib/types/DataType';
|
|
|
2
2
|
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
|
3
3
|
import { EntityDesc } from 'oak-domain/lib/types';
|
|
4
4
|
import { Schema as Account } from './Account';
|
|
5
|
-
type Type = 'deposit' | 'withdraw' | 'consume' | 'loan' | 'repay' | 'withdrawBack';
|
|
5
|
+
type Type = 'deposit' | 'withdraw' | 'consume' | 'loan' | 'repay' | 'withdrawBack' | 'loss';
|
|
6
6
|
export interface Schema extends EntityShape {
|
|
7
7
|
account: Account;
|
|
8
8
|
type: Type;
|
|
@@ -19,6 +19,7 @@ export const entityDesc = {
|
|
|
19
19
|
loan: '抵押',
|
|
20
20
|
repay: '偿还',
|
|
21
21
|
withdrawBack: '提现失败',
|
|
22
|
+
loss: '损耗'
|
|
22
23
|
},
|
|
23
24
|
},
|
|
24
25
|
},
|
|
@@ -32,6 +33,7 @@ export const entityDesc = {
|
|
|
32
33
|
consume: '#A569BD',
|
|
33
34
|
loan: '#CD6155',
|
|
34
35
|
repay: '#82E0AA',
|
|
36
|
+
loss: '#2E4053'
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { String, Price } from 'oak-domain/lib/types/DataType';
|
|
2
|
+
import { EntityShape } from 'oak-domain/lib/types/Entity';
|
|
3
|
+
import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
|
|
4
|
+
import { Schema as Pay } from './Pay';
|
|
5
|
+
export interface Schema extends EntityShape {
|
|
6
|
+
entity?: String<32>;
|
|
7
|
+
entityId?: String<64>;
|
|
8
|
+
pay: Pay;
|
|
9
|
+
meta?: Object;
|
|
10
|
+
externalId?: String<64>;
|
|
11
|
+
price: Price;
|
|
12
|
+
}
|
|
13
|
+
type IState = 'refunding' | 'refunded' | 'failed';
|
|
14
|
+
type IAction = 'succeedRefunding' | 'failRefunding';
|
|
15
|
+
type Action = IAction;
|
|
16
|
+
export declare const IActionDef: ActionDef<IAction, IState>;
|
|
17
|
+
export declare const entityDesc: EntityDesc<Schema, Action, '', {
|
|
18
|
+
iState: IState;
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
;
|
|
2
|
+
export const IActionDef = {
|
|
3
|
+
stm: {
|
|
4
|
+
succeedRefunding: ['refunding', 'refunded'],
|
|
5
|
+
failRefunding: ['refunding', 'failed'],
|
|
6
|
+
},
|
|
7
|
+
is: 'refunding',
|
|
8
|
+
};
|
|
9
|
+
export const entityDesc = {
|
|
10
|
+
locales: {
|
|
11
|
+
zh_CN: {
|
|
12
|
+
name: '帐户',
|
|
13
|
+
attr: {
|
|
14
|
+
pay: '关联支付',
|
|
15
|
+
price: '价格',
|
|
16
|
+
entity: '关联对象',
|
|
17
|
+
entityId: '关联对象ID',
|
|
18
|
+
meta: 'metadata',
|
|
19
|
+
externalId: '外部ID',
|
|
20
|
+
iState: '状态',
|
|
21
|
+
},
|
|
22
|
+
action: {
|
|
23
|
+
succeedRefunding: '退款成功',
|
|
24
|
+
failRefunding: ''
|
|
25
|
+
},
|
|
26
|
+
v: {
|
|
27
|
+
iState: {
|
|
28
|
+
refunding: '退款中',
|
|
29
|
+
refunded: '退款成功',
|
|
30
|
+
failed: '退款失败',
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
style: {
|
|
36
|
+
icon: {
|
|
37
|
+
succeedRefunding: '',
|
|
38
|
+
failRefunding: '',
|
|
39
|
+
},
|
|
40
|
+
color: {
|
|
41
|
+
iState: {
|
|
42
|
+
refunding: '#F5B041',
|
|
43
|
+
refunded: '#52BE80',
|
|
44
|
+
failed: '#E74C3C',
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -7,7 +7,7 @@ import { Price, String } from "oak-domain/lib/types/DataType";
|
|
|
7
7
|
import * as Account from "../Account/Schema";
|
|
8
8
|
import * as Pay from "../Pay/Schema";
|
|
9
9
|
import * as Withdraw from "../Withdraw/Schema";
|
|
10
|
-
type Type = "deposit" | "withdraw" | "consume" | "loan" | "repay" | "withdrawBack";
|
|
10
|
+
type Type = "deposit" | "withdraw" | "consume" | "loan" | "repay" | "withdrawBack" | "loss";
|
|
11
11
|
export type OpSchema = EntityShape & {
|
|
12
12
|
accountId: ForeignKey<"account">;
|
|
13
13
|
type: Type;
|
|
@@ -9,7 +9,7 @@ export const desc = {
|
|
|
9
9
|
type: {
|
|
10
10
|
notNull: true,
|
|
11
11
|
type: "enum",
|
|
12
|
-
enumeration: ["deposit", "withdraw", "consume", "loan", "repay", "withdrawBack"]
|
|
12
|
+
enumeration: ["deposit", "withdraw", "consume", "loan", "repay", "withdrawBack", "loss"]
|
|
13
13
|
},
|
|
14
14
|
totalPlus: {
|
|
15
15
|
notNull: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "帐号操作", "attr": { "account": "帐号", "type": "类型", "totalPlus": "余额变化", "availPlus": "可用余额变化", "entity": "关联对象", "entityId": "关联对象Id" }, "v": { "type": { "deposit": "充值", "withdraw": "提现", "consume": "消费", "loan": "抵押", "repay": "偿还", "withdrawBack": "提现失败" } } }
|
|
1
|
+
{ "name": "帐号操作", "attr": { "account": "帐号", "type": "类型", "totalPlus": "余额变化", "availPlus": "可用余额变化", "entity": "关联对象", "entityId": "关联对象Id" }, "v": { "type": { "deposit": "充值", "withdraw": "提现", "consume": "消费", "loan": "抵押", "repay": "偿还", "withdrawBack": "提现失败", "loss": "损耗" } } }
|
|
@@ -45,6 +45,9 @@ export declare const actionDefDict: {
|
|
|
45
45
|
pay: {
|
|
46
46
|
iState: import("oak-domain/lib/types").ActionDef<string, string>;
|
|
47
47
|
};
|
|
48
|
+
refund: {
|
|
49
|
+
iState: import("oak-domain/lib/types").ActionDef<string, string>;
|
|
50
|
+
};
|
|
48
51
|
user: {
|
|
49
52
|
idState: import("oak-domain/lib/types").ActionDef<import("oak-general-business/lib/entities/User").IdAction, import("oak-general-business/lib/entities/User").IdState>;
|
|
50
53
|
userState: import("oak-domain/lib/types").ActionDef<import("oak-general-business/lib/entities/User").UserAction, import("oak-general-business/lib/entities/User").UserState>;
|
|
@@ -15,6 +15,7 @@ import { actionDefDict as wechatPublicTag } from "./WechatPublicTag/Action";
|
|
|
15
15
|
import { actionDefDict as account } from "./Account/Action";
|
|
16
16
|
import { actionDefDict as order } from "./Order/Action";
|
|
17
17
|
import { actionDefDict as pay } from "./Pay/Action";
|
|
18
|
+
import { actionDefDict as refund } from "./Refund/Action";
|
|
18
19
|
import { actionDefDict as user } from "./User/Action";
|
|
19
20
|
import { actionDefDict as withdraw } from "./Withdraw/Action";
|
|
20
21
|
export const actionDefDict = {
|
|
@@ -35,6 +36,7 @@ export const actionDefDict = {
|
|
|
35
36
|
account,
|
|
36
37
|
order,
|
|
37
38
|
pay,
|
|
39
|
+
refund,
|
|
38
40
|
user,
|
|
39
41
|
withdraw
|
|
40
42
|
};
|
|
@@ -56,6 +56,7 @@ import { EntityDef as Account } from "./Account/Schema";
|
|
|
56
56
|
import { EntityDef as AccountOper } from "./AccountOper/Schema";
|
|
57
57
|
import { EntityDef as Order } from "./Order/Schema";
|
|
58
58
|
import { EntityDef as Pay } from "./Pay/Schema";
|
|
59
|
+
import { EntityDef as Refund } from "./Refund/Schema";
|
|
59
60
|
import { EntityDef as Withdraw } from "./Withdraw/Schema";
|
|
60
61
|
import { EntityDef as WithdrawChannel } from "./WithdrawChannel/Schema";
|
|
61
62
|
export type EntityDict = {
|
|
@@ -117,6 +118,7 @@ export type EntityDict = {
|
|
|
117
118
|
accountOper: AccountOper;
|
|
118
119
|
order: Order;
|
|
119
120
|
pay: Pay;
|
|
121
|
+
refund: Refund;
|
|
120
122
|
withdraw: Withdraw;
|
|
121
123
|
withdrawChannel: WithdrawChannel;
|
|
122
124
|
};
|
|
@@ -8,6 +8,7 @@ import * as Account from "../Account/Schema";
|
|
|
8
8
|
import * as Order from "../Order/Schema";
|
|
9
9
|
import * as Application from "../Application/Schema";
|
|
10
10
|
import * as User from "../User/Schema";
|
|
11
|
+
import * as Refund from "../Refund/Schema";
|
|
11
12
|
import * as AccountOper from "../AccountOper/Schema";
|
|
12
13
|
export type OpSchema = EntityShape & {
|
|
13
14
|
price: Price;
|
|
@@ -51,6 +52,8 @@ export type Schema = EntityShape & {
|
|
|
51
52
|
order?: Order.Schema | null;
|
|
52
53
|
application: Application.Schema;
|
|
53
54
|
creator: User.Schema;
|
|
55
|
+
refund$pay?: Array<Refund.Schema>;
|
|
56
|
+
refund$pay$$aggr?: AggregationResult<Refund.Schema>;
|
|
54
57
|
accountOper$entity?: Array<AccountOper.Schema>;
|
|
55
58
|
accountOper$entity$$aggr?: AggregationResult<AccountOper.Schema>;
|
|
56
59
|
} & {
|
|
@@ -82,6 +85,7 @@ type AttrFilter = {
|
|
|
82
85
|
phantom3: Q_NumberValue;
|
|
83
86
|
phantom4: Q_NumberValue;
|
|
84
87
|
iState: Q_EnumValue<IState>;
|
|
88
|
+
refund$pay: Refund.Filter & SubQueryPredicateMetadata;
|
|
85
89
|
accountOper$entity: AccountOper.Filter & SubQueryPredicateMetadata;
|
|
86
90
|
};
|
|
87
91
|
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
@@ -113,6 +117,12 @@ export type Projection = {
|
|
|
113
117
|
phantom3?: number;
|
|
114
118
|
phantom4?: number;
|
|
115
119
|
iState?: number;
|
|
120
|
+
refund$pay?: Refund.Selection & {
|
|
121
|
+
$entity: "refund";
|
|
122
|
+
};
|
|
123
|
+
refund$pay$$aggr?: Refund.Aggregation & {
|
|
124
|
+
$entity: "refund";
|
|
125
|
+
};
|
|
116
126
|
accountOper$entity?: AccountOper.Selection & {
|
|
117
127
|
$entity: "accountOper";
|
|
118
128
|
};
|
|
@@ -231,6 +241,7 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "accountId" | "o
|
|
|
231
241
|
creator?: never;
|
|
232
242
|
creatorId: ForeignKey<"creator">;
|
|
233
243
|
})) & {
|
|
244
|
+
refund$pay?: OakOperation<Refund.UpdateOperation["action"], Omit<Refund.UpdateOperationData, "pay" | "payId">, Omit<Refund.Filter, "pay" | "payId">> | OakOperation<"create", Omit<Refund.CreateOperationData, "pay" | "payId">[]> | Array<OakOperation<"create", Omit<Refund.CreateOperationData, "pay" | "payId">> | OakOperation<Refund.UpdateOperation["action"], Omit<Refund.UpdateOperationData, "pay" | "payId">, Omit<Refund.Filter, "pay" | "payId">>>;
|
|
234
245
|
accountOper$entity?: OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">>>;
|
|
235
246
|
};
|
|
236
247
|
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
@@ -286,6 +297,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "accountId" | "o
|
|
|
286
297
|
creatorId?: ForeignKey<"creator">;
|
|
287
298
|
})) & {
|
|
288
299
|
[k: string]: any;
|
|
300
|
+
refund$pay?: OakOperation<Refund.UpdateOperation["action"], Omit<Refund.UpdateOperationData, "pay" | "payId">, Omit<Refund.Filter, "pay" | "payId">> | OakOperation<Refund.RemoveOperation["action"], Omit<Refund.RemoveOperationData, "pay" | "payId">, Omit<Refund.Filter, "pay" | "payId">> | OakOperation<"create", Omit<Refund.CreateOperationData, "pay" | "payId">[]> | Array<OakOperation<"create", Omit<Refund.CreateOperationData, "pay" | "payId">> | OakOperation<Refund.UpdateOperation["action"], Omit<Refund.UpdateOperationData, "pay" | "payId">, Omit<Refund.Filter, "pay" | "payId">> | OakOperation<Refund.RemoveOperation["action"], Omit<Refund.RemoveOperationData, "pay" | "payId">, Omit<Refund.Filter, "pay" | "payId">>>;
|
|
289
301
|
accountOper$entity?: OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<AccountOper.CreateOperationData, "entity" | "entityId">>>;
|
|
290
302
|
};
|
|
291
303
|
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "订单", "attr": { "price": "
|
|
1
|
+
{ "name": "订单", "attr": { "price": "应支付金额", "paid": "已支付金额", "refunded": "已退款金额", "iState": "支付状态", "channel": "支付渠道", "order": "所属订单", "timeoutAt": "过期时间", "forbidRefundAt": "停止退款时间", "account": "充值帐户", "meta": "支付metadata", "externalId": "外部订单Id", "opers": "被关联帐户操作", "application": "关联应用", "creator": "创建者", "phantom1": "索引项一", "phantom2": "索引项二", "phantom3": "索引项三", "phantom4": "索引项四" }, "action": { "startPaying": "开始支付", "succeedPaying": "支付成功", "close": "关闭", "startRefunding": "开始退款", "refundAll": "完全退款", "refundPartially": "部分退款" }, "v": { "iState": { "unpaid": "待付款", "paying": "支付中", "paid": "已付款", "closed": "已关闭", "refunding": "退款中", "refunded": "已退款", "partiallyRefunded": "已部分退款" } } }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionDef } from "oak-domain/lib/types/Action";
|
|
2
|
+
import { GenericAction } from "oak-domain/lib/actions/action";
|
|
3
|
+
export type IState = 'refunding' | 'refunded' | 'failed' | string;
|
|
4
|
+
export type IAction = 'succeedRefunding' | 'failRefunding' | string;
|
|
5
|
+
export type ParticularAction = IAction;
|
|
6
|
+
export declare const actions: string[];
|
|
7
|
+
export declare const IActionDef: ActionDef<IAction, IState>;
|
|
8
|
+
export type Action = GenericAction | ParticularAction | string;
|
|
9
|
+
export declare const actionDefDict: {
|
|
10
|
+
iState: ActionDef<string, string>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeedRefunding", "failRefunding"];
|
|
2
|
+
export const IActionDef = {
|
|
3
|
+
stm: {
|
|
4
|
+
succeedRefunding: ['refunding', 'refunded'],
|
|
5
|
+
failRefunding: ['refunding', 'failed'],
|
|
6
|
+
},
|
|
7
|
+
is: 'refunding',
|
|
8
|
+
};
|
|
9
|
+
export const actionDefDict = {
|
|
10
|
+
iState: IActionDef
|
|
11
|
+
};
|