oak-pay-business 1.0.5 → 1.0.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 (38) hide show
  1. package/es/components/AbstractComponents.d.ts +1 -0
  2. package/es/components/account/deposit/index.d.ts +1 -0
  3. package/es/components/account/deposit/index.js +39 -9
  4. package/es/components/account/deposit/index.json +1 -0
  5. package/es/components/account/deposit/index.xml +3 -0
  6. package/es/components/account/deposit/locales/zh-CN.json +4 -0
  7. package/es/components/account/deposit/web.d.ts +4 -1
  8. package/es/components/account/deposit/web.js +7 -7
  9. package/es/components/account/deposit/web.pc.d.ts +4 -2
  10. package/es/components/account/deposit/web.pc.js +9 -7
  11. package/es/components/account/deposit/web.pc.module.less +3 -0
  12. package/es/components/account/detail/index.d.ts +2 -1
  13. package/es/components/account/detail/index.js +18 -3
  14. package/es/components/account/detail/index.xml +2 -1
  15. package/es/components/account/detail/locales/zh-CN.json +5 -1
  16. package/es/components/account/detail/web.d.ts +2 -1
  17. package/es/components/account/detail/web.js +2 -2
  18. package/es/components/account/detail/web.pc.d.ts +2 -1
  19. package/es/components/account/detail/web.pc.js +2 -2
  20. package/es/components/order/pay/info.js +6 -6
  21. package/es/components/pay/detail/index.js +2 -1
  22. package/es/components/payConfig/upsert/account/index.js +21 -3
  23. package/es/components/payConfig/upsert/account/locales/zh-CN.json +9 -1
  24. package/es/components/payConfig/upsert/wechatPay/index.js +17 -11
  25. package/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json +4 -2
  26. package/es/context/BackendRuntimeContext.d.ts +1 -0
  27. package/es/context/BackendRuntimeContext.js +24 -0
  28. package/es/data/i18n.js +22 -4
  29. package/es/types/Exception.d.ts +1 -1
  30. package/es/types/Exception.js +2 -3
  31. package/es/types/PayConfig.d.ts +3 -0
  32. package/lib/context/BackendRuntimeContext.d.ts +1 -0
  33. package/lib/context/BackendRuntimeContext.js +24 -0
  34. package/lib/data/i18n.js +22 -4
  35. package/lib/types/Exception.d.ts +1 -1
  36. package/lib/types/Exception.js +3 -4
  37. package/lib/types/PayConfig.d.ts +3 -0
  38. package/package.json +4 -4
@@ -48,6 +48,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
48
48
  size?: "small" | "large" | "middle" | undefined;
49
49
  scroll?: any;
50
50
  locale?: any;
51
+ opWidth?: number | undefined;
51
52
  }) => React.ReactElement;
52
53
  declare const Detail: <T extends keyof EntityDict>(props: ReactComponentProps<EntityDict, T, false, {
53
54
  column?: number | Record<Breakpoint, number> | undefined;
@@ -1,4 +1,5 @@
1
1
  declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, {
2
+ depositMinCent: number;
2
3
  depositMaxCent: number;
3
4
  onSetPrice: (price: null | number) => void;
4
5
  onSetChannel: (channel: string) => void;
@@ -2,6 +2,7 @@ import { ToCent, ToYuan } from 'oak-domain/lib/utils/money';
2
2
  import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../../../types/PayConfig';
3
3
  export default OakComponent({
4
4
  properties: {
5
+ depositMinCent: 0,
5
6
  depositMaxCent: 1000000,
6
7
  onSetPrice: (price) => undefined,
7
8
  onSetChannel: (channel) => undefined,
@@ -21,12 +22,16 @@ export default OakComponent({
21
22
  payConfig.push(config);
22
23
  }
23
24
  }
24
- const { depositMaxCent } = this.props;
25
+ const { depositMaxCent, depositMinCent } = this.props;
26
+ const depositLoss = accountConfig?.depositLoss;
27
+ const depositLossRatio = accountConfig?.depositLossRatio;
28
+ const tips = depositLoss ? depositLossRatio ? this.t('tips.depositLossRatio', { ratio: depositLossRatio }) : this.t('tips.depositLoss') : '';
25
29
  return {
26
30
  depositMax: ToYuan(depositMaxCent),
31
+ depositMin: ToYuan(depositMinCent),
27
32
  account: data,
28
33
  payConfig,
29
- // accountConfig,
34
+ tips,
30
35
  };
31
36
  },
32
37
  features: ['application'],
@@ -36,23 +41,48 @@ export default OakComponent({
36
41
  }
37
42
  },
38
43
  methods: {
39
- onDepPriceChangeMp(event) {
40
- const { value } = event.detail;
41
- const { depositMaxCent } = this.props;
42
- const price2 = parseInt(value);
43
- if (!isNaN(price2)) {
44
- const price = Math.min(depositMaxCent, ToCent(price2));
44
+ onPriceChange(price2) {
45
+ if (price2 === null) {
46
+ this.props.onSetPrice(price2);
47
+ this.setState({
48
+ price: price2,
49
+ priceStr: '',
50
+ });
51
+ }
52
+ else {
53
+ let price = ToCent(price2);
45
54
  this.props.onSetPrice(price);
46
55
  this.setState({
47
56
  price,
48
- priceStr: price ? `${ToYuan(price)}` : undefined
57
+ priceStr: ToYuan(price),
49
58
  });
50
59
  }
51
60
  },
61
+ onDepPriceChangeMp(event) {
62
+ const { value } = event.detail;
63
+ if (value === null) {
64
+ this.onPriceChange(value);
65
+ }
66
+ else {
67
+ const price2 = parseInt(value);
68
+ if (!isNaN(price2)) {
69
+ this.onPriceChange(price2);
70
+ }
71
+ }
72
+ },
52
73
  },
53
74
  data: {
54
75
  onChannelPickMp(channel) { this.props.onSetChannel(channel); },
55
76
  onMetaSetMp(meta) { this.props.onSetMeta(meta); },
56
77
  price: 0,
78
+ priceStr: '',
79
+ },
80
+ lifetimes: {
81
+ ready() {
82
+ const { depositMinCent } = this.props;
83
+ if (depositMinCent) {
84
+ this.onPriceChange(ToYuan(depositMinCent));
85
+ }
86
+ }
57
87
  }
58
88
  });
@@ -4,6 +4,7 @@
4
4
  "l-form-item": "@oak-frontend-base/miniprogram_npm/lin-ui/form-item/index",
5
5
  "l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
6
6
  "l-button": "@oak-frontend-base/miniprogram_npm/lin-ui/button/index",
7
+ "l-notice-bar": "@oak-frontend-base/miniprogram_npm/lin-ui/notice-bar/index",
7
8
  "pay-channel-picker": "../../pay/channelPicker/index"
8
9
  }
9
10
  }
@@ -1,5 +1,8 @@
1
1
  <view class="container">
2
2
  <l-form>
3
+ <block wx:if="{{tips}}">
4
+ <l-notice-bar type="roll" show="{{true}}">{{tips}}</l-notice-bar>
5
+ </block>
3
6
  <l-form-item label="{{t('label.depPrice')}}">
4
7
  <l-input
5
8
  hide-label
@@ -3,5 +3,9 @@
3
3
  "label": {
4
4
  "depPrice": "充值金额",
5
5
  "channel": "充值渠道"
6
+ },
7
+ "tips": {
8
+ "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓",
9
+ "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
6
10
  }
7
11
  }
@@ -6,11 +6,14 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
6
6
  depositMax: number;
7
7
  payConfig: PayConfig;
8
8
  accountConfig?: AccountPayConfig;
9
- onSetPrice: (price: null | number) => void;
10
9
  onSetChannel: (channel: string) => void;
11
10
  onSetMeta: (meta: any) => void;
12
11
  price: number;
13
12
  priceStr: string | undefined;
14
13
  channel: string;
15
14
  meta: any;
15
+ depositMin: number;
16
+ tips: string;
17
+ }, {
18
+ onPriceChange: (price: null | number) => void;
16
19
  }>): React.JSX.Element | null;
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
2
  import ChannelPicker from '../../pay/channelPicker';
3
- import { Form, Input } from 'antd-mobile';
4
- import { ToCent } from 'oak-domain/lib/utils/money';
3
+ import { Form, Input, NoticeBar } from 'antd-mobile';
5
4
  export default function Render(props) {
6
- const { depositMax, payConfig, price, channel, meta, priceStr, onSetChannel, onSetMeta, onSetPrice } = props.data;
7
- const { t } = props.methods;
5
+ const { depositMax, payConfig, tips, price, channel, meta, priceStr, onSetChannel, onSetMeta } = props.data;
6
+ const { t, onPriceChange } = props.methods;
8
7
  if (payConfig) {
9
8
  return (<Form layout="horizontal">
9
+ {tips && <NoticeBar content={tips} color='info'/>}
10
10
  <Form.Item label={<span>{t("label.depPrice")}:</span>} extra={t('common::pay.symbol')}>
11
- <Input type='number' placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={priceStr} onChange={(value) => {
11
+ <Input autoFocus type='number' placeholder={t('placeholder', { max: depositMax })} value={priceStr} onChange={(value) => {
12
12
  if (value === '' || value === null) {
13
- onSetPrice(null);
13
+ onPriceChange(null);
14
14
  return;
15
15
  }
16
16
  const v = parseInt(value);
17
17
  if (!isNaN(v)) {
18
- onSetPrice(ToCent(v));
18
+ onPriceChange(v);
19
19
  }
20
20
  }}/>
21
21
  </Form.Item>
@@ -6,11 +6,13 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
6
6
  depositMax: number;
7
7
  payConfig: PayConfig;
8
8
  accountConfig?: AccountPayConfig;
9
- onSetPrice: (price: null | number) => void;
10
9
  onSetChannel: (channel: string) => void;
11
10
  onSetMeta: (meta: any) => void;
12
11
  price: number;
13
- priceStr: string | undefined;
14
12
  channel: string;
15
13
  meta: any;
14
+ depositMin: number;
15
+ tips: string;
16
+ }, {
17
+ onPriceChange: (price: null | number) => void;
16
18
  }>): React.JSX.Element | null;
@@ -1,15 +1,17 @@
1
1
  import React from 'react';
2
- import { Form, InputNumber } from 'antd';
2
+ import { Form, InputNumber, Alert } from 'antd';
3
3
  import ChannelPicker from '../../pay/channelPicker';
4
- import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
4
+ import { ToYuan } from 'oak-domain/lib/utils/money';
5
+ import Styles from './web.pc.module.less';
5
6
  export default function Render(props) {
6
- const { depositMax, payConfig, price, channel, meta, priceStr, onSetChannel, onSetMeta, onSetPrice } = props.data;
7
- const { t } = props.methods;
7
+ const { depositMax, payConfig, price, channel, meta, tips, onSetChannel, onSetMeta } = props.data;
8
+ const { t, onPriceChange } = props.methods;
8
9
  if (payConfig) {
9
- return (<Form labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" style={{ minWidth: 600 }} colon={false}>
10
+ return (<Form labelCol={{ span: 4 }} wrapperCol={{ span: 14 }} layout="horizontal" style={{ width: '100%' }} colon={false}>
11
+ {tips && <Alert className={Styles.tips} type="info" message={tips}/>}
10
12
  <Form.Item label={<span>{t("label.depPrice")}:</span>}>
11
- <InputNumber placeholder={t('placeholder', { max: depositMax })} max={depositMax} min={1} value={typeof price == 'number' ? ToYuan(price) : null} addonAfter={t('common::pay.symbol')} onChange={(value) => {
12
- onSetPrice(ToCent(value || 0));
13
+ <InputNumber autoFocus placeholder={t('placeholder', { max: depositMax })} value={typeof price == 'number' ? ToYuan(price) : null} addonAfter={t('common::pay.symbol')} onChange={(value) => {
14
+ onPriceChange(value);
13
15
  }}/>
14
16
  </Form.Item>
15
17
  {price > 0 ? <Form.Item label={<span style={{ marginTop: 10 }}>
@@ -0,0 +1,3 @@
1
+ .tips {
2
+ margin-bottom: 4px;
3
+ }
@@ -1,5 +1,6 @@
1
1
  declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "account", false, {
2
- depositMax: number;
2
+ depositMinCent: number;
3
+ depositMaxCent: number;
3
4
  onDepositPayId: (payId: string) => void;
4
5
  }>) => React.ReactElement;
5
6
  export default _default;
@@ -1,4 +1,4 @@
1
- import { CentToString } from "oak-domain/lib/utils/money";
1
+ import { CentToString, ToYuan } from "oak-domain/lib/utils/money";
2
2
  import { generateNewIdAsync } from "oak-domain/lib/utils/uuid";
3
3
  import assert from 'assert';
4
4
  import { DATA_SUBSCRIBER_KEYS } from "../../../config/constants";
@@ -49,7 +49,8 @@ export default OakComponent({
49
49
  }
50
50
  },
51
51
  properties: {
52
- depositMax: 10000,
52
+ depositMinCent: 0,
53
+ depositMaxCent: 1000000,
53
54
  onDepositPayId: (payId) => undefined,
54
55
  },
55
56
  formData({ data }) {
@@ -66,7 +67,21 @@ export default OakComponent({
66
67
  async createDepositPay() {
67
68
  const { depPrice, depositChannel, depositMeta } = this.state;
68
69
  const payId = await generateNewIdAsync();
69
- const { oakId } = this.props;
70
+ const { oakId, depositMaxCent, depositMinCent } = this.props;
71
+ if (depPrice > depositMaxCent) {
72
+ this.setMessage({
73
+ type: 'error',
74
+ content: this.t('error.maxOverflow', { value: ToYuan(depositMaxCent) }),
75
+ });
76
+ return;
77
+ }
78
+ else if (depPrice < depositMinCent) {
79
+ this.setMessage({
80
+ type: 'error',
81
+ content: this.t('error.minOverflow', { value: ToYuan(depositMinCent) }),
82
+ });
83
+ return;
84
+ }
70
85
  this.setDepositing(true);
71
86
  try {
72
87
  await this.execute(undefined, undefined, undefined, [
@@ -37,7 +37,8 @@
37
37
  >
38
38
  <view class="ad-container">
39
39
  <account-deposit
40
- depositMax='{{depositMax}}'
40
+ depositMinCent="{{depositMinCent}}"
41
+ depositMaxCent='{{depositMaxCent}}'
41
42
  channel='{{depositChannel}}'
42
43
  meta='{{depositMeta}}'
43
44
  onSetPrice="{{setDepPriceMp}}"
@@ -12,5 +12,9 @@
12
12
  "content": "您有未支付的充值,请先完成支付",
13
13
  "go": "前往支付"
14
14
  },
15
- "history": "账单:"
15
+ "history": "账单:",
16
+ "error": {
17
+ "maxOverflow": "充值金额不得高于%{value}元",
18
+ "minOverflow": "充值金额不得低于%{value}元"
19
+ }
16
20
  }
@@ -3,7 +3,8 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
3
3
  import { EntityDict } from '../../../oak-app-domain';
4
4
  export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
5
5
  account: RowWithActions<EntityDict, 'account'>;
6
- depositMax: number;
6
+ depositMaxCent: number;
7
+ depositMinCent: number;
7
8
  unfinishedPayId?: string;
8
9
  onDepositPayId: (payId: string) => void;
9
10
  depositOpen: boolean;
@@ -5,7 +5,7 @@ import classNames from 'classnames';
5
5
  import { CentToString } from 'oak-domain/lib/utils/money';
6
6
  import AccountDeposit from '../deposit';
7
7
  export default function Render(props) {
8
- const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
8
+ const { account, depositMaxCent, unfinishedPayId, onDepositPayId, depositOpen, depositMinCent, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
9
9
  const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen, setDepPrice, setDepositChannel, setDepositMeta, setDepositing, onDepositClick, onDepositModalClose, onUfModalClose } = props.methods;
10
10
  if (account) {
11
11
  const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
@@ -50,7 +50,7 @@ export default function Render(props) {
50
50
  </div>
51
51
  <Popup visible={depositOpen} onMaskClick={() => onDepositModalClose()} onClose={() => onDepositModalClose()}>
52
52
  <div style={{ padding: 12, marginBottom: 6 }}>
53
- <AccountDeposit depositMax={depositMax} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
53
+ <AccountDeposit depositMinCent={depositMinCent} depositMaxCent={depositMaxCent} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
54
54
  <Button block loading={depositing} color="primary" disabled={!depPrice || !depositChannel || depositing} onClick={() => createDepositPay()}>
55
55
  {depositing ? t('depositing') : t('common::confirm')}
56
56
  </Button>
@@ -3,7 +3,8 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
3
3
  import { EntityDict } from '../../../oak-app-domain';
4
4
  export default function Render(props: WebComponentProps<EntityDict, 'account', false, {
5
5
  account: RowWithActions<EntityDict, 'account'>;
6
- depositMax: number;
6
+ depositMaxCent: number;
7
+ depositMinCent: number;
7
8
  unfinishedPayId?: string;
8
9
  onDepositPayId: (payId: string) => void;
9
10
  depositOpen: boolean;
@@ -7,7 +7,7 @@ import AccountDeposit from '../deposit';
7
7
  import AccountOperList from '../../accountOper/pure/List.pc';
8
8
  import { AccountBookOutlined, ScheduleOutlined } from '@ant-design/icons';
9
9
  export default function Render(props) {
10
- const { account, depositMax, unfinishedPayId, onDepositPayId, depositOpen, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
10
+ const { account, depositMaxCent, unfinishedPayId, onDepositPayId, depositOpen, depositMinCent, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
11
11
  const { t, createDepositPay, setMessage, setDepositOpen, setUfOpen, setDepPrice, setDepositChannel, setDepositMeta, setDepositing, onDepositClick, onDepositModalClose, } = props.methods;
12
12
  if (account) {
13
13
  const { total, avail, '#oakLegalActions': legalActions, accountOper$account: opers } = account;
@@ -51,7 +51,7 @@ export default function Render(props) {
51
51
  {depositing ? t('depositing') : t('common::confirm')}
52
52
  </Button>}>
53
53
  <div style={{ padding: 12 }}>
54
- <AccountDeposit depositMax={depositMax} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
54
+ <AccountDeposit depositMinCent={depositMinCent} depositMaxCent={depositMaxCent} channel={depositChannel} meta={depositMeta} onSetPrice={(price) => setDepPrice(price)} onSetChannel={(channel) => setDepositChannel(channel)} onSetMeta={(meta) => setDepositMeta(meta)}/>
55
55
  </div>
56
56
  </Modal>
57
57
  <Modal title={t('uf.title')} open={ufOpen} onCancel={() => {
@@ -1,11 +1,11 @@
1
1
  import Styles from './info.module.less';
2
2
  export default function Info(props) {
3
3
  const { price, t } = props;
4
- return (<div className={Styles.info}>
5
- <div className={Styles.should}>{t('price')}</div>
6
- <div className={Styles.price}>
7
- <div>{t('common::pay.symbol')}</div>
8
- <div>{price}</div>
9
- </div>
4
+ return (<div className={Styles.info}>
5
+ <div className={Styles.should}>{t('price')}</div>
6
+ <div className={Styles.price}>
7
+ <div>{t('common::pay.symbol')}</div>
8
+ <div>{price}</div>
9
+ </div>
10
10
  </div>);
11
11
  }
@@ -27,7 +27,8 @@ export default OakComponent({
27
27
  order: {
28
28
  id: 1,
29
29
  creatorId: 1,
30
- }
30
+ },
31
+ creatorId: 1,
31
32
  },
32
33
  properties: {
33
34
  onClose: () => undefined,
@@ -1,6 +1,24 @@
1
1
  import React from 'react';
2
- import { Alert } from 'antd';
2
+ import { Alert, Form, Switch, InputNumber } from 'antd';
3
3
  export default function Account(props) {
4
- const { t } = props;
5
- return <Alert type='info' message={t('tips')}/>;
4
+ const { t, config, update } = props;
5
+ return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
6
+ <Alert type='info' message={t('tips')}/>
7
+ <Form.Item label={t('label.depositLoss')} help={t('placeholder.depositLoss')}>
8
+ <Switch value={config.depositLoss} onChange={(value) => {
9
+ config.depositLoss = value;
10
+ if (value === false) {
11
+ config.depositLossRatio = undefined;
12
+ }
13
+ update(config);
14
+ }}/>
15
+ </Form.Item>
16
+ {config.depositLoss &&
17
+ <Form.Item label={t('label.depositLossRatio')} help={t('placeholder.depositLossRatio')}>
18
+ <InputNumber value={config.depositLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
19
+ config.depositLossRatio = value;
20
+ update(config);
21
+ }}/>
22
+ </Form.Item>}
23
+ </Form>);
6
24
  }
@@ -1,3 +1,11 @@
1
1
  {
2
- "tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
2
+ "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
3
+ "label": {
4
+ "depositLossRatio": "充值损耗比例",
5
+ "depositLoss": "充值损耗"
6
+ },
7
+ "placeholder": {
8
+ "depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
9
+ "depositLoss": "开启后用户充值有损耗"
10
+ }
3
11
  }
@@ -1,25 +1,31 @@
1
1
  import React from 'react';
2
- import { Form, Input } from 'antd';
2
+ import { Form, Input, InputNumber } from 'antd';
3
3
  export default function WechatPay(props) {
4
4
  const { config, update, t } = props;
5
- return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
6
- <Form.Item label="mchId">
5
+ return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
6
+ <Form.Item label="mchId">
7
7
  <Input value={config.mchId} onChange={({ currentTarget }) => {
8
8
  config.mchId = currentTarget.value;
9
9
  update(config);
10
- }}/>
11
- </Form.Item>
12
- <Form.Item label={t('label.privateKeyFilePath')}>
10
+ }}/>
11
+ </Form.Item>
12
+ <Form.Item label={t('label.privateKeyFilePath')}>
13
13
  <Input value={config.privateKeyFilePath} placeholder={t('placeholder.privateKeyFilePath')} onChange={({ currentTarget }) => {
14
14
  config.privateKeyFilePath = currentTarget.value;
15
15
  update(config);
16
- }}/>
17
- </Form.Item>
18
- <Form.Item label={t('label.publicKeyFilePath')}>
16
+ }}/>
17
+ </Form.Item>
18
+ <Form.Item label={t('label.publicKeyFilePath')}>
19
19
  <Input value={config.publicKeyFilePath} placeholder={t('placeholder.publicKeyFilePath')} onChange={({ currentTarget }) => {
20
20
  config.publicKeyFilePath = currentTarget.value;
21
21
  update(config);
22
- }}/>
23
- </Form.Item>
22
+ }}/>
23
+ </Form.Item>
24
+ <Form.Item label={t('label.lossRatio')} help={t('placeholder.lossRatio')}>
25
+ <InputNumber value={config.lossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
26
+ config.lossRatio = value;
27
+ update(config);
28
+ }}/>
29
+ </Form.Item>
24
30
  </Form>);
25
31
  }
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "label": {
3
3
  "privateKeyFilePath": "私钥文件路径",
4
- "publicKeyFilePath": "公钥文件路径"
4
+ "publicKeyFilePath": "公钥文件路径",
5
+ "lossRatio": "手续费比例"
5
6
  },
6
7
  "placeholder": {
7
8
  "privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
8
- "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
9
+ "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
10
+ "lossRatio": "填百分比(0.6就代表千分之六)"
9
11
  }
10
12
  }
@@ -4,5 +4,6 @@ import { RuntimeContext } from './RuntimeContext';
4
4
  import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext';
5
5
  export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentBackendRuntimeContext<ED> implements RuntimeContext {
6
6
  toString(): Promise<string>;
7
+ refineOpRecords(): Promise<void>;
7
8
  }
8
9
  export default BackendRuntimeContext;
@@ -1,9 +1,33 @@
1
1
  import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext';
2
+ import { unset } from 'oak-domain/lib/utils/lodash';
2
3
  export class BackendRuntimeContext extends DependentBackendRuntimeContext {
3
4
  async toString() {
4
5
  const data = await this.getSerializedData();
5
6
  return JSON.stringify(data);
6
7
  }
8
+ async refineOpRecords() {
9
+ await super.refineOpRecords();
10
+ for (const opRecord of this.opRecords) {
11
+ if (opRecord.a === 's') {
12
+ const { d } = opRecord;
13
+ for (const entity in d) {
14
+ if (['application', 'system'].includes(entity)) {
15
+ // todo 删除掉config中的敏感返回信息
16
+ const rowDict = d[entity];
17
+ for (const id in rowDict) {
18
+ const { payConfig } = rowDict[id];
19
+ if (payConfig) {
20
+ payConfig.forEach((config) => {
21
+ unset(config, 'publicKeyFilePath');
22
+ unset(config, 'privateKeyFilePath');
23
+ });
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
7
31
  }
8
32
  ;
9
33
  export default BackendRuntimeContext;
package/es/data/i18n.js CHANGED
@@ -11,6 +11,10 @@ const i18ns = [
11
11
  "label": {
12
12
  "depPrice": "充值金额",
13
13
  "channel": "充值渠道"
14
+ },
15
+ "tips": {
16
+ "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓",
17
+ "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
14
18
  }
15
19
  }
16
20
  },
@@ -34,7 +38,11 @@ const i18ns = [
34
38
  "content": "您有未支付的充值,请先完成支付",
35
39
  "go": "前往支付"
36
40
  },
37
- "history": "账单:"
41
+ "history": "账单:",
42
+ "error": {
43
+ "maxOverflow": "充值金额不得高于%{value}元",
44
+ "minOverflow": "充值金额不得低于%{value}元"
45
+ }
38
46
  }
39
47
  },
40
48
  {
@@ -162,7 +170,15 @@ const i18ns = [
162
170
  module: "oak-pay-business",
163
171
  position: "src/components/payConfig/upsert/account",
164
172
  data: {
165
- "tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
173
+ "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
174
+ "label": {
175
+ "depositLossRatio": "充值损耗比例",
176
+ "depositLoss": "充值损耗"
177
+ },
178
+ "placeholder": {
179
+ "depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
180
+ "depositLoss": "开启后用户充值有损耗"
181
+ }
166
182
  }
167
183
  },
168
184
  {
@@ -200,11 +216,13 @@ const i18ns = [
200
216
  data: {
201
217
  "label": {
202
218
  "privateKeyFilePath": "私钥文件路径",
203
- "publicKeyFilePath": "公钥文件路径"
219
+ "publicKeyFilePath": "公钥文件路径",
220
+ "lossRatio": "手续费比例"
204
221
  },
205
222
  "placeholder": {
206
223
  "privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
207
- "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
224
+ "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
225
+ "lossRatio": "填百分比(0.6就代表千分之六)"
208
226
  }
209
227
  }
210
228
  },
@@ -1,3 +1,3 @@
1
1
  import { OakException } from 'oak-domain/lib/types';
2
2
  import { EntityDict } from '../oak-app-domain/index';
3
- export declare function makeException<ED extends EntityDict>(msg: string | object): OakException<ED>;
3
+ export declare function makeException<ED extends EntityDict>(msg: string | object): OakException<ED> | undefined;
@@ -1,4 +1,3 @@
1
- import { OakException } from 'oak-domain/lib/types';
2
1
  import makeDepedentException from './DependentExceptions';
3
2
  export function makeException(msg) {
4
3
  const data = typeof msg === 'string' ? JSON.parse(msg) : msg;
@@ -6,10 +5,10 @@ export function makeException(msg) {
6
5
  if (exception) {
7
6
  return exception;
8
7
  }
9
- const { name, message } = data;
8
+ /* const { name, message } = data;
10
9
  switch (name) {
11
10
  default: {
12
11
  throw new OakException(`不可解读的exception信息「${msg}」`);
13
12
  }
14
- }
13
+ } */
15
14
  }
@@ -7,10 +7,13 @@ export type WechatPayConfig = {
7
7
  mchId: string;
8
8
  publicKeyFilePath: string;
9
9
  privateKeyFilePath: string;
10
+ lossRatio: number;
10
11
  };
11
12
  export type AccountPayChannel = 'ACCOUNT';
12
13
  export type AccountPayConfig = {
13
14
  channel: AccountPayChannel;
15
+ depositLoss: boolean;
16
+ depositLossRatio?: number;
14
17
  };
15
18
  export type OfflinePayChannel = 'OFFLINE';
16
19
  export type OfflinePayConfig = {
@@ -4,5 +4,6 @@ import { RuntimeContext } from './RuntimeContext';
4
4
  import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext';
5
5
  export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentBackendRuntimeContext<ED> implements RuntimeContext {
6
6
  toString(): Promise<string>;
7
+ refineOpRecords(): Promise<void>;
7
8
  }
8
9
  export default BackendRuntimeContext;
@@ -2,11 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackendRuntimeContext = void 0;
4
4
  const DependentContext_1 = require("./DependentContext");
5
+ const lodash_1 = require("oak-domain/lib/utils/lodash");
5
6
  class BackendRuntimeContext extends DependentContext_1.BackendRuntimeContext {
6
7
  async toString() {
7
8
  const data = await this.getSerializedData();
8
9
  return JSON.stringify(data);
9
10
  }
11
+ async refineOpRecords() {
12
+ await super.refineOpRecords();
13
+ for (const opRecord of this.opRecords) {
14
+ if (opRecord.a === 's') {
15
+ const { d } = opRecord;
16
+ for (const entity in d) {
17
+ if (['application', 'system'].includes(entity)) {
18
+ // todo 删除掉config中的敏感返回信息
19
+ const rowDict = d[entity];
20
+ for (const id in rowDict) {
21
+ const { payConfig } = rowDict[id];
22
+ if (payConfig) {
23
+ payConfig.forEach((config) => {
24
+ (0, lodash_1.unset)(config, 'publicKeyFilePath');
25
+ (0, lodash_1.unset)(config, 'privateKeyFilePath');
26
+ });
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
10
34
  }
11
35
  exports.BackendRuntimeContext = BackendRuntimeContext;
12
36
  ;
package/lib/data/i18n.js CHANGED
@@ -13,6 +13,10 @@ const i18ns = [
13
13
  "label": {
14
14
  "depPrice": "充值金额",
15
15
  "channel": "充值渠道"
16
+ },
17
+ "tips": {
18
+ "depositLoss": "线上充值将按照充值渠道的扣款比例扣除相应费用(一般是0.6%),敬请知晓",
19
+ "depositLossRatio": "线上充值将按照%{ratio}%的比例扣除相应费用,敬请知晓"
16
20
  }
17
21
  }
18
22
  },
@@ -36,7 +40,11 @@ const i18ns = [
36
40
  "content": "您有未支付的充值,请先完成支付",
37
41
  "go": "前往支付"
38
42
  },
39
- "history": "账单:"
43
+ "history": "账单:",
44
+ "error": {
45
+ "maxOverflow": "充值金额不得高于%{value}元",
46
+ "minOverflow": "充值金额不得低于%{value}元"
47
+ }
40
48
  }
41
49
  },
42
50
  {
@@ -164,7 +172,15 @@ const i18ns = [
164
172
  module: "oak-pay-business",
165
173
  position: "src/components/payConfig/upsert/account",
166
174
  data: {
167
- "tips": "无需配置。开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付等操作"
175
+ "tips": "开启后支持向系统帐户内充值,并使用帐户余额进行抵扣、支付、提现等操作,请了解功能后再使用",
176
+ "label": {
177
+ "depositLossRatio": "充值损耗比例",
178
+ "depositLoss": "充值损耗"
179
+ },
180
+ "placeholder": {
181
+ "depositLossRatio": "若为空,则默认按收费途径的损耗扣除",
182
+ "depositLoss": "开启后用户充值有损耗"
183
+ }
168
184
  }
169
185
  },
170
186
  {
@@ -202,11 +218,13 @@ const i18ns = [
202
218
  data: {
203
219
  "label": {
204
220
  "privateKeyFilePath": "私钥文件路径",
205
- "publicKeyFilePath": "公钥文件路径"
221
+ "publicKeyFilePath": "公钥文件路径",
222
+ "lossRatio": "手续费比例"
206
223
  },
207
224
  "placeholder": {
208
225
  "privateKeyFilePath": "服务器上存放微信支付帐户私钥文件的路径,注意访问权限",
209
- "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限"
226
+ "publicKeyFilePath": "服务器上存放微信支付帐户公钥文件的路径,注意访问权限",
227
+ "lossRatio": "填百分比(0.6就代表千分之六)"
210
228
  }
211
229
  }
212
230
  },
@@ -1,3 +1,3 @@
1
1
  import { OakException } from 'oak-domain/lib/types';
2
2
  import { EntityDict } from '../oak-app-domain/index';
3
- export declare function makeException<ED extends EntityDict>(msg: string | object): OakException<ED>;
3
+ export declare function makeException<ED extends EntityDict>(msg: string | object): OakException<ED> | undefined;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeException = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const types_1 = require("oak-domain/lib/types");
6
5
  const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions"));
7
6
  function makeException(msg) {
8
7
  const data = typeof msg === 'string' ? JSON.parse(msg) : msg;
@@ -10,11 +9,11 @@ function makeException(msg) {
10
9
  if (exception) {
11
10
  return exception;
12
11
  }
13
- const { name, message } = data;
12
+ /* const { name, message } = data;
14
13
  switch (name) {
15
14
  default: {
16
- throw new types_1.OakException(`不可解读的exception信息「${msg}」`);
15
+ throw new OakException(`不可解读的exception信息「${msg}」`);
17
16
  }
18
- }
17
+ } */
19
18
  }
20
19
  exports.makeException = makeException;
@@ -7,10 +7,13 @@ export type WechatPayConfig = {
7
7
  mchId: string;
8
8
  publicKeyFilePath: string;
9
9
  privateKeyFilePath: string;
10
+ lossRatio: number;
10
11
  };
11
12
  export type AccountPayChannel = 'ACCOUNT';
12
13
  export type AccountPayConfig = {
13
14
  channel: AccountPayChannel;
15
+ depositLoss: boolean;
16
+ depositLossRatio?: number;
14
17
  };
15
18
  export type OfflinePayChannel = 'OFFLINE';
16
19
  export type OfflinePayConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-pay-business",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib/**/*",
@@ -50,11 +50,11 @@
50
50
  "js-base64": "^3.7.2",
51
51
  "lodash": "^4.17.21",
52
52
  "nprogress": "^0.2.0",
53
- "oak-domain": "~5.0.6",
53
+ "oak-domain": "~5.0.7",
54
54
  "oak-external-sdk": "~2.3.0",
55
- "oak-frontend-base": "~5.0.6",
55
+ "oak-frontend-base": "~5.0.8",
56
56
  "oak-memory-tree-store": "~3.3.0",
57
- "oak-general-business": "~5.0.7",
57
+ "oak-general-business": "~5.0.8",
58
58
  "react": "^18.2.0",
59
59
  "react-dom": "^18.1.0",
60
60
  "react-image-gallery": "^1.2.11",