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.
- package/es/aspects/withdraw.js +2 -2
- package/es/checkers/offlineAccount.js +4 -4
- package/es/checkers/order.js +2 -2
- package/es/checkers/pay.js +1 -1
- package/es/checkers/wpProduct.js +4 -4
- package/es/components/AbstractComponents.d.ts +2 -2
- package/es/data/i18n.js +2 -1
- package/es/entities/System.js +1 -0
- package/es/locales/error/zh-CN.json +2 -1
- package/es/oak-app-domain/Application/Storage.js +15 -0
- package/es/oak-app-domain/Application/_baseSchema.d.ts +14 -0
- package/es/oak-app-domain/Application/locales/zh_CN.json +4 -1
- package/es/oak-app-domain/Platform/Storage.js +6 -0
- package/es/oak-app-domain/Platform/_baseSchema.d.ts +4 -0
- package/es/oak-app-domain/Platform/locales/zh_CN.json +2 -1
- package/es/oak-app-domain/System/Storage.js +10 -5
- package/es/oak-app-domain/System/_baseSchema.d.ts +4 -0
- package/es/oak-app-domain/System/locales/zh_CN.json +2 -1
- package/es/types/Exception.d.ts +4 -4
- package/es/types/Exception.js +5 -5
- package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
- package/lib/aspects/withdraw.js +2 -2
- package/lib/checkers/offlineAccount.js +4 -4
- package/lib/checkers/order.js +2 -2
- package/lib/checkers/pay.js +1 -1
- package/lib/checkers/wpProduct.js +4 -4
- package/lib/data/i18n.js +2 -1
- package/lib/entities/System.js +1 -0
- package/lib/locales/error/zh-CN.json +2 -1
- package/lib/oak-app-domain/Application/Storage.js +15 -0
- package/lib/oak-app-domain/Application/_baseSchema.d.ts +14 -0
- package/lib/oak-app-domain/Application/locales/zh_CN.json +4 -1
- package/lib/oak-app-domain/Platform/Storage.js +6 -0
- package/lib/oak-app-domain/Platform/_baseSchema.d.ts +4 -0
- package/lib/oak-app-domain/Platform/locales/zh_CN.json +2 -1
- package/lib/oak-app-domain/System/Storage.js +10 -5
- package/lib/oak-app-domain/System/_baseSchema.d.ts +4 -0
- package/lib/oak-app-domain/System/locales/zh_CN.json +2 -1
- package/lib/types/Exception.d.ts +4 -4
- package/lib/types/Exception.js +5 -5
- package/lib/utils/payClazz/WechatPay/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/entities/System.ts +1 -0
package/es/aspects/withdraw.js
CHANGED
|
@@ -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 = [
|
package/es/checkers/order.js
CHANGED
|
@@ -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
|
}
|
package/es/checkers/pay.js
CHANGED
|
@@ -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.
|
|
77
|
+
throw new OakInputIllegalException('pay', ['price'], 'error::pay.priceOverflow', 'oak-pay-business');
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
if (order instanceof Promise) {
|
package/es/checkers/wpProduct.js
CHANGED
|
@@ -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?: "
|
|
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?: "
|
|
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
package/es/entities/System.js
CHANGED
|
@@ -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 {};
|
|
@@ -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;
|
|
@@ -25,15 +25,20 @@ export const desc = {
|
|
|
25
25
|
length: 16
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
type: "
|
|
28
|
+
oldestVersion: {
|
|
29
|
+
type: "varchar",
|
|
30
|
+
params: {
|
|
31
|
+
length: 32
|
|
32
|
+
}
|
|
30
33
|
},
|
|
31
|
-
|
|
34
|
+
super // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
|
|
32
35
|
: {
|
|
36
|
+
type: "boolean"
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
33
39
|
type: "object"
|
|
34
40
|
},
|
|
35
|
-
entity
|
|
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;
|
package/es/types/Exception.d.ts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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);
|
package/es/types/Exception.js
CHANGED
|
@@ -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,
|
|
6
|
-
super(message || 'error::pay.externalException',
|
|
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,
|
|
19
|
-
super(message || 'error::refund.create.exceedMax',
|
|
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,
|
|
23
|
+
constructor(message, _module, params) {
|
|
24
24
|
super(message || 'error::refund.create.payUnrefundable');
|
|
25
25
|
}
|
|
26
26
|
}
|
package/lib/aspects/withdraw.js
CHANGED
|
@@ -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 = [
|
package/lib/checkers/order.js
CHANGED
|
@@ -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
|
}
|
package/lib/checkers/pay.js
CHANGED
|
@@ -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.
|
|
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
package/lib/entities/System.js
CHANGED
|
@@ -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 {};
|
|
@@ -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;
|
|
@@ -28,15 +28,20 @@ exports.desc = {
|
|
|
28
28
|
length: 16
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
|
|
32
|
-
type: "
|
|
31
|
+
oldestVersion: {
|
|
32
|
+
type: "varchar",
|
|
33
|
+
params: {
|
|
34
|
+
length: 32
|
|
35
|
+
}
|
|
33
36
|
},
|
|
34
|
-
|
|
37
|
+
super // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款)
|
|
35
38
|
: {
|
|
39
|
+
type: "boolean"
|
|
40
|
+
},
|
|
41
|
+
style: {
|
|
36
42
|
type: "object"
|
|
37
43
|
},
|
|
38
|
-
entity
|
|
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;
|
package/lib/types/Exception.d.ts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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);
|
package/lib/types/Exception.js
CHANGED
|
@@ -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,
|
|
10
|
-
super(message || 'error::pay.externalException',
|
|
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,
|
|
24
|
-
super(message || 'error::refund.create.exceedMax',
|
|
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,
|
|
29
|
+
constructor(message, _module, params) {
|
|
30
30
|
super(message || 'error::refund.create.payUnrefundable');
|
|
31
31
|
}
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "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": "
|
|
34
|
-
"oak-frontend-base": "
|
|
35
|
-
"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": {
|