oak-pay-business 2.0.1 → 2.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 (69) hide show
  1. package/es/context/BackendRuntimeContext.d.ts +1 -1
  2. package/es/context/BackendRuntimeContext.js +1 -1
  3. package/es/context/FrontendRuntimeContext.d.ts +1 -1
  4. package/es/context/FrontendRuntimeContext.js +1 -1
  5. package/es/features/Pay.js +19 -1
  6. package/es/features/index.d.ts +1 -1
  7. package/es/index.d.ts +0 -3
  8. package/es/index.js +0 -2
  9. package/es/oak-app-domain/Refund/locales/zh_CN.json +1 -1
  10. package/es/oak-app-domain/WithdrawTransfer/locales/zh_CN.json +1 -1
  11. package/es/triggers/withdraw.d.ts +1 -1
  12. package/es/utils/pay.d.ts +0 -10
  13. package/es/utils/pay.js +0 -26
  14. package/lib/context/BackendRuntimeContext.d.ts +1 -1
  15. package/lib/context/BackendRuntimeContext.js +2 -2
  16. package/lib/context/FrontendRuntimeContext.d.ts +1 -1
  17. package/lib/context/FrontendRuntimeContext.js +2 -2
  18. package/lib/features/Pay.js +20 -2
  19. package/lib/features/index.d.ts +1 -1
  20. package/lib/index.d.ts +0 -3
  21. package/lib/index.js +0 -5
  22. package/lib/oak-app-domain/Refund/locales/zh_CN.json +1 -1
  23. package/lib/oak-app-domain/WithdrawTransfer/locales/zh_CN.json +1 -1
  24. package/lib/triggers/withdraw.d.ts +1 -1
  25. package/lib/utils/pay.d.ts +0 -10
  26. package/lib/utils/pay.js +1 -28
  27. package/package.json +4 -4
  28. package/es/aspects/account.d.ts +0 -5
  29. package/es/aspects/account.js +0 -4
  30. package/es/aspects/sample.d.ts +0 -2
  31. package/es/aspects/sample.js +0 -3
  32. package/es/components/offlineAccount/index.d.ts +0 -3
  33. package/es/components/offlineAccount/index.js +0 -17
  34. package/es/components/offlineAccount/index.json +0 -1
  35. package/es/components/offlineAccount/locales/zh-CN.json +0 -3
  36. package/es/components/offlineAccount/web.pc.d.ts +0 -6
  37. package/es/components/offlineAccount/web.pc.js +0 -27
  38. package/es/components/pay/channelPicker/index.d.ts +0 -23
  39. package/es/components/pay/channelPicker/index.js +0 -47
  40. package/es/components/pay/channelPicker/index.json +0 -8
  41. package/es/components/pay/channelPicker/index.less +0 -31
  42. package/es/components/pay/channelPicker/index.xml +0 -36
  43. package/es/components/pay/channelPicker/locales/zh-CN.json +0 -6
  44. package/es/components/pay/channelPicker/web.d.ts +0 -14
  45. package/es/components/pay/channelPicker/web.js +0 -49
  46. package/es/components/pay/channelPicker/web.mobile.module.less +0 -8
  47. package/es/components/pay/channelPicker/web.pc.d.ts +0 -12
  48. package/es/components/pay/channelPicker/web.pc.js +0 -54
  49. package/es/components/pay/channelPicker/web.pc.module.less +0 -7
  50. package/es/config/connector.d.ts +0 -5
  51. package/es/config/connector.js +0 -5
  52. package/es/context/DependentContext.d.ts +0 -1
  53. package/es/context/DependentContext.js +0 -1
  54. package/es/entities/Application.d.ts +0 -5
  55. package/es/entities/Application.js +0 -38
  56. package/es/exceptionHandler.d.ts +0 -8
  57. package/es/exceptionHandler.js +0 -47
  58. package/es/features/Console.d.ts +0 -12
  59. package/es/features/Console.js +0 -15
  60. package/es/features/Menu.d.ts +0 -20
  61. package/es/features/Menu.js +0 -62
  62. package/es/features/Sample.d.ts +0 -15
  63. package/es/features/Sample.js +0 -14
  64. package/es/triggers/acount.d.ts +0 -5
  65. package/es/triggers/acount.js +0 -20
  66. package/lib/aspects/account.d.ts +0 -5
  67. package/lib/aspects/account.js +0 -8
  68. package/lib/context/DependentContext.d.ts +0 -1
  69. package/lib/context/DependentContext.js +0 -6
@@ -1,7 +1,7 @@
1
1
  import { EntityDict } from '../oak-app-domain';
2
2
  import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
3
3
  import { RuntimeContext } from './RuntimeContext';
4
- import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext';
4
+ import { BackendRuntimeContext as DependentBackendRuntimeContext } from 'oak-general-business/lib/context/BackendRuntimeContext';
5
5
  export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentBackendRuntimeContext<ED> implements RuntimeContext {
6
6
  protected applicationProjection: {
7
7
  [k: string]: any;
@@ -1,4 +1,4 @@
1
- import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext';
1
+ import { BackendRuntimeContext as DependentBackendRuntimeContext } from 'oak-general-business/lib/context/BackendRuntimeContext';
2
2
  import { mergedProjection } from '../utils/application';
3
3
  export class BackendRuntimeContext extends DependentBackendRuntimeContext {
4
4
  applicationProjection = mergedProjection;
@@ -1,6 +1,6 @@
1
1
  import { EntityDict } from '../oak-app-domain';
2
2
  import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
3
- import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from './DependentContext';
3
+ import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from 'oak-general-business/es/context/FrontendRuntimeContext';
4
4
  import { RuntimeContext } from './RuntimeContext';
5
5
  export { SerializedData, };
6
6
  export declare class FrontendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentFrontendRuntimeContext<ED> implements RuntimeContext {
@@ -1,4 +1,4 @@
1
- import { FrontendRuntimeContext as DependentFrontendRuntimeContext } from './DependentContext';
1
+ import { FrontendRuntimeContext as DependentFrontendRuntimeContext } from 'oak-general-business/es/context/FrontendRuntimeContext';
2
2
  export class FrontendRuntimeContext extends DependentFrontendRuntimeContext {
3
3
  async toString() {
4
4
  const data = await this.getSerializedData();
@@ -1,6 +1,24 @@
1
1
  import { Feature } from "oak-frontend-base";
2
- import { getDepositLoss } from '../utils/pay';
3
2
  import { getWpProductTypeFromEnv } from "../utils/wpProductFrontend";
3
+ function getDepositLoss(price, application) {
4
+ const { system } = application;
5
+ const { payConfig } = system;
6
+ const depositLoss = payConfig?.depositLoss;
7
+ if (depositLoss) {
8
+ const { ratio, highest, lowest } = depositLoss;
9
+ let loss = ratio && Math.round(price * ratio / 100) || 0;
10
+ if (highest && loss > highest) {
11
+ return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
12
+ }
13
+ if (lowest && loss < lowest) {
14
+ return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
15
+ }
16
+ if (loss > 0) {
17
+ return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
18
+ }
19
+ }
20
+ return [0, '', undefined];
21
+ }
4
22
  export default class Pay extends Feature {
5
23
  application;
6
24
  locales;
@@ -2,7 +2,7 @@ import { EntityDict } from '../oak-app-domain';
2
2
  import { AccessConfiguration } from 'oak-domain/lib/types/Configuration';
3
3
  import { BasicFeatures } from 'oak-frontend-base';
4
4
  import { FeatureDict as Ogb0FeatureDict } from "oak-general-business";
5
- import Cos from 'oak-general-business/es/types/Cos';
5
+ import { Cos } from 'oak-general-business/es/types/Cos';
6
6
  import Pay from './Pay';
7
7
  export declare function create<ED extends EntityDict>(features: BasicFeatures<ED> & Ogb0FeatureDict<ED>): {
8
8
  pay: Pay;
package/es/index.d.ts CHANGED
@@ -2,6 +2,3 @@ export type { FeatureDict } from './features';
2
2
  export type { AspectDict } from './aspects/AspectDict';
3
3
  export * from './types/Exception';
4
4
  export * from './types/RuntimeCxt';
5
- export { BackendRuntimeContext } from './context/BackendRuntimeContext';
6
- export { FrontendRuntimeContext, SerializedData, } from './context/FrontendRuntimeContext';
7
- export { RuntimeContext } from './context/RuntimeContext';
package/es/index.js CHANGED
@@ -1,4 +1,2 @@
1
1
  export * from './types/Exception';
2
2
  export * from './types/RuntimeCxt';
3
- export { BackendRuntimeContext } from './context/BackendRuntimeContext';
4
- export { FrontendRuntimeContext, } from './context/FrontendRuntimeContext';
@@ -1 +1 @@
1
- { "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部ID", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
1
+ { "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
@@ -1 +1 @@
1
- { "name": "提现转账", "attr": { "withdraw": "提现申请", "withdrawAccount": "提现账户", "price": "金额", "loss": "手续费", "operator": "操作者", "creator": "创建者", "iState": "状态", "externalId": "外部Id", "meta": "metadata", "reason": "原因", "sysOpers": "账户操作" }, "v": { "iState": { "transferring": "待转账", "failed": "已失败", "successful": "已成功" } }, "action": { "succeed": "提现成功", "fail": "提现失败" } }
1
+ { "name": "提现转账", "attr": { "withdraw": "提现申请", "withdrawAccount": "提现账户", "price": "金额", "loss": "手续费", "operator": "操作者", "creator": "创建者", "iState": "状态", "externalId": "外部转账流水号", "meta": "metadata", "reason": "原因", "sysOpers": "账户操作" }, "v": { "iState": { "transferring": "待转账", "failed": "已失败", "successful": "已成功" } }, "action": { "succeed": "转账成功", "fail": "转账失败" } }
@@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
6
6
  * @param context
7
7
  * @param refunds
8
8
  */
9
- export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
9
+ export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
10
10
  declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
11
11
  export default triggers;
package/es/utils/pay.d.ts CHANGED
@@ -5,13 +5,3 @@ import BackendRuntimeContext from '../context/BackendRuntimeContext';
5
5
  import { IncomingHttpHeaders } from 'http';
6
6
  export declare const fullPayProjection: EntityDict['pay']['Selection']['data'];
7
7
  export declare function payNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, payId: string, headers: IncomingHttpHeaders): Promise<void>;
8
- type CalcLoss = <ED extends EntityDict & BaseEntityDict>(entityId: string, application: ED['application']['Schema'], price: number) => [number, string, any];
9
- /**
10
- * 计算充值的损耗比例
11
- * attention: 这个函数目前是在前端调用的
12
- * @param context
13
- * @param channel
14
- * @param application
15
- */
16
- export declare function getDepositLoss<ED extends EntityDict & BaseEntityDict>(price: number, application: ED['application']['Schema']): ReturnType<CalcLoss>;
17
- export {};
package/es/utils/pay.js CHANGED
@@ -83,29 +83,3 @@ export async function payNotify(context, body, payId, headers) {
83
83
  }
84
84
  return;
85
85
  }
86
- /**
87
- * 计算充值的损耗比例
88
- * attention: 这个函数目前是在前端调用的
89
- * @param context
90
- * @param channel
91
- * @param application
92
- */
93
- export function getDepositLoss(price, application) {
94
- const { system } = application;
95
- const { payConfig } = system;
96
- const depositLoss = payConfig?.depositLoss;
97
- if (depositLoss) {
98
- const { ratio, highest, lowest } = depositLoss;
99
- let loss = ratio && Math.round(price * ratio / 100) || 0;
100
- if (highest && loss > highest) {
101
- return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
102
- }
103
- if (lowest && loss < lowest) {
104
- return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
105
- }
106
- if (loss > 0) {
107
- return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
108
- }
109
- }
110
- return [0, '', undefined];
111
- }
@@ -1,7 +1,7 @@
1
1
  import { EntityDict } from '../oak-app-domain';
2
2
  import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
3
3
  import { RuntimeContext } from './RuntimeContext';
4
- import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext';
4
+ import { BackendRuntimeContext as DependentBackendRuntimeContext } from 'oak-general-business/lib/context/BackendRuntimeContext';
5
5
  export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentBackendRuntimeContext<ED> implements RuntimeContext {
6
6
  protected applicationProjection: {
7
7
  [k: string]: any;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackendRuntimeContext = void 0;
4
- const DependentContext_1 = require("./DependentContext");
4
+ const BackendRuntimeContext_1 = require("oak-general-business/lib/context/BackendRuntimeContext");
5
5
  const application_1 = require("../utils/application");
6
- class BackendRuntimeContext extends DependentContext_1.BackendRuntimeContext {
6
+ class BackendRuntimeContext extends BackendRuntimeContext_1.BackendRuntimeContext {
7
7
  applicationProjection = application_1.mergedProjection;
8
8
  async toString() {
9
9
  const data = await this.getSerializedData();
@@ -1,6 +1,6 @@
1
1
  import { EntityDict } from '../oak-app-domain';
2
2
  import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
3
- import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from './DependentContext';
3
+ import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from 'oak-general-business/es/context/FrontendRuntimeContext';
4
4
  import { RuntimeContext } from './RuntimeContext';
5
5
  export { SerializedData, };
6
6
  export declare class FrontendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentFrontendRuntimeContext<ED> implements RuntimeContext {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FrontendRuntimeContext = void 0;
4
- const DependentContext_1 = require("./DependentContext");
5
- class FrontendRuntimeContext extends DependentContext_1.FrontendRuntimeContext {
4
+ const FrontendRuntimeContext_1 = require("oak-general-business/es/context/FrontendRuntimeContext");
5
+ class FrontendRuntimeContext extends FrontendRuntimeContext_1.FrontendRuntimeContext {
6
6
  async toString() {
7
7
  const data = await this.getSerializedData();
8
8
  return JSON.stringify(data);
@@ -1,8 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const oak_frontend_base_1 = require("oak-frontend-base");
4
- const pay_1 = require("../utils/pay");
5
4
  const wpProductFrontend_1 = require("../utils/wpProductFrontend");
5
+ function getDepositLoss(price, application) {
6
+ const { system } = application;
7
+ const { payConfig } = system;
8
+ const depositLoss = payConfig?.depositLoss;
9
+ if (depositLoss) {
10
+ const { ratio, highest, lowest } = depositLoss;
11
+ let loss = ratio && Math.round(price * ratio / 100) || 0;
12
+ if (highest && loss > highest) {
13
+ return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
14
+ }
15
+ if (lowest && loss < lowest) {
16
+ return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
17
+ }
18
+ if (loss > 0) {
19
+ return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
20
+ }
21
+ }
22
+ return [0, '', undefined];
23
+ }
6
24
  class Pay extends oak_frontend_base_1.Feature {
7
25
  application;
8
26
  locales;
@@ -52,7 +70,7 @@ class Pay extends oak_frontend_base_1.Feature {
52
70
  }
53
71
  calcDepositLoss(price, channel) {
54
72
  const { entity, entityId } = channel;
55
- return (0, pay_1.getDepositLoss)(price, this.application.getApplication());
73
+ return getDepositLoss(price, this.application.getApplication());
56
74
  }
57
75
  getDepositRatio(channel) {
58
76
  throw new Error('method not implemented');
@@ -2,7 +2,7 @@ import { EntityDict } from '../oak-app-domain';
2
2
  import { AccessConfiguration } from 'oak-domain/lib/types/Configuration';
3
3
  import { BasicFeatures } from 'oak-frontend-base';
4
4
  import { FeatureDict as Ogb0FeatureDict } from "oak-general-business";
5
- import Cos from 'oak-general-business/es/types/Cos';
5
+ import { Cos } from 'oak-general-business/es/types/Cos';
6
6
  import Pay from './Pay';
7
7
  export declare function create<ED extends EntityDict>(features: BasicFeatures<ED> & Ogb0FeatureDict<ED>): {
8
8
  pay: Pay;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,3 @@ export type { FeatureDict } from './features';
2
2
  export type { AspectDict } from './aspects/AspectDict';
3
3
  export * from './types/Exception';
4
4
  export * from './types/RuntimeCxt';
5
- export { BackendRuntimeContext } from './context/BackendRuntimeContext';
6
- export { FrontendRuntimeContext, SerializedData, } from './context/FrontendRuntimeContext';
7
- export { RuntimeContext } from './context/RuntimeContext';
package/lib/index.js CHANGED
@@ -1,10 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FrontendRuntimeContext = exports.BackendRuntimeContext = void 0;
4
3
  const tslib_1 = require("tslib");
5
4
  tslib_1.__exportStar(require("./types/Exception"), exports);
6
5
  tslib_1.__exportStar(require("./types/RuntimeCxt"), exports);
7
- var BackendRuntimeContext_1 = require("./context/BackendRuntimeContext");
8
- Object.defineProperty(exports, "BackendRuntimeContext", { enumerable: true, get: function () { return BackendRuntimeContext_1.BackendRuntimeContext; } });
9
- var FrontendRuntimeContext_1 = require("./context/FrontendRuntimeContext");
10
- Object.defineProperty(exports, "FrontendRuntimeContext", { enumerable: true, get: function () { return FrontendRuntimeContext_1.FrontendRuntimeContext; } });
@@ -1 +1 @@
1
- { "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部ID", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
1
+ { "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
@@ -1 +1 @@
1
- { "name": "提现转账", "attr": { "withdraw": "提现申请", "withdrawAccount": "提现账户", "price": "金额", "loss": "手续费", "operator": "操作者", "creator": "创建者", "iState": "状态", "externalId": "外部Id", "meta": "metadata", "reason": "原因", "sysOpers": "账户操作" }, "v": { "iState": { "transferring": "待转账", "failed": "已失败", "successful": "已成功" } }, "action": { "succeed": "提现成功", "fail": "提现失败" } }
1
+ { "name": "提现转账", "attr": { "withdraw": "提现申请", "withdrawAccount": "提现账户", "price": "金额", "loss": "手续费", "operator": "操作者", "creator": "创建者", "iState": "状态", "externalId": "外部转账流水号", "meta": "metadata", "reason": "原因", "sysOpers": "账户操作" }, "v": { "iState": { "transferring": "待转账", "failed": "已失败", "successful": "已成功" } }, "action": { "succeed": "转账成功", "fail": "转账失败" } }
@@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
6
6
  * @param context
7
7
  * @param refunds
8
8
  */
9
- export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
9
+ export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
10
10
  declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
11
11
  export default triggers;
@@ -5,13 +5,3 @@ import BackendRuntimeContext from '../context/BackendRuntimeContext';
5
5
  import { IncomingHttpHeaders } from 'http';
6
6
  export declare const fullPayProjection: EntityDict['pay']['Selection']['data'];
7
7
  export declare function payNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, payId: string, headers: IncomingHttpHeaders): Promise<void>;
8
- type CalcLoss = <ED extends EntityDict & BaseEntityDict>(entityId: string, application: ED['application']['Schema'], price: number) => [number, string, any];
9
- /**
10
- * 计算充值的损耗比例
11
- * attention: 这个函数目前是在前端调用的
12
- * @param context
13
- * @param channel
14
- * @param application
15
- */
16
- export declare function getDepositLoss<ED extends EntityDict & BaseEntityDict>(price: number, application: ED['application']['Schema']): ReturnType<CalcLoss>;
17
- export {};
package/lib/utils/pay.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDepositLoss = exports.payNotify = exports.fullPayProjection = void 0;
3
+ exports.payNotify = exports.fullPayProjection = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const payClazz_1 = require("./payClazz");
6
6
  const assert_1 = tslib_1.__importDefault(require("assert"));
@@ -88,30 +88,3 @@ async function payNotify(context, body, payId, headers) {
88
88
  return;
89
89
  }
90
90
  exports.payNotify = payNotify;
91
- /**
92
- * 计算充值的损耗比例
93
- * attention: 这个函数目前是在前端调用的
94
- * @param context
95
- * @param channel
96
- * @param application
97
- */
98
- function getDepositLoss(price, application) {
99
- const { system } = application;
100
- const { payConfig } = system;
101
- const depositLoss = payConfig?.depositLoss;
102
- if (depositLoss) {
103
- const { ratio, highest, lowest } = depositLoss;
104
- let loss = ratio && Math.round(price * ratio / 100) || 0;
105
- if (highest && loss > highest) {
106
- return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
107
- }
108
- if (lowest && loss < lowest) {
109
- return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
110
- }
111
- if (loss > 0) {
112
- return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
113
- }
114
- }
115
- return [0, '', undefined];
116
- }
117
- exports.getDepositLoss = getDepositLoss;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-pay-business",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib/**/*",
@@ -50,9 +50,9 @@
50
50
  "js-base64": "^3.7.2",
51
51
  "lodash": "^4.17.21",
52
52
  "nprogress": "^0.2.0",
53
- "oak-domain": "~5.0.10",
54
- "oak-frontend-base": "~5.1.3",
55
- "oak-general-business": "~5.1.5",
53
+ "oak-domain": "~5.0.11",
54
+ "oak-frontend-base": "~5.2.0",
55
+ "oak-general-business": "~5.2.0",
56
56
  "react": "~18.2.0",
57
57
  "react-dom": "~18.2.0",
58
58
  "react-image-gallery": "^1.2.11",
@@ -1,5 +0,0 @@
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">[]>;
@@ -1,4 +0,0 @@
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,2 +0,0 @@
1
- import { BRC } from '../types/RuntimeCxt';
2
- export declare function test(params: string, context: BRC): Promise<string>;
@@ -1,3 +0,0 @@
1
- export async function test(params, context) {
2
- return 'hello world';
3
- }
@@ -1,3 +0,0 @@
1
- /// <reference types="wechat-miniprogram" />
2
- declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../oak-app-domain").EntityDict, "offlineAccount", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
3
- export default _default;
@@ -1,17 +0,0 @@
1
- export default OakComponent({
2
- entity: 'offlineAccount',
3
- projection: {
4
- id: 1,
5
- type: 1,
6
- channel: 1,
7
- name: 1,
8
- desc: 1,
9
- systemId: 1,
10
- },
11
- isList: false,
12
- formData({ data }) {
13
- return {
14
- offlineAccount: data,
15
- };
16
- },
17
- });
@@ -1 +0,0 @@
1
- {}
@@ -1,3 +0,0 @@
1
- {
2
- "tips": "线下交易账户是需要人工同步收款和打款行为的账户"
3
- }
@@ -1,6 +0,0 @@
1
- import { EntityDict } from "../../oak-app-domain";
2
- import { RowWithActions, WebComponentProps } from "oak-frontend-base";
3
- import React from 'react';
4
- export default function render(props: WebComponentProps<EntityDict, 'offlineAccount', false, {
5
- offlineAccount: RowWithActions<EntityDict, 'offlineAccount'>;
6
- }>): React.JSX.Element | undefined;
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { Alert, Form, Switch, InputNumber } from 'antd';
3
- export default function render(props) {
4
- const { offlineAccount } = props.data;
5
- const { t } = props.methods;
6
- if (offlineAccount) {
7
- return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
8
- <Alert type='info' message={t('tips')}/>
9
- <Form.Item label={t('label.depositLoss')} help={t('placeholder.depositLoss')}>
10
- <Switch value={config.depositLoss} onChange={(value) => {
11
- config.depositLoss = value;
12
- if (value === false) {
13
- config.depositLossRatio = undefined;
14
- }
15
- update(config);
16
- }}/>
17
- </Form.Item>
18
- {config.depositLoss &&
19
- <Form.Item label={t('label.depositLossRatio')} help={t('placeholder.depositLossRatio')}>
20
- <InputNumber value={config.depositLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
21
- config.depositLossRatio = value;
22
- update(config);
23
- }}/>
24
- </Form.Item>}
25
- </Form>);
26
- }
27
- }
@@ -1,23 +0,0 @@
1
- /// <reference types="react" />
2
- import { PayConfig } from "../../../types/PayConfig";
3
- /**
4
- * 支持自定义支付通道的选择器注入
5
- * 未来遇到真正需求时再实现,by Xc 20240426
6
- */
7
- export type ExtraPicker = {
8
- label: string;
9
- name: string;
10
- icon: React.ForwardRefExoticComponent<any>;
11
- component?: React.ForwardRefExoticComponent<{
12
- onSetMeta?: (meta: object) => void;
13
- }>;
14
- };
15
- declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, {
16
- payConfig: PayConfig;
17
- channel: string;
18
- meta: object;
19
- extraChannelPickers: ExtraPicker[];
20
- onPick: (channel: string) => void;
21
- onSetMeta: (meta?: object) => void;
22
- }>) => React.ReactElement;
23
- export default _default;
@@ -1,47 +0,0 @@
1
- import { PAY_CHANNEL_OFFLINE_NAME } from "../../../types/PayConfig";
2
- import assert from 'assert';
3
- export default OakComponent({
4
- properties: {
5
- payConfig: [],
6
- channel: '',
7
- meta: {},
8
- extraChannelPickers: [],
9
- onPick: (channel) => undefined,
10
- onSetMeta: (meta) => undefined,
11
- },
12
- formData() {
13
- const { payConfig } = this.props;
14
- assert(payConfig);
15
- const offlineConfig = payConfig.find(ele => ele.channel === PAY_CHANNEL_OFFLINE_NAME);
16
- return {
17
- offlineConfig,
18
- payChannels: payConfig.map(ele => ele.channel),
19
- };
20
- },
21
- methods: {
22
- onPickChannel(channel) {
23
- this.props.onPick(channel);
24
- if (channel === PAY_CHANNEL_OFFLINE_NAME && this.state.offlineConfig?.options?.length) {
25
- this.props.onSetMeta({
26
- option: this.state.offlineConfig.options[0],
27
- });
28
- }
29
- else {
30
- this.props.onSetMeta({});
31
- }
32
- },
33
- onPickChannelMp(touch) {
34
- const { detail } = touch;
35
- const { currentKey } = detail;
36
- this.onPickChannel(currentKey);
37
- },
38
- onSelectOfflineOptionMp(touch) {
39
- const { option } = touch.currentTarget.dataset;
40
- const { meta, onSetMeta } = this.props;
41
- onSetMeta({
42
- ...meta,
43
- option,
44
- });
45
- }
46
- }
47
- });
@@ -1,8 +0,0 @@
1
- {
2
- "usingComponents": {
3
- "l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
4
- "l-radio": "@oak-frontend-base/miniprogram_npm/lin-ui/radio/index",
5
- "l-radio-group": "@oak-frontend-base/miniprogram_npm/lin-ui/radio-group/index",
6
- "l-tag": "@oak-frontend-base/miniprogram_npm/lin-ui/tag/index"
7
- }
8
- }
@@ -1,31 +0,0 @@
1
- .form-item {
2
- position: relative;
3
- font-size: 28rpx;
4
- color: #333;
5
- padding-right: 25rpx;
6
- margin-left: 12rpx;
7
- box-sizing: border-box;
8
-
9
- .radio {
10
- height: 80rpx;
11
- display: flex;
12
- flex-direction: row;
13
- align-items: center;
14
-
15
- .offline-option {
16
- margin-left: 12rpx;
17
- display: flex;
18
- flex-direction: row;
19
- flex-wrap: wrap;
20
-
21
- l-tag {
22
- margin-left: 6rpx;
23
- }
24
-
25
- .selected {
26
- background:#333 !important;
27
- color:#fff !important;
28
- }
29
- }
30
- }
31
- }
@@ -1,36 +0,0 @@
1
- <block wx:if="{{payChannels.length > 0}}">
2
- <l-radio-group
3
- wx:for="{{payChannels}}"
4
- l-class="form-item"
5
- current="{{channel}}"
6
- bind:linchange="onPickChannelMp"
7
- >
8
- <l-radio wx:key="{{item}}" key="{{item}}">
9
- <view class="radio">
10
- <view style="white-space:nowrap">{{t('payChannel::' + item)}}</view>
11
- <block wx:if="{{channel==='OFFLINE' && item==='OFFLINE'}}">
12
- <view
13
- class="offline-option"
14
- >
15
- <l-tag
16
- wx:for="{{offlineConfig.options}}"
17
- plain="{{true}}"
18
- select="{{item===meta.option}}"
19
- l-select-class="selected"
20
- catch:lintap="onSelectOfflineOptionMp"
21
- data-option="{{item}}"
22
- >
23
- {{item}}
24
- </l-tag>
25
- </view>
26
- </block>
27
- </view>
28
- </l-radio>
29
- </l-radio-group>
30
- </block>
31
- <block wx:else>
32
- <l-input
33
- disabled
34
- value="{{t('noChannel')}}"
35
- />
36
- </block>
@@ -1,6 +0,0 @@
1
- {
2
- "label": {
3
- "option": "渠道"
4
- },
5
- "noChannel": "未配置收费渠道"
6
- }
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { WebComponentProps } from 'oak-frontend-base';
3
- import { EntityDict } from '../../../oak-app-domain';
4
- import { OfflinePayConfig, PayConfig } from '../../../types/PayConfig';
5
- export default function Render(props: WebComponentProps<EntityDict, keyof EntityDict, false, {
6
- payConfig: PayConfig;
7
- offlineConfig?: OfflinePayConfig;
8
- channel: string;
9
- meta?: any;
10
- onPick: (channel: string, meta?: object) => void;
11
- onSetMeta: (meta?: object) => void;
12
- }, {
13
- onPickChannel: (channel: string) => void;
14
- }>): React.JSX.Element;
@@ -1,49 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Radio, Space, Picker, Button } from 'antd-mobile';
3
- import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME, 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';
4
- import { WechatOutlined, WalletOutlined } from '@ant-design/icons';
5
- import Styles from './web.mobile.module.less';
6
- const ChannelIconDict = {
7
- [PAY_CHANNEL_ACCOUNT_NAME]: <WalletOutlined />,
8
- [PAY_CHANNEL_OFFLINE_NAME]: <WalletOutlined />,
9
- [PAY_CHANNEL_WECHAT_APP_NAME]: <WechatOutlined />,
10
- [PAY_CHANNEL_WECHAT_JS_NAME]: <WechatOutlined />,
11
- [PAY_CHANNEL_WECHAT_NATIVE_NAME]: <WechatOutlined />,
12
- [PAY_CHANNEL_WECHAT_H5_NAME]: <WechatOutlined />,
13
- [PAY_CHANNEL_WECHAT_MP_NAME]: <WechatOutlined />,
14
- };
15
- export default function Render(props) {
16
- const { payConfig, offlineConfig, channel, onPick, meta, onSetMeta } = props.data;
17
- const { t, onPickChannel } = props.methods;
18
- const [offlinePickerVisible, setOpVisible] = useState(false);
19
- if (payConfig?.length) {
20
- const Offline = offlineConfig && offlineConfig.options?.length && (<>
21
- <Button onClick={() => setOpVisible(true)}>
22
- {meta?.option || t('common::change')}
23
- </Button>
24
- <Picker value={meta?.option} columns={[offlineConfig.options.map(ele => ({
25
- label: ele,
26
- value: ele,
27
- }))]} visible={offlinePickerVisible} onConfirm={(value) => {
28
- onSetMeta({
29
- ...meta,
30
- option: value[0],
31
- });
32
- setOpVisible(false);
33
- }} onCancel={() => setOpVisible(false)}/>
34
- </>);
35
- return (<Radio.Group onChange={(value) => onPickChannel(value)} value={channel}>
36
- <Space direction="vertical">
37
- {payConfig.map((v) => (<Radio className={Styles.radio} value={v.channel} key={v.channel}>
38
- <Space direction="horizontal" align='center'>
39
- <span className={Styles.span}>
40
- {t(`payChannel::${v.channel}`)}
41
- </span>
42
- {v.channel === PAY_CHANNEL_OFFLINE_NAME && channel === PAY_CHANNEL_OFFLINE_NAME && Offline}
43
- </Space>
44
- </Radio>))}
45
- </Space>
46
- </Radio.Group>);
47
- }
48
- return (<div>{t('noChannel')}</div>);
49
- }
@@ -1,8 +0,0 @@
1
- .span {
2
- margin-right: 10px;
3
- }
4
-
5
-
6
- .radio {
7
- height: 40px;
8
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { WebComponentProps } from 'oak-frontend-base';
3
- import { EntityDict } from '../../../oak-app-domain';
4
- import { OfflinePayConfig, PayConfig } from '../../../types/PayConfig';
5
- export default function Render(props: WebComponentProps<EntityDict, keyof EntityDict, false, {
6
- payConfig: PayConfig;
7
- offlineConfig?: OfflinePayConfig;
8
- channel: string;
9
- meta?: any;
10
- onPick: (channel: string, meta?: object) => void;
11
- onSetMeta: (meta?: object) => void;
12
- }>): React.JSX.Element;
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import { Radio, Space, Select, Flex } from 'antd';
3
- import Styles from './web.pc.module.less';
4
- import { PAY_CHANNEL_ACCOUNT_NAME, PAY_CHANNEL_OFFLINE_NAME, 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';
5
- import { WechatOutlined, WalletOutlined } from '@ant-design/icons';
6
- const ChannelIconDict = {
7
- [PAY_CHANNEL_ACCOUNT_NAME]: <WalletOutlined />,
8
- [PAY_CHANNEL_OFFLINE_NAME]: <WalletOutlined />,
9
- [PAY_CHANNEL_WECHAT_APP_NAME]: <WechatOutlined />,
10
- [PAY_CHANNEL_WECHAT_JS_NAME]: <WechatOutlined />,
11
- [PAY_CHANNEL_WECHAT_NATIVE_NAME]: <WechatOutlined />,
12
- [PAY_CHANNEL_WECHAT_H5_NAME]: <WechatOutlined />,
13
- [PAY_CHANNEL_WECHAT_MP_NAME]: <WechatOutlined />,
14
- };
15
- export default function Render(props) {
16
- const { payConfig, offlineConfig, channel, onPick, meta, onSetMeta } = props.data;
17
- const { t } = props.methods;
18
- if (payConfig?.length) {
19
- const Offline = offlineConfig && offlineConfig.options?.length && (<span className={Styles.span}>
20
- <Select style={{ width: 140 }} value={meta?.option} options={offlineConfig.options.map(ele => ({
21
- label: ele,
22
- value: ele,
23
- }))} onSelect={(value) => {
24
- onSetMeta({
25
- ...meta,
26
- option: value,
27
- });
28
- }}/>
29
- </span>);
30
- return (<Radio.Group onChange={({ target }) => {
31
- onPick(target.value);
32
- if (target.value === PAY_CHANNEL_OFFLINE_NAME && offlineConfig?.options?.length) {
33
- onSetMeta({
34
- option: offlineConfig.options[0],
35
- });
36
- }
37
- else {
38
- onSetMeta({});
39
- }
40
- }} value={channel}>
41
- <Space direction="vertical">
42
- {payConfig.map((v) => (<Radio value={v.channel} key={v.channel}>
43
- <Flex gap="middle" className={Styles.option} align='center'>
44
- <span className={Styles.span}>
45
- {t(`payChannel::${v.channel}`)}
46
- </span>
47
- {v.channel === 'OFFLINE' && channel === 'OFFLINE' && Offline}
48
- </Flex>
49
- </Radio>))}
50
- </Space>
51
- </Radio.Group>);
52
- }
53
- return (<div>{t('noChannel')}</div>);
54
- }
@@ -1,7 +0,0 @@
1
- .span {
2
- margin-left: 6px;
3
- }
4
-
5
- .option {
6
- height: 44px;
7
- }
@@ -1,5 +0,0 @@
1
- import SimpleConnector from 'oak-domain/lib/utils/SimpleConnector';
2
- import { EntityDict } from '../oak-app-domain';
3
- import FrontendRuntimeContext from '../context/FrontendRuntimeContext';
4
- declare const connector: SimpleConnector<EntityDict, FrontendRuntimeContext>;
5
- export default connector;
@@ -1,5 +0,0 @@
1
- import SimpleConnector from 'oak-domain/lib/utils/SimpleConnector';
2
- import accessConfiguration from '../configuration/access';
3
- import { makeException } from '../types/Exception';
4
- const connector = new SimpleConnector(accessConfiguration, makeException);
5
- export default connector;
@@ -1 +0,0 @@
1
- export { BackendRuntimeContext, FrontendRuntimeContext, SerializedData } from "oak-general-business";
@@ -1 +0,0 @@
1
- export { BackendRuntimeContext, FrontendRuntimeContext } from "oak-general-business";
@@ -1,5 +0,0 @@
1
- import { Schema as Application } from 'oak-general-business/lib/entities/Application';
2
- import { PayConfig } from '../types/PayConfig';
3
- export interface Schema extends Application {
4
- payConfig?: PayConfig;
5
- }
@@ -1,38 +0,0 @@
1
- ;
2
- const entityDesc = {
3
- locales: {
4
- zh_CN: {
5
- name: '应用',
6
- attr: {
7
- description: '描述',
8
- type: '类型',
9
- system: '系统',
10
- name: '名称',
11
- config: '设置',
12
- style: '样式',
13
- sessions: '会话',
14
- domain: '域名',
15
- payConfig: '支付配置',
16
- },
17
- v: {
18
- type: {
19
- web: '网站',
20
- wechatPublic: '微信公众号',
21
- wechatMp: '微信小程序',
22
- native: 'App',
23
- },
24
- },
25
- },
26
- },
27
- style: {
28
- color: {
29
- type: {
30
- wechatMp: '#32CD32',
31
- web: '#00FF7F',
32
- wechatPublic: '#90EE90',
33
- native: '#008000',
34
- }
35
- }
36
- }
37
- };
38
- export {};
@@ -1,8 +0,0 @@
1
- import { AFD } from './types/RuntimeCxt';
2
- /**
3
- * 构造backUrl
4
- * @param location
5
- * @param encode
6
- * @returns
7
- */
8
- export declare const handler: (reason: any, features: AFD) => Promise<boolean>;
@@ -1,47 +0,0 @@
1
- import { OakException, OakUnloggedInException, OakAttrNotNullException, OakInputIllegalException, } from 'oak-domain/lib/types/Exception';
2
- import { ExampleException, } from './types/Exception';
3
- /**
4
- * 构造backUrl
5
- * @param location
6
- * @param encode
7
- * @returns
8
- */
9
- export const handler = async (reason, features) => {
10
- if (reason instanceof OakException) {
11
- if (reason instanceof OakUnloggedInException) {
12
- // await features.token.logout();
13
- features.navigator.navigateTo({
14
- url: '/login',
15
- }, { isGoBack: true }, true);
16
- }
17
- else if (reason instanceof OakInputIllegalException) {
18
- features.message.setMessage({
19
- content: reason.message,
20
- type: 'error',
21
- });
22
- }
23
- else if (reason instanceof OakAttrNotNullException) {
24
- features.message.setMessage({
25
- content: reason.message,
26
- type: 'error',
27
- });
28
- }
29
- else if (reason instanceof ExampleException) {
30
- console.log('在此处理ExampleException');
31
- }
32
- else {
33
- console.warn(reason);
34
- features.message.setMessage({
35
- content: reason.message,
36
- type: 'error',
37
- });
38
- }
39
- return true;
40
- }
41
- console.error(reason);
42
- features.message.setMessage({
43
- content: reason.message,
44
- type: 'error',
45
- });
46
- return false;
47
- };
@@ -1,12 +0,0 @@
1
- import { EntityDict } from '../oak-app-domain';
2
- import { Feature } from 'oak-frontend-base';
3
- import { Cache } from 'oak-frontend-base/es/features/cache';
4
- type IMode = 'systemProvider' | 'store';
5
- export default class Console extends Feature {
6
- private cache;
7
- constructor(cache: Cache<EntityDict>);
8
- getMode(allowUninitialized?: boolean): IMode;
9
- initialize(): Promise<void>;
10
- destroy(): Promise<void>;
11
- }
12
- export {};
@@ -1,15 +0,0 @@
1
- import { Feature } from 'oak-frontend-base';
2
- export default class Console extends Feature {
3
- cache;
4
- constructor(cache) {
5
- super();
6
- this.cache = cache;
7
- }
8
- getMode(allowUninitialized) {
9
- return 'systemProvider';
10
- }
11
- async initialize() {
12
- }
13
- async destroy() {
14
- }
15
- }
@@ -1,20 +0,0 @@
1
- import { EntityDict } from '../oak-app-domain';
2
- import { Feature } from 'oak-frontend-base';
3
- import { ContextMenuFactory } from 'oak-frontend-base/es/features/contextMenuFactory';
4
- import Console from './Console';
5
- type GroupName = 'System';
6
- export interface OMenu {
7
- name: GroupName | string;
8
- icon: string;
9
- url?: string;
10
- children?: Array<OMenu>;
11
- }
12
- export default class Menu extends Feature {
13
- private contextMenuFactory;
14
- private console;
15
- private menus?;
16
- constructor(contextMenuFactory: ContextMenuFactory<EntityDict>, console: Console);
17
- refreshMenus(): void;
18
- getMenus(): OMenu[] | undefined;
19
- }
20
- export {};
@@ -1,62 +0,0 @@
1
- import { Feature } from 'oak-frontend-base';
2
- ;
3
- ;
4
- const groups = [
5
- {
6
- name: 'System', // 系统级别配置
7
- icon: 'setup_fill',
8
- },
9
- ];
10
- const menus = [
11
- {
12
- name: 'Dashboard',
13
- icon: 'document',
14
- url: '',
15
- },
16
- {
17
- name: 'relationManage',
18
- icon: 'share',
19
- url: '/relation/entityList',
20
- parent: 'System',
21
- entity: 'relation',
22
- action: 'create',
23
- paths: [],
24
- },
25
- ];
26
- export default class Menu extends Feature {
27
- contextMenuFactory;
28
- console;
29
- menus;
30
- constructor(contextMenuFactory, console) {
31
- super();
32
- this.contextMenuFactory = contextMenuFactory;
33
- this.contextMenuFactory.setMenus(menus);
34
- this.console = console;
35
- this.console.subscribe(() => {
36
- this.refreshMenus();
37
- });
38
- }
39
- refreshMenus() {
40
- /* const roomId = this.console.getRoomId();
41
- const menus = this.contextMenuFactory.getMenusByContext<IMenu<keyof EntityDict>>('room', roomId);
42
- const menuGroup = groupBy(menus, 'parent');
43
- this.menus = (menus as any[]).filter(ele => !ele.parent).concat(
44
- groups.map((ele) => {
45
- const { name, icon } = ele;
46
- const children = menuGroup[name];
47
- return {
48
- name,
49
- icon,
50
- children,
51
- };
52
- }).filter((ele) => !!ele.children)
53
- );
54
- this.publish(); */
55
- }
56
- getMenus() {
57
- if (!this.menus) {
58
- this.refreshMenus();
59
- }
60
- return this.menus;
61
- }
62
- }
@@ -1,15 +0,0 @@
1
- import { EntityDict } from '../oak-app-domain/index';
2
- import { BasicFeatures, Feature } from 'oak-frontend-base';
3
- type DoSthAcion = {
4
- type: 'doSth';
5
- payload: {
6
- args: string;
7
- };
8
- };
9
- export default class Sample extends Feature {
10
- get(params: any): void;
11
- action(action: DoSthAcion): void;
12
- cache: BasicFeatures<EntityDict>['cache'];
13
- constructor(cache: BasicFeatures<EntityDict>['cache']);
14
- }
15
- export {};
@@ -1,14 +0,0 @@
1
- import { Feature } from 'oak-frontend-base';
2
- export default class Sample extends Feature {
3
- get(params) {
4
- throw new Error('Method not implemented.');
5
- }
6
- action(action) {
7
- throw new Error('Method not implemented.');
8
- }
9
- cache;
10
- constructor(cache) {
11
- super();
12
- this.cache = cache;
13
- }
14
- }
@@ -1,5 +0,0 @@
1
- import { Trigger } from 'oak-domain/lib/types/Trigger';
2
- import { EntityDict } from '../oak-app-domain';
3
- import { BRC } from '../types/RuntimeCxt';
4
- declare const triggers: Trigger<EntityDict, 'account', BRC>[];
5
- export default triggers;
@@ -1,20 +0,0 @@
1
- import { DATA_SUBSCRIBER_KEYS } from '../config/constants';
2
- import assert from 'assert';
3
- const triggers = [
4
- {
5
- name: '当account帐户的值发生变化时,向订阅者推送',
6
- entity: 'account',
7
- action: ['deposit', 'withdraw', 'withdrawBack', 'consume', 'loan', 'repay'],
8
- check(operation) {
9
- return operation.data.hasOwnProperty('total') || operation.data.hasOwnProperty('avail');
10
- },
11
- when: 'after',
12
- fn: async ({ operation }, context, option) => {
13
- const { id, filter } = operation;
14
- assert(typeof filter?.id === 'string');
15
- context.saveOperationToEvent(id, `${DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${filter.id}`);
16
- return 1;
17
- },
18
- },
19
- ];
20
- export default triggers;
@@ -1,5 +0,0 @@
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">[]>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccountPayRefunds = void 0;
4
- const pay_1 = require("../utils/pay");
5
- async function getAccountPayRefunds(params, context) {
6
- return (0, pay_1.getAccountPayRefunds)(context, params.accountId, params.price);
7
- }
8
- exports.getAccountPayRefunds = getAccountPayRefunds;
@@ -1 +0,0 @@
1
- export { BackendRuntimeContext, FrontendRuntimeContext, SerializedData } from "oak-general-business";
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FrontendRuntimeContext = exports.BackendRuntimeContext = void 0;
4
- var oak_general_business_1 = require("oak-general-business");
5
- Object.defineProperty(exports, "BackendRuntimeContext", { enumerable: true, get: function () { return oak_general_business_1.BackendRuntimeContext; } });
6
- Object.defineProperty(exports, "FrontendRuntimeContext", { enumerable: true, get: function () { return oak_general_business_1.FrontendRuntimeContext; } });