@chevre/domain 25.2.0-alpha.3 → 25.2.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/service/offer/event/authorize/factory.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +4 -4
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +59 -59
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +5 -0
- package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -1
- package/package.json +2 -2
|
@@ -174,7 +174,7 @@ function acceptedOffers2programMembershipUsed(params) {
|
|
|
174
174
|
}
|
|
175
175
|
function acceptedOffers2authorizeResult(params) {
|
|
176
176
|
const { acceptedOffers4result, noOfferSpecified, ticketOffers } = params;
|
|
177
|
-
const priceCurrency =
|
|
177
|
+
// const priceCurrency = factory.priceCurrency.JPY; // fix(2024-07-03~)
|
|
178
178
|
let offers;
|
|
179
179
|
let price;
|
|
180
180
|
let programMembershipUsed = [];
|
|
@@ -213,8 +213,8 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
213
213
|
}
|
|
214
214
|
return {
|
|
215
215
|
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
216
|
-
priceCurrency,
|
|
217
|
-
amount: [],
|
|
216
|
+
// priceCurrency, // discontinue(2026-07-06~)
|
|
217
|
+
// amount: [], // discontinue(2026-07-06~)
|
|
218
218
|
itemOffered: {
|
|
219
219
|
serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
220
220
|
},
|
|
@@ -109,8 +109,8 @@ function authorize(params, options) {
|
|
|
109
109
|
result = {
|
|
110
110
|
typeOf: factory_2.factory.offerType.AggregateOffer, // add(2024-06-18~)
|
|
111
111
|
price: price,
|
|
112
|
-
priceCurrency:
|
|
113
|
-
amount: []
|
|
112
|
+
// priceCurrency: factory.priceCurrency.JPY, // discontinue(2026-07-06~)
|
|
113
|
+
// amount: [] // discontinue(2026-07-06~)
|
|
114
114
|
};
|
|
115
115
|
await (0, any_1.acceptOffer)({
|
|
116
116
|
project: transaction.project,
|
|
@@ -133,7 +133,7 @@ function changeOffers(params) {
|
|
|
133
133
|
const actionResult = {
|
|
134
134
|
...authorizeAction.result,
|
|
135
135
|
price: price,
|
|
136
|
-
amount: []
|
|
136
|
+
// amount: [] // discontinue(2026-07-06~)
|
|
137
137
|
};
|
|
138
138
|
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
139
139
|
await repos.action.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
|
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js
CHANGED
|
@@ -32,7 +32,7 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
32
32
|
};
|
|
33
33
|
});
|
|
34
34
|
return {
|
|
35
|
-
amount: [],
|
|
35
|
+
// amount: [], // discontinue(2026-07-06~)
|
|
36
36
|
itemOffered: {
|
|
37
37
|
serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
38
38
|
},
|
|
@@ -93,7 +93,7 @@ function prepareUnitPriceOfferConditions(params) {
|
|
|
93
93
|
id: authorizeEventServiceOfferAction.id,
|
|
94
94
|
result: {
|
|
95
95
|
typeOf: authorizeEventServiceOfferAction.result.typeOf,
|
|
96
|
-
priceCurrency: authorizeEventServiceOfferAction.result.priceCurrency,
|
|
96
|
+
// priceCurrency: authorizeEventServiceOfferAction.result.priceCurrency,
|
|
97
97
|
price: authorizeEventServiceOfferAction.result.price,
|
|
98
98
|
...acceptedOffers2authorizeResult({
|
|
99
99
|
acceptedOffers4result: acceptedOffers4action,
|
|
@@ -106,9 +106,9 @@ function prepareUnitPriceOfferConditions(params) {
|
|
|
106
106
|
for (const authorizeEventServiceOfferAction of params.authorizeEventServiceOfferActions) {
|
|
107
107
|
const conditionExpected = conditions.find(({ id }) => id === authorizeEventServiceOfferAction.id);
|
|
108
108
|
const resultMatched = (0, util_1.isDeepStrictEqual)(conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
109
|
-
console.log('resultMatched?', resultMatched, authorizeEventServiceOfferAction.id, authorizeEventServiceOfferAction.instrument.transactionNumber);
|
|
109
|
+
console.log('resultMatched?', resultMatched, params.project.id, authorizeEventServiceOfferAction.id, authorizeEventServiceOfferAction.instrument.transactionNumber);
|
|
110
110
|
if (!resultMatched) {
|
|
111
|
-
console.log(conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
111
|
+
console.log('conditionExpected not matched!', params.project.id, authorizeEventServiceOfferAction.id, conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
return conditions;
|
|
@@ -29,8 +29,8 @@ eventReservationAcceptedOffers, payTransactions, customer) {
|
|
|
29
29
|
(0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
30
30
|
// 請求のreferencesOrder検証(2025-11-23~)
|
|
31
31
|
(0, validateInvoiceReferencesOrder_1.validateInvoiceReferencesOrder)(authorizePaymentActions, eventReservationAcceptedOffers);
|
|
32
|
-
// 利用可能な通貨単位に対して取引検証
|
|
33
|
-
validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
32
|
+
// // 利用可能な通貨単位に対して取引検証
|
|
33
|
+
// validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions); // discontinue(2026-07-06~)
|
|
34
34
|
// 利用可能なMovieTicketIF決済方法タイプに対して動的にコーディング
|
|
35
35
|
const movieTicketPaymentMethodTypes = findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentActions, eventReservationAcceptedOffers);
|
|
36
36
|
debug('processing validateMovieTicket... movieTicketPaymentMethodTypes:', movieTicketPaymentMethodTypes);
|
|
@@ -148,63 +148,63 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
151
|
+
// JPY以外の通貨決済はひとまず廃止(2026-07-06~)
|
|
152
|
+
// /**
|
|
153
|
+
// * JPY以外の通貨について取引を検証する
|
|
154
|
+
// */
|
|
155
|
+
// function validateMonetaryAmount(
|
|
156
|
+
// _authorizePaymentActions: IAuthorizePaymentAction[],
|
|
157
|
+
// authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'result'>[]
|
|
158
|
+
// ) {
|
|
159
|
+
// // PaymentCard決済を廃止したので、JPY以外の通貨に対しての承認はありえない(2026-04-18~)
|
|
160
|
+
// const authorizeMonetaryAmountActions: IAuthorizePaymentAction[] = [];
|
|
161
|
+
// const requiredMonetaryAmountByCurrencyType: {
|
|
162
|
+
// currency: string;
|
|
163
|
+
// value: number;
|
|
164
|
+
// }[] = [];
|
|
165
|
+
// authorizeEventServiceOfferActions.forEach(
|
|
166
|
+
// (a) => {
|
|
167
|
+
// const amount = a.result?.amount;
|
|
168
|
+
// if (Array.isArray(amount)) {
|
|
169
|
+
// amount.forEach((monetaryAmount) => {
|
|
170
|
+
// if (typeof monetaryAmount.value === 'number') {
|
|
171
|
+
// requiredMonetaryAmountByCurrencyType.push({ currency: monetaryAmount.currency, value: monetaryAmount.value });
|
|
172
|
+
// }
|
|
173
|
+
// });
|
|
174
|
+
// }
|
|
175
|
+
// },
|
|
176
|
+
// 0
|
|
177
|
+
// );
|
|
178
|
+
// const requiredCurrencyTypes = [...new Set(requiredMonetaryAmountByCurrencyType.map((m) => m.currency))];
|
|
179
|
+
// const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map(({ result }) => {
|
|
180
|
+
// const resultAsInvoice = (Array.isArray(result))
|
|
181
|
+
// ? result[0]
|
|
182
|
+
// : undefined;
|
|
183
|
+
// return resultAsInvoice?.totalPaymentDue?.currency as string;
|
|
184
|
+
// }
|
|
185
|
+
// ))];
|
|
186
|
+
// if (requiredCurrencyTypes.length !== authorizedCurrencyTypes.length) {
|
|
187
|
+
// throw new factory.errors.Argument('Transaction', 'MonetaryAmount account types not matched');
|
|
188
|
+
// }
|
|
189
|
+
// const requireMonetaryAmountSatisfied = requiredCurrencyTypes.every((currencyType) => {
|
|
190
|
+
// const requiredMonetaryAmount = requiredMonetaryAmountByCurrencyType
|
|
191
|
+
// .filter((m) => m.currency === currencyType)
|
|
192
|
+
// .reduce((a, b) => a + b.value, 0);
|
|
193
|
+
// let authorizedMonetaryAmount = 0;
|
|
194
|
+
// authorizeMonetaryAmountActions.forEach(({ result }) => {
|
|
195
|
+
// const resultAsInvoice = (Array.isArray(result))
|
|
196
|
+
// ? result[0]
|
|
197
|
+
// : undefined;
|
|
198
|
+
// if (resultAsInvoice?.totalPaymentDue?.currency === currencyType) {
|
|
199
|
+
// authorizedMonetaryAmount += resultAsInvoice.totalPaymentDue.value;
|
|
200
|
+
// }
|
|
201
|
+
// });
|
|
202
|
+
// return requiredMonetaryAmount === authorizedMonetaryAmount;
|
|
203
|
+
// });
|
|
204
|
+
// if (!requireMonetaryAmountSatisfied) {
|
|
205
|
+
// throw new factory.errors.Argument('Transaction', 'Required MonetaryAmount not satisfied');
|
|
206
|
+
// }
|
|
207
|
+
// }
|
|
208
208
|
/**
|
|
209
209
|
* 注文オファー数検証
|
|
210
210
|
*/
|
|
@@ -41,6 +41,11 @@ interface IConfirmOptions {
|
|
|
41
41
|
* 注文における最大CreditCardIF決済方法数
|
|
42
42
|
*/
|
|
43
43
|
maxNumCreditCardPaymentMethod: number;
|
|
44
|
+
/**
|
|
45
|
+
* 2026-07-06~
|
|
46
|
+
* 実験的に
|
|
47
|
+
*/
|
|
48
|
+
usePrepareUnitPriceOfferConditions?: boolean;
|
|
44
49
|
}
|
|
45
50
|
type IConfirmParams = PlaceOrderFactory.IConfirmParams;
|
|
46
51
|
interface IConfirmResult {
|
|
@@ -116,7 +116,8 @@ function confirm(params, options) {
|
|
|
116
116
|
}))
|
|
117
117
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
118
118
|
// 単価オファーの全適用条件を検証するために、単価オファーを参照(2026-07-06~)
|
|
119
|
-
|
|
119
|
+
const { usePrepareUnitPriceOfferConditions } = options;
|
|
120
|
+
if (usePrepareUnitPriceOfferConditions === true) {
|
|
120
121
|
await (0, prepareUnitPriceOfferConditions_1.prepareUnitPriceOfferConditions)({
|
|
121
122
|
project: { id: transaction.project.id, },
|
|
122
123
|
acceptedOffers,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "9.5.0-alpha.
|
|
14
|
+
"@chevre/factory": "9.5.0-alpha.3",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "25.2.0-alpha.
|
|
94
|
+
"version": "25.2.0-alpha.5"
|
|
95
95
|
}
|