oak-pay-business 2.6.2 → 2.7.0

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 (43) hide show
  1. package/es/aspects/withdraw.js +2 -2
  2. package/es/checkers/offlineAccount.js +4 -4
  3. package/es/checkers/order.js +2 -2
  4. package/es/checkers/pay.js +1 -1
  5. package/es/checkers/wpProduct.js +4 -4
  6. package/es/components/AbstractComponents.d.ts +2 -2
  7. package/es/data/i18n.js +2 -1
  8. package/es/entities/System.js +1 -0
  9. package/es/locales/error/zh-CN.json +2 -1
  10. package/es/oak-app-domain/Application/Storage.js +15 -0
  11. package/es/oak-app-domain/Application/_baseSchema.d.ts +14 -0
  12. package/es/oak-app-domain/Application/locales/zh_CN.json +4 -1
  13. package/es/oak-app-domain/Platform/Storage.js +6 -0
  14. package/es/oak-app-domain/Platform/_baseSchema.d.ts +4 -0
  15. package/es/oak-app-domain/Platform/locales/zh_CN.json +2 -1
  16. package/es/oak-app-domain/System/Storage.js +10 -5
  17. package/es/oak-app-domain/System/_baseSchema.d.ts +4 -0
  18. package/es/oak-app-domain/System/locales/zh_CN.json +2 -1
  19. package/es/types/Exception.d.ts +4 -4
  20. package/es/types/Exception.js +5 -5
  21. package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
  22. package/lib/aspects/withdraw.js +2 -2
  23. package/lib/checkers/offlineAccount.js +4 -4
  24. package/lib/checkers/order.js +2 -2
  25. package/lib/checkers/pay.js +1 -1
  26. package/lib/checkers/wpProduct.js +4 -4
  27. package/lib/data/i18n.js +2 -1
  28. package/lib/entities/System.js +1 -0
  29. package/lib/locales/error/zh-CN.json +2 -1
  30. package/lib/oak-app-domain/Application/Storage.js +15 -0
  31. package/lib/oak-app-domain/Application/_baseSchema.d.ts +14 -0
  32. package/lib/oak-app-domain/Application/locales/zh_CN.json +4 -1
  33. package/lib/oak-app-domain/Platform/Storage.js +6 -0
  34. package/lib/oak-app-domain/Platform/_baseSchema.d.ts +4 -0
  35. package/lib/oak-app-domain/Platform/locales/zh_CN.json +2 -1
  36. package/lib/oak-app-domain/System/Storage.js +10 -5
  37. package/lib/oak-app-domain/System/_baseSchema.d.ts +4 -0
  38. package/lib/oak-app-domain/System/locales/zh_CN.json +2 -1
  39. package/lib/types/Exception.d.ts +4 -4
  40. package/lib/types/Exception.js +5 -5
  41. package/lib/utils/payClazz/WechatPay/index.d.ts +1 -1
  42. package/package.json +4 -4
  43. package/src/entities/System.ts +1 -0
@@ -28,7 +28,7 @@ export async function getWithdrawCreateData(params, context) {
28
28
  const { system } = context.getApplication();
29
29
  const withdrawLoss = system?.payConfig?.withdrawLoss;
30
30
  if (!withdrawLoss || (!withdrawLoss.conservative && typeof withdrawLoss.ratio !== 'number')) {
31
- throw new OakException('error::system.withdrawLossUnSet');
31
+ throw new OakException('error::system.withdrawLossUnSet', 'oak-pay-business');
32
32
  }
33
33
  const { accountId, price: totalPrice, withdrawAccountId } = params;
34
34
  const [account] = await context.select('account', {
@@ -46,7 +46,7 @@ export async function getWithdrawCreateData(params, context) {
46
46
  // throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.overflow');
47
47
  // }
48
48
  if (totalPrice > refundable && !withdrawAccountId) {
49
- throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId');
49
+ throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId', 'oak-pay-business');
50
50
  }
51
51
  const data = {
52
52
  id: await generateNewIdAsync(),
@@ -14,7 +14,7 @@ function checkAttributes(data) {
14
14
  case 'wechat':
15
15
  case 'alipay': {
16
16
  if (!name && !qrCode) {
17
- throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull');
17
+ throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull', 'oak-pay-business');
18
18
  }
19
19
  break;
20
20
  }
@@ -29,13 +29,13 @@ function checkAttributes(data) {
29
29
  }
30
30
  const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data;
31
31
  if (typeof refundGapDays !== 'number' || refundGapDays < 0) {
32
- throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative');
32
+ throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative', 'oak-pay-business');
33
33
  }
34
34
  if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) {
35
- throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal');
35
+ throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal', 'oak-pay-business');
36
36
  }
37
37
  if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) {
38
- throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative');
38
+ throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative', 'oak-pay-business');
39
39
  }
40
40
  }
41
41
  const checkers = [
@@ -45,7 +45,7 @@ const checkers = [
45
45
  assert(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
46
46
  const { pay$order: pays } = data;
47
47
  if (!(pays instanceof Array) || !pays.length) {
48
- throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
48
+ throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay', 'oak-pay-business');
49
49
  }
50
50
  let amount = 0;
51
51
  pays.forEach(({ action, data }) => {
@@ -54,7 +54,7 @@ const checkers = [
54
54
  amount += price;
55
55
  });
56
56
  if (!allowPartialPay && amount !== price) {
57
- throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough');
57
+ throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough', 'oak-pay-business');
58
58
  }
59
59
  });
60
60
  }
@@ -74,7 +74,7 @@ const checkers = [
74
74
  let pricePaying = 0;
75
75
  pays.forEach((pay) => pricePaying += pay.price);
76
76
  if (pricePaying + price > orderPrice) {
77
- throw new OakInputIllegalException('pay', ['price'], 'pay.create.priceOverflow');
77
+ throw new OakInputIllegalException('pay', ['price'], 'error::pay.priceOverflow', 'oak-pay-business');
78
78
  }
79
79
  };
80
80
  if (order instanceof Promise) {
@@ -79,27 +79,27 @@ const checkers = [
79
79
  }, { dontCollect: true }), (applications) => {
80
80
  const { type, config } = applications[0];
81
81
  if (!getAppTypeFromProductType(data.type).includes(type)) {
82
- throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict');
82
+ throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict', 'oak-pay-business');
83
83
  }
84
84
  switch (type) {
85
85
  case 'web': {
86
86
  const { wechat } = config;
87
87
  if (!wechat?.appId) {
88
- throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
88
+ throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
89
89
  }
90
90
  break;
91
91
  }
92
92
  case 'wechatMp': {
93
93
  const { appId } = config;
94
94
  if (!appId) {
95
- throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
95
+ throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
96
96
  }
97
97
  break;
98
98
  }
99
99
  case 'wechatPublic': {
100
100
  const { appId } = config;
101
101
  if (!appId) {
102
- throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
102
+ throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
103
103
  }
104
104
  break;
105
105
  }
@@ -21,7 +21,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
21
21
  rowSelection?: any;
22
22
  hideHeader?: boolean | undefined;
23
23
  disableSerialNumber?: boolean | undefined;
24
- size?: "large" | "middle" | "small" | undefined;
24
+ size?: "small" | "middle" | "large" | undefined;
25
25
  scroll?: any;
26
26
  empty?: React.ReactNode;
27
27
  opWidth?: number | undefined;
@@ -43,7 +43,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
43
43
  tablePagination?: any;
44
44
  rowSelection?: any;
45
45
  disableSerialNumber?: boolean | undefined;
46
- size?: "large" | "middle" | "small" | undefined;
46
+ size?: "small" | "middle" | "large" | undefined;
47
47
  scroll?: any;
48
48
  empty?: any;
49
49
  opWidth?: number | undefined;
package/es/data/i18n.js CHANGED
@@ -804,7 +804,8 @@ const i18ns = [
804
804
  }
805
805
  },
806
806
  "pay": {
807
- "externalException": "外部支付渠道异常"
807
+ "externalException": "外部支付渠道异常",
808
+ "priceOverflow": "支付金额总和大于订单金额"
808
809
  }
809
810
  }
810
811
  },
@@ -16,6 +16,7 @@ export const entityDesc = {
16
16
  entityId: '关联对象id',
17
17
  accounts: '关联账户',
18
18
  withdrawAccounts: '关联提现账户',
19
+ oldestVersion: '支持app最低版本',
19
20
  },
20
21
  },
21
22
  }
@@ -25,6 +25,7 @@
25
25
  }
26
26
  },
27
27
  "pay": {
28
- "externalException": "外部支付渠道异常"
28
+ "externalException": "外部支付渠道异常",
29
+ "priceOverflow": "支付金额总和大于订单金额"
29
30
  }
30
31
  }
@@ -28,6 +28,21 @@ export const desc = {
28
28
  style: {
29
29
  type: "object"
30
30
  },
31
+ dangerousVersions: {
32
+ notNull: true,
33
+ type: "object"
34
+ },
35
+ warningVersions: {
36
+ notNull: true,
37
+ type: "object"
38
+ },
39
+ soaVersion: {
40
+ notNull: true,
41
+ type: "varchar",
42
+ params: {
43
+ length: 12
44
+ }
45
+ },
31
46
  domainId: {
32
47
  type: "ref",
33
48
  ref: "domain"
@@ -75,6 +75,7 @@ export type NativeConfig = {
75
75
  port: string;
76
76
  };
77
77
  };
78
+ type Versions = string[];
78
79
  export type OpSchema = EntityShape & {
79
80
  name: String<32>;
80
81
  description?: Text | null;
@@ -82,6 +83,9 @@ export type OpSchema = EntityShape & {
82
83
  systemId: ForeignKey<"system">;
83
84
  config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
84
85
  style?: Style | null;
86
+ dangerousVersions: Versions;
87
+ warningVersions: Versions;
88
+ soaVersion: String<12>;
85
89
  domainId?: ForeignKey<"domain"> | null;
86
90
  } & {
87
91
  [A in ExpressionKey]?: any;
@@ -98,6 +102,9 @@ export type OpFilter = {
98
102
  systemId: Q_StringValue;
99
103
  config: JsonFilter<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
100
104
  style: JsonFilter<Style>;
105
+ dangerousVersions: JsonFilter<Versions>;
106
+ warningVersions: JsonFilter<Versions>;
107
+ soaVersion: Q_StringValue;
101
108
  domainId: Q_StringValue;
102
109
  } & ExprOp<OpAttr | string>;
103
110
  export type OpProjection = {
@@ -113,6 +120,9 @@ export type OpProjection = {
113
120
  systemId?: number;
114
121
  config?: number | JsonProjection<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
115
122
  style?: number | JsonProjection<Style>;
123
+ dangerousVersions?: number | JsonProjection<Versions>;
124
+ warningVersions?: number | JsonProjection<Versions>;
125
+ soaVersion?: number;
116
126
  domainId?: number;
117
127
  } & Partial<ExprOp<OpAttr | string>>;
118
128
  export type OpSortAttr = Partial<{
@@ -124,7 +134,11 @@ export type OpSortAttr = Partial<{
124
134
  description: number;
125
135
  type: number;
126
136
  style: number;
137
+ dangerousVersions: number;
138
+ warningVersions: number;
139
+ soaVersion: number;
127
140
  [k: string]: any;
128
141
  } | ExprOp<OpAttr | string>>;
129
142
  export type OpAction = OakMakeAction<GenericAction | string>;
130
143
  export type OpUpdateAction = "update" | string;
144
+ export {};
@@ -8,7 +8,10 @@
8
8
  "config": "设置",
9
9
  "style": "样式",
10
10
  "sessions": "会话",
11
- "domain": "域名"
11
+ "domain": "域名",
12
+ "dangerousVersions": "强制升级版本",
13
+ "warningVersions": "建议升级版本",
14
+ "soaVersion": "最新发布版本"
12
15
  },
13
16
  "v": {
14
17
  "type": {
@@ -15,6 +15,12 @@ export const desc = {
15
15
  notNull: true,
16
16
  type: "object"
17
17
  },
18
+ oldestVersion: {
19
+ type: "varchar",
20
+ params: {
21
+ length: 32
22
+ }
23
+ },
18
24
  style: {
19
25
  type: "object"
20
26
  },
@@ -9,6 +9,7 @@ export type OpSchema = EntityShape & {
9
9
  name: String<32>;
10
10
  description?: Text | null;
11
11
  config: Config;
12
+ oldestVersion?: String<32> | null;
12
13
  style?: Style | null;
13
14
  entity?: String<32> | null;
14
15
  entityId?: String<64> | null;
@@ -24,6 +25,7 @@ export type OpFilter = {
24
25
  name: Q_StringValue;
25
26
  description: Q_StringValue;
26
27
  config: JsonFilter<Config>;
28
+ oldestVersion: Q_StringValue;
27
29
  style: JsonFilter<Style>;
28
30
  entity: Q_StringValue;
29
31
  entityId: Q_StringValue;
@@ -38,6 +40,7 @@ export type OpProjection = {
38
40
  name?: number;
39
41
  description?: number;
40
42
  config?: number | JsonProjection<Config>;
43
+ oldestVersion?: number;
41
44
  style?: number | JsonProjection<Style>;
42
45
  entity?: number;
43
46
  entityId?: number;
@@ -50,6 +53,7 @@ export type OpSortAttr = Partial<{
50
53
  name: number;
51
54
  description: number;
52
55
  config: number;
56
+ oldestVersion: number;
53
57
  style: number;
54
58
  entity: number;
55
59
  entityId: number;
@@ -6,7 +6,8 @@
6
6
  "config": "设置",
7
7
  "style": "样式",
8
8
  "entity": "关联对象",
9
- "entityId": "关联对象id"
9
+ "entityId": "关联对象id",
10
+ "oldestVersion": "支持app最低版本"
10
11
  },
11
12
  "r": {
12
13
  "owner": "拥有者",
@@ -25,15 +25,20 @@ export const desc = {
25
25
  length: 16
26
26
  }
27
27
  },
28
- super: {
29
- type: "boolean"
28
+ oldestVersion: {
29
+ type: "varchar",
30
+ params: {
31
+ length: 32
32
+ }
30
33
  },
31
- style // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
34
+ super // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
32
35
  : {
36
+ type: "boolean"
37
+ },
38
+ style: {
33
39
  type: "object"
34
40
  },
35
- entity // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
36
- : {
41
+ entity: {
37
42
  type: "varchar",
38
43
  params: {
39
44
  length: 32
@@ -25,6 +25,7 @@ export type OpSchema = EntityShape & {
25
25
  config: Config;
26
26
  platformId?: ForeignKey<"platform"> | null;
27
27
  folder?: String<16> | null;
28
+ oldestVersion?: String<32> | null;
28
29
  super?: Boolean | null;
29
30
  style?: Style | null;
30
31
  entity?: String<32> | null;
@@ -44,6 +45,7 @@ export type OpFilter = {
44
45
  config: JsonFilter<Config>;
45
46
  platformId: Q_StringValue;
46
47
  folder: Q_StringValue;
48
+ oldestVersion: Q_StringValue;
47
49
  super: Q_BooleanValue;
48
50
  style: JsonFilter<Style>;
49
51
  entity: Q_StringValue;
@@ -62,6 +64,7 @@ export type OpProjection = {
62
64
  config?: number | JsonProjection<Config>;
63
65
  platformId?: number;
64
66
  folder?: number;
67
+ oldestVersion?: number;
65
68
  super?: number;
66
69
  style?: number | JsonProjection<Style>;
67
70
  entity?: number;
@@ -77,6 +80,7 @@ export type OpSortAttr = Partial<{
77
80
  description: number;
78
81
  config: number;
79
82
  folder: number;
83
+ oldestVersion: number;
80
84
  super: number;
81
85
  style: number;
82
86
  entity: number;
@@ -12,6 +12,7 @@
12
12
  "entity": "关联对象",
13
13
  "entityId": "关联对象id",
14
14
  "accounts": "关联账户",
15
- "withdrawAccounts": "关联提现账户"
15
+ "withdrawAccounts": "关联提现账户",
16
+ "oldestVersion": "支持app最低版本"
16
17
  }
17
18
  }
@@ -2,12 +2,12 @@ import { OakException, OpRecord } from 'oak-domain/lib/types';
2
2
  import { EntityDict } from '../oak-app-domain/index';
3
3
  export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
4
4
  reason: any;
5
- constructor(reason: any, message?: string, module?: string, params?: Record<string, any>);
5
+ constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>);
6
6
  getSerialData(): {
7
7
  reason: any;
8
8
  name: string;
9
9
  message: string;
10
- module: string | undefined;
10
+ _module: string | undefined;
11
11
  opRecords: OpRecord<ED>[];
12
12
  tag1: string | undefined;
13
13
  tag2: boolean | undefined;
@@ -15,10 +15,10 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
15
15
  };
16
16
  }
17
17
  export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
18
- constructor(message?: string, module?: string, params?: Record<string, any>);
18
+ constructor(message?: string, _module?: string, params?: Record<string, any>);
19
19
  }
20
20
  export declare class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
21
- constructor(message?: string, module?: string, params?: Record<string, any>);
21
+ constructor(message?: string, _module?: string, params?: Record<string, any>);
22
22
  }
23
23
  export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
24
24
  constructor(message: string);
@@ -2,8 +2,8 @@ import { OakException } from 'oak-domain/lib/types';
2
2
  import makeDepedentException from './DependentExceptions';
3
3
  export class ExternalPayUtilException extends OakException {
4
4
  reason;
5
- constructor(reason, message, module, params) {
6
- super(message || 'error::pay.externalException', module || 'oak-pay-business', params);
5
+ constructor(reason, message, _module, params) {
6
+ super(message || 'error::pay.externalException', _module || 'oak-pay-business', params);
7
7
  this.reason = reason;
8
8
  }
9
9
  getSerialData() {
@@ -15,12 +15,12 @@ export class ExternalPayUtilException extends OakException {
15
15
  }
16
16
  }
17
17
  export class RefundExceedMax extends OakException {
18
- constructor(message, module, params) {
19
- super(message || 'error::refund.create.exceedMax', module || 'oak-pay-business', params);
18
+ constructor(message, _module, params) {
19
+ super(message || 'error::refund.create.exceedMax', _module || 'oak-pay-business', params);
20
20
  }
21
21
  }
22
22
  export class PayUnRefundable extends OakException {
23
- constructor(message, module, params) {
23
+ constructor(message, _module, params) {
24
24
  super(message || 'error::refund.create.payUnrefundable');
25
25
  }
26
26
  }
@@ -1,4 +1,4 @@
1
1
  import WechatPay from './WechatPay';
2
2
  import WechatPayDebug from './WechatPay.debug';
3
- declare const _default: typeof WechatPay | typeof WechatPayDebug;
3
+ declare const _default: typeof WechatPayDebug | typeof WechatPay;
4
4
  export default _default;
@@ -32,7 +32,7 @@ async function getWithdrawCreateData(params, context) {
32
32
  const { system } = context.getApplication();
33
33
  const withdrawLoss = system?.payConfig?.withdrawLoss;
34
34
  if (!withdrawLoss || (!withdrawLoss.conservative && typeof withdrawLoss.ratio !== 'number')) {
35
- throw new types_1.OakException('error::system.withdrawLossUnSet');
35
+ throw new types_1.OakException('error::system.withdrawLossUnSet', 'oak-pay-business');
36
36
  }
37
37
  const { accountId, price: totalPrice, withdrawAccountId } = params;
38
38
  const [account] = await context.select('account', {
@@ -50,7 +50,7 @@ async function getWithdrawCreateData(params, context) {
50
50
  // throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.overflow');
51
51
  // }
52
52
  if (totalPrice > refundable && !withdrawAccountId) {
53
- throw new types_1.OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId');
53
+ throw new types_1.OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId', 'oak-pay-business');
54
54
  }
55
55
  const data = {
56
56
  id: await (0, uuid_1.generateNewIdAsync)(),
@@ -17,7 +17,7 @@ function checkAttributes(data) {
17
17
  case 'wechat':
18
18
  case 'alipay': {
19
19
  if (!name && !qrCode) {
20
- throw new types_1.OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull');
20
+ throw new types_1.OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull', 'oak-pay-business');
21
21
  }
22
22
  break;
23
23
  }
@@ -32,13 +32,13 @@ function checkAttributes(data) {
32
32
  }
33
33
  const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data;
34
34
  if (typeof refundGapDays !== 'number' || refundGapDays < 0) {
35
- throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative');
35
+ throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative', 'oak-pay-business');
36
36
  }
37
37
  if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) {
38
- throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal');
38
+ throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal', 'oak-pay-business');
39
39
  }
40
40
  if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) {
41
- throw new types_1.OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative');
41
+ throw new types_1.OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative', 'oak-pay-business');
42
42
  }
43
43
  }
44
44
  const checkers = [
@@ -48,7 +48,7 @@ const checkers = [
48
48
  (0, assert_1.default)(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
49
49
  const { pay$order: pays } = data;
50
50
  if (!(pays instanceof Array) || !pays.length) {
51
- throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
51
+ throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay', 'oak-pay-business');
52
52
  }
53
53
  let amount = 0;
54
54
  pays.forEach(({ action, data }) => {
@@ -57,7 +57,7 @@ const checkers = [
57
57
  amount += price;
58
58
  });
59
59
  if (!allowPartialPay && amount !== price) {
60
- throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough');
60
+ throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough', 'oak-pay-business');
61
61
  }
62
62
  });
63
63
  }
@@ -77,7 +77,7 @@ const checkers = [
77
77
  let pricePaying = 0;
78
78
  pays.forEach((pay) => pricePaying += pay.price);
79
79
  if (pricePaying + price > orderPrice) {
80
- throw new types_1.OakInputIllegalException('pay', ['price'], 'pay.create.priceOverflow');
80
+ throw new types_1.OakInputIllegalException('pay', ['price'], 'error::pay.priceOverflow', 'oak-pay-business');
81
81
  }
82
82
  };
83
83
  if (order instanceof Promise) {
@@ -82,27 +82,27 @@ const checkers = [
82
82
  }, { dontCollect: true }), (applications) => {
83
83
  const { type, config } = applications[0];
84
84
  if (!(0, wpProduct_1.getAppTypeFromProductType)(data.type).includes(type)) {
85
- throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict');
85
+ throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict', 'oak-pay-business');
86
86
  }
87
87
  switch (type) {
88
88
  case 'web': {
89
89
  const { wechat } = config;
90
90
  if (!wechat?.appId) {
91
- throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
91
+ throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
92
92
  }
93
93
  break;
94
94
  }
95
95
  case 'wechatMp': {
96
96
  const { appId } = config;
97
97
  if (!appId) {
98
- throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
98
+ throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
99
99
  }
100
100
  break;
101
101
  }
102
102
  case 'wechatPublic': {
103
103
  const { appId } = config;
104
104
  if (!appId) {
105
- throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
105
+ throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
106
106
  }
107
107
  break;
108
108
  }
package/lib/data/i18n.js CHANGED
@@ -806,7 +806,8 @@ const i18ns = [
806
806
  }
807
807
  },
808
808
  "pay": {
809
- "externalException": "外部支付渠道异常"
809
+ "externalException": "外部支付渠道异常",
810
+ "priceOverflow": "支付金额总和大于订单金额"
810
811
  }
811
812
  }
812
813
  },
@@ -19,6 +19,7 @@ exports.entityDesc = {
19
19
  entityId: '关联对象id',
20
20
  accounts: '关联账户',
21
21
  withdrawAccounts: '关联提现账户',
22
+ oldestVersion: '支持app最低版本',
22
23
  },
23
24
  },
24
25
  }
@@ -25,6 +25,7 @@
25
25
  }
26
26
  },
27
27
  "pay": {
28
- "externalException": "外部支付渠道异常"
28
+ "externalException": "外部支付渠道异常",
29
+ "priceOverflow": "支付金额总和大于订单金额"
29
30
  }
30
31
  }
@@ -31,6 +31,21 @@ exports.desc = {
31
31
  style: {
32
32
  type: "object"
33
33
  },
34
+ dangerousVersions: {
35
+ notNull: true,
36
+ type: "object"
37
+ },
38
+ warningVersions: {
39
+ notNull: true,
40
+ type: "object"
41
+ },
42
+ soaVersion: {
43
+ notNull: true,
44
+ type: "varchar",
45
+ params: {
46
+ length: 12
47
+ }
48
+ },
34
49
  domainId: {
35
50
  type: "ref",
36
51
  ref: "domain"
@@ -75,6 +75,7 @@ export type NativeConfig = {
75
75
  port: string;
76
76
  };
77
77
  };
78
+ type Versions = string[];
78
79
  export type OpSchema = EntityShape & {
79
80
  name: String<32>;
80
81
  description?: Text | null;
@@ -82,6 +83,9 @@ export type OpSchema = EntityShape & {
82
83
  systemId: ForeignKey<"system">;
83
84
  config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
84
85
  style?: Style | null;
86
+ dangerousVersions: Versions;
87
+ warningVersions: Versions;
88
+ soaVersion: String<12>;
85
89
  domainId?: ForeignKey<"domain"> | null;
86
90
  } & {
87
91
  [A in ExpressionKey]?: any;
@@ -98,6 +102,9 @@ export type OpFilter = {
98
102
  systemId: Q_StringValue;
99
103
  config: JsonFilter<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
100
104
  style: JsonFilter<Style>;
105
+ dangerousVersions: JsonFilter<Versions>;
106
+ warningVersions: JsonFilter<Versions>;
107
+ soaVersion: Q_StringValue;
101
108
  domainId: Q_StringValue;
102
109
  } & ExprOp<OpAttr | string>;
103
110
  export type OpProjection = {
@@ -113,6 +120,9 @@ export type OpProjection = {
113
120
  systemId?: number;
114
121
  config?: number | JsonProjection<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
115
122
  style?: number | JsonProjection<Style>;
123
+ dangerousVersions?: number | JsonProjection<Versions>;
124
+ warningVersions?: number | JsonProjection<Versions>;
125
+ soaVersion?: number;
116
126
  domainId?: number;
117
127
  } & Partial<ExprOp<OpAttr | string>>;
118
128
  export type OpSortAttr = Partial<{
@@ -124,7 +134,11 @@ export type OpSortAttr = Partial<{
124
134
  description: number;
125
135
  type: number;
126
136
  style: number;
137
+ dangerousVersions: number;
138
+ warningVersions: number;
139
+ soaVersion: number;
127
140
  [k: string]: any;
128
141
  } | ExprOp<OpAttr | string>>;
129
142
  export type OpAction = OakMakeAction<GenericAction | string>;
130
143
  export type OpUpdateAction = "update" | string;
144
+ export {};
@@ -8,7 +8,10 @@
8
8
  "config": "设置",
9
9
  "style": "样式",
10
10
  "sessions": "会话",
11
- "domain": "域名"
11
+ "domain": "域名",
12
+ "dangerousVersions": "强制升级版本",
13
+ "warningVersions": "建议升级版本",
14
+ "soaVersion": "最新发布版本"
12
15
  },
13
16
  "v": {
14
17
  "type": {
@@ -18,6 +18,12 @@ exports.desc = {
18
18
  notNull: true,
19
19
  type: "object"
20
20
  },
21
+ oldestVersion: {
22
+ type: "varchar",
23
+ params: {
24
+ length: 32
25
+ }
26
+ },
21
27
  style: {
22
28
  type: "object"
23
29
  },
@@ -9,6 +9,7 @@ export type OpSchema = EntityShape & {
9
9
  name: String<32>;
10
10
  description?: Text | null;
11
11
  config: Config;
12
+ oldestVersion?: String<32> | null;
12
13
  style?: Style | null;
13
14
  entity?: String<32> | null;
14
15
  entityId?: String<64> | null;
@@ -24,6 +25,7 @@ export type OpFilter = {
24
25
  name: Q_StringValue;
25
26
  description: Q_StringValue;
26
27
  config: JsonFilter<Config>;
28
+ oldestVersion: Q_StringValue;
27
29
  style: JsonFilter<Style>;
28
30
  entity: Q_StringValue;
29
31
  entityId: Q_StringValue;
@@ -38,6 +40,7 @@ export type OpProjection = {
38
40
  name?: number;
39
41
  description?: number;
40
42
  config?: number | JsonProjection<Config>;
43
+ oldestVersion?: number;
41
44
  style?: number | JsonProjection<Style>;
42
45
  entity?: number;
43
46
  entityId?: number;
@@ -50,6 +53,7 @@ export type OpSortAttr = Partial<{
50
53
  name: number;
51
54
  description: number;
52
55
  config: number;
56
+ oldestVersion: number;
53
57
  style: number;
54
58
  entity: number;
55
59
  entityId: number;
@@ -6,7 +6,8 @@
6
6
  "config": "设置",
7
7
  "style": "样式",
8
8
  "entity": "关联对象",
9
- "entityId": "关联对象id"
9
+ "entityId": "关联对象id",
10
+ "oldestVersion": "支持app最低版本"
10
11
  },
11
12
  "r": {
12
13
  "owner": "拥有者",
@@ -28,15 +28,20 @@ exports.desc = {
28
28
  length: 16
29
29
  }
30
30
  },
31
- super: {
32
- type: "boolean"
31
+ oldestVersion: {
32
+ type: "varchar",
33
+ params: {
34
+ length: 32
35
+ }
33
36
  },
34
- style // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
37
+ super // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
35
38
  : {
39
+ type: "boolean"
40
+ },
41
+ style: {
36
42
  type: "object"
37
43
  },
38
- entity // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
39
- : {
44
+ entity: {
40
45
  type: "varchar",
41
46
  params: {
42
47
  length: 32
@@ -25,6 +25,7 @@ export type OpSchema = EntityShape & {
25
25
  config: Config;
26
26
  platformId?: ForeignKey<"platform"> | null;
27
27
  folder?: String<16> | null;
28
+ oldestVersion?: String<32> | null;
28
29
  super?: Boolean | null;
29
30
  style?: Style | null;
30
31
  entity?: String<32> | null;
@@ -44,6 +45,7 @@ export type OpFilter = {
44
45
  config: JsonFilter<Config>;
45
46
  platformId: Q_StringValue;
46
47
  folder: Q_StringValue;
48
+ oldestVersion: Q_StringValue;
47
49
  super: Q_BooleanValue;
48
50
  style: JsonFilter<Style>;
49
51
  entity: Q_StringValue;
@@ -62,6 +64,7 @@ export type OpProjection = {
62
64
  config?: number | JsonProjection<Config>;
63
65
  platformId?: number;
64
66
  folder?: number;
67
+ oldestVersion?: number;
65
68
  super?: number;
66
69
  style?: number | JsonProjection<Style>;
67
70
  entity?: number;
@@ -77,6 +80,7 @@ export type OpSortAttr = Partial<{
77
80
  description: number;
78
81
  config: number;
79
82
  folder: number;
83
+ oldestVersion: number;
80
84
  super: number;
81
85
  style: number;
82
86
  entity: number;
@@ -12,6 +12,7 @@
12
12
  "entity": "关联对象",
13
13
  "entityId": "关联对象id",
14
14
  "accounts": "关联账户",
15
- "withdrawAccounts": "关联提现账户"
15
+ "withdrawAccounts": "关联提现账户",
16
+ "oldestVersion": "支持app最低版本"
16
17
  }
17
18
  }
@@ -2,12 +2,12 @@ import { OakException, OpRecord } from 'oak-domain/lib/types';
2
2
  import { EntityDict } from '../oak-app-domain/index';
3
3
  export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
4
4
  reason: any;
5
- constructor(reason: any, message?: string, module?: string, params?: Record<string, any>);
5
+ constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>);
6
6
  getSerialData(): {
7
7
  reason: any;
8
8
  name: string;
9
9
  message: string;
10
- module: string | undefined;
10
+ _module: string | undefined;
11
11
  opRecords: OpRecord<ED>[];
12
12
  tag1: string | undefined;
13
13
  tag2: boolean | undefined;
@@ -15,10 +15,10 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
15
15
  };
16
16
  }
17
17
  export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
18
- constructor(message?: string, module?: string, params?: Record<string, any>);
18
+ constructor(message?: string, _module?: string, params?: Record<string, any>);
19
19
  }
20
20
  export declare class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
21
- constructor(message?: string, module?: string, params?: Record<string, any>);
21
+ constructor(message?: string, _module?: string, params?: Record<string, any>);
22
22
  }
23
23
  export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
24
24
  constructor(message: string);
@@ -6,8 +6,8 @@ const types_1 = require("oak-domain/lib/types");
6
6
  const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions"));
7
7
  class ExternalPayUtilException extends types_1.OakException {
8
8
  reason;
9
- constructor(reason, message, module, params) {
10
- super(message || 'error::pay.externalException', module || 'oak-pay-business', params);
9
+ constructor(reason, message, _module, params) {
10
+ super(message || 'error::pay.externalException', _module || 'oak-pay-business', params);
11
11
  this.reason = reason;
12
12
  }
13
13
  getSerialData() {
@@ -20,13 +20,13 @@ class ExternalPayUtilException extends types_1.OakException {
20
20
  }
21
21
  exports.ExternalPayUtilException = ExternalPayUtilException;
22
22
  class RefundExceedMax extends types_1.OakException {
23
- constructor(message, module, params) {
24
- super(message || 'error::refund.create.exceedMax', module || 'oak-pay-business', params);
23
+ constructor(message, _module, params) {
24
+ super(message || 'error::refund.create.exceedMax', _module || 'oak-pay-business', params);
25
25
  }
26
26
  }
27
27
  exports.RefundExceedMax = RefundExceedMax;
28
28
  class PayUnRefundable extends types_1.OakException {
29
- constructor(message, module, params) {
29
+ constructor(message, _module, params) {
30
30
  super(message || 'error::refund.create.payUnrefundable');
31
31
  }
32
32
  }
@@ -1,4 +1,4 @@
1
1
  import WechatPay from './WechatPay';
2
2
  import WechatPayDebug from './WechatPay.debug';
3
- declare const _default: typeof WechatPay | typeof WechatPayDebug;
3
+ declare const _default: typeof WechatPayDebug | typeof WechatPay;
4
4
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-pay-business",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib/**/*",
@@ -30,9 +30,9 @@
30
30
  "dependencies": {
31
31
  "classnames": "^2.3.1",
32
32
  "dayjs": "^1.11.5",
33
- "oak-domain": "file:../oak-domain",
34
- "oak-frontend-base": "file:../oak-frontend-base",
35
- "oak-general-business": "file:../oak-general-business",
33
+ "oak-domain": "^5.1.19",
34
+ "oak-frontend-base": "^5.3.27",
35
+ "oak-general-business": "~5.7.0",
36
36
  "wechat-pay-nodejs": "^0.2.3"
37
37
  },
38
38
  "peerDependencies": {
@@ -44,6 +44,7 @@ export const entityDesc: EntityDesc<Schema> = {
44
44
  entityId: '关联对象id',
45
45
  accounts: '关联账户',
46
46
  withdrawAccounts: '关联提现账户',
47
+ oldestVersion: '支持app最低版本',
47
48
  },
48
49
  },
49
50
  }