oak-pay-business 1.0.7 → 1.0.9
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/checkers/application.d.ts +5 -0
- package/es/checkers/application.js +31 -0
- package/es/checkers/index.js +2 -0
- package/es/components/AbstractComponents.d.ts +4 -4
- package/es/components/pay/detail/index.js +10 -2
- package/es/components/pay/detail/index.xml +12 -12
- package/es/components/pay/detail/locales/zh-CN.json +2 -1
- package/es/components/payConfig/system/web.pc.js +2 -2
- package/es/components/payConfig/upsert/wechatPay/index.js +6 -6
- package/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json +4 -4
- package/es/configuration/attrUpdateMatrix.js +2 -0
- package/es/data/i18n.js +6 -5
- package/es/utils/payClazz/WechatPay/WechatPay.js +1 -4
- package/lib/checkers/application.d.ts +5 -0
- package/lib/checkers/application.js +33 -0
- package/lib/checkers/index.js +2 -0
- package/lib/configuration/attrUpdateMatrix.js +2 -0
- package/lib/data/i18n.js +6 -5
- package/lib/utils/payClazz/WechatPay/WechatPay.js +1 -4
- package/package.json +1 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PAY_CHANNEL_WECHAT_APP_NAME, PAY_CHANNEL_WECHAT_H5_NAME, PAY_CHANNEL_WECHAT_JS_NAME, PAY_CHANNEL_WECHAT_MP_NAME, PAY_CHANNEL_WECHAT_NATIVE_NAME } from '../types/PayConfig';
|
|
2
|
+
import { OakInputIllegalException } from 'oak-domain/lib/types';
|
|
3
|
+
const checkers = [
|
|
4
|
+
{
|
|
5
|
+
type: 'data',
|
|
6
|
+
entity: 'application',
|
|
7
|
+
action: 'update',
|
|
8
|
+
checker: (data, context) => {
|
|
9
|
+
const { payConfig } = (data || {});
|
|
10
|
+
if (payConfig) {
|
|
11
|
+
const wechatPayConfigs = payConfig.filter(ele => [
|
|
12
|
+
PAY_CHANNEL_WECHAT_APP_NAME,
|
|
13
|
+
PAY_CHANNEL_WECHAT_H5_NAME,
|
|
14
|
+
PAY_CHANNEL_WECHAT_JS_NAME,
|
|
15
|
+
PAY_CHANNEL_WECHAT_MP_NAME,
|
|
16
|
+
PAY_CHANNEL_WECHAT_NATIVE_NAME
|
|
17
|
+
].includes(ele.channel));
|
|
18
|
+
if (wechatPayConfigs) {
|
|
19
|
+
wechatPayConfigs.forEach((config) => {
|
|
20
|
+
const { apiV3Key } = config;
|
|
21
|
+
if (apiV3Key?.length && apiV3Key.length !== 32) {
|
|
22
|
+
throw new OakInputIllegalException('appliation', ['payConfig'], 'apiV3Key长度只能是32位');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
export default checkers;
|
package/es/checkers/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import aoCheckers from './accountOper';
|
|
2
2
|
import payCheckers from './pay';
|
|
3
3
|
import orderCheckers from './order';
|
|
4
|
+
import applicationCheckers from './application';
|
|
4
5
|
const checkers = [
|
|
5
6
|
...aoCheckers,
|
|
6
7
|
...payCheckers,
|
|
7
8
|
...orderCheckers,
|
|
9
|
+
...applicationCheckers,
|
|
8
10
|
];
|
|
9
11
|
export default checkers;
|
|
@@ -20,7 +20,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
|
|
|
20
20
|
rowSelection?: any;
|
|
21
21
|
hideHeader?: boolean | undefined;
|
|
22
22
|
disableSerialNumber?: boolean | undefined;
|
|
23
|
-
size?: "small" | "
|
|
23
|
+
size?: "small" | "large" | "middle" | undefined;
|
|
24
24
|
scroll?: ({
|
|
25
25
|
x?: string | number | true | undefined;
|
|
26
26
|
y?: string | number | undefined;
|
|
@@ -46,7 +46,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
|
|
|
46
46
|
tablePagination?: any;
|
|
47
47
|
rowSelection?: any;
|
|
48
48
|
disableSerialNumber?: boolean | undefined;
|
|
49
|
-
size?: "small" | "
|
|
49
|
+
size?: "small" | "large" | "middle" | undefined;
|
|
50
50
|
scroll?: any;
|
|
51
51
|
locale?: any;
|
|
52
52
|
opWidth?: number | undefined;
|
|
@@ -58,14 +58,14 @@ declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<En
|
|
|
58
58
|
data: Partial<EntityDict[T]["Schema"]>;
|
|
59
59
|
title?: string | undefined;
|
|
60
60
|
bordered?: boolean | undefined;
|
|
61
|
-
layout?: "
|
|
61
|
+
layout?: "horizontal" | "vertical" | undefined;
|
|
62
62
|
}>) => React.ReactElement;
|
|
63
63
|
declare const Upsert: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
|
|
64
64
|
helps: Record<string, string>;
|
|
65
65
|
entity: T;
|
|
66
66
|
attributes: OakAbsAttrUpsertDef<EntityDict, T, string | number>[];
|
|
67
67
|
data: EntityDict[T]["Schema"];
|
|
68
|
-
layout: "
|
|
68
|
+
layout: "horizontal" | "vertical";
|
|
69
69
|
mode: "default" | "card";
|
|
70
70
|
}>) => React.ReactElement;
|
|
71
71
|
export { FilterPanel, List, ListPro, Detail, Upsert, ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, };
|
|
@@ -125,8 +125,16 @@ export default OakComponent({
|
|
|
125
125
|
switch (channel) {
|
|
126
126
|
case PAY_CHANNEL_WECHAT_MP_NAME: {
|
|
127
127
|
const { prepayMeta } = meta;
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
if (prepayMeta) {
|
|
129
|
+
const result = await wx.requestPayment(prepayMeta);
|
|
130
|
+
console.log(result);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.setMessage({
|
|
134
|
+
type: 'warning',
|
|
135
|
+
content: '没有预支付数据,可能是在开发环境,请检查',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
130
138
|
break;
|
|
131
139
|
}
|
|
132
140
|
default: {
|
|
@@ -85,7 +85,18 @@
|
|
|
85
85
|
</view>
|
|
86
86
|
<view class="padding" />
|
|
87
87
|
<view class="btn-container">
|
|
88
|
-
<block wx:if="{{
|
|
88
|
+
<block wx:if="{{startPayable}}">
|
|
89
|
+
<view class="btn">
|
|
90
|
+
<l-button
|
|
91
|
+
type="default"
|
|
92
|
+
size="long"
|
|
93
|
+
bind:lintap="startPay"
|
|
94
|
+
>
|
|
95
|
+
{{t('wechatPay')}}
|
|
96
|
+
</l-button>
|
|
97
|
+
</view>
|
|
98
|
+
</block>
|
|
99
|
+
<block wx:elif="{{oakExecutable === true}}">
|
|
89
100
|
<view class="btn">
|
|
90
101
|
<l-button
|
|
91
102
|
type="default"
|
|
@@ -125,17 +136,6 @@
|
|
|
125
136
|
bind:lintap="cancelCloseMp"
|
|
126
137
|
/>
|
|
127
138
|
</block>
|
|
128
|
-
<block wx:elif="{{startPayable}}">
|
|
129
|
-
<view class="btn">
|
|
130
|
-
<l-button
|
|
131
|
-
type="default"
|
|
132
|
-
size="long"
|
|
133
|
-
bind:lintap="startPay"
|
|
134
|
-
>
|
|
135
|
-
{{t('pay')}}
|
|
136
|
-
</l-button>
|
|
137
|
-
</view>
|
|
138
|
-
</block>
|
|
139
139
|
<block wx:else>
|
|
140
140
|
<view class="btn">
|
|
141
141
|
<l-button
|
|
@@ -27,7 +27,7 @@ export function registerApplicationPayChannel(type, channel) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export default function render(props) {
|
|
30
|
-
const { system, oakFullpath, operation, oakDirty, serverUrl } = props.data;
|
|
30
|
+
const { system, oakFullpath, operation, oakDirty, serverUrl, oakExecutable } = props.data;
|
|
31
31
|
const { t, update, setMessage, execute } = props.methods;
|
|
32
32
|
const defaultApplicationPayChannelDict = {
|
|
33
33
|
web: AppTypeToPayChannelDict.web.map(ele => [t(`payChannel::internal.${ele}`), ele]),
|
|
@@ -39,7 +39,7 @@ export default function render(props) {
|
|
|
39
39
|
const { payConfig, application$system: applications } = system;
|
|
40
40
|
return (<div className={Styles.container}>
|
|
41
41
|
<Row justify="end" style={{ marginBottom: 12 }}>
|
|
42
|
-
<Button type="primary" disabled={!oakDirty} onClick={() => execute()}>
|
|
42
|
+
<Button type="primary" disabled={!oakDirty && oakExecutable !== true} onClick={() => execute()}>
|
|
43
43
|
{t('common::action.save')}
|
|
44
44
|
</Button>
|
|
45
45
|
</Row>
|
|
@@ -25,18 +25,18 @@ export default function WechatPay(props) {
|
|
|
25
25
|
<Input prefix={`${serverUrl}/endpoint`} suffix='/${payId}' value={config.payNotifyUrl} placeholder={t('placeholder.payNotifyUrl')} onChange={({ currentTarget }) => {
|
|
26
26
|
config.payNotifyUrl = currentTarget.value;
|
|
27
27
|
update(config);
|
|
28
|
-
}}/>
|
|
29
|
-
</Form.Item>
|
|
30
|
-
<Form.Item label={t('label.apiV3Key')}>
|
|
31
|
-
<Input value={config.apiV3Key} placeholder={t('placeholder.apiV3Key')} onChange={({ currentTarget }) => {
|
|
32
|
-
config.apiV3Key = currentTarget.value;
|
|
33
|
-
update(config);
|
|
34
28
|
}}/>
|
|
35
29
|
</Form.Item>
|
|
36
30
|
<Form.Item label={t('label.refundNotifyUrl')}>
|
|
37
31
|
<Input prefix={`${serverUrl}/endpoint`} suffix='/${refundId}' value={config.refundNotifyUrl} placeholder={t('placeholder.refundNotifyUrl')} onChange={({ currentTarget }) => {
|
|
38
32
|
config.refundNotifyUrl = currentTarget.value;
|
|
39
33
|
update(config);
|
|
34
|
+
}}/>
|
|
35
|
+
</Form.Item>
|
|
36
|
+
<Form.Item label={t('label.apiV3Key')}>
|
|
37
|
+
<Input value={config.apiV3Key} placeholder={t('placeholder.apiV3Key')} onChange={({ currentTarget }) => {
|
|
38
|
+
config.apiV3Key = currentTarget.value;
|
|
39
|
+
update(config);
|
|
40
40
|
}}/>
|
|
41
41
|
</Form.Item>
|
|
42
42
|
<Form.Item label={t('label.lossRatio')} help={t('placeholder.lossRatio')}>
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"apiV3Key": "apiV3Key"
|
|
9
9
|
},
|
|
10
10
|
"placeholder": {
|
|
11
|
-
"privateKeyFilePath": "
|
|
12
|
-
"publicKeyFilePath": "
|
|
11
|
+
"privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限",
|
|
12
|
+
"publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限",
|
|
13
13
|
"lossRatio": "填百分比(0.6就代表千分之六)",
|
|
14
|
-
"payNotifyUrl": "
|
|
15
|
-
"refundNotifyUrl": "
|
|
14
|
+
"payNotifyUrl": "endpoint",
|
|
15
|
+
"refundNotifyUrl": "endpoint",
|
|
16
16
|
"apiV3Key": "需要登录商户后台获取"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/es/data/i18n.js
CHANGED
|
@@ -119,7 +119,8 @@ const i18ns = [
|
|
|
119
119
|
"account": "帐户充值"
|
|
120
120
|
},
|
|
121
121
|
"success": "支付成功",
|
|
122
|
-
"pay": "支付"
|
|
122
|
+
"pay": "支付",
|
|
123
|
+
"wechatPay": "微信支付"
|
|
123
124
|
}
|
|
124
125
|
},
|
|
125
126
|
{
|
|
@@ -224,11 +225,11 @@ const i18ns = [
|
|
|
224
225
|
"apiV3Key": "apiV3Key"
|
|
225
226
|
},
|
|
226
227
|
"placeholder": {
|
|
227
|
-
"privateKeyFilePath": "
|
|
228
|
-
"publicKeyFilePath": "
|
|
228
|
+
"privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限",
|
|
229
|
+
"publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限",
|
|
229
230
|
"lossRatio": "填百分比(0.6就代表千分之六)",
|
|
230
|
-
"payNotifyUrl": "
|
|
231
|
-
"refundNotifyUrl": "
|
|
231
|
+
"payNotifyUrl": "endpoint",
|
|
232
|
+
"refundNotifyUrl": "endpoint",
|
|
232
233
|
"apiV3Key": "需要登录商户后台获取"
|
|
233
234
|
}
|
|
234
235
|
}
|
|
@@ -120,10 +120,7 @@ export default class WechatPay {
|
|
|
120
120
|
getState: omit(result, ['mchid', 'appid', 'out_trade_no']),
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
return [iState,
|
|
124
|
-
...updateData,
|
|
125
|
-
iState,
|
|
126
|
-
}];
|
|
123
|
+
return [iState, updateData];
|
|
127
124
|
}
|
|
128
125
|
async close(pay) {
|
|
129
126
|
const outTradeNo = compressTo32(pay.id);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const PayConfig_1 = require("../types/PayConfig");
|
|
4
|
+
const types_1 = require("oak-domain/lib/types");
|
|
5
|
+
const checkers = [
|
|
6
|
+
{
|
|
7
|
+
type: 'data',
|
|
8
|
+
entity: 'application',
|
|
9
|
+
action: 'update',
|
|
10
|
+
checker: (data, context) => {
|
|
11
|
+
const { payConfig } = (data || {});
|
|
12
|
+
if (payConfig) {
|
|
13
|
+
const wechatPayConfigs = payConfig.filter(ele => [
|
|
14
|
+
PayConfig_1.PAY_CHANNEL_WECHAT_APP_NAME,
|
|
15
|
+
PayConfig_1.PAY_CHANNEL_WECHAT_H5_NAME,
|
|
16
|
+
PayConfig_1.PAY_CHANNEL_WECHAT_JS_NAME,
|
|
17
|
+
PayConfig_1.PAY_CHANNEL_WECHAT_MP_NAME,
|
|
18
|
+
PayConfig_1.PAY_CHANNEL_WECHAT_NATIVE_NAME
|
|
19
|
+
].includes(ele.channel));
|
|
20
|
+
if (wechatPayConfigs) {
|
|
21
|
+
wechatPayConfigs.forEach((config) => {
|
|
22
|
+
const { apiV3Key } = config;
|
|
23
|
+
if (apiV3Key?.length && apiV3Key.length !== 32) {
|
|
24
|
+
throw new types_1.OakInputIllegalException('appliation', ['payConfig'], 'apiV3Key长度只能是32位');
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
exports.default = checkers;
|
package/lib/checkers/index.js
CHANGED
|
@@ -4,9 +4,11 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const accountOper_1 = tslib_1.__importDefault(require("./accountOper"));
|
|
5
5
|
const pay_1 = tslib_1.__importDefault(require("./pay"));
|
|
6
6
|
const order_1 = tslib_1.__importDefault(require("./order"));
|
|
7
|
+
const application_1 = tslib_1.__importDefault(require("./application"));
|
|
7
8
|
const checkers = [
|
|
8
9
|
...accountOper_1.default,
|
|
9
10
|
...pay_1.default,
|
|
10
11
|
...order_1.default,
|
|
12
|
+
...application_1.default,
|
|
11
13
|
];
|
|
12
14
|
exports.default = checkers;
|
package/lib/data/i18n.js
CHANGED
|
@@ -121,7 +121,8 @@ const i18ns = [
|
|
|
121
121
|
"account": "帐户充值"
|
|
122
122
|
},
|
|
123
123
|
"success": "支付成功",
|
|
124
|
-
"pay": "支付"
|
|
124
|
+
"pay": "支付",
|
|
125
|
+
"wechatPay": "微信支付"
|
|
125
126
|
}
|
|
126
127
|
},
|
|
127
128
|
{
|
|
@@ -226,11 +227,11 @@ const i18ns = [
|
|
|
226
227
|
"apiV3Key": "apiV3Key"
|
|
227
228
|
},
|
|
228
229
|
"placeholder": {
|
|
229
|
-
"privateKeyFilePath": "
|
|
230
|
-
"publicKeyFilePath": "
|
|
230
|
+
"privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限",
|
|
231
|
+
"publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限",
|
|
231
232
|
"lossRatio": "填百分比(0.6就代表千分之六)",
|
|
232
|
-
"payNotifyUrl": "
|
|
233
|
-
"refundNotifyUrl": "
|
|
233
|
+
"payNotifyUrl": "endpoint",
|
|
234
|
+
"refundNotifyUrl": "endpoint",
|
|
234
235
|
"apiV3Key": "需要登录商户后台获取"
|
|
235
236
|
}
|
|
236
237
|
}
|
|
@@ -123,10 +123,7 @@ class WechatPay {
|
|
|
123
123
|
getState: (0, lodash_1.omit)(result, ['mchid', 'appid', 'out_trade_no']),
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
return [iState,
|
|
127
|
-
...updateData,
|
|
128
|
-
iState,
|
|
129
|
-
}];
|
|
126
|
+
return [iState, updateData];
|
|
130
127
|
}
|
|
131
128
|
async close(pay) {
|
|
132
129
|
const outTradeNo = (0, uuid_1.compressTo32)(pay.id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*",
|
|
@@ -51,10 +51,8 @@
|
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"nprogress": "^0.2.0",
|
|
53
53
|
"oak-domain": "~5.0.8",
|
|
54
|
-
"oak-external-sdk": "~2.3.0",
|
|
55
54
|
"oak-frontend-base": "~5.1.0",
|
|
56
55
|
"oak-general-business": "~5.1.0",
|
|
57
|
-
"oak-memory-tree-store": "~3.3.1",
|
|
58
56
|
"react": "~18.2.0",
|
|
59
57
|
"react-dom": "~18.2.0",
|
|
60
58
|
"react-image-gallery": "^1.2.11",
|