oak-pay-business 2.2.4 → 2.2.6

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 (55) hide show
  1. package/es/aspects/withdraw.d.ts +4 -4
  2. package/es/components/AbstractComponents.d.ts +5 -8
  3. package/es/components/account/detail/index.json +1 -0
  4. package/es/components/account/detail/index.less +1 -1
  5. package/es/components/account/detail/index.xml +6 -3
  6. package/es/components/accountOper/list/index.js +13 -1
  7. package/es/components/deposit/new/index.xml +0 -1
  8. package/es/components/order/list/web.pc.js +1 -1
  9. package/es/components/pay/list/web.pc.js +1 -1
  10. package/es/components/refund/list/web.pc.js +1 -1
  11. package/es/components/sysAccount/transferList/web.pc.js +1 -1
  12. package/es/components/withdrawTransfer/list/web.pc.js +2 -2
  13. package/es/context/BackendRuntimeContext.d.ts +1 -1
  14. package/es/entities/Refund.d.ts +2 -1
  15. package/es/entities/Refund.js +2 -1
  16. package/es/oak-app-domain/Refund/Schema.d.ts +7 -1
  17. package/es/oak-app-domain/Refund/Storage.js +3 -0
  18. package/es/oak-app-domain/Refund/locales/zh_CN.json +1 -1
  19. package/es/triggers/refund.js +1 -1
  20. package/es/types/Exception.d.ts +4 -1
  21. package/es/types/Exception.js +3 -3
  22. package/es/types/PayClazz.d.ts +8 -2
  23. package/es/utils/application.d.ts +1 -1
  24. package/es/utils/payClazz/Account.d.ts +6 -1
  25. package/es/utils/payClazz/Account.js +3 -3
  26. package/es/utils/payClazz/Offline.d.ts +6 -1
  27. package/es/utils/payClazz/Offline.js +3 -4
  28. package/es/utils/payClazz/WechatPay/WechatPay.d.ts +10 -5
  29. package/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts +7 -2
  30. package/es/utils/payClazz/WechatPay/WechatPay.debug.js +4 -4
  31. package/es/utils/payClazz/WechatPay/WechatPay.js +98 -14
  32. package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
  33. package/lib/aspects/withdraw.d.ts +8 -8
  34. package/lib/context/BackendRuntimeContext.d.ts +1 -1
  35. package/lib/entities/Refund.d.ts +2 -1
  36. package/lib/entities/Refund.js +2 -1
  37. package/lib/oak-app-domain/Refund/Schema.d.ts +7 -1
  38. package/lib/oak-app-domain/Refund/Storage.js +3 -0
  39. package/lib/oak-app-domain/Refund/locales/zh_CN.json +1 -1
  40. package/lib/oak-app-domain/System/Storage.js +2 -1
  41. package/lib/triggers/refund.js +1 -1
  42. package/lib/types/Exception.d.ts +4 -1
  43. package/lib/types/Exception.js +5 -5
  44. package/lib/types/PayClazz.d.ts +8 -2
  45. package/lib/utils/application.d.ts +1 -1
  46. package/lib/utils/payClazz/Account.d.ts +6 -1
  47. package/lib/utils/payClazz/Account.js +3 -3
  48. package/lib/utils/payClazz/Offline.d.ts +6 -1
  49. package/lib/utils/payClazz/Offline.js +3 -4
  50. package/lib/utils/payClazz/WechatPay/WechatPay.d.ts +10 -5
  51. package/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts +7 -2
  52. package/lib/utils/payClazz/WechatPay/WechatPay.debug.js +4 -4
  53. package/lib/utils/payClazz/WechatPay/WechatPay.js +97 -13
  54. package/package.json +4 -4
  55. package/src/entities/Refund.ts +3 -1
@@ -3,7 +3,7 @@ export declare function getWithdrawCreateData(params: {
3
3
  accountId: string;
4
4
  price: number;
5
5
  withdrawAccountId?: string;
6
- }, context: BRC): Promise<(Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
6
+ }, context: BRC): Promise<(Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
7
7
  id: string;
8
8
  } & {
9
9
  accountId: string;
@@ -17,7 +17,7 @@ export declare function getWithdrawCreateData(params: {
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;
20
- }) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
20
+ }) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
21
21
  id: string;
22
22
  } & {
23
23
  accountId: string;
@@ -31,7 +31,7 @@ export declare function getWithdrawCreateData(params: {
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;
34
- }) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
34
+ }) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
35
35
  id: string;
36
36
  } & {
37
37
  account?: undefined;
@@ -45,7 +45,7 @@ export declare function getWithdrawCreateData(params: {
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;
48
- }) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
48
+ }) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
49
49
  id: string;
50
50
  } & {
51
51
  account?: undefined;
@@ -2,6 +2,7 @@
2
2
  * 抽象组件在业务层根据EntityDict的重新声明
3
3
  * by Xc 20230807
4
4
  */
5
+ import React from 'react';
5
6
  import { EntityDict } from '../oak-app-domain';
6
7
  import { ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, ListButtonProps, OakAbsAttrUpsertDef } from 'oak-frontend-base';
7
8
  declare const FilterPanel: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
@@ -20,13 +21,8 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
20
21
  rowSelection?: any;
21
22
  hideHeader?: boolean | undefined;
22
23
  disableSerialNumber?: boolean | undefined;
23
- size?: "small" | "middle" | "large" | undefined;
24
- scroll?: ({
25
- x?: string | number | true | undefined;
26
- y?: string | number | undefined;
27
- } & {
28
- scrollToFirstRowOnChange?: boolean | undefined;
29
- }) | undefined;
24
+ size?: "large" | "middle" | "small" | undefined;
25
+ scroll?: any;
30
26
  locale?: any;
31
27
  opWidth?: number | undefined;
32
28
  }>) => React.ReactElement;
@@ -46,10 +42,11 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
46
42
  tablePagination?: any;
47
43
  rowSelection?: any;
48
44
  disableSerialNumber?: boolean | undefined;
49
- size?: "small" | "middle" | "large" | undefined;
45
+ size?: "large" | "middle" | "small" | undefined;
50
46
  scroll?: any;
51
47
  locale?: any;
52
48
  opWidth?: number | undefined;
49
+ oakPath?: string | undefined;
53
50
  }) => React.ReactElement;
54
51
  declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
55
52
  column?: number | Record<Breakpoint, number> | undefined;
@@ -2,6 +2,7 @@
2
2
  "usingComponents": {
3
3
  "l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
4
4
  "l-popup": "@oak-frontend-base/miniprogram_npm/lin-ui/popup/index",
5
+ "l-arc-popup": "@oak-frontend-base/miniprogram_npm/lin-ui/arc-popup/index",
5
6
  "l-dialog": "@oak-frontend-base/miniprogram_npm/lin-ui/dialog/index",
6
7
  "deposit-new": "../../deposit/new/index"
7
8
  }
@@ -90,8 +90,8 @@
90
90
 
91
91
  .ad-container {
92
92
  padding: 24rpx;
93
- margin-bottom: 12rpx;
94
93
  background-color: white;
94
+ .safe-area-inset-bottom();
95
95
  }
96
96
 
97
97
  .uf {
@@ -47,10 +47,13 @@
47
47
  </view>
48
48
  </view>
49
49
  <block wx:if="{{depositOpen}}">
50
- <l-popup
50
+ <l-arc-popup
51
51
  show="{{depositOpen}}"
52
- content-align="bottom"
52
+ direction="bottom"
53
53
  bind:lintap="onDepositModalClose"
54
+ min-height="200"
55
+ max-height="800"
56
+ z-index="1000"
54
57
  >
55
58
  <view class="ad-container">
56
59
  <deposit-new
@@ -75,7 +78,7 @@
75
78
  </l-button>
76
79
  </view>
77
80
  </view>
78
- </l-popup>
81
+ </l-arc-popup>
79
82
  </block>
80
83
  <block wx:if="{{ufOpen}}">
81
84
  <l-dialog
@@ -21,6 +21,7 @@ export default OakComponent({
21
21
  chooseType: false,
22
22
  pickerStart: dayjs().subtract(10, 'y').startOf('m').format('YYYY-MM-DD'),
23
23
  pickerEnd: dayjs().startOf('m').format('YYYY-MM-DD'),
24
+ refreshing: false,
24
25
  },
25
26
  filters: [
26
27
  {
@@ -163,6 +164,17 @@ export default OakComponent({
163
164
  type: key,
164
165
  }, () => this.setTypeFilter());
165
166
  this.closeChooseTypeMp();
166
- }
167
+ },
168
+ bindrefresherrefresh() {
169
+ this.setState({
170
+ refreshing: true
171
+ });
172
+ this.refresh();
173
+ setTimeout(() => {
174
+ this.setState({
175
+ refreshing: false
176
+ });
177
+ }, 1000);
178
+ },
167
179
  }
168
180
  });
@@ -4,7 +4,6 @@
4
4
  <l-input
5
5
  label="{{t('common::pay.symbol')}}"
6
6
  label-width="{{70}}"
7
- focus="{{true}}"
8
7
  show-row="{{false}}"
9
8
  value="{{priceStr || ''}}"
10
9
  type="number"
@@ -52,7 +52,7 @@ export default function Render(props) {
52
52
  label: t('order:attr.settled'),
53
53
  width: 100,
54
54
  }
55
- ]}/>
55
+ ]} oakPath={oakFullpath}/>
56
56
  </div>);
57
57
  }
58
58
  return null;
@@ -135,7 +135,7 @@ export default function Render(props) {
135
135
  setSpId(row.id);
136
136
  }
137
137
  }
138
- }}/>
138
+ }} oakPath={oakFullpath}/>
139
139
  <Modal title={t('csp.title')} width={600} destroyOnClose open={!!spId} footer={null} onCancel={() => {
140
140
  clean();
141
141
  setSpId('');
@@ -118,7 +118,7 @@ export default function Render(props) {
118
118
  setUpsertId(row.id);
119
119
  setUpdateAction(action);
120
120
  }
121
- }}/>
121
+ }} oakPath={oakFullpath}/>
122
122
  {upsertRow && <Modal open={!!upsertId} onCancel={() => {
123
123
  clean();
124
124
  setUpsertId('');
@@ -39,7 +39,7 @@ export default function Render(props) {
39
39
  label: t('withdrawTransfer:attr.externalId'),
40
40
  width: 120,
41
41
  },
42
- ]} disabledOp={true}/>);
42
+ ]} disabledOp={true} oakPath={oakFullpath}/>);
43
43
  }
44
44
  return (<Result status="404" title={t('common::noData')}/>);
45
45
  }
@@ -89,7 +89,7 @@ export default function Render(props) {
89
89
  ]} onAction={(row, action) => {
90
90
  setUpdateId(row.id, action);
91
91
  setUpdateAction(action);
92
- }}/>
92
+ }} oakPath={oakFullpath}/>
93
93
  {updateRow && <Modal open={!!updateId} onCancel={() => {
94
94
  setUpdateId('', '');
95
95
  setUpdateAction('');
@@ -124,7 +124,7 @@ export default function Render(props) {
124
124
  </Form.Item>
125
125
  <Form.Item label={t('label.transferActualPrice')}>
126
126
  <span className={Styles.actualPrice}>
127
- {`${t('common::pay.symbol')} ${ThousandCont(ToYuan(updateRow.price - updateRow.loss), 2)}`}
127
+ {`${t('common::pay.symbol')} ${ThousandCont(ToYuan(updateRow.price - updateRow.loss), 2)}`}
128
128
  </span>
129
129
  </Form.Item>
130
130
  {updateAction === 'succeed' && (<Form.Item label={t('withdrawTransfer:attr.externalId')}>
@@ -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").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | 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").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | 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;
@@ -1,4 +1,4 @@
1
- import { String, Text, Price } from 'oak-domain/lib/types/DataType';
1
+ import { String, Text, Price, Datetime } from 'oak-domain/lib/types/DataType';
2
2
  import { EntityShape } from 'oak-domain/lib/types/Entity';
3
3
  import { EntityDesc, ActionDef } from 'oak-domain/lib/types';
4
4
  import { Schema as User } from './User';
@@ -14,6 +14,7 @@ export interface Schema extends EntityShape {
14
14
  price: Price;
15
15
  creator: User;
16
16
  reason?: Text;
17
+ successAt?: Datetime;
17
18
  opers: AccountOper[];
18
19
  }
19
20
  export type IAction = 'succeed' | 'fail';
@@ -20,7 +20,8 @@ export const entityDesc = {
20
20
  iState: '状态',
21
21
  creator: '创建者',
22
22
  reason: '原因',
23
- opers: '相关账户操作'
23
+ opers: '相关账户操作',
24
+ successAt: '退款成功时间'
24
25
  },
25
26
  action: {
26
27
  succeed: '退款成功',
@@ -3,7 +3,7 @@ import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFil
3
3
  import { OneOf } from "oak-domain/lib/types/Polyfill";
4
4
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
5
5
  import { Action, ParticularAction, IState } from "./Action";
6
- import { Price, String, Text } from "oak-domain/lib/types/DataType";
6
+ import { Price, String, Text, Datetime } from "oak-domain/lib/types/DataType";
7
7
  import * as Withdraw from "../Withdraw/Schema";
8
8
  import * as Pay from "../Pay/Schema";
9
9
  import * as User from "../User/Schema";
@@ -18,6 +18,7 @@ export type OpSchema = EntityShape & {
18
18
  price: Price;
19
19
  creatorId: ForeignKey<"user">;
20
20
  reason?: Text | null;
21
+ successAt?: Datetime | null;
21
22
  iState?: IState | null;
22
23
  };
23
24
  export type OpAttr = keyof OpSchema;
@@ -30,6 +31,7 @@ export type Schema = EntityShape & {
30
31
  price: Price;
31
32
  creatorId: ForeignKey<"user">;
32
33
  reason?: Text | null;
34
+ successAt?: Datetime | null;
33
35
  iState?: IState | null;
34
36
  withdraw?: Withdraw.Schema | null;
35
37
  pay: Pay.Schema;
@@ -57,6 +59,7 @@ type AttrFilter = {
57
59
  creatorId: Q_StringValue;
58
60
  creator: User.Filter;
59
61
  reason: Q_StringValue;
62
+ successAt: Q_DateValue;
60
63
  iState: Q_EnumValue<IState>;
61
64
  sysAccountOper$refund: SysAccountOper.Filter & SubQueryPredicateMetadata;
62
65
  accountOper$entity: AccountOper.Filter & SubQueryPredicateMetadata;
@@ -80,6 +83,7 @@ export type Projection = {
80
83
  creatorId?: number;
81
84
  creator?: User.Projection;
82
85
  reason?: number;
86
+ successAt?: number;
83
87
  iState?: number;
84
88
  sysAccountOper$refund?: SysAccountOper.Selection & {
85
89
  $entity: "sysAccountOper";
@@ -134,6 +138,8 @@ export type SortAttr = {
134
138
  creator: User.SortAttr;
135
139
  } | {
136
140
  reason: number;
141
+ } | {
142
+ successAt: number;
137
143
  } | {
138
144
  iState: number;
139
145
  } | {
@@ -35,6 +35,9 @@ export const desc = {
35
35
  reason: {
36
36
  type: "text"
37
37
  },
38
+ successAt: {
39
+ type: "datetime"
40
+ },
38
41
  iState: {
39
42
  type: "enum",
40
43
  enumeration: ["refunding", "successful", "failed"]
@@ -1 +1 @@
1
- { "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
1
+ { "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作", "successAt": "退款成功时间" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
@@ -322,7 +322,7 @@ const triggers = [
322
322
  return;
323
323
  }
324
324
  }
325
- const data = await payClazz.refund(refund);
325
+ const data = await payClazz.refund(refund, context);
326
326
  if (data) {
327
327
  assert(data.externalId);
328
328
  const closeFn = context.openRootMode();
@@ -1,6 +1,6 @@
1
1
  import { OakException, OpRecord } from 'oak-domain/lib/types';
2
2
  import { EntityDict } from '../oak-app-domain/index';
3
- export declare class ExternalPrePayException<ED extends EntityDict> extends OakException<ED> {
3
+ export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
4
4
  reason: any;
5
5
  constructor(reason: any, message?: string);
6
6
  getSerialData(): {
@@ -8,6 +8,9 @@ export declare class ExternalPrePayException<ED extends EntityDict> extends OakE
8
8
  name: string;
9
9
  message: string;
10
10
  opRecords: OpRecord<ED>[];
11
+ tag1: string | undefined;
12
+ tag2: boolean | undefined;
13
+ tag3: any;
11
14
  };
12
15
  }
13
16
  export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
@@ -1,9 +1,9 @@
1
1
  import { OakException } from 'oak-domain/lib/types';
2
2
  import makeDepedentException from './DependentExceptions';
3
- export class ExternalPrePayException extends OakException {
3
+ export class ExternalPayUtilException extends OakException {
4
4
  reason;
5
5
  constructor(reason, message) {
6
- super(message || '调用外部支付预下单接口失败');
6
+ super(message || '调用外部支付渠道接口失败');
7
7
  this.reason = reason;
8
8
  }
9
9
  getSerialData() {
@@ -28,7 +28,7 @@ export function makeException(msg) {
28
28
  const { name, message } = data;
29
29
  switch (name) {
30
30
  case 'ExternalPrePayException': {
31
- exception = new ExternalPrePayException(data.reason, message);
31
+ exception = new ExternalPayUtilException(data.reason, message);
32
32
  break;
33
33
  }
34
34
  case 'RefundExceedMax': {
@@ -1,6 +1,7 @@
1
1
  import { EntityDict } from '../oak-app-domain';
2
2
  import { BRC } from '../types/RuntimeCxt';
3
3
  type IState = EntityDict['pay']['OpSchema']['iState'];
4
+ type RefundIState = EntityDict['refund']['OpSchema']['iState'];
4
5
  export default interface PayClazz {
5
6
  getAccountEntity(): [string, string];
6
7
  getAccountAmount(context: BRC): Promise<number>;
@@ -16,8 +17,13 @@ export default interface PayClazz {
16
17
  extra?: EntityDict['pay']['Update']['data'];
17
18
  price?: number;
18
19
  }>;
19
- refund(refund: EntityDict['refund']['OpSchema']): Promise<EntityDict['refund']['Update']['data'] | undefined>;
20
- closeRefund(refund: EntityDict['refund']['OpSchema']): Promise<void>;
20
+ decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
21
+ refundId: string;
22
+ iState: RefundIState;
23
+ extra?: EntityDict['refund']['Update']['data'];
24
+ price?: number;
25
+ }>;
26
+ refund(refund: EntityDict['refund']['Schema'], context: BRC): Promise<EntityDict['refund']['Update']['data'] | undefined>;
21
27
  getRefundableAt(successAt: number): number;
22
28
  getRefundState(refund: EntityDict['refund']['OpSchema']): Promise<[EntityDict['refund']['OpSchema']['iState'], EntityDict['refund']['Update']['data'] | undefined]>;
23
29
  }
@@ -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").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | 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").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | 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;
@@ -9,13 +9,18 @@ export default class Account implements PayClazz {
9
9
  calcPayTax(): [number, string, string];
10
10
  getRefundableAt(successAt: number): number;
11
11
  refund(refund: EntityDict['refund']['Schema']): Promise<undefined>;
12
- closeRefund(refund: EntityDict['refund']['Schema']): Promise<void>;
13
12
  getRefundState(refund: EntityDict['refund']['Schema']): Promise<[EntityDict['refund']['Schema']['iState'], undefined]>;
14
13
  decodePayNotification(params: Record<string, any>, body: any): Promise<{
15
14
  payId: string;
16
15
  iState: string | null | undefined;
17
16
  extra?: EntityDict['pay']['Update']['data'] | undefined;
18
17
  }>;
18
+ decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
19
+ refundId: string;
20
+ iState: string | null | undefined;
21
+ extra?: EntityDict['refund']['Update']['data'] | undefined;
22
+ price?: number | undefined;
23
+ }>;
19
24
  prepay(pay: EntityDict['pay']['Schema'], data: EntityDict['pay']['Update']['data'], context: BRC): Promise<void>;
20
25
  getState(pay: EntityDict['pay']['Schema']): Promise<[string, EntityDict['pay']['Update']['data']]>;
21
26
  close(pay: EntityDict['pay']['Schema']): Promise<void>;
@@ -23,15 +23,15 @@ export default class Account {
23
23
  async refund(refund) {
24
24
  return;
25
25
  }
26
- async closeRefund(refund) {
27
- return;
28
- }
29
26
  async getRefundState(refund) {
30
27
  return ['refuding', undefined];
31
28
  }
32
29
  decodePayNotification(params, body) {
33
30
  throw new Error("account类型的pay不需调用此接口");
34
31
  }
32
+ decodeRefundNotification(params, body) {
33
+ throw new Error("account类型的pay不需调用此接口");
34
+ }
35
35
  async prepay(pay, data, context) {
36
36
  const { entity, entityId, price } = pay;
37
37
  assert(entity === 'account' && entityId);
@@ -13,13 +13,18 @@ export default class Offline implements PayClazz {
13
13
  calcPayTax(price: number): [number, string, string];
14
14
  getRefundableAt(successTime: number): number;
15
15
  refund(refund: RefundOpSchema): Promise<UpdateOperationData | undefined>;
16
- closeRefund(refund: RefundOpSchema): Promise<void>;
17
16
  getRefundState(refund: RefundOpSchema): Promise<[PayOpSchema['iState'], PayUpdateData | undefined]>;
18
17
  decodePayNotification(params: Record<string, any>, body: any): Promise<{
19
18
  payId: string;
20
19
  iState: string | null | undefined;
21
20
  extra?: PayUpdateData | undefined;
22
21
  }>;
22
+ decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
23
+ refundId: string;
24
+ iState: string | null | undefined;
25
+ extra?: EntityDict['refund']['Update']['data'] | undefined;
26
+ price?: number | undefined;
27
+ }>;
23
28
  prepay(pay: PayOpSchema, data: PayUpdateData, context: BRC): Promise<void>;
24
29
  getState(pay: PayOpSchema): Promise<[string, PayUpdateData]>;
25
30
  close(pay: PayOpSchema): Promise<void>;
@@ -49,10 +49,6 @@ export default class Offline {
49
49
  // 啥也不做
50
50
  return;
51
51
  }
52
- async closeRefund(refund) {
53
- // 啥也不做
54
- return;
55
- }
56
52
  async getRefundState(refund) {
57
53
  const { iState } = refund;
58
54
  assert(iState === 'refunding');
@@ -61,6 +57,9 @@ export default class Offline {
61
57
  decodePayNotification(params, body) {
62
58
  throw new Error("offline类型的pay不需调用此接口");
63
59
  }
60
+ decodeRefundNotification(params, body) {
61
+ throw new Error("offline类型的pay不需调用此接口");
62
+ }
64
63
  async prepay(pay, data, context) {
65
64
  data.phantom3 = Math.ceil(Math.random() * 1000000);
66
65
  return;
@@ -3,7 +3,7 @@ import PayClazz from "../../../types/PayClazz";
3
3
  import { BRC } from "../../../types/RuntimeCxt";
4
4
  import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs';
5
5
  import { EntityDict } from "../../../oak-app-domain";
6
- import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData } from "../../../oak-app-domain/Refund/Schema";
6
+ import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData, Schema as Refund } from "../../../oak-app-domain/Refund/Schema";
7
7
  import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema';
8
8
  import WechatPayDebug from './WechatPay.debug';
9
9
  export default class WechatPay extends WechatPayDebug implements PayClazz {
@@ -19,10 +19,9 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
19
19
  static MIN_REFUND_DAYS_GAP: number;
20
20
  static DEFAULT_REFUND_DAYS_GAP: number;
21
21
  constructor(wpProduct: WpProduct, appId: string);
22
- refund(refund: OpRefund): Promise<RefundUpdateData | undefined>;
23
- closeRefund(refund: OpRefund): Promise<void>;
24
- getRefundState(refund: OpRefund): Promise<[string | null | undefined, PayUpdateData | undefined]>;
25
- private analyzePrepayResult;
22
+ refund(refund: Refund, context: BRC): Promise<RefundUpdateData | undefined>;
23
+ getRefundState(refund: OpRefund): Promise<[string | null | undefined, RefundUpdateData | undefined]>;
24
+ private analyzeResult;
26
25
  private caclRefundDeadline;
27
26
  prepay(pay: Pay, data: PayUpdateData, context: BRC): Promise<void>;
28
27
  getState(pay: OpPay): Promise<[EntityDict['pay']['OpSchema']['iState'], PayUpdateData]>;
@@ -32,5 +31,11 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
32
31
  iState: EntityDict['pay']['OpSchema']['iState'];
33
32
  extra?: PayUpdateData;
34
33
  }>;
34
+ decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
35
+ refundId: string;
36
+ iState: string | null | undefined;
37
+ extra?: RefundUpdateData | undefined;
38
+ price?: number | undefined;
39
+ }>;
35
40
  getRefundableAt(successAt: number): number;
36
41
  }
@@ -8,13 +8,18 @@ export declare function registerGetPayStateResult(payState: NonNullable<EntityDi
8
8
  export default class WechatPay implements PayClazz {
9
9
  wpProduct: WpProduct;
10
10
  constructor(wpProduct: WpProduct);
11
+ decodeRefundNotification(params: Record<string, any>, body: any): Promise<{
12
+ refundId: string;
13
+ iState: string | null | undefined;
14
+ extra?: RefundUpdateData | undefined;
15
+ price?: number | undefined;
16
+ }>;
11
17
  getAccountEntity(): [string, string];
12
18
  getAccountAmount(context: BRC): Promise<number>;
13
19
  calcTransferTax(price: number): [number, string, string];
14
20
  calcRefundTax(price: number): [number, string, string];
15
21
  calcPayTax(price: number): [number, string, string];
16
- refund(refund: Refund): Promise<RefundUpdateData | undefined>;
17
- closeRefund(refund: Refund): Promise<void>;
22
+ refund(refund: Refund, context: BRC): Promise<RefundUpdateData | undefined>;
18
23
  getRefundState(refund: Refund): Promise<[string | null | undefined, PayUpdateData | undefined]>;
19
24
  decodePayNotification(params: Record<string, any>, body: any): Promise<{
20
25
  payId: string;
@@ -8,6 +8,9 @@ export default class WechatPay {
8
8
  constructor(wpProduct) {
9
9
  this.wpProduct = wpProduct;
10
10
  }
11
+ decodeRefundNotification(params, body) {
12
+ throw new Error('Method not implemented.');
13
+ }
11
14
  getAccountEntity() {
12
15
  return ['wpAccount', this.wpProduct.wpAccountId];
13
16
  }
@@ -49,14 +52,11 @@ export default class WechatPay {
49
52
  assert(typeof taxLossRatio === 'number', '微信渠道的手续费率未配置');
50
53
  return [Math.round(price * taxLossRatio / 100), 'wpAccount', wpProduct.wpAccountId];
51
54
  }
52
- async refund(refund) {
55
+ async refund(refund, context) {
53
56
  return {
54
57
  externalId: Math.random().toString(),
55
58
  };
56
59
  }
57
- async closeRefund(refund) {
58
- return;
59
- }
60
60
  async getRefundState(refund) {
61
61
  const r = Math.random();
62
62
  if (r < 0.5) {