oak-pay-business 2.2.6 → 2.2.7
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.d.ts +21 -10
- package/es/components/account/detail/index.js +8 -1
- package/es/components/account/detail/index.less +10 -1
- package/es/components/account/detail/index.xml +11 -5
- package/es/components/deposit/new/index.d.ts +1 -0
- package/es/components/deposit/new/index.js +1 -0
- package/es/components/deposit/new/index.xml +15 -2
- package/es/components/wpAccount/upsert/web.pc.js +1 -1
- package/es/triggers/withdraw.d.ts +1 -1
- package/es/utils/pay.d.ts +1 -0
- package/es/utils/pay.js +52 -0
- package/lib/aspects/withdraw.d.ts +8 -8
- package/lib/context/BackendRuntimeContext.d.ts +1 -1
- package/lib/utils/application.d.ts +1 -1
- package/lib/utils/pay.d.ts +1 -0
- package/lib/utils/pay.js +54 -1
- package/package.json +2 -2
|
@@ -17,14 +17,20 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
|
|
|
17
17
|
attributes: OakAbsAttrDef[];
|
|
18
18
|
data: RowWithActions<EntityDict, T>[];
|
|
19
19
|
loading: boolean;
|
|
20
|
-
tablePagination?:
|
|
21
|
-
rowSelection?:
|
|
20
|
+
tablePagination?: React.ReactNode;
|
|
21
|
+
rowSelection?: import("antd/es/table/interface").TableRowSelection<RowWithActions<EntityDict, T>> | undefined;
|
|
22
22
|
hideHeader?: boolean | undefined;
|
|
23
23
|
disableSerialNumber?: boolean | undefined;
|
|
24
|
-
size?: "
|
|
25
|
-
scroll?:
|
|
26
|
-
|
|
24
|
+
size?: "small" | "middle" | "large" | undefined;
|
|
25
|
+
scroll?: ({
|
|
26
|
+
x?: string | number | true | undefined;
|
|
27
|
+
y?: string | number | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
scrollToFirstRowOnChange?: boolean | undefined;
|
|
30
|
+
}) | undefined;
|
|
31
|
+
empty?: React.ReactNode;
|
|
27
32
|
opWidth?: number | undefined;
|
|
33
|
+
ellipsis?: boolean | undefined;
|
|
28
34
|
}>) => React.ReactElement;
|
|
29
35
|
declare const ListPro: <T extends keyof EntityDict>(props: {
|
|
30
36
|
title?: any;
|
|
@@ -40,16 +46,21 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
|
|
|
40
46
|
data: RowWithActions<EntityDict, T>[];
|
|
41
47
|
loading?: boolean | undefined;
|
|
42
48
|
tablePagination?: any;
|
|
43
|
-
rowSelection?:
|
|
49
|
+
rowSelection?: import("antd/es/table/interface").TableRowSelection<RowWithActions<EntityDict, T>> | undefined;
|
|
44
50
|
disableSerialNumber?: boolean | undefined;
|
|
45
|
-
size?: "
|
|
46
|
-
scroll?:
|
|
47
|
-
|
|
51
|
+
size?: "small" | "middle" | "large" | undefined;
|
|
52
|
+
scroll?: ({
|
|
53
|
+
x?: string | number | true | undefined;
|
|
54
|
+
y?: string | number | undefined;
|
|
55
|
+
} & {
|
|
56
|
+
scrollToFirstRowOnChange?: boolean | undefined;
|
|
57
|
+
}) | undefined;
|
|
58
|
+
empty?: any;
|
|
48
59
|
opWidth?: number | undefined;
|
|
49
60
|
oakPath?: string | undefined;
|
|
50
61
|
}) => React.ReactElement;
|
|
51
62
|
declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
|
|
52
|
-
column?: number | Record<Breakpoint, number> | undefined;
|
|
63
|
+
column?: number | Record<import("antd").Breakpoint, number> | undefined;
|
|
53
64
|
entity: T;
|
|
54
65
|
attributes: OakAbsAttrDef[];
|
|
55
66
|
data: Partial<EntityDict[T]["Schema"]>;
|
|
@@ -127,7 +127,13 @@ export default OakComponent({
|
|
|
127
127
|
onGoToUnfinishedPay && onGoToUnfinishedPay(payId);
|
|
128
128
|
},
|
|
129
129
|
setDepositOpen(depositOpen) {
|
|
130
|
-
this.setState({ depositOpen })
|
|
130
|
+
this.setState({ depositOpen }, () => {
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
this.setState({
|
|
133
|
+
focus: depositOpen
|
|
134
|
+
});
|
|
135
|
+
}, 333);
|
|
136
|
+
});
|
|
131
137
|
},
|
|
132
138
|
setUfOpen(ufOpen) {
|
|
133
139
|
this.setState({ ufOpen });
|
|
@@ -218,6 +224,7 @@ export default OakComponent({
|
|
|
218
224
|
depositing: false,
|
|
219
225
|
setDepPriceMp(price) { this.setDepPrice(price); },
|
|
220
226
|
setDepositChannelMp(depositChannel) { this.setDepositChannel(depositChannel); },
|
|
227
|
+
focus: false,
|
|
221
228
|
},
|
|
222
229
|
lifetimes: {
|
|
223
230
|
ready() {
|
|
@@ -91,7 +91,16 @@
|
|
|
91
91
|
.ad-container {
|
|
92
92
|
padding: 24rpx;
|
|
93
93
|
background-color: white;
|
|
94
|
-
.safe-area-inset-bottom();
|
|
94
|
+
// .safe-area-inset-bottom();
|
|
95
|
+
height: 40vh;
|
|
96
|
+
|
|
97
|
+
.btnBox {
|
|
98
|
+
position: fixed;
|
|
99
|
+
bottom: 0;
|
|
100
|
+
left: 0;
|
|
101
|
+
width: 100%;
|
|
102
|
+
.safe-area-inset-bottom();
|
|
103
|
+
}
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
.uf {
|
|
@@ -47,14 +47,19 @@
|
|
|
47
47
|
</view>
|
|
48
48
|
</view>
|
|
49
49
|
<block wx:if="{{depositOpen}}">
|
|
50
|
-
<l-
|
|
50
|
+
<l-popup
|
|
51
|
+
show="{{depositOpen}}"
|
|
52
|
+
content-align="bottom"
|
|
53
|
+
bind:lintap="onDepositModalClose"
|
|
54
|
+
>
|
|
55
|
+
<!-- <l-arc-popup
|
|
51
56
|
show="{{depositOpen}}"
|
|
52
57
|
direction="bottom"
|
|
53
58
|
bind:lintap="onDepositModalClose"
|
|
54
59
|
min-height="200"
|
|
55
|
-
max-height="
|
|
60
|
+
max-height="1000"
|
|
56
61
|
z-index="1000"
|
|
57
|
-
>
|
|
62
|
+
> -->
|
|
58
63
|
<view class="ad-container">
|
|
59
64
|
<deposit-new
|
|
60
65
|
depositMinCent="{{depositMinCent}}"
|
|
@@ -65,8 +70,9 @@
|
|
|
65
70
|
onSetPrice="{{setDepPriceMp}}"
|
|
66
71
|
onSetChannel="{{setDepositChannelMp}}"
|
|
67
72
|
onSetPrice="{{setDepPriceMp}}"
|
|
73
|
+
focus="{{focus}}"
|
|
68
74
|
/>
|
|
69
|
-
<view style="margin-top:
|
|
75
|
+
<view style="margin-top:20rpx">
|
|
70
76
|
<l-button
|
|
71
77
|
type="default"
|
|
72
78
|
size="long"
|
|
@@ -78,7 +84,7 @@
|
|
|
78
84
|
</l-button>
|
|
79
85
|
</view>
|
|
80
86
|
</view>
|
|
81
|
-
</l-
|
|
87
|
+
</l-popup>
|
|
82
88
|
</block>
|
|
83
89
|
<block wx:if="{{ufOpen}}">
|
|
84
90
|
<l-dialog
|
|
@@ -8,5 +8,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
|
|
|
8
8
|
onSetPrice: (price: null | number) => void;
|
|
9
9
|
onSetChannel: (channel: PayChannel) => void;
|
|
10
10
|
loss: [number, string, any];
|
|
11
|
+
focus: boolean;
|
|
11
12
|
}>) => React.ReactElement;
|
|
12
13
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<block wx:if="{{payChannels && payChannels.length > 0}}">
|
|
2
2
|
<l-form>
|
|
3
3
|
<l-form-item label="{{t('deposit:attr.price')}}" label-placement="column">
|
|
4
|
-
<l-input
|
|
4
|
+
<!-- <l-input
|
|
5
5
|
label="{{t('common::pay.symbol')}}"
|
|
6
6
|
label-width="{{70}}"
|
|
7
7
|
show-row="{{false}}"
|
|
@@ -9,7 +9,20 @@
|
|
|
9
9
|
type="number"
|
|
10
10
|
placeholder="一次最大充值{{depositMax}}元"
|
|
11
11
|
bind:lininput="onDepPriceChangeMp"
|
|
12
|
-
|
|
12
|
+
focus="{{focus}}"
|
|
13
|
+
/> -->
|
|
14
|
+
<view style="display:flex;margin-top:8rpx;">
|
|
15
|
+
<span style="margin-right:8rpx;">{{t('common::pay.symbol')}}</span>
|
|
16
|
+
<input
|
|
17
|
+
cursor-spacing="260"
|
|
18
|
+
value="{{priceStr || ''}}"
|
|
19
|
+
type="digit"
|
|
20
|
+
placeholder="一次最大充值{{depositMax}}元"
|
|
21
|
+
bindinput="onDepPriceChangeMp"
|
|
22
|
+
focus="{{focus}}"
|
|
23
|
+
style="flex:1"
|
|
24
|
+
/>
|
|
25
|
+
</view>
|
|
13
26
|
</l-form-item>
|
|
14
27
|
<block wx:if="{{price > 0}}">
|
|
15
28
|
<l-form-item label="{{t('pay:attr.entity')}}" label-placement="column">
|
|
@@ -6,7 +6,7 @@ export default function render(props) {
|
|
|
6
6
|
const { wpAccount, wechatPay, oakFullpath, systemId } = props.data;
|
|
7
7
|
const { t, update } = props.methods;
|
|
8
8
|
if (wpAccount) {
|
|
9
|
-
return (<Form labelCol={{ span:
|
|
9
|
+
return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 16 }} layout="horizontal" style={{ minWidth: 860 }}>
|
|
10
10
|
{(!wechatPay || wechatPay.$$createAt$$ === 1) && <WechatPayUpsert oakPath={`${oakFullpath}.wechatPay`} systemId={systemId} key="wpCreate"/>}
|
|
11
11
|
{(wpAccount.wechatPayId && wpAccount?.$$createAt$$ !== 1) && <WechatPayUpsert oakPath={`${oakFullpath}.wechatPay`} systemId={systemId} key="wpUpdate" oakId={wpAccount.wechatPayId}/>}
|
|
12
12
|
<Form.Item label="说明">
|
|
@@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
|
|
|
6
6
|
* @param context
|
|
7
7
|
* @param refunds
|
|
8
8
|
*/
|
|
9
|
-
export declare function updateWithdrawState(context: BRC, id: string): Promise<
|
|
9
|
+
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
|
|
10
10
|
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
|
11
11
|
export default triggers;
|
package/es/utils/pay.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ import BackendRuntimeContext from '../context/BackendRuntimeContext';
|
|
|
5
5
|
import { IncomingHttpHeaders } from 'http';
|
|
6
6
|
export declare const fullPayProjection: EntityDict['pay']['Selection']['data'];
|
|
7
7
|
export declare function payNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, payId: string, headers: IncomingHttpHeaders): Promise<void>;
|
|
8
|
+
export declare function refundNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, refundId: string, headers: IncomingHttpHeaders): Promise<void>;
|
package/es/utils/pay.js
CHANGED
|
@@ -83,3 +83,55 @@ export async function payNotify(context, body, payId, headers) {
|
|
|
83
83
|
}
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
+
export async function refundNotify(context, body, refundId, headers) {
|
|
87
|
+
const [refund] = await context.select('refund', {
|
|
88
|
+
data: {
|
|
89
|
+
id: 1,
|
|
90
|
+
price: 1,
|
|
91
|
+
iState: 1,
|
|
92
|
+
pay: {
|
|
93
|
+
entity: 1,
|
|
94
|
+
entityId: 1,
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
filter: {
|
|
98
|
+
id: refundId,
|
|
99
|
+
}
|
|
100
|
+
}, {});
|
|
101
|
+
if (!refund) {
|
|
102
|
+
console.error('接受到无效的refundId', refundId);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const { entity, entityId } = refund.pay;
|
|
106
|
+
const payClazz = await getPayClazz(entity, entityId, context);
|
|
107
|
+
const { refundId: refundId2, extra, iState, } = await payClazz.decodeRefundNotification({ headers }, body);
|
|
108
|
+
assert(refundId2 === refundId);
|
|
109
|
+
if (iState !== refund.iState) {
|
|
110
|
+
let action = 'succeed';
|
|
111
|
+
const updateData = {};
|
|
112
|
+
switch (iState) {
|
|
113
|
+
case 'successful': {
|
|
114
|
+
// action = 'close';
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case 'failed': {
|
|
118
|
+
action = 'fail';
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
default: {
|
|
122
|
+
assert(false);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (extra) {
|
|
126
|
+
Object.assign(updateData, extra);
|
|
127
|
+
}
|
|
128
|
+
await context.operate('refund', {
|
|
129
|
+
id: await generateNewIdAsync(),
|
|
130
|
+
action,
|
|
131
|
+
data: updateData,
|
|
132
|
+
filter: {
|
|
133
|
+
id: refundId,
|
|
134
|
+
}
|
|
135
|
+
}, {});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -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, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
|
16
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | 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, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
|
30
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | 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, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
|
44
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | 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, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
|
58
|
+
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | 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").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | 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;
|
|
@@ -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").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | 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;
|
package/lib/utils/pay.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ import BackendRuntimeContext from '../context/BackendRuntimeContext';
|
|
|
5
5
|
import { IncomingHttpHeaders } from 'http';
|
|
6
6
|
export declare const fullPayProjection: EntityDict['pay']['Selection']['data'];
|
|
7
7
|
export declare function payNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, payId: string, headers: IncomingHttpHeaders): Promise<void>;
|
|
8
|
+
export declare function refundNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, refundId: string, headers: IncomingHttpHeaders): Promise<void>;
|
package/lib/utils/pay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.payNotify = exports.fullPayProjection = void 0;
|
|
3
|
+
exports.refundNotify = exports.payNotify = exports.fullPayProjection = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const payClazz_1 = require("./payClazz");
|
|
6
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
@@ -88,3 +88,56 @@ async function payNotify(context, body, payId, headers) {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
exports.payNotify = payNotify;
|
|
91
|
+
async function refundNotify(context, body, refundId, headers) {
|
|
92
|
+
const [refund] = await context.select('refund', {
|
|
93
|
+
data: {
|
|
94
|
+
id: 1,
|
|
95
|
+
price: 1,
|
|
96
|
+
iState: 1,
|
|
97
|
+
pay: {
|
|
98
|
+
entity: 1,
|
|
99
|
+
entityId: 1,
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
filter: {
|
|
103
|
+
id: refundId,
|
|
104
|
+
}
|
|
105
|
+
}, {});
|
|
106
|
+
if (!refund) {
|
|
107
|
+
console.error('接受到无效的refundId', refundId);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const { entity, entityId } = refund.pay;
|
|
111
|
+
const payClazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context);
|
|
112
|
+
const { refundId: refundId2, extra, iState, } = await payClazz.decodeRefundNotification({ headers }, body);
|
|
113
|
+
(0, assert_1.default)(refundId2 === refundId);
|
|
114
|
+
if (iState !== refund.iState) {
|
|
115
|
+
let action = 'succeed';
|
|
116
|
+
const updateData = {};
|
|
117
|
+
switch (iState) {
|
|
118
|
+
case 'successful': {
|
|
119
|
+
// action = 'close';
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
case 'failed': {
|
|
123
|
+
action = 'fail';
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
default: {
|
|
127
|
+
(0, assert_1.default)(false);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (extra) {
|
|
131
|
+
Object.assign(updateData, extra);
|
|
132
|
+
}
|
|
133
|
+
await context.operate('refund', {
|
|
134
|
+
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
135
|
+
action,
|
|
136
|
+
data: updateData,
|
|
137
|
+
filter: {
|
|
138
|
+
id: refundId,
|
|
139
|
+
}
|
|
140
|
+
}, {});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.refundNotify = refundNotify;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"classnames": "^2.3.1",
|
|
31
31
|
"dayjs": "^1.11.5",
|
|
32
32
|
"oak-domain": "~5.0.15",
|
|
33
|
-
"oak-frontend-base": "
|
|
33
|
+
"oak-frontend-base": "5.2.10",
|
|
34
34
|
"oak-general-business": "~5.2.5",
|
|
35
35
|
"wechat-pay-nodejs": "^0.2.3"
|
|
36
36
|
},
|