@chevre/domain 21.6.0-alpha.4 → 21.6.0-alpha.6
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.
|
@@ -4,7 +4,7 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
6
|
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
9
|
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
10
10
|
|
|
@@ -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, _v;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
11
11
|
const paymentServiceId = (params.paymentService !== undefined)
|
|
12
12
|
? String(params.paymentService.id)
|
|
13
13
|
: '';
|
|
@@ -36,15 +36,14 @@ function createStartParams(params) {
|
|
|
36
36
|
};
|
|
37
37
|
break;
|
|
38
38
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
39
|
+
const specifiedMovieTickets = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.movieTickets;
|
|
39
40
|
totalPaymentDue = {
|
|
40
41
|
typeOf: 'MonetaryAmount',
|
|
41
42
|
currency: factory.unitCode.C62,
|
|
42
|
-
value: (Array.isArray(
|
|
43
|
-
? (_d = params.object.paymentMethod) === null || _d === void 0 ? void 0 : _d.movieTickets.length
|
|
44
|
-
: 0
|
|
43
|
+
value: (Array.isArray(specifiedMovieTickets)) ? specifiedMovieTickets.length : 0
|
|
45
44
|
};
|
|
46
45
|
// MovieTicketIFの決済取引において最大同時着券数を設定可能にする(2023-03-27~)
|
|
47
|
-
const totalPaymentDueMaxValue = (
|
|
46
|
+
const totalPaymentDueMaxValue = (_f = (_e = (_d = params.paymentService) === null || _d === void 0 ? void 0 : _d.availableChannel) === null || _e === void 0 ? void 0 : _e.totalPaymentDue) === null || _f === void 0 ? void 0 : _f.maxValue;
|
|
48
47
|
const totalPaymentDueValue = totalPaymentDue.value;
|
|
49
48
|
if (typeof totalPaymentDueValue === 'number' && typeof totalPaymentDueMaxValue === 'number') {
|
|
50
49
|
if (totalPaymentDueValue > totalPaymentDueMaxValue) {
|
|
@@ -56,30 +55,29 @@ function createStartParams(params) {
|
|
|
56
55
|
// no op
|
|
57
56
|
}
|
|
58
57
|
const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
|
|
59
|
-
const accountId = (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, expires: params.expires }, (typeof ((_v = params.location) === null || _v === void 0 ? void 0 : _v.typeOf) === 'string')
|
|
58
|
+
const accountId = (_g = params.object.paymentMethod) === null || _g === void 0 ? void 0 : _g.accountId;
|
|
59
|
+
const creditCardAsPaymentServiceOutputCurrency = (_k = (_j = (_h = params.paymentService) === null || _h === void 0 ? void 0 : _h.serviceOutput) === null || _j === void 0 ? void 0 : _j.amount) === null || _k === void 0 ? void 0 : _k.currency;
|
|
60
|
+
const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.additionalProperty))
|
|
61
|
+
? (_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.additionalProperty
|
|
62
|
+
: [], name: (typeof ((_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.name) === 'string')
|
|
63
|
+
? params.object.paymentMethod.name
|
|
64
|
+
: paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.description) === 'string')
|
|
65
|
+
? { description: (_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.description }
|
|
66
|
+
: undefined), (totalPaymentDue !== undefined)
|
|
67
|
+
? { totalPaymentDue: totalPaymentDue }
|
|
68
|
+
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.method) === 'string')
|
|
69
|
+
? { method: (_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.method }
|
|
70
|
+
: undefined), (((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.creditCard) !== undefined)
|
|
71
|
+
? { creditCard: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.creditCard }
|
|
72
|
+
: undefined), (Array.isArray((_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.movieTickets))
|
|
73
|
+
? { movieTickets: (_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.movieTickets }
|
|
74
|
+
: undefined);
|
|
75
|
+
const object = Object.assign({
|
|
76
|
+
// パラメータから必要なもののみ取り込む
|
|
77
|
+
accountId: (typeof accountId === 'string') ? accountId : '', paymentMethodId: params.transactionNumber, typeOf: params.paymentServiceType, id: paymentServiceId, onPaymentStatusChanged: { informPayment: informPaymentParams }, paymentMethod }, (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
|
|
78
|
+
? { serviceOutput: { amount: { currency: creditCardAsPaymentServiceOutputCurrency } } }
|
|
79
|
+
: undefined);
|
|
80
|
+
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 ((_x = params.location) === null || _x === void 0 ? void 0 : _x.typeOf) === 'string')
|
|
83
81
|
? { location: params.location }
|
|
84
82
|
: undefined);
|
|
85
83
|
}
|
|
@@ -111,6 +111,7 @@ function createPayObject(params) {
|
|
|
111
111
|
return payObject;
|
|
112
112
|
}
|
|
113
113
|
function createPayObjectServiceOutput(params) {
|
|
114
|
+
var _a, _b;
|
|
114
115
|
const transaction = params.transaction;
|
|
115
116
|
const paymentMethod = transaction.object.paymentMethod;
|
|
116
117
|
const order = params.order;
|
|
@@ -118,7 +119,15 @@ function createPayObjectServiceOutput(params) {
|
|
|
118
119
|
switch (transaction.object.typeOf) {
|
|
119
120
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
120
121
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
122
|
+
break;
|
|
121
123
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
124
|
+
// CreditCardIFのカード通貨区分を追加(2023-08-07~)
|
|
125
|
+
const creditCardAsPaymentServiceOutput = (typeof ((_b = (_a = transaction.object.serviceOutput) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency) === 'string')
|
|
126
|
+
? { amount: { currency: transaction.object.serviceOutput.amount.currency } }
|
|
127
|
+
: undefined;
|
|
128
|
+
if (creditCardAsPaymentServiceOutput !== undefined) {
|
|
129
|
+
paymentServiceOutput = creditCardAsPaymentServiceOutput;
|
|
130
|
+
}
|
|
122
131
|
break;
|
|
123
132
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
124
133
|
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf;
|
|
@@ -129,9 +138,7 @@ function createPayObjectServiceOutput(params) {
|
|
|
129
138
|
const amount = movieTicket2amount(transaction, movieTicket);
|
|
130
139
|
const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
|
|
131
140
|
return Object.assign(Object.assign({ identifier: movieTicket.identifier }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
132
|
-
? {
|
|
133
|
-
serviceOutput: reservation4invoice
|
|
134
|
-
}
|
|
141
|
+
? { serviceOutput: reservation4invoice }
|
|
135
142
|
: undefined);
|
|
136
143
|
});
|
|
137
144
|
}
|
|
@@ -80,27 +80,29 @@ function createMovieTicket(params) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function createAuthorizeResult(params) {
|
|
83
|
-
var _a, _b, _c, _d;
|
|
83
|
+
var _a, _b, _c, _d, _e, _f;
|
|
84
84
|
const payTransactionObject = params.payTransaction.object;
|
|
85
85
|
const totalPaymentDue = (_a = payTransactionObject.paymentMethod) === null || _a === void 0 ? void 0 : _a.totalPaymentDue;
|
|
86
86
|
if (typeof (totalPaymentDue === null || totalPaymentDue === void 0 ? void 0 : totalPaymentDue.typeOf) !== 'string') {
|
|
87
87
|
throw new factory.errors.ServiceUnavailable('payTransaction.object.paymentMethod.totalPaymentDue undefined');
|
|
88
88
|
}
|
|
89
|
+
const creditCardAsPaymentServiceOutputCurrency = (_c = (_b = payTransactionObject.serviceOutput) === null || _b === void 0 ? void 0 : _b.amount) === null || _c === void 0 ? void 0 : _c.currency;
|
|
90
|
+
const issuedThrough = Object.assign({ typeOf: payTransactionObject.typeOf, id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : '' }, (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
|
|
91
|
+
? { serviceOutput: { amount: { currency: creditCardAsPaymentServiceOutputCurrency } } }
|
|
92
|
+
: undefined);
|
|
89
93
|
return {
|
|
90
|
-
accountId: (typeof ((
|
|
94
|
+
accountId: (typeof ((_d = payTransactionObject.paymentMethod) === null || _d === void 0 ? void 0 : _d.accountId) === 'string')
|
|
91
95
|
? payTransactionObject.paymentMethod.accountId
|
|
92
96
|
: '',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : ''
|
|
97
|
-
},
|
|
97
|
+
// 廃止(2023-08-07~)
|
|
98
|
+
// amount: params.object.amount,
|
|
99
|
+
issuedThrough,
|
|
98
100
|
paymentMethod: params.object.paymentMethod,
|
|
99
101
|
paymentStatus: factory.paymentStatusType.PaymentDue,
|
|
100
|
-
paymentMethodId: (typeof ((
|
|
102
|
+
paymentMethodId: (typeof ((_e = payTransactionObject.paymentMethod) === null || _e === void 0 ? void 0 : _e.paymentMethodId) === 'string')
|
|
101
103
|
? payTransactionObject.paymentMethod.paymentMethodId
|
|
102
104
|
: '',
|
|
103
|
-
name: (typeof ((
|
|
105
|
+
name: (typeof ((_f = payTransactionObject.paymentMethod) === null || _f === void 0 ? void 0 : _f.name) === 'string')
|
|
104
106
|
? payTransactionObject.paymentMethod.name
|
|
105
107
|
: params.object.paymentMethod,
|
|
106
108
|
totalPaymentDue: totalPaymentDue,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.324.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.324.0-alpha.2",
|
|
13
13
|
"@cinerino/sdk": "3.162.2",
|
|
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.6.0-alpha.
|
|
120
|
+
"version": "21.6.0-alpha.6"
|
|
121
121
|
}
|