oak-pay-business 1.0.12 → 1.1.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 (277) hide show
  1. package/es/aspects/AspectDict.d.ts +4 -1
  2. package/es/aspects/account.d.ts +5 -0
  3. package/es/aspects/account.js +4 -0
  4. package/es/aspects/index.js +2 -2
  5. package/es/checkers/accountOper.js +10 -3
  6. package/es/checkers/pay.js +31 -0
  7. package/es/checkers/refund.d.ts +5 -0
  8. package/es/checkers/refund.js +18 -0
  9. package/es/components/account/deposit/index.js +1 -1
  10. package/es/components/account/detail/index.d.ts +1 -0
  11. package/es/components/account/detail/index.js +4 -0
  12. package/es/components/account/detail/index.xml +1 -0
  13. package/es/components/account/detail/web.d.ts +2 -1
  14. package/es/components/account/detail/web.js +2 -5
  15. package/es/components/account/detail/web.pc.d.ts +1 -0
  16. package/es/components/account/detail/web.pc.js +2 -5
  17. package/es/components/pay/list/web.pc.js +19 -17
  18. package/es/components/pay/list/web.pc.module.less +10 -10
  19. package/es/components/payConfig/system/web.pc.module.less +16 -16
  20. package/es/components/payConfig/upsert/offline/index.js +20 -20
  21. package/es/components/payConfig/upsert/wechatPay/index.js +24 -1
  22. package/es/components/payConfig/upsert/wechatPay/locales/zh-CN.json +8 -2
  23. package/es/components/withdraw/create/index.d.ts +8 -0
  24. package/es/components/withdraw/create/index.js +236 -0
  25. package/es/components/withdraw/create/index.json +9 -0
  26. package/es/components/withdraw/create/index.less +105 -0
  27. package/es/components/withdraw/create/index.xml +94 -0
  28. package/es/components/withdraw/create/locales/zh-CN.json +39 -0
  29. package/es/components/withdraw/create/web.d.ts +32 -0
  30. package/es/components/withdraw/create/web.js +89 -0
  31. package/es/components/withdraw/create/web.module.less +104 -0
  32. package/es/components/withdraw/create/web.pc.d.ts +32 -0
  33. package/es/components/withdraw/create/web.pc.js +71 -0
  34. package/es/components/withdraw/create/web.pc.module.less +79 -0
  35. package/es/components/withdraw/detail/index.d.ts +4 -0
  36. package/es/components/withdraw/detail/index.js +60 -0
  37. package/es/components/withdraw/detail/index.json +5 -0
  38. package/es/components/withdraw/detail/index.less +11 -0
  39. package/es/components/withdraw/detail/index.xml +14 -0
  40. package/es/components/withdraw/detail/locales/zh-CN.json +13 -0
  41. package/es/components/withdraw/detail/web.d.ts +19 -0
  42. package/es/components/withdraw/detail/web.js +13 -0
  43. package/es/components/withdraw/detail/web.module.less +8 -0
  44. package/es/components/withdraw/detail/web.pc.d.ts +19 -0
  45. package/es/components/withdraw/detail/web.pc.js +13 -0
  46. package/es/components/withdraw/detail/web.pc.module.less +8 -0
  47. package/es/components/withdraw/dry/Detail.d.ts +14 -0
  48. package/es/components/withdraw/dry/Detail.js +71 -0
  49. package/es/components/withdraw/dry/Detail.mobile.d.ts +21 -0
  50. package/es/components/withdraw/dry/Detail.mobile.js +75 -0
  51. package/es/components/withdraw/dry/Detail.module.less +84 -0
  52. package/es/components/withdraw/dry/Detail.pc.d.ts +21 -0
  53. package/es/components/withdraw/dry/Detail.pc.js +100 -0
  54. package/es/components/withdraw/dry/Detail.pc.module.less +81 -0
  55. package/es/components/withdraw/dry/index.d.ts +21 -0
  56. package/es/components/withdraw/dry/index.js +11 -0
  57. package/es/components/withdraw/dry/index.json +7 -0
  58. package/es/components/withdraw/dry/index.less +84 -0
  59. package/es/components/withdraw/dry/index.xml +74 -0
  60. package/es/components/withdraw/dry/locales/zh-CN.json +39 -0
  61. package/es/components/withdrawChannel/list/index.d.ts +6 -0
  62. package/es/components/withdrawChannel/list/index.js +32 -0
  63. package/es/components/withdrawChannel/list/index.json +1 -0
  64. package/es/components/withdrawChannel/list/locales/zh-CN.json +3 -0
  65. package/es/components/withdrawChannel/list/web.pc.d.ts +8 -0
  66. package/es/components/withdrawChannel/list/web.pc.js +25 -0
  67. package/es/components/withdrawChannel/upsert/index.d.ts +3 -0
  68. package/es/components/withdrawChannel/upsert/index.js +14 -0
  69. package/es/components/withdrawChannel/upsert/index.json +1 -0
  70. package/es/components/withdrawChannel/upsert/locales/zh-CN.json +6 -0
  71. package/es/components/withdrawChannel/upsert/web.pc.d.ts +6 -0
  72. package/es/components/withdrawChannel/upsert/web.pc.js +25 -0
  73. package/es/configuration/attrUpdateMatrix.js +34 -0
  74. package/es/context/BackendRuntimeContext.d.ts +1 -0
  75. package/es/context/BackendRuntimeContext.js +2 -0
  76. package/es/data/actionAuth.d.ts +3 -0
  77. package/es/data/actionAuth.js +43 -0
  78. package/es/data/i18n.js +143 -2
  79. package/es/data/index.d.ts +2 -0
  80. package/es/data/index.js +4 -0
  81. package/es/data/path.d.ts +3 -0
  82. package/es/data/path.js +73 -0
  83. package/es/entities/Account.d.ts +1 -0
  84. package/es/entities/Account.js +1 -0
  85. package/es/entities/AccountOper.d.ts +2 -1
  86. package/es/entities/AccountOper.js +5 -2
  87. package/es/entities/Pay.d.ts +4 -3
  88. package/es/entities/Pay.js +19 -0
  89. package/es/entities/Refund.d.ts +9 -5
  90. package/es/entities/Refund.js +10 -3
  91. package/es/entities/User.d.ts +2 -0
  92. package/es/entities/User.js +1 -0
  93. package/es/entities/Withdraw.d.ts +14 -5
  94. package/es/entities/Withdraw.js +17 -3
  95. package/es/entities/WithdrawAccount.d.ts +15 -0
  96. package/es/entities/WithdrawAccount.js +34 -0
  97. package/es/entities/WithdrawChannel.d.ts +5 -5
  98. package/es/entities/WithdrawChannel.js +3 -17
  99. package/es/oak-app-domain/Account/Schema.d.ts +6 -0
  100. package/es/oak-app-domain/Account/Storage.js +4 -0
  101. package/es/oak-app-domain/Account/locales/zh_CN.json +1 -1
  102. package/es/oak-app-domain/AccountOper/Schema.d.ts +7 -1
  103. package/es/oak-app-domain/AccountOper/Storage.js +4 -1
  104. package/es/oak-app-domain/AccountOper/Style.js +2 -1
  105. package/es/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
  106. package/es/oak-app-domain/EntityDict.d.ts +2 -0
  107. package/es/oak-app-domain/ModiEntity/Schema.d.ts +34 -5
  108. package/es/oak-app-domain/ModiEntity/Storage.js +1 -1
  109. package/es/oak-app-domain/OperEntity/Schema.d.ts +34 -5
  110. package/es/oak-app-domain/OperEntity/Storage.js +1 -1
  111. package/es/oak-app-domain/Pay/Action.d.ts +2 -2
  112. package/es/oak-app-domain/Pay/Action.js +2 -1
  113. package/es/oak-app-domain/Pay/Schema.d.ts +8 -2
  114. package/es/oak-app-domain/Pay/Storage.js +15 -0
  115. package/es/oak-app-domain/Pay/Style.js +2 -0
  116. package/es/oak-app-domain/Pay/locales/zh_CN.json +1 -1
  117. package/es/oak-app-domain/Refund/Action.d.ts +2 -2
  118. package/es/oak-app-domain/Refund/Action.js +4 -3
  119. package/es/oak-app-domain/Refund/Schema.d.ts +95 -10
  120. package/es/oak-app-domain/Refund/Storage.js +17 -2
  121. package/es/oak-app-domain/Refund/Style.js +1 -0
  122. package/es/oak-app-domain/Refund/locales/zh_CN.json +1 -1
  123. package/es/oak-app-domain/Storage.js +2 -0
  124. package/es/oak-app-domain/System/Schema.d.ts +12 -0
  125. package/es/oak-app-domain/User/Schema.d.ts +36 -0
  126. package/es/oak-app-domain/User/locales/zh_CN.json +1 -1
  127. package/es/oak-app-domain/Withdraw/Action.d.ts +2 -2
  128. package/es/oak-app-domain/Withdraw/Action.js +4 -3
  129. package/es/oak-app-domain/Withdraw/Schema.d.ts +110 -31
  130. package/es/oak-app-domain/Withdraw/Storage.js +25 -3
  131. package/es/oak-app-domain/Withdraw/Style.js +3 -0
  132. package/es/oak-app-domain/Withdraw/locales/zh_CN.json +1 -1
  133. package/es/oak-app-domain/WithdrawAccount/Schema.d.ts +230 -0
  134. package/es/oak-app-domain/WithdrawAccount/Schema.js +1 -0
  135. package/es/oak-app-domain/WithdrawAccount/Storage.d.ts +3 -0
  136. package/es/oak-app-domain/WithdrawAccount/Storage.js +71 -0
  137. package/es/oak-app-domain/WithdrawAccount/locales/zh_CN.json +1 -0
  138. package/es/oak-app-domain/WithdrawChannel/Schema.d.ts +60 -30
  139. package/es/oak-app-domain/WithdrawChannel/Storage.js +9 -27
  140. package/es/oak-app-domain/WithdrawChannel/locales/zh_CN.json +1 -1
  141. package/es/oak-app-domain/_SubQuery.d.ts +24 -2
  142. package/es/triggers/account.js +72 -0
  143. package/es/triggers/accountOper.js +24 -22
  144. package/es/triggers/index.js +4 -0
  145. package/es/triggers/pay.js +52 -2
  146. package/es/triggers/refund.js +157 -6
  147. package/es/triggers/userSystem.js +1 -0
  148. package/es/triggers/withdraw.d.ts +5 -0
  149. package/es/triggers/withdraw.js +147 -0
  150. package/es/types/Exception.d.ts +3 -0
  151. package/es/types/Exception.js +9 -0
  152. package/es/types/PayConfig.d.ts +3 -0
  153. package/es/utils/application.d.ts +1 -0
  154. package/es/utils/application.js +8 -0
  155. package/es/utils/pay.d.ts +1 -0
  156. package/es/utils/pay.js +87 -0
  157. package/es/utils/payClazz/Account.d.ts +2 -1
  158. package/es/utils/payClazz/Account.js +27 -15
  159. package/es/utils/payClazz/WechatPay/WechatPay.d.ts +4 -0
  160. package/es/utils/payClazz/WechatPay/WechatPay.debug.js +12 -5
  161. package/es/utils/payClazz/WechatPay/WechatPay.js +28 -5
  162. package/es/watchers/index.js +2 -0
  163. package/es/watchers/pay.js +17 -0
  164. package/es/watchers/refund.d.ts +5 -0
  165. package/es/watchers/refund.js +74 -0
  166. package/lib/aspects/AspectDict.d.ts +4 -1
  167. package/lib/aspects/account.d.ts +5 -0
  168. package/lib/aspects/account.js +8 -0
  169. package/lib/aspects/index.js +2 -2
  170. package/lib/checkers/accountOper.js +10 -3
  171. package/lib/checkers/pay.js +32 -0
  172. package/lib/checkers/refund.d.ts +5 -0
  173. package/lib/checkers/refund.js +20 -0
  174. package/lib/configuration/attrUpdateMatrix.js +34 -0
  175. package/lib/context/BackendRuntimeContext.d.ts +1 -0
  176. package/lib/context/BackendRuntimeContext.js +2 -0
  177. package/lib/data/actionAuth.d.ts +3 -0
  178. package/lib/data/actionAuth.js +45 -0
  179. package/lib/data/i18n.js +143 -2
  180. package/lib/data/index.d.ts +2 -0
  181. package/lib/data/index.js +4 -0
  182. package/lib/data/path.d.ts +3 -0
  183. package/lib/data/path.js +75 -0
  184. package/lib/entities/Account.d.ts +1 -0
  185. package/lib/entities/Account.js +1 -0
  186. package/lib/entities/AccountOper.d.ts +2 -1
  187. package/lib/entities/AccountOper.js +5 -2
  188. package/lib/entities/Pay.d.ts +4 -3
  189. package/lib/entities/Pay.js +19 -0
  190. package/lib/entities/Refund.d.ts +9 -5
  191. package/lib/entities/Refund.js +10 -3
  192. package/lib/entities/User.d.ts +2 -0
  193. package/lib/entities/User.js +1 -0
  194. package/lib/entities/Withdraw.d.ts +14 -5
  195. package/lib/entities/Withdraw.js +17 -3
  196. package/lib/entities/WithdrawAccount.d.ts +15 -0
  197. package/lib/entities/WithdrawAccount.js +37 -0
  198. package/lib/entities/WithdrawChannel.d.ts +5 -5
  199. package/lib/entities/WithdrawChannel.js +3 -17
  200. package/lib/oak-app-domain/Account/Schema.d.ts +6 -0
  201. package/lib/oak-app-domain/Account/Storage.js +4 -0
  202. package/lib/oak-app-domain/Account/locales/zh_CN.json +1 -1
  203. package/lib/oak-app-domain/AccountOper/Schema.d.ts +7 -1
  204. package/lib/oak-app-domain/AccountOper/Storage.js +4 -1
  205. package/lib/oak-app-domain/AccountOper/Style.js +2 -1
  206. package/lib/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
  207. package/lib/oak-app-domain/EntityDict.d.ts +2 -0
  208. package/lib/oak-app-domain/ModiEntity/Schema.d.ts +34 -5
  209. package/lib/oak-app-domain/ModiEntity/Storage.js +1 -1
  210. package/lib/oak-app-domain/OperEntity/Schema.d.ts +34 -5
  211. package/lib/oak-app-domain/OperEntity/Storage.js +1 -1
  212. package/lib/oak-app-domain/Pay/Action.d.ts +2 -2
  213. package/lib/oak-app-domain/Pay/Action.js +2 -1
  214. package/lib/oak-app-domain/Pay/Schema.d.ts +8 -2
  215. package/lib/oak-app-domain/Pay/Storage.js +15 -0
  216. package/lib/oak-app-domain/Pay/Style.js +2 -0
  217. package/lib/oak-app-domain/Pay/locales/zh_CN.json +1 -1
  218. package/lib/oak-app-domain/Refund/Action.d.ts +2 -2
  219. package/lib/oak-app-domain/Refund/Action.js +4 -3
  220. package/lib/oak-app-domain/Refund/Schema.d.ts +95 -10
  221. package/lib/oak-app-domain/Refund/Storage.js +17 -2
  222. package/lib/oak-app-domain/Refund/Style.js +1 -0
  223. package/lib/oak-app-domain/Refund/locales/zh_CN.json +1 -1
  224. package/lib/oak-app-domain/Storage.js +4 -2
  225. package/lib/oak-app-domain/System/Schema.d.ts +12 -0
  226. package/lib/oak-app-domain/User/Schema.d.ts +36 -0
  227. package/lib/oak-app-domain/User/locales/zh_CN.json +1 -1
  228. package/lib/oak-app-domain/Withdraw/Action.d.ts +2 -2
  229. package/lib/oak-app-domain/Withdraw/Action.js +4 -3
  230. package/lib/oak-app-domain/Withdraw/Schema.d.ts +110 -31
  231. package/lib/oak-app-domain/Withdraw/Storage.js +25 -3
  232. package/lib/oak-app-domain/Withdraw/Style.js +3 -0
  233. package/lib/oak-app-domain/Withdraw/locales/zh_CN.json +1 -1
  234. package/lib/oak-app-domain/WithdrawAccount/Schema.d.ts +230 -0
  235. package/lib/oak-app-domain/WithdrawAccount/Schema.js +2 -0
  236. package/lib/oak-app-domain/WithdrawAccount/Storage.d.ts +3 -0
  237. package/lib/oak-app-domain/WithdrawAccount/Storage.js +74 -0
  238. package/lib/oak-app-domain/WithdrawAccount/locales/zh_CN.json +1 -0
  239. package/lib/oak-app-domain/WithdrawChannel/Schema.d.ts +60 -30
  240. package/lib/oak-app-domain/WithdrawChannel/Storage.js +9 -27
  241. package/lib/oak-app-domain/WithdrawChannel/locales/zh_CN.json +1 -1
  242. package/lib/oak-app-domain/_SubQuery.d.ts +24 -2
  243. package/lib/triggers/account.js +74 -0
  244. package/lib/triggers/accountOper.js +9 -5
  245. package/lib/triggers/index.js +4 -0
  246. package/lib/triggers/pay.js +101 -5
  247. package/lib/triggers/refund.js +156 -5
  248. package/lib/triggers/userSystem.js +1 -0
  249. package/lib/triggers/withdraw.d.ts +5 -0
  250. package/lib/triggers/withdraw.js +150 -0
  251. package/lib/types/Exception.d.ts +3 -0
  252. package/lib/types/Exception.js +11 -1
  253. package/lib/types/PayConfig.d.ts +3 -0
  254. package/lib/utils/application.d.ts +1 -0
  255. package/lib/utils/application.js +11 -0
  256. package/lib/utils/pay.d.ts +1 -0
  257. package/lib/utils/pay.js +89 -1
  258. package/lib/utils/payClazz/Account.d.ts +2 -1
  259. package/lib/utils/payClazz/Account.js +20 -6
  260. package/lib/utils/payClazz/WechatPay/WechatPay.d.ts +4 -0
  261. package/lib/utils/payClazz/WechatPay/WechatPay.debug.js +12 -5
  262. package/lib/utils/payClazz/WechatPay/WechatPay.js +28 -5
  263. package/lib/watchers/index.js +2 -0
  264. package/lib/watchers/pay.js +17 -0
  265. package/lib/watchers/refund.d.ts +5 -0
  266. package/lib/watchers/refund.js +77 -0
  267. package/package.json +4 -4
  268. package/src/entities/Account.ts +77 -75
  269. package/src/entities/AccountOper.ts +7 -3
  270. package/src/entities/Application.ts +53 -53
  271. package/src/entities/Pay.ts +22 -2
  272. package/src/entities/Refund.ts +18 -8
  273. package/src/entities/System.ts +28 -28
  274. package/src/entities/User.ts +170 -167
  275. package/src/entities/Withdraw.ts +94 -71
  276. package/src/entities/WithdrawAccount.ts +55 -0
  277. package/src/entities/WithdrawChannel.ts +8 -21
@@ -1,4 +1,7 @@
1
1
  import { BRC } from '../types/RuntimeCxt';
2
+ import { EntityDict } from '../oak-app-domain';
2
3
  export type AspectDict = {
3
- test: (params: string, context: BRC) => Promise<any>;
4
+ getAccountPayRefunds: (params: {
5
+ accountId: string;
6
+ }, context: BRC) => Promise<EntityDict['refund']['CreateSingle']['data'][]>;
4
7
  };
@@ -0,0 +1,5 @@
1
+ import { BRC } from '../types/RuntimeCxt';
2
+ export declare function getAccountPayRefunds(params: {
3
+ accountId: string;
4
+ price: number;
5
+ }, context: BRC): Promise<Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "entity" | "entityId">[]>;
@@ -0,0 +1,4 @@
1
+ import { getAccountPayRefunds as getAprsFn } from '../utils/pay';
2
+ export async function getAccountPayRefunds(params, context) {
3
+ return getAprsFn(context, params.accountId, params.price);
4
+ }
@@ -1,5 +1,5 @@
1
- import { test } from './sample';
1
+ import { getAccountPayRefunds } from './account';
2
2
  const aspectDict = {
3
- test,
3
+ getAccountPayRefunds,
4
4
  };
5
5
  export default aspectDict;
@@ -18,7 +18,7 @@ const checkers = [
18
18
  type: 'data',
19
19
  checker(data, context) {
20
20
  assert(!(data instanceof Array));
21
- const { type, totalPlus, availPlus } = data;
21
+ const { type, totalPlus, availPlus, refundablePlus } = data;
22
22
  if (typeof totalPlus !== 'number') {
23
23
  throw new OakInputIllegalException('accountOper', ['totalPlus'], 'accountOper中的totalPlus不是数字');
24
24
  }
@@ -33,8 +33,9 @@ const checkers = [
33
33
  break;
34
34
  }
35
35
  case 'deposit': {
36
- if (totalPlus < 0 || availPlus < 0 || totalPlus !== availPlus) {
37
- throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为deposit时,其totalPlus/availPlus必须为正数且相等');
36
+ if (totalPlus < 0 || availPlus < 0 || totalPlus !== availPlus ||
37
+ typeof refundablePlus === 'number' && refundablePlus < 0) {
38
+ throw new OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为deposit时,其totalPlus/availPlus必须为正数且相等, refundable必须为空或者正数');
38
39
  }
39
40
  break;
40
41
  }
@@ -68,6 +69,12 @@ const checkers = [
68
69
  }
69
70
  break;
70
71
  }
72
+ case 'cutoffRefundable': {
73
+ if (totalPlus !== 0 || availPlus !== 0 || typeof refundablePlus !== 'number' || refundablePlus >= 0) {
74
+ throw new OakInputIllegalException('accountOper', ['refundablePlus'], 'accountOper为cutoffRefundable时,其totalPlus/availPlus必须为0,且refundablePlus必须为负数');
75
+ }
76
+ break;
77
+ }
71
78
  default: {
72
79
  assert(false);
73
80
  break;
@@ -1,4 +1,7 @@
1
1
  import { OakInputIllegalException } from 'oak-domain/lib/types';
2
+ import { CHECKER_MAX_PRIORITY } from 'oak-domain/lib/types/Trigger';
3
+ import { pipeline } from 'oak-domain/lib/utils/executor';
4
+ import assert from 'assert';
2
5
  import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME } from '../types/PayConfig';
3
6
  const checkers = [
4
7
  {
@@ -50,6 +53,7 @@ const checkers = [
50
53
  checker(operation, context) {
51
54
  const { data } = operation;
52
55
  const { orderId, price } = data;
56
+ data.refundable = false;
53
57
  if (orderId) {
54
58
  // 所有已经支付和正在支付的pay之和不能超过订单总和
55
59
  const order = context.select('order', {
@@ -102,6 +106,33 @@ const checkers = [
102
106
  channel: PAY_CHANNEL_OFFLINE_NAME,
103
107
  };
104
108
  }
109
+ },
110
+ {
111
+ // 如果在开始支付或者继续支付过程中,paid达到了price,pay的状态可以改为paid
112
+ entity: 'pay',
113
+ type: 'logical',
114
+ action: ['continuePaying', 'startPaying'],
115
+ priority: CHECKER_MAX_PRIORITY - 1, // 要超过action矩阵定义的赋state值
116
+ checker: (operation, context) => {
117
+ const { data, filter } = operation;
118
+ assert(filter && typeof filter.id === 'string');
119
+ const { paid } = data;
120
+ if (paid) {
121
+ return pipeline(() => context.select('pay', {
122
+ data: {
123
+ id: 1,
124
+ paid: 1,
125
+ price: 1,
126
+ },
127
+ }, {}), (pays) => {
128
+ const [pay] = pays;
129
+ const { paid: payPaid, price } = pay;
130
+ if (payPaid + paid === price) {
131
+ data.iState === 'paid';
132
+ }
133
+ });
134
+ }
135
+ }
105
136
  }
106
137
  ];
107
138
  export default checkers;
@@ -0,0 +1,5 @@
1
+ import { Checker } from 'oak-domain/lib/types/Auth';
2
+ import { EntityDict } from '../oak-app-domain';
3
+ import { RuntimeCxt } from '../types/RuntimeCxt';
4
+ declare const checkers: Checker<EntityDict, 'refund', RuntimeCxt>[];
5
+ export default checkers;
@@ -0,0 +1,18 @@
1
+ const checkers = [
2
+ {
3
+ // 退款所在的pay一定是可以退款状态,且其上不能有另一个正在退款的请求
4
+ entity: 'refund',
5
+ type: 'row',
6
+ filter: {
7
+ pay: {
8
+ refundable: true,
9
+ refund$pay: {
10
+ '#sqp': 'not in',
11
+ iState: 'refunding',
12
+ }
13
+ },
14
+ },
15
+ action: 'create',
16
+ }
17
+ ];
18
+ export default checkers;
@@ -52,7 +52,7 @@ export default OakComponent({
52
52
  }
53
53
  else if (PAY_ORG_CHANNELS.includes(next.channel) && (!prev.channel || !PAY_ORG_CHANNELS.includes(prev.channel))) {
54
54
  // 计算损耗
55
- const ratio = this.features.pay.getDepositRatio(prev.channel);
55
+ const ratio = this.features.pay.getDepositRatio(next.channel);
56
56
  if (ratio > 0) {
57
57
  const ratioDelta = Math.floor(price * ratio / 100);
58
58
  this.onPriceChange(ToYuan(price + ratioDelta), true, ratioDelta);
@@ -2,5 +2,6 @@ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<
2
2
  depositMinCent: number;
3
3
  depositMaxCent: number;
4
4
  onDepositPayId: (payId: string) => void;
5
+ onWithdraw: () => void;
5
6
  }>) => React.ReactElement;
6
7
  export default _default;
@@ -52,6 +52,7 @@ export default OakComponent({
52
52
  depositMinCent: 0,
53
53
  depositMaxCent: 1000000,
54
54
  onDepositPayId: (payId) => undefined,
55
+ onWithdraw: () => undefined,
55
56
  },
56
57
  formData({ data }) {
57
58
  const unfinishedPayId = data?.pay$account?.[0]?.id;
@@ -158,6 +159,9 @@ export default OakComponent({
158
159
  const { onDepositPayId } = this.props;
159
160
  const { unfinishedPayId } = this.state;
160
161
  onDepositPayId && onDepositPayId(unfinishedPayId);
162
+ },
163
+ onWithdrawClick() {
164
+ this.props.onWithdraw();
161
165
  }
162
166
  },
163
167
  data: {
@@ -24,6 +24,7 @@
24
24
  <l-button
25
25
  type="success"
26
26
  size="long"
27
+ bind:lintap="onWithdrawClick"
27
28
  >
28
29
  {{t('account:action.withdraw')}}
29
30
  </l-button>
@@ -7,6 +7,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
7
7
  depositMinCent: number;
8
8
  unfinishedPayId?: string;
9
9
  onDepositPayId: (payId: string) => void;
10
+ onWithdraw: () => void;
10
11
  depositOpen: boolean;
11
12
  ufOpen: boolean;
12
13
  depPrice: number | null;
@@ -14,7 +15,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
14
15
  depositMeta: any;
15
16
  depositing: boolean;
16
17
  }, {
17
- createDepositPay: () => Promise<string>;
18
+ createDepositPay: () => Promise<void>;
18
19
  setDepositOpen: (v: boolean) => void;
19
20
  setUfOpen: (v: boolean) => void;
20
21
  setDepPrice: (v: number | null) => void;
@@ -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, depositMaxCent, unfinishedPayId, onDepositPayId, depositOpen, depositMinCent, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
8
+ const { account, depositMaxCent, unfinishedPayId, onDepositPayId, depositOpen, depositMinCent, ufOpen, depPrice, depositChannel, depositMeta, depositing, onWithdraw, } = 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;
@@ -40,10 +40,7 @@ export default function Render(props) {
40
40
  </Button>
41
41
  </div>}
42
42
  {legalActions?.includes('withdraw') && <div className={Styles.item}>
43
- <Button block onClick={() => setMessage({
44
- type: 'warning',
45
- content: '尚未实现'
46
- })}>
43
+ <Button block onClick={() => onWithdraw()}>
47
44
  {t('account:action.withdraw')}
48
45
  </Button>
49
46
  </div>}
@@ -7,6 +7,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'account', f
7
7
  depositMinCent: number;
8
8
  unfinishedPayId?: string;
9
9
  onDepositPayId: (payId: string) => void;
10
+ onWithdraw: () => void;
10
11
  depositOpen: boolean;
11
12
  ufOpen: boolean;
12
13
  depPrice: number | null;
@@ -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, depositMaxCent, unfinishedPayId, onDepositPayId, depositOpen, depositMinCent, ufOpen, depPrice, depositChannel, depositMeta, depositing } = props.data;
10
+ const { account, depositMaxCent, unfinishedPayId, onDepositPayId, depositOpen, depositMinCent, ufOpen, depPrice, depositChannel, depositMeta, depositing, onWithdraw, } = 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;
@@ -16,10 +16,7 @@ export default function Render(props) {
16
16
  {legalActions?.includes('deposit') && <Button type="primary" disabled={ufOpen || depositOpen} onClick={() => onDepositClick()}>
17
17
  {t('account:action.deposit')}
18
18
  </Button>}
19
- {legalActions?.includes('withdraw') && <Button onClick={() => setMessage({
20
- type: 'warning',
21
- content: '尚未实现'
22
- })}>
19
+ {legalActions?.includes('withdraw') && <Button onClick={() => onWithdraw()}>
23
20
  {t('account:action.withdraw')}
24
21
  </Button>}
25
22
  </Flex>}>
@@ -11,7 +11,7 @@ export default function Render(props) {
11
11
  const [spId, setSpId] = useState('');
12
12
  if (pays) {
13
13
  const spRow = (spId && pays.find(ele => ele.id === spId));
14
- return (<>
14
+ return (<>
15
15
  <ListPro data={pays} entity="pay" attributes={[
16
16
  {
17
17
  path: 'price',
@@ -30,8 +30,8 @@ export default function Render(props) {
30
30
  span: 1,
31
31
  render(row) {
32
32
  const { orderId } = row;
33
- return (<Tag bordered={false} color={orderId ? 'processing' : 'success'}>
34
- {orderId ? t('source.order') : t('source.deposit')}
33
+ return (<Tag bordered={false} color={orderId ? 'processing' : 'success'}>
34
+ {orderId ? t('source.order') : t('source.deposit')}
35
35
  </Tag>);
36
36
  }
37
37
  },
@@ -86,31 +86,33 @@ export default function Render(props) {
86
86
  });
87
87
  }
88
88
  else {
89
- updateItem({}, row.id, 'succeedPaying');
89
+ updateItem({
90
+ paid:row.price,
91
+ }, row.id, 'succeedPaying');
90
92
  setSpId(row.id);
91
93
  }
92
94
  }
93
- }}/>
95
+ }}/>
94
96
  <Modal title={t('csp.title')} width={600} open={!!spId} footer={null} onCancel={() => {
95
97
  clean();
96
98
  setSpId('');
97
- }}>
98
- <div className={Styles.spCon}>
99
- <Alert type="warning" message={t('csp.tips')}/>
100
- <Divider style={{ width: '80%', alignSelf: 'flex-end' }}/>
99
+ }}>
100
+ <div className={Styles.spCon}>
101
+ <Alert type="warning" message={t('csp.tips')}/>
102
+ <Divider style={{ width: '80%', alignSelf: 'flex-end' }}/>
101
103
  <RenderOffline pay={spRow} t={t} offline={offlineConfig} metaUpdatable={true} updateMeta={(meta) => {
102
104
  updateItem({ meta }, spRow.id, 'succeedPaying');
103
- }}/>
104
- <div className={Styles.btn}>
105
+ }}/>
106
+ <div className={Styles.btn}>
105
107
  <Button type="primary" onClick={async () => {
106
108
  await execute();
107
109
  setSpId('');
108
- }}>
109
- {t('common::confirm')}
110
- </Button>
111
- </div>
112
- </div>
113
- </Modal>
110
+ }}>
111
+ {t('common::confirm')}
112
+ </Button>
113
+ </div>
114
+ </div>
115
+ </Modal>
114
116
  </>);
115
117
  }
116
118
  return null;
@@ -1,11 +1,11 @@
1
- .spCon {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- padding: 18px;
6
-
7
- .btn {
8
- margin-top: 13px;
9
- align-self: flex-end;
10
- }
1
+ .spCon {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ padding: 18px;
6
+
7
+ .btn {
8
+ margin-top: 13px;
9
+ align-self: flex-end;
10
+ }
11
11
  }
@@ -1,17 +1,17 @@
1
- .container {
2
- background: var(--oak-bg-color-container);
3
- padding: 8px;
4
- height: 100%;
5
-
6
- // .tabLabel {
7
- // writing-mode: vertical-rl;
8
- // letter-spacing: .2rem;
9
- // }
10
- .systemLabel {
11
- font-weight: bolder;
12
- }
13
- .padding {
14
- height: 10px;
15
- font-size: small;
16
- }
1
+ .container {
2
+ background: var(--oak-bg-color-container);
3
+ padding: 8px;
4
+ height: 100%;
5
+
6
+ // .tabLabel {
7
+ // writing-mode: vertical-rl;
8
+ // letter-spacing: .2rem;
9
+ // }
10
+ .systemLabel {
11
+ font-weight: bolder;
12
+ }
13
+ .padding {
14
+ height: 10px;
15
+ font-size: small;
16
+ }
17
17
  }
@@ -36,41 +36,41 @@ export default function Offline(props) {
36
36
  setOption('');
37
37
  setInputVisible(false);
38
38
  };
39
- return (<div className={Styles.container}>
40
- <Alert type='info' message={t('tips')}/>
41
- <Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600, marginTop: 22 }}>
42
- <Form.Item label={t('tips2')}>
39
+ return (<div className={Styles.container}>
40
+ <Alert type='info' message={t('tips')}/>
41
+ <Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600, marginTop: 22 }}>
42
+ <Form.Item label={t('tips2')}>
43
43
  <Input.TextArea rows={4} value={tips} placeholder={t('tipsHolder')} onChange={({ currentTarget }) => {
44
44
  update({
45
45
  ...config,
46
46
  tips: currentTarget.value,
47
47
  });
48
- }}/>
49
- </Form.Item>
50
- <Form.Item label={t('options')}>
51
- <Flex gap="4px 0" wrap="wrap">
48
+ }}/>
49
+ </Form.Item>
50
+ <Form.Item label={t('options')}>
51
+ <Flex gap="4px 0" wrap="wrap">
52
52
  {options.map((option, idx) => <Tag bordered={false} closable key={idx} onClose={() => {
53
53
  options.splice(idx, 1);
54
54
  update({
55
55
  ...config,
56
56
  options,
57
57
  });
58
- }}>
59
- {option}
60
- </Tag>)}
61
- {inputVisible ? (<Input ref={inputRef} type="text" size="small" style={tagInputStyle} value={option} onChange={({ currentTarget }) => setOption(currentTarget.value)} onBlur={handleOptionCreated} onPressEnter={handleOptionCreated}/>) : (<Tag style={tagPlusStyle} icon={<PlusOutlined />} onClick={() => setInputVisible(true)}>
62
- {t('newOption')}
63
- </Tag>)}
64
- </Flex>
65
- </Form.Item>
66
- <Form.Item label={t('allowUser')}>
58
+ }}>
59
+ {option}
60
+ </Tag>)}
61
+ {inputVisible ? (<Input ref={inputRef} type="text" size="small" style={tagInputStyle} value={option} onChange={({ currentTarget }) => setOption(currentTarget.value)} onBlur={handleOptionCreated} onPressEnter={handleOptionCreated}/>) : (<Tag style={tagPlusStyle} icon={<PlusOutlined />} onClick={() => setInputVisible(true)}>
62
+ {t('newOption')}
63
+ </Tag>)}
64
+ </Flex>
65
+ </Form.Item>
66
+ <Form.Item label={t('allowUser')}>
67
67
  <Switch value={allowUser} onChange={(v) => {
68
68
  update({
69
69
  ...config,
70
70
  allowUser: v,
71
71
  });
72
- }}/>
73
- </Form.Item>
74
- </Form>
72
+ }}/>
73
+ </Form.Item>
74
+ </Form>
75
75
  </div>);
76
76
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Form, Input, InputNumber } from 'antd';
2
+ import { Form, Input, InputNumber, Radio } from 'antd';
3
3
  export default function WechatPay(props) {
4
4
  const { config, update, t, extra: { serverUrl } } = props;
5
5
  return (<Form labelCol={{ span: 3 }} wrapperCol={{ span: 18 }} layout="horizontal" style={{ minWidth: 600 }}>
@@ -45,5 +45,28 @@ export default function WechatPay(props) {
45
45
  update(config);
46
46
  }}/>
47
47
  </Form.Item>
48
+ <Form.Item label={t('label.refundGapDays')} help={t('placeholder.refundGapDays')}>
49
+ <InputNumber value={config.refundGapDays} max={365} min={7} addonAfter={"天"} step={1} onChange={(value) => {
50
+ config.refundGapDays = value;
51
+ update(config);
52
+ }}/>
53
+ </Form.Item>
54
+ <Form.Item label={t('label.refundLossRatio')} help={t('placeholder.refundLossRatio')}>
55
+ <InputNumber value={config.refundLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
56
+ config.refundLossRatio = value;
57
+ update(config);
58
+ }}/>
59
+ </Form.Item>
60
+ <Form.Item label={t('label.refundLossFloor')} help={t('placeholder.refundLossFloor')}>
61
+ <Radio.Group onChange={({ target }) => {
62
+ const { value } = target;
63
+ config.refundLossFloor = value;
64
+ update(config);
65
+ }} value={config.refundLossFloor}>
66
+ <Radio value={1}>分</Radio>
67
+ <Radio value={2}>角</Radio>
68
+ <Radio value={3}>元</Radio>
69
+ </Radio.Group>
70
+ </Form.Item>
48
71
  </Form>);
49
72
  }
@@ -5,7 +5,10 @@
5
5
  "payNotifyUrl": "支付回调URL",
6
6
  "refundNotifyUrl": "退款回调URL",
7
7
  "lossRatio": "手续费比例",
8
- "apiV3Key": "apiV3Key"
8
+ "apiV3Key": "apiV3Key",
9
+ "refundGapDays": "退款限制天数",
10
+ "refundLossRatio": "退款损耗百分比",
11
+ "refundLossFloor": "退款取整位数"
9
12
  },
10
13
  "placeholder": {
11
14
  "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限",
@@ -13,6 +16,9 @@
13
16
  "lossRatio": "填百分比(0.6就代表千分之六)",
14
17
  "payNotifyUrl": "endpoint",
15
18
  "refundNotifyUrl": "endpoint",
16
- "apiV3Key": "需要登录商户后台获取"
19
+ "apiV3Key": "需要登录商户后台获取",
20
+ "refundGapDays": "超过这个天数后无法退款",
21
+ "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)",
22
+ "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)"
17
23
  }
18
24
  }
@@ -0,0 +1,8 @@
1
+ import { EntityDict } from "../../../oak-app-domain";
2
+ declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, boolean, {
3
+ accountId: string;
4
+ withdrawAccountFilter: import("../../../oak-app-domain/WithdrawAccount/Schema").Filter | undefined;
5
+ onNewWithdrawAccount: () => void;
6
+ onCreateWithdraw: (id: string) => void;
7
+ }>) => React.ReactElement;
8
+ export default _default;