oak-pay-business 2.5.0 → 2.5.2

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 (41) hide show
  1. package/es/aspects/withdraw.d.ts +8 -8
  2. package/es/configuration/attrUpdateMatrix.js +1 -1
  3. package/es/context/BackendRuntimeContext.d.ts +1 -1
  4. package/es/data/i18n.js +3 -1
  5. package/es/locales/error/zh-CN.json +3 -1
  6. package/es/oak-app-domain/ActionDefDict.d.ts +1 -3
  7. package/es/oak-app-domain/ArticleMenu/Schema.d.ts +2 -2
  8. package/es/oak-app-domain/ArticleMenu/Storage.js +0 -1
  9. package/es/oak-app-domain/Log/Action.d.ts +1 -7
  10. package/es/oak-app-domain/Log/Action.js +1 -10
  11. package/es/oak-app-domain/Log/Schema.d.ts +4 -4
  12. package/es/oak-app-domain/Log/Storage.js +1 -0
  13. package/es/oak-app-domain/Log/Style.js +0 -6
  14. package/es/triggers/pay.js +13 -14
  15. package/es/triggers/refund.js +70 -23
  16. package/es/types/Exception.d.ts +3 -0
  17. package/es/types/Exception.js +6 -1
  18. package/es/utils/application.d.ts +1 -1
  19. package/es/utils/payClazz/WechatPay/index.d.ts +1 -1
  20. package/lib/aspects/withdraw.d.ts +8 -8
  21. package/lib/configuration/attrUpdateMatrix.js +1 -1
  22. package/lib/context/BackendRuntimeContext.d.ts +1 -1
  23. package/lib/data/i18n.js +3 -1
  24. package/lib/locales/error/zh-CN.json +3 -1
  25. package/lib/oak-app-domain/ActionDefDict.d.ts +1 -3
  26. package/lib/oak-app-domain/ArticleMenu/Schema.d.ts +2 -2
  27. package/lib/oak-app-domain/ArticleMenu/Storage.js +0 -1
  28. package/lib/oak-app-domain/Log/Action.d.ts +1 -7
  29. package/lib/oak-app-domain/Log/Action.js +2 -11
  30. package/lib/oak-app-domain/Log/Schema.d.ts +4 -4
  31. package/lib/oak-app-domain/Log/Storage.js +1 -0
  32. package/lib/oak-app-domain/Log/Style.js +0 -6
  33. package/lib/oak-app-domain/User/Storage.js +3 -0
  34. package/lib/oak-app-domain/User/locales/zh_CN.json +1 -1
  35. package/lib/triggers/pay.js +13 -14
  36. package/lib/triggers/refund.js +70 -23
  37. package/lib/types/Exception.d.ts +3 -0
  38. package/lib/types/Exception.js +8 -2
  39. package/lib/utils/application.d.ts +1 -1
  40. package/lib/utils/payClazz/WechatPay/index.d.ts +1 -1
  41. package/package.json +4 -4
@@ -12,8 +12,8 @@ export declare function getWithdrawCreateData(params: {
12
12
  creatorId: string;
13
13
  creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
14
14
  } & {
15
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
16
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
15
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
16
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
17
17
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
18
18
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
19
19
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -26,8 +26,8 @@ export declare function getWithdrawCreateData(params: {
26
26
  creator?: undefined;
27
27
  creatorId: string;
28
28
  } & {
29
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
30
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
29
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
30
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
31
31
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
32
32
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
33
33
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -40,8 +40,8 @@ export declare function getWithdrawCreateData(params: {
40
40
  creatorId: string;
41
41
  creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
42
42
  } & {
43
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
44
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
43
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
44
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
45
45
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
46
46
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
47
47
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -54,8 +54,8 @@ export declare function getWithdrawCreateData(params: {
54
54
  creator?: undefined;
55
55
  creatorId: string;
56
56
  } & {
57
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
58
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
57
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
58
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
59
59
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
60
60
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
61
61
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -44,7 +44,7 @@ const attrUpdateMatrix = {
44
44
  actions: ['refundPartially', 'refundAll'],
45
45
  },
46
46
  refundable: {
47
- actions: ['succeedPaying', 'closeRefund'],
47
+ actions: ['succeedPaying', 'closeRefund', 'stopRefunding', 'refundPartially'],
48
48
  },
49
49
  forbidRefundAt: {
50
50
  actions: ['succeedPaying'],
@@ -15,7 +15,7 @@ export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDic
15
15
  type?: number | undefined;
16
16
  systemId?: number | undefined;
17
17
  system?: import("../oak-app-domain/System/Schema").Projection | undefined;
18
- config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
18
+ config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
19
19
  style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
20
20
  domainId?: number | undefined;
21
21
  domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
package/es/data/i18n.js CHANGED
@@ -798,7 +798,9 @@ const i18ns = [
798
798
  },
799
799
  "refund": {
800
800
  "create": {
801
- "hasAnotherRefunding": "您有一笔退款正在进行中"
801
+ "hasAnotherRefunding": "您有一笔退款正在进行中",
802
+ "exceedMax": "退款额度大于可用值",
803
+ "payUnrefundable": "支付已经不可退款"
802
804
  }
803
805
  }
804
806
  }
@@ -19,7 +19,9 @@
19
19
  },
20
20
  "refund": {
21
21
  "create": {
22
- "hasAnotherRefunding": "您有一笔退款正在进行中"
22
+ "hasAnotherRefunding": "您有一笔退款正在进行中",
23
+ "exceedMax": "退款额度大于可用值",
24
+ "payUnrefundable": "支付已经不可退款"
23
25
  }
24
26
  }
25
27
  }
@@ -1,7 +1,5 @@
1
1
  export declare const actionDefDict: {
2
- log: {
3
- iState: import("oak-domain/lib/types").ActionDef<string, string>;
4
- };
2
+ log: {};
5
3
  modi: {
6
4
  iState: import("oak-domain/lib/types").ActionDef<string, string>;
7
5
  };
@@ -10,7 +10,7 @@ export type OpSchema = EntityShape & {
10
10
  name: String<32>;
11
11
  isArticle: Boolean;
12
12
  parentId?: ForeignKey<"articleMenu"> | null;
13
- isLeaf: Boolean;
13
+ isLeaf?: Boolean | null;
14
14
  entity: String<32>;
15
15
  entityId: String<64>;
16
16
  };
@@ -19,7 +19,7 @@ export type Schema = EntityShape & {
19
19
  name: String<32>;
20
20
  isArticle: Boolean;
21
21
  parentId?: ForeignKey<"articleMenu"> | null;
22
- isLeaf: Boolean;
22
+ isLeaf?: Boolean | null;
23
23
  entity: String<32>;
24
24
  entityId: String<64>;
25
25
  parent?: Schema | null;
@@ -17,7 +17,6 @@ export const desc = {
17
17
  ref: "articleMenu"
18
18
  },
19
19
  isLeaf: {
20
- notNull: true,
21
20
  type: "boolean"
22
21
  },
23
22
  entity: {
@@ -1,12 +1,6 @@
1
- import { ActionDef } from "oak-domain/lib/types/Action";
2
1
  import { GenericAction } from "oak-domain/lib/actions/action";
3
- export type IState = 'normal' | 'rollbacked' | string;
4
- export type State = IState | string;
5
2
  export type IAction = 'undo' | 'redo' | string;
6
3
  export type ParticularAction = IAction;
7
4
  export declare const actions: string[];
8
- export declare const IActionDef: ActionDef<IAction, IState>;
9
5
  export type Action = GenericAction | ParticularAction | string;
10
- export declare const actionDefDict: {
11
- iState: ActionDef<string, string>;
12
- };
6
+ export declare const actionDefDict: {};
@@ -1,11 +1,2 @@
1
1
  export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "undo", "redo"];
2
- export const IActionDef = {
3
- stm: {
4
- undo: ['normal', 'rollbacked'],
5
- redo: ['rollbacked', 'normal'],
6
- },
7
- is: 'normal',
8
- };
9
- export const actionDefDict = {
10
- iState: IActionDef
11
- };
2
+ export const actionDefDict = {};
@@ -1,19 +1,19 @@
1
1
  import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
2
2
  import { OneOf } from "oak-domain/lib/types/Polyfill";
3
3
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
4
- import { Action, ParticularAction, IState } from "./Action";
4
+ import { Action, ParticularAction } from "./Action";
5
5
  import { String } from "oak-domain/lib/types/DataType";
6
6
  import * as Oper from "../Oper/Schema";
7
7
  export type OpSchema = EntityShape & {
8
8
  entity: String<32>;
9
9
  entityId: String<64>;
10
- iState?: IState | null;
10
+ iState: "normal" | "rollbacked";
11
11
  };
12
12
  export type OpAttr = keyof OpSchema;
13
13
  export type Schema = EntityShape & {
14
14
  entity: String<32>;
15
15
  entityId: String<64>;
16
- iState?: IState | null;
16
+ iState: "normal" | "rollbacked";
17
17
  oper$log?: Array<Oper.Schema>;
18
18
  oper$log$$aggr?: AggregationResult<Oper.Schema>;
19
19
  } & {
@@ -26,7 +26,7 @@ type AttrFilter = {
26
26
  $$updateAt$$: Q_DateValue;
27
27
  entity: Q_StringValue;
28
28
  entityId: Q_StringValue;
29
- iState: Q_EnumValue<IState>;
29
+ iState: Q_EnumValue<"normal" | "rollbacked">;
30
30
  oper$log: Oper.Filter & SubQueryPredicateMetadata;
31
31
  };
32
32
  export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
@@ -16,6 +16,7 @@ export const desc = {
16
16
  }
17
17
  },
18
18
  iState: {
19
+ notNull: true,
19
20
  type: "enum",
20
21
  enumeration: ["normal", "rollbacked"]
21
22
  }
@@ -3,10 +3,4 @@ export const style = {
3
3
  undo: '',
4
4
  redo: '',
5
5
  },
6
- color: {
7
- iState: {
8
- normal: '#229954',
9
- rollbacked: '#2C3E50',
10
- },
11
- },
12
6
  };
@@ -44,8 +44,7 @@ async function changeOrderStateByPay(filter, context, option) {
44
44
  break;
45
45
  }
46
46
  }
47
- if (paid && iState === 'paid') {
48
- //已支付完成的订单的paid
47
+ if (paid) { //对iState是否为paid的判断会影响退款,先去掉
49
48
  payPaid += paid;
50
49
  }
51
50
  if (refunded) {
@@ -72,7 +71,7 @@ async function changeOrderStateByPay(filter, context, option) {
72
71
  }
73
72
  }
74
73
  else if (hasRefunding) {
75
- assert(!hasPaying && payPaid === orderPrice && payPaid === orderPaid && payRefunded < orderPrice);
74
+ assert(!hasPaying && payPaid === orderPrice && payRefunded < orderPrice);
76
75
  if (orderIState !== 'refunding' || orderRefunded !== payRefunded) {
77
76
  await context.operate('order', {
78
77
  id: await generateNewIdAsync(),
@@ -504,17 +503,6 @@ const triggers = [
504
503
  action: 'create',
505
504
  }
506
505
  ];
507
- await context.operate('deposit', {
508
- id: await generateNewIdAsync(),
509
- action: 'succeed',
510
- data: {
511
- accountOper$entity: accountOpers,
512
- },
513
- filter: {
514
- id: depositId,
515
- },
516
- }, {});
517
- cnt++;
518
506
  if (loss > 0) {
519
507
  // 如果有loss就充入system的account账户
520
508
  const [account] = await context.select('account', {
@@ -539,6 +527,17 @@ const triggers = [
539
527
  });
540
528
  cnt++;
541
529
  }
530
+ await context.operate('deposit', {
531
+ id: await generateNewIdAsync(),
532
+ action: 'succeed',
533
+ data: {
534
+ accountOper$entity: accountOpers,
535
+ },
536
+ filter: {
537
+ id: depositId,
538
+ },
539
+ }, {});
540
+ cnt++;
542
541
  }
543
542
  return cnt;
544
543
  },
@@ -2,6 +2,7 @@ import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
2
2
  import { getAccountEntity, getPayClazz } from '../utils/payClazz';
3
3
  import assert from 'assert';
4
4
  import { updateWithdrawState } from './withdraw';
5
+ import { RefundExceedMax, PayUnRefundable } from '../types/Exception';
5
6
  /**
6
7
  * 开始退款的逻辑
7
8
  * @param context
@@ -15,6 +16,9 @@ async function startRefunding(context, data) {
15
16
  paid: 1,
16
17
  refunded: 1,
17
18
  iState: 1,
19
+ entity: 1,
20
+ entityId: 1,
21
+ refundable: 1,
18
22
  deposit: {
19
23
  id: 1,
20
24
  accountId: 1,
@@ -29,10 +33,32 @@ async function startRefunding(context, data) {
29
33
  }
30
34
  }, { dontCollect: true });
31
35
  const { paid, refunded, deposit, order } = pay;
32
- assert(paid - refunded >= data.price);
36
+ if (paid - refunded < data.price) {
37
+ throw new RefundExceedMax();
38
+ }
39
+ if (!pay.refundable) {
40
+ throw new PayUnRefundable();
41
+ }
33
42
  if (deposit) {
34
- // 是提现,其Account相应的计算在withdraw进行
35
- assert(data.withdrawId);
43
+ // 充值不可能从account渠道支付
44
+ assert(pay.entity !== 'account');
45
+ if (!data.withdrawId && !order?.id) {
46
+ //充值退款需创建关联的accountOper,若为提现则在withdraw中创建
47
+ data.accountOper$entity = [
48
+ {
49
+ id: await generateNewIdAsync(),
50
+ action: 'create',
51
+ data: {
52
+ id: await generateNewIdAsync(),
53
+ accountId: deposit.accountId,
54
+ type: 'refund',
55
+ totalPlus: -data.price,
56
+ availPlus: -data.price,
57
+ refundablePlus: -data.price,
58
+ },
59
+ }
60
+ ];
61
+ }
36
62
  }
37
63
  else {
38
64
  assert(order);
@@ -121,24 +147,45 @@ async function succeedRefunding(context, refundId) {
121
147
  id: pay.id,
122
148
  }
123
149
  }, {});
124
- const payClazz = await getPayClazz(entity, entityId, context);
125
- // 实际执行的退款的额度应该是price - loss
126
- const [delta, sysAccountEntity, sysAccountEntityId] = payClazz.calcRefundTax(refundPrice - refundLoss);
127
- // sysAccount上减掉实际退款的额度-税费
128
- await context.operate('sysAccountOper', {
129
- id: await generateNewIdAsync(),
130
- action: 'create',
131
- data: {
150
+ let d = undefined; //退回至account的退款无渠道退款补偿
151
+ if (entity === 'account') {
152
+ //退回至account中的退款,创建accountOper,更新account余额
153
+ await context.operate('accountOper', {
132
154
  id: await generateNewIdAsync(),
133
- delta: refundLoss - refundPrice - delta,
134
- entity: sysAccountEntity,
135
- entityId: sysAccountEntityId,
136
- refundId: refund.id,
137
- type: 'refund',
138
- }
139
- }, {});
155
+ action: 'create',
156
+ data: {
157
+ id: await generateNewIdAsync(),
158
+ accountId: pay.entityId,
159
+ entity: 'refund',
160
+ entityId: refund.id,
161
+ type: 'consumeBack',
162
+ totalPlus: refundPrice - refundLoss,
163
+ availPlus: refundPrice - refundLoss,
164
+ }
165
+ }, {});
166
+ }
167
+ else {
168
+ //订单退回至非account的退款会使得系统对应账户的资金发生流出
169
+ const payClazz = await getPayClazz(entity, entityId, context);
170
+ // 实际执行的退款的额度应该是price - loss
171
+ const [delta, sysAccountEntity, sysAccountEntityId] = payClazz.calcRefundTax(refundPrice - refundLoss);
172
+ // sysAccount上减掉实际退款的额度-税费
173
+ await context.operate('sysAccountOper', {
174
+ id: await generateNewIdAsync(),
175
+ action: 'create',
176
+ data: {
177
+ id: await generateNewIdAsync(),
178
+ delta: refundLoss - refundPrice - delta,
179
+ entity: sysAccountEntity,
180
+ entityId: sysAccountEntityId,
181
+ refundId: refund.id,
182
+ type: 'refund',
183
+ }
184
+ }, {});
185
+ d = delta;
186
+ }
140
187
  let cnt = 2;
141
- if (refundLoss || delta) {
188
+ if (refundLoss || d) {
142
189
  // 如果有退回或者要缴纳的税费,进入system相关联的account账户
143
190
  const [account] = await context.select('account', {
144
191
  data: {
@@ -149,16 +196,16 @@ async function succeedRefunding(context, refundId) {
149
196
  entityId: application.systemId,
150
197
  },
151
198
  }, { dontCollect: true });
152
- if (delta) {
199
+ if (d) {
153
200
  await context.operate('accountOper', {
154
201
  id: await generateNewIdAsync(),
155
202
  action: 'create',
156
203
  data: {
157
204
  id: await generateNewIdAsync(),
158
205
  accountId: account.id,
159
- type: delta < 0 ? 'taxRefund' : 'tax',
160
- totalPlus: -delta,
161
- availPlus: -delta,
206
+ type: d < 0 ? 'taxRefund' : 'tax',
207
+ totalPlus: -d,
208
+ availPlus: -d,
162
209
  entity: 'refund',
163
210
  entityId: refund.id,
164
211
  },
@@ -16,6 +16,9 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
16
16
  export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
17
17
  constructor(message?: string);
18
18
  }
19
+ export declare class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
20
+ constructor(message?: string);
21
+ }
19
22
  export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
20
23
  constructor(message: string);
21
24
  }
@@ -16,7 +16,12 @@ export class ExternalPayUtilException extends OakException {
16
16
  }
17
17
  export class RefundExceedMax extends OakException {
18
18
  constructor(message) {
19
- super(message || '可退款的总额不足');
19
+ super(message || 'error::refund.create.exceedMax');
20
+ }
21
+ }
22
+ export class PayUnRefundable extends OakException {
23
+ constructor(message) {
24
+ super(message || 'error::refund.create.payUnrefundable');
20
25
  }
21
26
  }
22
27
  export class StartPayFailure extends OakException {
@@ -14,7 +14,7 @@ export declare const mergedProjection: {
14
14
  type?: number | undefined;
15
15
  systemId?: number | undefined;
16
16
  system?: import("../oak-app-domain/System/Schema").Projection | undefined;
17
- config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
17
+ config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
18
18
  style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
19
19
  domainId?: number | undefined;
20
20
  domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
@@ -1,4 +1,4 @@
1
1
  import WechatPay from './WechatPay';
2
2
  import WechatPayDebug from './WechatPay.debug';
3
- declare const _default: typeof WechatPay | typeof WechatPayDebug;
3
+ declare const _default: typeof WechatPayDebug | typeof WechatPay;
4
4
  export default _default;
@@ -12,8 +12,8 @@ export declare function getWithdrawCreateData(params: {
12
12
  creatorId: string;
13
13
  creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
14
14
  } & {
15
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
16
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
15
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
16
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
17
17
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
18
18
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
19
19
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -26,8 +26,8 @@ export declare function getWithdrawCreateData(params: {
26
26
  creator?: undefined;
27
27
  creatorId: string;
28
28
  } & {
29
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
30
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
29
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
30
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
31
31
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
32
32
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
33
33
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -40,8 +40,8 @@ export declare function getWithdrawCreateData(params: {
40
40
  creatorId: string;
41
41
  creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
42
42
  } & {
43
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
44
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
43
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
44
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
45
45
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
46
46
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
47
47
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -54,8 +54,8 @@ export declare function getWithdrawCreateData(params: {
54
54
  creator?: undefined;
55
55
  creatorId: string;
56
56
  } & {
57
- refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
58
- withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
57
+ refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
58
+ withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
59
59
  modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
60
60
  operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
61
61
  accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
@@ -46,7 +46,7 @@ const attrUpdateMatrix = {
46
46
  actions: ['refundPartially', 'refundAll'],
47
47
  },
48
48
  refundable: {
49
- actions: ['succeedPaying', 'closeRefund'],
49
+ actions: ['succeedPaying', 'closeRefund', 'stopRefunding', 'refundPartially'],
50
50
  },
51
51
  forbidRefundAt: {
52
52
  actions: ['succeedPaying'],
@@ -15,7 +15,7 @@ export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDic
15
15
  type?: number | undefined;
16
16
  systemId?: number | undefined;
17
17
  system?: import("../oak-app-domain/System/Schema").Projection | undefined;
18
- config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
18
+ config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
19
19
  style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
20
20
  domainId?: number | undefined;
21
21
  domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
package/lib/data/i18n.js CHANGED
@@ -800,7 +800,9 @@ const i18ns = [
800
800
  },
801
801
  "refund": {
802
802
  "create": {
803
- "hasAnotherRefunding": "您有一笔退款正在进行中"
803
+ "hasAnotherRefunding": "您有一笔退款正在进行中",
804
+ "exceedMax": "退款额度大于可用值",
805
+ "payUnrefundable": "支付已经不可退款"
804
806
  }
805
807
  }
806
808
  }
@@ -19,7 +19,9 @@
19
19
  },
20
20
  "refund": {
21
21
  "create": {
22
- "hasAnotherRefunding": "您有一笔退款正在进行中"
22
+ "hasAnotherRefunding": "您有一笔退款正在进行中",
23
+ "exceedMax": "退款额度大于可用值",
24
+ "payUnrefundable": "支付已经不可退款"
23
25
  }
24
26
  }
25
27
  }
@@ -1,7 +1,5 @@
1
1
  export declare const actionDefDict: {
2
- log: {
3
- iState: import("oak-domain/lib/types").ActionDef<string, string>;
4
- };
2
+ log: {};
5
3
  modi: {
6
4
  iState: import("oak-domain/lib/types").ActionDef<string, string>;
7
5
  };
@@ -10,7 +10,7 @@ export type OpSchema = EntityShape & {
10
10
  name: String<32>;
11
11
  isArticle: Boolean;
12
12
  parentId?: ForeignKey<"articleMenu"> | null;
13
- isLeaf: Boolean;
13
+ isLeaf?: Boolean | null;
14
14
  entity: String<32>;
15
15
  entityId: String<64>;
16
16
  };
@@ -19,7 +19,7 @@ export type Schema = EntityShape & {
19
19
  name: String<32>;
20
20
  isArticle: Boolean;
21
21
  parentId?: ForeignKey<"articleMenu"> | null;
22
- isLeaf: Boolean;
22
+ isLeaf?: Boolean | null;
23
23
  entity: String<32>;
24
24
  entityId: String<64>;
25
25
  parent?: Schema | null;
@@ -20,7 +20,6 @@ exports.desc = {
20
20
  ref: "articleMenu"
21
21
  },
22
22
  isLeaf: {
23
- notNull: true,
24
23
  type: "boolean"
25
24
  },
26
25
  entity: {
@@ -1,12 +1,6 @@
1
- import { ActionDef } from "oak-domain/lib/types/Action";
2
1
  import { GenericAction } from "oak-domain/lib/actions/action";
3
- export type IState = 'normal' | 'rollbacked' | string;
4
- export type State = IState | string;
5
2
  export type IAction = 'undo' | 'redo' | string;
6
3
  export type ParticularAction = IAction;
7
4
  export declare const actions: string[];
8
- export declare const IActionDef: ActionDef<IAction, IState>;
9
5
  export type Action = GenericAction | ParticularAction | string;
10
- export declare const actionDefDict: {
11
- iState: ActionDef<string, string>;
12
- };
6
+ export declare const actionDefDict: {};
@@ -1,14 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.actionDefDict = exports.IActionDef = exports.actions = void 0;
3
+ exports.actionDefDict = exports.actions = void 0;
4
4
  exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "undo", "redo"];
5
- exports.IActionDef = {
6
- stm: {
7
- undo: ['normal', 'rollbacked'],
8
- redo: ['rollbacked', 'normal'],
9
- },
10
- is: 'normal',
11
- };
12
- exports.actionDefDict = {
13
- iState: exports.IActionDef
14
- };
5
+ exports.actionDefDict = {};
@@ -1,19 +1,19 @@
1
1
  import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
2
2
  import { OneOf } from "oak-domain/lib/types/Polyfill";
3
3
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
4
- import { Action, ParticularAction, IState } from "./Action";
4
+ import { Action, ParticularAction } from "./Action";
5
5
  import { String } from "oak-domain/lib/types/DataType";
6
6
  import * as Oper from "../Oper/Schema";
7
7
  export type OpSchema = EntityShape & {
8
8
  entity: String<32>;
9
9
  entityId: String<64>;
10
- iState?: IState | null;
10
+ iState: "normal" | "rollbacked";
11
11
  };
12
12
  export type OpAttr = keyof OpSchema;
13
13
  export type Schema = EntityShape & {
14
14
  entity: String<32>;
15
15
  entityId: String<64>;
16
- iState?: IState | null;
16
+ iState: "normal" | "rollbacked";
17
17
  oper$log?: Array<Oper.Schema>;
18
18
  oper$log$$aggr?: AggregationResult<Oper.Schema>;
19
19
  } & {
@@ -26,7 +26,7 @@ type AttrFilter = {
26
26
  $$updateAt$$: Q_DateValue;
27
27
  entity: Q_StringValue;
28
28
  entityId: Q_StringValue;
29
- iState: Q_EnumValue<IState>;
29
+ iState: Q_EnumValue<"normal" | "rollbacked">;
30
30
  oper$log: Oper.Filter & SubQueryPredicateMetadata;
31
31
  };
32
32
  export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
@@ -19,6 +19,7 @@ exports.desc = {
19
19
  }
20
20
  },
21
21
  iState: {
22
+ notNull: true,
22
23
  type: "enum",
23
24
  enumeration: ["normal", "rollbacked"]
24
25
  }
@@ -6,10 +6,4 @@ exports.style = {
6
6
  undo: '',
7
7
  redo: '',
8
8
  },
9
- color: {
10
- iState: {
11
- normal: '#229954',
12
- rollbacked: '#2C3E50',
13
- },
14
- },
15
9
  };
@@ -46,6 +46,9 @@ exports.desc = {
46
46
  isRoot: {
47
47
  type: "boolean"
48
48
  },
49
+ hasPassword: {
50
+ type: "boolean"
51
+ },
49
52
  idState: {
50
53
  type: "enum",
51
54
  enumeration: ["unverified", "verified", "verifying"]
@@ -1 +1 @@
1
- { "name": "用户", "attr": { "name": "姓名", "nickname": "昵称", "birth": "生日", "password": "密码", "passwordSha1": "sha1加密密码", "gender": "性别", "idCardType": "证件类型", "idNumber": "证件号码", "ref": "指向用户", "files": "相关文件", "userState": "用户状态", "idState": "身份验证状态", "codes": "微信分享二维码", "isRoot": "是否超级用户", "addresses": "收货地址", "accounts": "用户帐户", "withdrawAccounts": "用户提现帐户" }, "action": { "activate": "激活", "accept": "同意", "verify": "验证", "reject": "拒绝", "enable": "启用", "disable": "禁用", "mergeTo": "合并", "mergeFrom": "使合并" }, "v": { "userState": { "shadow": "未激活", "normal": "正常", "disabled": "禁用", "merged": "已被合并" }, "idState": { "unverified": "未验证", "verifying": "验证中", "verified": "已验证" }, "gender": { "male": "男", "female": "女" }, "idCardType": { "ID-Card": "身份证", "passport": "护照", "Mainland-passport": "港澳台通行证" } } }
1
+ { "name": "用户", "attr": { "name": "姓名", "nickname": "昵称", "birth": "生日", "password": "密码", "passwordSha1": "sha1加密密码", "gender": "性别", "idCardType": "证件类型", "idNumber": "证件号码", "ref": "指向用户", "files": "相关文件", "userState": "用户状态", "idState": "身份验证状态", "codes": "微信分享二维码", "isRoot": "是否超级用户", "addresses": "收货地址", "hasPassword": "用户是否存在密码", "accounts": "用户帐户", "withdrawAccounts": "用户提现帐户" }, "action": { "activate": "激活", "accept": "同意", "verify": "验证", "reject": "拒绝", "enable": "启用", "disable": "禁用", "mergeTo": "合并", "mergeFrom": "使合并" }, "v": { "userState": { "shadow": "未激活", "normal": "正常", "disabled": "禁用", "merged": "已被合并" }, "idState": { "unverified": "未验证", "verifying": "验证中", "verified": "已验证" }, "gender": { "male": "男", "female": "女" }, "idCardType": { "ID-Card": "身份证", "passport": "护照", "Mainland-passport": "港澳台通行证" } } }
@@ -47,8 +47,7 @@ async function changeOrderStateByPay(filter, context, option) {
47
47
  break;
48
48
  }
49
49
  }
50
- if (paid && iState === 'paid') {
51
- //已支付完成的订单的paid
50
+ if (paid) { //对iState是否为paid的判断会影响退款,先去掉
52
51
  payPaid += paid;
53
52
  }
54
53
  if (refunded) {
@@ -75,7 +74,7 @@ async function changeOrderStateByPay(filter, context, option) {
75
74
  }
76
75
  }
77
76
  else if (hasRefunding) {
78
- (0, assert_1.default)(!hasPaying && payPaid === orderPrice && payPaid === orderPaid && payRefunded < orderPrice);
77
+ (0, assert_1.default)(!hasPaying && payPaid === orderPrice && payRefunded < orderPrice);
79
78
  if (orderIState !== 'refunding' || orderRefunded !== payRefunded) {
80
79
  await context.operate('order', {
81
80
  id: await (0, uuid_1.generateNewIdAsync)(),
@@ -507,17 +506,6 @@ const triggers = [
507
506
  action: 'create',
508
507
  }
509
508
  ];
510
- await context.operate('deposit', {
511
- id: await (0, uuid_1.generateNewIdAsync)(),
512
- action: 'succeed',
513
- data: {
514
- accountOper$entity: accountOpers,
515
- },
516
- filter: {
517
- id: depositId,
518
- },
519
- }, {});
520
- cnt++;
521
509
  if (loss > 0) {
522
510
  // 如果有loss就充入system的account账户
523
511
  const [account] = await context.select('account', {
@@ -542,6 +530,17 @@ const triggers = [
542
530
  });
543
531
  cnt++;
544
532
  }
533
+ await context.operate('deposit', {
534
+ id: await (0, uuid_1.generateNewIdAsync)(),
535
+ action: 'succeed',
536
+ data: {
537
+ accountOper$entity: accountOpers,
538
+ },
539
+ filter: {
540
+ id: depositId,
541
+ },
542
+ }, {});
543
+ cnt++;
545
544
  }
546
545
  return cnt;
547
546
  },
@@ -5,6 +5,7 @@ const uuid_1 = require("oak-domain/lib/utils/uuid");
5
5
  const payClazz_1 = require("../utils/payClazz");
6
6
  const assert_1 = tslib_1.__importDefault(require("assert"));
7
7
  const withdraw_1 = require("./withdraw");
8
+ const Exception_1 = require("../types/Exception");
8
9
  /**
9
10
  * 开始退款的逻辑
10
11
  * @param context
@@ -18,6 +19,9 @@ async function startRefunding(context, data) {
18
19
  paid: 1,
19
20
  refunded: 1,
20
21
  iState: 1,
22
+ entity: 1,
23
+ entityId: 1,
24
+ refundable: 1,
21
25
  deposit: {
22
26
  id: 1,
23
27
  accountId: 1,
@@ -32,10 +36,32 @@ async function startRefunding(context, data) {
32
36
  }
33
37
  }, { dontCollect: true });
34
38
  const { paid, refunded, deposit, order } = pay;
35
- (0, assert_1.default)(paid - refunded >= data.price);
39
+ if (paid - refunded < data.price) {
40
+ throw new Exception_1.RefundExceedMax();
41
+ }
42
+ if (!pay.refundable) {
43
+ throw new Exception_1.PayUnRefundable();
44
+ }
36
45
  if (deposit) {
37
- // 是提现,其Account相应的计算在withdraw进行
38
- (0, assert_1.default)(data.withdrawId);
46
+ // 充值不可能从account渠道支付
47
+ (0, assert_1.default)(pay.entity !== 'account');
48
+ if (!data.withdrawId && !order?.id) {
49
+ //充值退款需创建关联的accountOper,若为提现则在withdraw中创建
50
+ data.accountOper$entity = [
51
+ {
52
+ id: await (0, uuid_1.generateNewIdAsync)(),
53
+ action: 'create',
54
+ data: {
55
+ id: await (0, uuid_1.generateNewIdAsync)(),
56
+ accountId: deposit.accountId,
57
+ type: 'refund',
58
+ totalPlus: -data.price,
59
+ availPlus: -data.price,
60
+ refundablePlus: -data.price,
61
+ },
62
+ }
63
+ ];
64
+ }
39
65
  }
40
66
  else {
41
67
  (0, assert_1.default)(order);
@@ -124,24 +150,45 @@ async function succeedRefunding(context, refundId) {
124
150
  id: pay.id,
125
151
  }
126
152
  }, {});
127
- const payClazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context);
128
- // 实际执行的退款的额度应该是price - loss
129
- const [delta, sysAccountEntity, sysAccountEntityId] = payClazz.calcRefundTax(refundPrice - refundLoss);
130
- // sysAccount上减掉实际退款的额度-税费
131
- await context.operate('sysAccountOper', {
132
- id: await (0, uuid_1.generateNewIdAsync)(),
133
- action: 'create',
134
- data: {
153
+ let d = undefined; //退回至account的退款无渠道退款补偿
154
+ if (entity === 'account') {
155
+ //退回至account中的退款,创建accountOper,更新account余额
156
+ await context.operate('accountOper', {
135
157
  id: await (0, uuid_1.generateNewIdAsync)(),
136
- delta: refundLoss - refundPrice - delta,
137
- entity: sysAccountEntity,
138
- entityId: sysAccountEntityId,
139
- refundId: refund.id,
140
- type: 'refund',
141
- }
142
- }, {});
158
+ action: 'create',
159
+ data: {
160
+ id: await (0, uuid_1.generateNewIdAsync)(),
161
+ accountId: pay.entityId,
162
+ entity: 'refund',
163
+ entityId: refund.id,
164
+ type: 'consumeBack',
165
+ totalPlus: refundPrice - refundLoss,
166
+ availPlus: refundPrice - refundLoss,
167
+ }
168
+ }, {});
169
+ }
170
+ else {
171
+ //订单退回至非account的退款会使得系统对应账户的资金发生流出
172
+ const payClazz = await (0, payClazz_1.getPayClazz)(entity, entityId, context);
173
+ // 实际执行的退款的额度应该是price - loss
174
+ const [delta, sysAccountEntity, sysAccountEntityId] = payClazz.calcRefundTax(refundPrice - refundLoss);
175
+ // sysAccount上减掉实际退款的额度-税费
176
+ await context.operate('sysAccountOper', {
177
+ id: await (0, uuid_1.generateNewIdAsync)(),
178
+ action: 'create',
179
+ data: {
180
+ id: await (0, uuid_1.generateNewIdAsync)(),
181
+ delta: refundLoss - refundPrice - delta,
182
+ entity: sysAccountEntity,
183
+ entityId: sysAccountEntityId,
184
+ refundId: refund.id,
185
+ type: 'refund',
186
+ }
187
+ }, {});
188
+ d = delta;
189
+ }
143
190
  let cnt = 2;
144
- if (refundLoss || delta) {
191
+ if (refundLoss || d) {
145
192
  // 如果有退回或者要缴纳的税费,进入system相关联的account账户
146
193
  const [account] = await context.select('account', {
147
194
  data: {
@@ -152,16 +199,16 @@ async function succeedRefunding(context, refundId) {
152
199
  entityId: application.systemId,
153
200
  },
154
201
  }, { dontCollect: true });
155
- if (delta) {
202
+ if (d) {
156
203
  await context.operate('accountOper', {
157
204
  id: await (0, uuid_1.generateNewIdAsync)(),
158
205
  action: 'create',
159
206
  data: {
160
207
  id: await (0, uuid_1.generateNewIdAsync)(),
161
208
  accountId: account.id,
162
- type: delta < 0 ? 'taxRefund' : 'tax',
163
- totalPlus: -delta,
164
- availPlus: -delta,
209
+ type: d < 0 ? 'taxRefund' : 'tax',
210
+ totalPlus: -d,
211
+ availPlus: -d,
165
212
  entity: 'refund',
166
213
  entityId: refund.id,
167
214
  },
@@ -16,6 +16,9 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
16
16
  export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
17
17
  constructor(message?: string);
18
18
  }
19
+ export declare class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
20
+ constructor(message?: string);
21
+ }
19
22
  export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
20
23
  constructor(message: string);
21
24
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeException = exports.StartPayFailure = exports.RefundExceedMax = exports.ExternalPayUtilException = void 0;
3
+ exports.makeException = exports.StartPayFailure = exports.PayUnRefundable = exports.RefundExceedMax = exports.ExternalPayUtilException = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const types_1 = require("oak-domain/lib/types");
6
6
  const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions"));
@@ -21,10 +21,16 @@ class ExternalPayUtilException extends types_1.OakException {
21
21
  exports.ExternalPayUtilException = ExternalPayUtilException;
22
22
  class RefundExceedMax extends types_1.OakException {
23
23
  constructor(message) {
24
- super(message || '可退款的总额不足');
24
+ super(message || 'error::refund.create.exceedMax');
25
25
  }
26
26
  }
27
27
  exports.RefundExceedMax = RefundExceedMax;
28
+ class PayUnRefundable extends types_1.OakException {
29
+ constructor(message) {
30
+ super(message || 'error::refund.create.payUnrefundable');
31
+ }
32
+ }
33
+ exports.PayUnRefundable = PayUnRefundable;
28
34
  class StartPayFailure extends types_1.OakException {
29
35
  constructor(message) {
30
36
  super(message);
@@ -14,7 +14,7 @@ export declare const mergedProjection: {
14
14
  type?: number | undefined;
15
15
  systemId?: number | undefined;
16
16
  system?: import("../oak-app-domain/System/Schema").Projection | undefined;
17
- config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
17
+ config?: number | import("oak-domain/lib/types").JsonProjection<import("../oak-app-domain/Application/Schema").WechatMpConfig | import("../oak-app-domain/Application/Schema").WebConfig | import("../oak-app-domain/Application/Schema").WechatPublicConfig | import("../oak-app-domain/Application/Schema").NativeConfig> | undefined;
18
18
  style?: number | import("oak-domain/lib/types").JsonProjection<import("oak-general-business/lib/types/Style").Style> | undefined;
19
19
  domainId?: number | undefined;
20
20
  domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined;
@@ -1,4 +1,4 @@
1
1
  import WechatPay from './WechatPay';
2
2
  import WechatPayDebug from './WechatPay.debug';
3
- declare const _default: typeof WechatPay | typeof WechatPayDebug;
3
+ declare const _default: typeof WechatPayDebug | typeof WechatPay;
4
4
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-pay-business",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "lib/**/*",
@@ -29,9 +29,9 @@
29
29
  "dependencies": {
30
30
  "classnames": "^2.3.1",
31
31
  "dayjs": "^1.11.5",
32
- "oak-domain": "^5.1.1",
33
- "oak-frontend-base": "^5.3.8",
34
- "oak-general-business": "~5.5.0",
32
+ "oak-domain": "^5.1.5",
33
+ "oak-frontend-base": "^5.3.13",
34
+ "oak-general-business": "~5.5.3",
35
35
  "wechat-pay-nodejs": "^0.2.3"
36
36
  },
37
37
  "peerDependencies": {