@chevre/domain 21.7.0-alpha.3 → 21.7.0-alpha.4
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.
|
@@ -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
|
package/package.json
CHANGED