@chevre/domain 21.2.0-alpha.154 → 21.2.0-alpha.155

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.
@@ -21,7 +21,7 @@ const onPaymentStatusChanged_1 = require("./onPaymentStatusChanged");
21
21
  */
22
22
  function onRefund(refundAction) {
23
23
  return (repos) => __awaiter(this, void 0, void 0, function* () {
24
- var _a;
24
+ var _a, _b;
25
25
  const aciton4inform = (0, factory_1.optimizeAction4inform)(refundAction);
26
26
  const potentialActions = refundAction.potentialActions;
27
27
  const now = new Date();
@@ -33,49 +33,53 @@ function onRefund(refundAction) {
33
33
  }
34
34
  const informPayment = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.informPayment;
35
35
  // 手数料決済があれば処理
36
- const refundFee = (_a = refundAction.object[0]) === null || _a === void 0 ? void 0 : _a.refundFee;
37
- if (typeof refundFee === 'number' && refundFee > 0) {
38
- const payObject = refundAction.object.map((o) => {
39
- return {
40
- typeOf: o.typeOf,
41
- id: o.id,
42
- paymentMethod: {
43
- accountId: o.paymentMethod.accountId,
44
- additionalProperty: o.paymentMethod.additionalProperty,
45
- name: o.paymentMethod.name,
46
- paymentMethodId: o.paymentMethod.paymentMethodId,
47
- totalPaymentDue: {
48
- typeOf: 'MonetaryAmount',
49
- currency: factory.priceCurrency.JPY,
50
- value: refundFee
51
- },
52
- typeOf: o.paymentMethod.typeOf
36
+ // CreditCardIFのみ(2023-06-29~)
37
+ const paymentServiceType = (_a = refundAction.object[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
38
+ if (paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
39
+ const refundFee = (_b = refundAction.object[0]) === null || _b === void 0 ? void 0 : _b.refundFee;
40
+ if (typeof refundFee === 'number' && refundFee > 0) {
41
+ const payObject = refundAction.object.map((o) => {
42
+ return {
43
+ typeOf: o.typeOf,
44
+ id: o.id,
45
+ paymentMethod: {
46
+ accountId: o.paymentMethod.accountId,
47
+ additionalProperty: o.paymentMethod.additionalProperty,
48
+ name: o.paymentMethod.name,
49
+ paymentMethodId: o.paymentMethod.paymentMethodId,
50
+ totalPaymentDue: {
51
+ typeOf: 'MonetaryAmount',
52
+ currency: factory.priceCurrency.JPY,
53
+ value: refundFee
54
+ },
55
+ typeOf: o.paymentMethod.typeOf
56
+ }
57
+ };
58
+ });
59
+ const payAction = {
60
+ project: refundAction.project,
61
+ typeOf: factory.actionType.PayAction,
62
+ object: payObject,
63
+ agent: refundAction.recipient,
64
+ recipient: refundAction.agent,
65
+ purpose: refundAction.purpose,
66
+ potentialActions: {
67
+ add2report: true,
68
+ informPayment: (Array.isArray(informPayment)) ? informPayment : []
53
69
  }
54
70
  };
55
- });
56
- const payAction = {
57
- project: refundAction.project,
58
- typeOf: factory.actionType.PayAction,
59
- object: payObject,
60
- agent: refundAction.recipient,
61
- recipient: refundAction.agent,
62
- purpose: refundAction.purpose,
63
- potentialActions: {
64
- add2report: true,
65
- informPayment: (Array.isArray(informPayment)) ? informPayment : []
66
- }
67
- };
68
- const payTask = {
69
- project: refundAction.project,
70
- name: factory.taskName.Pay,
71
- status: factory.taskStatus.Ready,
72
- runsAt: now,
73
- remainingNumberOfTries: 10,
74
- numberOfTried: 0,
75
- executionResults: [],
76
- data: payAction
77
- };
78
- taskAttributes.push(payTask);
71
+ const payTask = {
72
+ project: refundAction.project,
73
+ name: factory.taskName.Pay,
74
+ status: factory.taskStatus.Ready,
75
+ runsAt: now,
76
+ remainingNumberOfTries: 10,
77
+ numberOfTried: 0,
78
+ executionResults: [],
79
+ data: payAction
80
+ };
81
+ taskAttributes.push(payTask);
82
+ }
79
83
  }
80
84
  if (Array.isArray(informPayment)) {
81
85
  taskAttributes.push(...informPayment.map((a) => {
package/package.json CHANGED
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.2.0-alpha.154"
120
+ "version": "21.2.0-alpha.155"
121
121
  }