@chevre/domain 21.7.0-alpha.3 → 21.7.0-alpha.5
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.
- package/lib/chevre/emailMessageBuilder.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +35 -34
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +16 -4
- package/lib/chevre/service/payment/any/factory.js +4 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +6 -9
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +2 -2
- package/package.json +2 -2
|
@@ -24,6 +24,6 @@ export declare function createReturnOrderMessage(params: {
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function createRefundMessage(params: {
|
|
26
26
|
order: factory.order.IOrder;
|
|
27
|
-
paymentMethods: factory.order.
|
|
27
|
+
paymentMethods: factory.order.IReferencedInvoice[];
|
|
28
28
|
email?: factory.creativeWork.message.email.ICustomization;
|
|
29
29
|
}): Promise<factory.creativeWork.message.email.ICreativeWork>;
|
|
@@ -7,7 +7,7 @@ exports.createStartParams = void 0;
|
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
8
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
9
9
|
function createStartParams(params) {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
11
11
|
const paymentServiceId = (params.paymentService !== undefined)
|
|
12
12
|
? String(params.paymentService.id)
|
|
13
13
|
: '';
|
|
@@ -25,14 +25,14 @@ function createStartParams(params) {
|
|
|
25
25
|
totalPaymentDue = {
|
|
26
26
|
typeOf: 'MonetaryAmount',
|
|
27
27
|
currency: factory.priceCurrency.JPY,
|
|
28
|
-
value:
|
|
28
|
+
value: params.amount
|
|
29
29
|
};
|
|
30
30
|
break;
|
|
31
31
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
32
32
|
totalPaymentDue = {
|
|
33
33
|
typeOf: 'MonetaryAmount',
|
|
34
34
|
currency: factory.priceCurrency.JPY,
|
|
35
|
-
value:
|
|
35
|
+
value: params.amount
|
|
36
36
|
};
|
|
37
37
|
break;
|
|
38
38
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
@@ -57,40 +57,41 @@ function createStartParams(params) {
|
|
|
57
57
|
const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
|
|
58
58
|
const accountId = (_g = params.object.paymentMethod) === null || _g === void 0 ? void 0 : _g.accountId;
|
|
59
59
|
// currencyはデフォルトでJPY
|
|
60
|
-
let paymentMethodCurrency = factory.priceCurrency.JPY;
|
|
61
|
-
if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.PaymentCard) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
: [], name: (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.name) === 'string')
|
|
60
|
+
// let paymentMethodCurrency: string = factory.priceCurrency.JPY;
|
|
61
|
+
// if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.PaymentCard) {
|
|
62
|
+
// // ひとまず使用していないので空文字
|
|
63
|
+
// paymentMethodCurrency = '';
|
|
64
|
+
// } else if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
65
|
+
// // カード通貨区分が存在すれば適用
|
|
66
|
+
// const creditCardAsPaymentServiceOutputCurrency = params.paymentService?.serviceOutput?.paymentMethod?.amount?.currency;
|
|
67
|
+
// if (typeof creditCardAsPaymentServiceOutputCurrency === 'string') {
|
|
68
|
+
// paymentMethodCurrency = creditCardAsPaymentServiceOutputCurrency;
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
// const paymentMethodAmount: factory.assetTransaction.pay.IPaymentMethodAmount = {
|
|
72
|
+
// typeOf: 'MonetaryAmount',
|
|
73
|
+
// currency: paymentMethodCurrency,
|
|
74
|
+
// value: params.amount
|
|
75
|
+
// };
|
|
76
|
+
const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_h = params.object.paymentMethod) === null || _h === void 0 ? void 0 : _h.additionalProperty))
|
|
77
|
+
? (_j = params.object.paymentMethod) === null || _j === void 0 ? void 0 : _j.additionalProperty
|
|
78
|
+
: [], name: (typeof ((_k = params.object.paymentMethod) === null || _k === void 0 ? void 0 : _k.name) === 'string')
|
|
80
79
|
? params.object.paymentMethod.name
|
|
81
80
|
: paymentMethodType,
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
amount:
|
|
85
|
-
|
|
81
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
82
|
+
// TODO MonetaryAmount対応(2023-08-14~)
|
|
83
|
+
amount: params.amount,
|
|
84
|
+
// amount: paymentMethodAmount,
|
|
85
|
+
paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.description) === 'string')
|
|
86
|
+
? { description: (_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.description }
|
|
86
87
|
: undefined), (totalPaymentDue !== undefined)
|
|
87
88
|
? { totalPaymentDue: totalPaymentDue }
|
|
88
|
-
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((
|
|
89
|
-
? { method: (
|
|
90
|
-
: undefined), (((
|
|
91
|
-
? { creditCard: (
|
|
92
|
-
: undefined), (Array.isArray((
|
|
93
|
-
? { movieTickets: (
|
|
89
|
+
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.method) === 'string')
|
|
90
|
+
? { method: (_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.method }
|
|
91
|
+
: undefined), (((_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.creditCard) !== undefined)
|
|
92
|
+
? { creditCard: (_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.creditCard }
|
|
93
|
+
: undefined), (Array.isArray((_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.movieTickets))
|
|
94
|
+
? { movieTickets: (_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.movieTickets }
|
|
94
95
|
: undefined);
|
|
95
96
|
// const serviceOutput: factory.order.IOrderPaymentMethodIssuedThroughServiceOutput | undefined =
|
|
96
97
|
// (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
|
|
@@ -112,7 +113,7 @@ function createStartParams(params) {
|
|
|
112
113
|
// CreditCardIFのカード通貨区分を追加(2023-08-07~)
|
|
113
114
|
// ...(typeof serviceOutput !== undefined) ? { serviceOutput } : undefined
|
|
114
115
|
};
|
|
115
|
-
return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires }, (typeof ((
|
|
116
|
+
return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires }, (typeof ((_u = params.location) === null || _u === void 0 ? void 0 : _u.typeOf) === 'string')
|
|
116
117
|
? { location: params.location }
|
|
117
118
|
: undefined);
|
|
118
119
|
}
|
|
@@ -28,7 +28,7 @@ function createPayActions(params) {
|
|
|
28
28
|
}
|
|
29
29
|
return payActions;
|
|
30
30
|
}
|
|
31
|
-
// tslint:disable-next-line:cyclomatic-complexity
|
|
31
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
32
32
|
function createPayObject(params) {
|
|
33
33
|
var _a;
|
|
34
34
|
const transaction = params.transaction;
|
|
@@ -37,12 +37,20 @@ function createPayObject(params) {
|
|
|
37
37
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
38
38
|
const paymentMethodId = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId : transaction.id;
|
|
39
39
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
40
|
+
// MonetaryAmount対応(2023-08-13~)
|
|
41
|
+
const paymentMethodAmountValue = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount) === 'number')
|
|
42
|
+
? paymentMethod.amount
|
|
43
|
+
: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount.value;
|
|
40
44
|
const paymentServiceOutput = createPayObjectServiceOutput(params);
|
|
41
45
|
let payObject;
|
|
42
46
|
switch (transaction.object.typeOf) {
|
|
43
47
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
44
48
|
// 対面決済ではとりあえず問答無用にJPY
|
|
45
|
-
const totalPaymentDue4faceToFace = {
|
|
49
|
+
const totalPaymentDue4faceToFace = {
|
|
50
|
+
typeOf: 'MonetaryAmount',
|
|
51
|
+
currency: factory.priceCurrency.JPY,
|
|
52
|
+
value: paymentMethodAmountValue
|
|
53
|
+
};
|
|
46
54
|
payObject = {
|
|
47
55
|
typeOf: transaction.object.typeOf,
|
|
48
56
|
id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
|
|
@@ -52,7 +60,11 @@ function createPayObject(params) {
|
|
|
52
60
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
53
61
|
const totalPaymentDue = (typeof ((_a = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
54
62
|
? paymentMethod.totalPaymentDue
|
|
55
|
-
: {
|
|
63
|
+
: {
|
|
64
|
+
typeOf: 'MonetaryAmount',
|
|
65
|
+
currency: factory.priceCurrency.JPY,
|
|
66
|
+
value: paymentMethodAmountValue
|
|
67
|
+
};
|
|
56
68
|
payObject = {
|
|
57
69
|
typeOf: transaction.object.typeOf,
|
|
58
70
|
id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
|
|
@@ -74,7 +86,7 @@ function createPayObject(params) {
|
|
|
74
86
|
paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
|
|
75
87
|
typeOf: 'MonetaryAmount',
|
|
76
88
|
currency: factory.priceCurrency.JPY,
|
|
77
|
-
value:
|
|
89
|
+
value: paymentMethodAmountValue
|
|
78
90
|
}, typeOf: paymentMethodType }, (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.accountId) === 'string') ? { accountId: paymentMethod.accountId } : undefined)
|
|
79
91
|
// CreditCardIFのカード通貨区分を追加(2023-08-07~)
|
|
80
92
|
// ...(paymentServiceOutput !== undefined) ? { serviceOutput: paymentServiceOutput } : undefined
|
|
@@ -104,6 +104,9 @@ function createAuthorizeResult(params) {
|
|
|
104
104
|
// }
|
|
105
105
|
// : undefined
|
|
106
106
|
};
|
|
107
|
+
const paymentMethodAsObject = {
|
|
108
|
+
typeOf: params.object.paymentMethod
|
|
109
|
+
};
|
|
107
110
|
return {
|
|
108
111
|
accountId: (typeof ((_b = payTransactionObject.paymentMethod) === null || _b === void 0 ? void 0 : _b.accountId) === 'string')
|
|
109
112
|
? payTransactionObject.paymentMethod.accountId
|
|
@@ -112,6 +115,7 @@ function createAuthorizeResult(params) {
|
|
|
112
115
|
// amount: params.object.amount,
|
|
113
116
|
issuedThrough,
|
|
114
117
|
paymentMethod: params.object.paymentMethod,
|
|
118
|
+
paymentMethodAsObject,
|
|
115
119
|
paymentStatus: factory.paymentStatusType.PaymentDue,
|
|
116
120
|
paymentMethodId: (typeof ((_c = payTransactionObject.paymentMethod) === null || _c === void 0 ? void 0 : _c.paymentMethodId) === 'string')
|
|
117
121
|
? payTransactionObject.paymentMethod.paymentMethodId
|
|
@@ -70,16 +70,13 @@ function createPaymentMethods(params) {
|
|
|
70
70
|
});
|
|
71
71
|
// 決済方法をセット
|
|
72
72
|
authorizePaymentActions.forEach((a) => {
|
|
73
|
+
var _a, _b;
|
|
73
74
|
const result = a.result;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
paymentMethodId: result.paymentMethodId,
|
|
80
|
-
totalPaymentDue: result.totalPaymentDue,
|
|
81
|
-
typeOf: result.paymentMethod
|
|
82
|
-
});
|
|
75
|
+
const paymentMethodAmountCurrencyByAuthorizeAction = (_b = (_a = result.paymentMethodAsObject) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
76
|
+
const paymentMethodOfInvoice = (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
|
|
77
|
+
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } }
|
|
78
|
+
: undefined;
|
|
79
|
+
paymentMethods.push(Object.assign({ accountId: result.accountId, additionalProperty: (Array.isArray(result.additionalProperty)) ? result.additionalProperty : [], issuedThrough: result.issuedThrough, name: result.name, paymentMethodId: result.paymentMethodId, totalPaymentDue: result.totalPaymentDue, typeOf: result.paymentMethod }, (paymentMethodOfInvoice !== undefined) ? { paymentMethod: paymentMethodOfInvoice } : undefined));
|
|
83
80
|
});
|
|
84
81
|
// 決済方法から注文金額の計算
|
|
85
82
|
// price += authorizePaymentActions
|
|
@@ -214,9 +214,9 @@ function validatePaymentMethods(params) {
|
|
|
214
214
|
if (typeof settings_1.settings.maxNumCreditCardPaymentMethod === 'number') {
|
|
215
215
|
// CreditCard IFの決済方法の最大値検証
|
|
216
216
|
const creditCardPaymentMethodCount = params.order.paymentMethods.filter((p) => {
|
|
217
|
-
var _a, _b
|
|
217
|
+
var _a, _b;
|
|
218
218
|
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
219
|
-
const serviceOutputAmountCurrency = (
|
|
219
|
+
const serviceOutputAmountCurrency = (_b = (_a = p.paymentMethod) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
220
220
|
return p.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
221
221
|
&& typeof serviceOutputAmountCurrency !== 'string';
|
|
222
222
|
}).length;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.325.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.325.0-alpha.3",
|
|
13
13
|
"@cinerino/sdk": "3.164.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -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.7.0-alpha.
|
|
120
|
+
"version": "21.7.0-alpha.5"
|
|
121
121
|
}
|