@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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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