@chevre/domain 25.2.0-alpha.14 → 25.2.0-alpha.15
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.d.ts +5 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +21 -11
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +9 -1
- package/package.json +1 -1
|
@@ -31,7 +31,11 @@ declare function acceptedOffers2authorizeResult(params: {
|
|
|
31
31
|
acceptedOffers4result: IResultAcceptedOffer[];
|
|
32
32
|
noOfferSpecified: boolean;
|
|
33
33
|
ticketOffers: factory.product.ITicketOffer[];
|
|
34
|
-
}
|
|
34
|
+
}, options: {
|
|
35
|
+
useLegacyAuthorizeOfferResult: boolean;
|
|
36
|
+
}): factory.action.authorize.offer.eventService.IResult & {
|
|
37
|
+
onlyPrice?: boolean;
|
|
38
|
+
};
|
|
35
39
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
36
40
|
export type IResultAcceptedOffer = Omit<factory.order.IOptimizedAcceptedOffer, 'priceSpecification'> & {
|
|
37
41
|
itemOffered: factory.order.IEventReservation;
|
|
@@ -172,7 +172,8 @@ function acceptedOffers2programMembershipUsed(params) {
|
|
|
172
172
|
});
|
|
173
173
|
return programMembershipUsed;
|
|
174
174
|
}
|
|
175
|
-
function acceptedOffers2authorizeResult(params) {
|
|
175
|
+
function acceptedOffers2authorizeResult(params, options) {
|
|
176
|
+
const { useLegacyAuthorizeOfferResult } = options;
|
|
176
177
|
const { acceptedOffers4result, noOfferSpecified, ticketOffers } = params;
|
|
177
178
|
// const priceCurrency = factory.priceCurrency.JPY; // fix(2024-07-03~)
|
|
178
179
|
let offers;
|
|
@@ -211,16 +212,25 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
211
212
|
};
|
|
212
213
|
});
|
|
213
214
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
215
|
+
if (useLegacyAuthorizeOfferResult) {
|
|
216
|
+
return {
|
|
217
|
+
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
218
|
+
// priceCurrency, // discontinue(2026-07-06~)
|
|
219
|
+
// amount: [], // discontinue(2026-07-06~)
|
|
220
|
+
itemOffered: {
|
|
221
|
+
serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
222
|
+
},
|
|
223
|
+
...(typeof price === 'number') ? { price } : undefined,
|
|
224
|
+
...(Array.isArray(offers)) ? { offers } : undefined
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return {
|
|
229
|
+
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
230
|
+
onlyPrice: true,
|
|
231
|
+
...(typeof price === 'number') ? { price } : undefined,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
224
234
|
}
|
|
225
235
|
function responseBody2acceptedOffers4result(params) {
|
|
226
236
|
let acceptedOffers4result = [];
|
|
@@ -78,7 +78,7 @@ function authorize(params, options) {
|
|
|
78
78
|
}
|
|
79
79
|
throw error;
|
|
80
80
|
}
|
|
81
|
-
const result = (0, factory_2.acceptedOffers2authorizeResult)({ acceptedOffers4result, noOfferSpecified, ticketOffers });
|
|
81
|
+
const result = (0, factory_2.acceptedOffers2authorizeResult)({ acceptedOffers4result, noOfferSpecified, ticketOffers }, options);
|
|
82
82
|
await repos.authorizeOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
83
83
|
return { id: action.id, result };
|
|
84
84
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { factory } from '../../../../../factory';
|
|
2
2
|
export type IAcceptPayAction = Pick<factory.action.accept.pay.IAction, 'object' | 'result' | 'endDate'>;
|
|
3
|
-
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction
|
|
3
|
+
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction & {
|
|
4
|
+
result?: factory.action.authorize.offer.eventService.IResult & {
|
|
5
|
+
onlyPrice?: boolean;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
4
8
|
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate'> & {
|
|
5
9
|
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf' | 'paymentMethodId'>;
|
|
6
10
|
instrument?: never;
|
|
@@ -305,7 +305,15 @@ function validateEventOffers(params) {
|
|
|
305
305
|
const everyActionsMatched = unitPriceOfferConditions.length === params.authorizeOfferActions.length
|
|
306
306
|
&& params.authorizeOfferActions.every((authorizeEventServiceOfferAction) => {
|
|
307
307
|
const conditionExpected = unitPriceOfferConditions.find(({ id }) => id === authorizeEventServiceOfferAction.id);
|
|
308
|
-
|
|
308
|
+
let resultMatched;
|
|
309
|
+
// 承認アクションのresultが最適化済の場合,price以外を比較しても意味がないので比較しない(2026-07-10~)
|
|
310
|
+
if (authorizeEventServiceOfferAction.result?.onlyPrice === true) {
|
|
311
|
+
resultMatched = typeof conditionExpected?.result?.price === 'number'
|
|
312
|
+
&& conditionExpected?.result.price === authorizeEventServiceOfferAction.result.price;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
resultMatched = (0, util_1.isDeepStrictEqual)(conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
316
|
+
}
|
|
309
317
|
debug('validateEventOffers: unitPriceOfferConditions: resultMatched?', resultMatched, params.project.id, authorizeEventServiceOfferAction.id);
|
|
310
318
|
if (!resultMatched) {
|
|
311
319
|
console.error('validateEventOffers: unitPriceOfferConditions not matched!', params.project.id, authorizeEventServiceOfferAction.id, conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
package/package.json
CHANGED