oak-pay-business 2.2.9 → 2.2.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.
Files changed (48) hide show
  1. package/es/aspects/withdraw.d.ts +8 -8
  2. package/es/components/AbstractComponents.d.ts +4 -9
  3. package/es/components/AbstractComponents.js +0 -4
  4. package/es/components/account/detail/index.js +2 -2
  5. package/es/components/account/detail/index.json +0 -1
  6. package/es/components/account/detail/index.less +2 -2
  7. package/es/components/account/detail/web.pc.module.less +68 -68
  8. package/es/components/deposit/new/index.js +33 -0
  9. package/es/components/deposit/new/index.xml +9 -19
  10. package/es/components/order/pay/info.js +6 -6
  11. package/es/components/order/pay/info.module.less +24 -24
  12. package/es/components/order/pay/web.mobile.module.less +35 -35
  13. package/es/components/order/pay/web.pc.module.less +35 -35
  14. package/es/components/pay/detail/index.d.ts +3 -0
  15. package/es/components/pay/detail/index.js +48 -33
  16. package/es/components/pay/detail/index.less +1 -0
  17. package/es/components/pay/detail/index.xml +56 -51
  18. package/es/components/pay/detail/locales/zh-CN.json +3 -1
  19. package/es/components/pay/detail/web.js +13 -13
  20. package/es/components/payConfig/upsert/offline/web.pc.module.less +4 -4
  21. package/es/components/payConfig/upsert/web.pc.module.less +10 -10
  22. package/es/context/BackendRuntimeContext.d.ts +1 -1
  23. package/es/data/i18n.js +3 -1
  24. package/es/oak-app-domain/ExtraFile/Schema.d.ts +3 -3
  25. package/es/oak-app-domain/ExtraFile/Storage.js +3 -3
  26. package/es/oak-app-domain/ExtraFile/Style.js +7 -5
  27. package/es/oak-app-domain/ExtraFile/locales/zh_CN.json +1 -1
  28. package/es/oak-app-domain/System/Storage.js +2 -1
  29. package/es/types/Exception.d.ts +3 -0
  30. package/es/types/Exception.js +5 -0
  31. package/es/utils/application.d.ts +1 -1
  32. package/es/utils/payClazz/WechatPay/WechatPay.js +3 -0
  33. package/es/watchers/pay.js +17 -0
  34. package/lib/aspects/withdraw.d.ts +8 -8
  35. package/lib/components/pay/detail/index.d.ts +3 -0
  36. package/lib/components/pay/detail/index.js +48 -33
  37. package/lib/context/BackendRuntimeContext.d.ts +1 -1
  38. package/lib/data/i18n.js +3 -1
  39. package/lib/oak-app-domain/ExtraFile/Schema.d.ts +3 -3
  40. package/lib/oak-app-domain/ExtraFile/Storage.js +3 -3
  41. package/lib/oak-app-domain/ExtraFile/Style.js +7 -5
  42. package/lib/oak-app-domain/ExtraFile/locales/zh_CN.json +1 -1
  43. package/lib/types/Exception.d.ts +3 -0
  44. package/lib/types/Exception.js +7 -1
  45. package/lib/utils/application.d.ts +1 -1
  46. package/lib/utils/payClazz/WechatPay/WechatPay.js +3 -0
  47. package/lib/watchers/pay.js +17 -0
  48. package/package.json +3 -3
@@ -5,6 +5,7 @@ import { isWeiXin } from 'oak-frontend-base/es/utils/utils';
5
5
  import { merge } from "oak-domain/lib/utils/lodash";
6
6
  import { canStartPay } from "../../../utils/wpProductFrontend";
7
7
  import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
8
+ import { StartPayFailure } from "../../../types/Exception";
8
9
  const PayRoutineDict = {
9
10
  wpProduct: {
10
11
  projection: {
@@ -20,21 +21,22 @@ const PayRoutineDict = {
20
21
  if (process.env.OAK_PLATFORM === 'wechatMp') {
21
22
  const { prepayMeta } = meta;
22
23
  if (prepayMeta) {
23
- const result = await wx.requestPayment(prepayMeta);
24
- process.env.NODE_ENV === 'development' && console.log(result);
24
+ try {
25
+ const result = await wx.requestPayment(prepayMeta);
26
+ process.env.NODE_ENV === 'development' && console.log(result);
27
+ }
28
+ catch (err) {
29
+ throw new StartPayFailure(err.errMsg.includes('cancel')
30
+ ? features.locales.t('startPayError.userCancel')
31
+ : features.locales.t('startPayError.unknown'));
32
+ }
25
33
  }
26
34
  else {
27
- features.message.setMessage({
28
- type: 'error',
29
- content: features.locales.t('startPayError.illegaPayData'),
30
- });
35
+ throw new StartPayFailure(features.locales.t('startPayError.illegalPrepayData'));
31
36
  }
32
37
  }
33
38
  else {
34
- features.message.setMessage({
35
- type: 'error',
36
- content: features.locales.t('startPayError.falseEnv', { env: 'wechatMp' }),
37
- });
39
+ throw new StartPayFailure(features.locales.t('startPayError.falseEnv', { env: 'wechatMp' }));
38
40
  }
39
41
  return;
40
42
  }
@@ -50,10 +52,7 @@ const PayRoutineDict = {
50
52
  });
51
53
  }
52
54
  else {
53
- features.message.setMessage({
54
- type: 'error',
55
- content: features.locales.t('startPayError.illegaPayData'),
56
- });
55
+ throw new StartPayFailure(features.locales.t('startPayError.illegalPrepayData'));
57
56
  }
58
57
  }
59
58
  }
@@ -111,7 +110,10 @@ export default OakComponent({
111
110
  },
112
111
  properties: {
113
112
  onClose: () => undefined,
113
+ onPaid: () => undefined,
114
+ onPayFailure: () => undefined,
114
115
  disableAutoPay: false,
116
+ closeWhenFailure: false,
115
117
  },
116
118
  data: {
117
119
  showCloseConfirmMp: false,
@@ -202,32 +204,45 @@ export default OakComponent({
202
204
  async confirmCloseMp() {
203
205
  await this.execute('close');
204
206
  this.cancelCloseMp();
207
+ const { onClose } = this.props;
208
+ onClose && onClose();
205
209
  },
206
210
  goBack() {
207
211
  this.navigateBack();
208
212
  },
209
213
  async startPay() {
214
+ const { onPaid, onClose, onPayFailure } = this.props;
210
215
  const { pay } = this.state;
211
- await PayRoutineDict[pay.entity].routine(pay, this.features);
216
+ try {
217
+ await PayRoutineDict[pay.entity].routine(pay, this.features);
218
+ onPaid && onPaid();
219
+ }
220
+ catch (err) {
221
+ if (this.props.closeWhenFailure) {
222
+ await this.execute(undefined, undefined, undefined, [
223
+ {
224
+ entity: 'pay',
225
+ operation: {
226
+ id: await generateNewIdAsync(),
227
+ action: 'close',
228
+ data: {},
229
+ filter: {
230
+ id: this.props.oakId,
231
+ },
232
+ },
233
+ }
234
+ ]);
235
+ onClose && onClose();
236
+ }
237
+ else {
238
+ onPayFailure && onPayFailure();
239
+ }
240
+ this.features.message.setMessage({
241
+ type: 'warning',
242
+ content: err.message,
243
+ });
244
+ }
212
245
  },
213
- /* async onWxBridgeReady(payMetaData: any): Promise<void> {
214
- return new Promise(
215
- (resolve, reject) => {
216
- WeixinJSBridge.invoke('getBrandWCPayRequest', payMetaData,
217
- function (res: { err_msg: string }) {
218
- if (res.err_msg == "get_brand_wcpay_request:ok") {
219
- // 使用以上方式判断前端返回,微信团队郑重提示:
220
- //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
221
- resolve(undefined as void);
222
- }
223
- else {
224
- reject(res.err_msg);
225
- }
226
- }
227
- );
228
- }
229
- );
230
- } */
231
246
  openChannelSelectMp() {
232
247
  this.setState({
233
248
  showChannelSelectMp: true,
@@ -196,4 +196,5 @@
196
196
  display: grid;
197
197
  grid-template-columns: 1fr 1fr;
198
198
  gap: 32rpx;
199
+ flex: 1;
199
200
  }
@@ -106,57 +106,62 @@
106
106
  </block>
107
107
  </view>
108
108
  <view class="padding"></view>
109
- <block wx:if="{{startPayable}}">
110
- <l-button
111
- size="long"
112
- bind:lintap="startPay"
113
- bg-color="#04BE02"
114
- >
115
- {{t('pay')}}
116
- </l-button>
117
- </block>
118
- <block wx:elif="{{oakExecutable === true}}">
119
- <view class="btn">
109
+ <view style="display:flex; align-items: center;justify-content: space-between;gap:16rpx;">
110
+ <block wx:if="{{closable && !oakExecutable}}">
120
111
  <l-button
121
- size="long"
122
- bind:lintap="executeMp"
123
- >
124
- {{t('common::action.update')}}
125
- </l-button>
112
+ type="error"
113
+ size="long"
114
+ bind:lintap="closeMp"
115
+ style="flex:1;"
116
+ >
117
+ {{t('pay:action.close')}}
118
+ </l-button>
119
+ <l-dialog
120
+ show="{{showCloseConfirmMp}}"
121
+ type="confirm"
122
+ title="{{t('cc.title')}}"
123
+ content="{{t('cc.content')}}"
124
+ bind:linconfirm="confirmCloseMp"
125
+ bind:lincancel="cancelCloseMp"
126
+ bind:lintap="cancelCloseMp"
127
+ />
128
+ </block>
129
+ <block wx:if="{{startPayable}}">
126
130
  <l-button
127
- plain="true"
128
- size="long"
129
- bind:lintap="resetMp"
130
- >
131
- {{t('common::reset')}}
132
- </l-button>
133
- </view>
134
- </block>
135
- <block wx:elif="{{closable}}">
136
- <l-button
137
- type="error"
138
- size="long"
139
- bind:lintap="closeMp"
140
- >
141
- {{t('pay:action.close')}}
142
- </l-button>
143
- <l-dialog
144
- show="{{showCloseConfirmMp}}"
145
- type="confirm"
146
- title="{{t('cc.title')}}"
147
- content="{{t('cc.content')}}"
148
- bind:linconfirm="confirmCloseMp"
149
- bind:lincancel="cancelCloseMp"
150
- bind:lintap="cancelCloseMp"
151
- />
152
- </block>
153
- <block wx:else>
154
- <l-button
155
- type="default"
156
- size="long"
157
- bind:lintap="goBack"
158
- >
159
- {{t('common::back')}}
160
- </l-button>
161
- </block>
131
+ size="long"
132
+ bind:lintap="startPay"
133
+ type="success"
134
+ style="flex:1;"
135
+ >
136
+ {{t('pay')}}
137
+ </l-button>
138
+ </block>
139
+ <block wx:elif="{{oakExecutable === true}}">
140
+ <view class="btn">
141
+ <l-button
142
+ plain="true"
143
+ size="long"
144
+ bind:lintap="resetMp"
145
+ >
146
+ {{t('common::reset')}}
147
+ </l-button>
148
+ <l-button
149
+ size="long"
150
+ bind:lintap="executeMp"
151
+ >
152
+ {{t('common::action.update')}}
153
+ </l-button>
154
+ </view>
155
+ </block>
156
+ <block wx:elif="{{!closable}}">
157
+ <l-button
158
+ type="default"
159
+ size="long"
160
+ bind:lintap="goBack"
161
+ style="flex:1;"
162
+ >
163
+ {{t('common::back')}}
164
+ </l-button>
165
+ </block>
166
+ </view>
162
167
  </view>
@@ -16,7 +16,9 @@
16
16
  "wechatPay": "微信支付",
17
17
  "startPayError": {
18
18
  "illegalPrepayData": "没有有效的预支付数据,可能后台是运行在开发环境,请检查",
19
- "falseEnv": "该订单渠道【%{env}】不匹配当前环境"
19
+ "falseEnv": "该订单渠道【%{env}】不匹配当前环境",
20
+ "userCancel": "用户取消支付",
21
+ "unknown": "用户支付失败"
20
22
  },
21
23
  "type": {
22
24
  "label": "支付类型",
@@ -152,7 +152,18 @@ export default function Render(props) {
152
152
  const { t, update, execute, clean, goBack, startPay } = props.methods;
153
153
  if (pay) {
154
154
  const { iState, price, entity } = pay;
155
- let BtnPart = startPayable ? (<Button block style={{ backgroundColor: '#04BE02' }} className={Styles.btnWechatPay} onClick={() => startPay()}>
155
+ let BtnPart = closable ? (<Button block color="danger" onClick={() => {
156
+ Modal.confirm({
157
+ title: t('cc.title'),
158
+ content: t('cc.content'),
159
+ onConfirm: async () => {
160
+ await execute('close');
161
+ onClose();
162
+ }
163
+ });
164
+ }}>
165
+ {t('pay:action.close')}
166
+ </Button>) : startPayable ? (<Button block style={{ backgroundColor: '#04BE02' }} className={Styles.btnWechatPay} onClick={() => startPay()}>
156
167
  {t('pay')}
157
168
  </Button>) : oakExecutable === true ? (<>
158
169
  <div className={Styles.btnItem}>
@@ -165,18 +176,7 @@ export default function Render(props) {
165
176
  {t('common::reset')}
166
177
  </Button>
167
178
  </div>
168
- </>) : closable ? (<Button block color="danger" onClick={() => {
169
- Modal.confirm({
170
- title: t('cc.title'),
171
- content: t('cc.content'),
172
- onConfirm: async () => {
173
- await execute('close');
174
- onClose();
175
- }
176
- });
177
- }}>
178
- {t('pay:action.close')}
179
- </Button>) : (<Button block color="primary" onClick={goBack}>
179
+ </>) : (<Button block color="primary" onClick={goBack}>
180
180
  {t('common::back')}
181
181
  </Button>);
182
182
  return (<div className={Styles.container}>
@@ -1,5 +1,5 @@
1
- .container {
2
- display: flex;
3
- flex-direction: column;
4
- width: 100%;
1
+ .container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
5
  }
@@ -1,11 +1,11 @@
1
- .empty {
2
- min-height: 600px;
3
- }
4
-
5
- .container {
6
- width: 100%;
7
- display: flex;
8
- flex-direction: column;
9
- align-items: center;
10
- justify-content: center;
1
+ .empty {
2
+ min-height: 600px;
3
+ }
4
+
5
+ .container {
6
+ width: 100%;
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ justify-content: center;
11
11
  }
@@ -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").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
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;
package/es/data/i18n.js CHANGED
@@ -197,7 +197,9 @@ const i18ns = [
197
197
  "wechatPay": "微信支付",
198
198
  "startPayError": {
199
199
  "illegalPrepayData": "没有有效的预支付数据,可能后台是运行在开发环境,请检查",
200
- "falseEnv": "该订单渠道【%{env}】不匹配当前环境"
200
+ "falseEnv": "该订单渠道【%{env}】不匹配当前环境",
201
+ "userCancel": "用户取消支付",
202
+ "unknown": "用户支付失败"
201
203
  },
202
204
  "type": {
203
205
  "label": "支付类型",
@@ -10,7 +10,7 @@ import * as ArticleMenu from "../ArticleMenu/Schema";
10
10
  import * as SessionMessage from "../SessionMessage/Schema";
11
11
  import * as User from "../User/Schema";
12
12
  export type OpSchema = EntityShape & {
13
- origin: "qiniu" | "wechat" | "unknown" | "ctyun";
13
+ origin: "qiniu" | "wechat" | "ctyun" | "aliyun" | "tencent" | "unknown";
14
14
  type: "image" | "video" | "audio" | "file";
15
15
  bucket?: String<32> | null;
16
16
  objectId?: String<64> | null;
@@ -33,7 +33,7 @@ export type OpSchema = EntityShape & {
33
33
  };
34
34
  export type OpAttr = keyof OpSchema;
35
35
  export type Schema = EntityShape & {
36
- origin: "qiniu" | "wechat" | "unknown" | "ctyun";
36
+ origin: "qiniu" | "wechat" | "ctyun" | "aliyun" | "tencent" | "unknown";
37
37
  type: "image" | "video" | "audio" | "file";
38
38
  bucket?: String<32> | null;
39
39
  objectId?: String<64> | null;
@@ -66,7 +66,7 @@ type AttrFilter = {
66
66
  $$createAt$$: Q_DateValue;
67
67
  $$seq$$: Q_NumberValue;
68
68
  $$updateAt$$: Q_DateValue;
69
- origin: Q_EnumValue<"qiniu" | "wechat" | "unknown" | "ctyun">;
69
+ origin: Q_EnumValue<"qiniu" | "wechat" | "ctyun" | "aliyun" | "tencent" | "unknown">;
70
70
  type: Q_EnumValue<"image" | "video" | "audio" | "file">;
71
71
  bucket: Q_StringValue;
72
72
  objectId: Q_StringValue;
@@ -4,7 +4,7 @@ export const desc = {
4
4
  origin: {
5
5
  notNull: true,
6
6
  type: "enum",
7
- enumeration: ["qiniu", "wechat", "unknown", "ctyun"]
7
+ enumeration: ["qiniu", "wechat", "ctyun", "aliyun", "tencent", "unknown"]
8
8
  },
9
9
  type: {
10
10
  notNull: true,
@@ -120,8 +120,8 @@ export const desc = {
120
120
  },
121
121
  {
122
122
  name: '$$deleteAt$$',
123
- }
124
- ]
123
+ },
124
+ ],
125
125
  }
126
126
  ]
127
127
  };
@@ -1,9 +1,11 @@
1
1
  export const style = {
2
2
  color: {
3
3
  origin: {
4
- qiniu: '#0000FF',
5
- wechat: '#008000',
6
- ctyun: '#6495ED',
4
+ qiniu: '#37caff',
5
+ wechat: '#2aae67',
6
+ ctyun: '#ff0000',
7
+ aliyun: '#1677ff',
8
+ tencent: '#0052d9',
7
9
  unknown: '#A9A9A9',
8
10
  },
9
11
  type: {
@@ -16,6 +18,6 @@ export const style = {
16
18
  success: '#008000',
17
19
  failed: '#FF0000',
18
20
  uploading: '#0000FF',
19
- }
20
- }
21
+ },
22
+ },
21
23
  };
@@ -1 +1 @@
1
- { "name": "文件", "attr": { "origin": "源", "type": "类型", "bucket": "桶", "objectId": "对象编号", "tag1": "标签一", "tag2": "标签二", "filename": "文件名", "md5": "md5", "entity": "关联对象", "entityId": "关联对象id", "extra1": "额外信息", "extra2": "非结构化额外信息", "extension": "后缀名", "size": "文件大小", "sort": "排序", "fileType": "文件类型", "isBridge": "是否桥接访问", "uploadState": "上传状态", "uploadMeta": "上传需要的metadata", "application": "来源应用" }, "v": { "origin": { "qiniu": "七牛云", "ctyun": "天翼云", "wechat": "微信", "unknown": "未知" }, "type": { "image": "图像", "video": "视频", "audio": "音频", "file": "文件" }, "uploadState": { "success": "上传成功", "failed": "上传失败", "uploading": "上传中" } } }
1
+ { "name": "文件", "attr": { "origin": "源", "type": "类型", "bucket": "桶", "objectId": "对象编号", "tag1": "标签一", "tag2": "标签二", "filename": "文件名", "md5": "md5", "entity": "关联对象", "entityId": "关联对象id", "extra1": "额外信息", "extra2": "非结构化额外信息", "extension": "后缀名", "size": "文件大小", "sort": "排序", "fileType": "文件类型", "isBridge": "是否桥接访问", "uploadState": "上传状态", "uploadMeta": "上传需要的metadata", "application": "来源应用" }, "v": { "origin": { "qiniu": "七牛云", "ctyun": "天翼云", "wechat": "微信", "aliyun": "阿里云", "tencent": "腾讯云", "unknown": "未知" }, "type": { "image": "图像", "video": "视频", "audio": "音频", "file": "文件" }, "uploadState": { "success": "上传成功", "failed": "上传失败", "uploading": "上传中" } } }
@@ -34,7 +34,8 @@ export const desc = {
34
34
  : {
35
35
  type: "object"
36
36
  },
37
- entity: {
37
+ entity // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
38
+ : {
38
39
  type: "varchar",
39
40
  params: {
40
41
  length: 32
@@ -16,4 +16,7 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
16
16
  export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
17
17
  constructor(message?: string);
18
18
  }
19
+ export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
20
+ constructor(message: string);
21
+ }
19
22
  export declare function makeException<ED extends EntityDict>(msg: string | object): OakException<ED> | undefined;
@@ -19,6 +19,11 @@ export class RefundExceedMax extends OakException {
19
19
  super(message || '可退款的总额不足');
20
20
  }
21
21
  }
22
+ export class StartPayFailure extends OakException {
23
+ constructor(message) {
24
+ super(message);
25
+ }
26
+ }
22
27
  export function makeException(msg) {
23
28
  const data = typeof msg === 'string' ? JSON.parse(msg) : msg;
24
29
  let exception = makeDepedentException(data);
@@ -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").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
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;
@@ -20,6 +20,7 @@ const REFUND_STATE_MATRIX = {
20
20
  "ABNORMAL": "refunding",
21
21
  "PROCESSING": 'refunding',
22
22
  };
23
+ const PREPAY_TIMEOUT = 15 * 60 * 1000; // 默认订单15分钟过期
23
24
  export default class WechatPay extends WechatPayDebug {
24
25
  wechatPay;
25
26
  refundGapDays;
@@ -169,6 +170,8 @@ export default class WechatPay extends WechatPayDebug {
169
170
  throw new Error('本支付方法还没来的及实现呢');
170
171
  }
171
172
  }
173
+ // pay加一个过期时间,到期自动close
174
+ data.timeoutAt = Date.now() + PREPAY_TIMEOUT;
172
175
  }
173
176
  async getState(pay) {
174
177
  const outTradeNo = compressTo32(pay.id);
@@ -48,6 +48,23 @@ const watchers = [
48
48
  actionData: {
49
49
  refundable: false,
50
50
  }
51
+ },
52
+ {
53
+ name: '当pay达到禁止退款期限时,关闭退款允许',
54
+ entity: 'pay',
55
+ filter: () => {
56
+ const now = Date.now();
57
+ return {
58
+ iState: {
59
+ $in: ['unpaid', 'paying'],
60
+ },
61
+ timeoutAt: {
62
+ $lt: now,
63
+ },
64
+ };
65
+ },
66
+ action: 'close',
67
+ actionData: {},
51
68
  }
52
69
  ];
53
70
  export default watchers;
@@ -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, "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;
15
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
16
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | 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, "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;
29
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
30
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | 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, "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;
43
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
44
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | 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, "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;
57
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
58
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | 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;