@chevre/domain 25.2.0-alpha.4 → 25.2.0-alpha.41
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/factory/customerTelephone2COATelNum.d.ts +3 -0
- package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
- package/lib/chevre/repo/action/acceptPay.js +47 -19
- package/lib/chevre/repo/action/actionProcess.js +57 -57
- package/lib/chevre/repo/action.d.ts +16 -9
- package/lib/chevre/repo/action.js +99 -180
- package/lib/chevre/repo/aggregateOffer.d.ts +2 -3
- package/lib/chevre/repo/creativeWork.d.ts +2 -3
- package/lib/chevre/repo/customerType.d.ts +2 -3
- package/lib/chevre/repo/event.d.ts +10 -11
- package/lib/chevre/repo/eventOffer.d.ts +4 -5
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
- package/lib/chevre/repo/eventSeries.d.ts +4 -5
- package/lib/chevre/repo/message.d.ts +1 -1
- package/lib/chevre/repo/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
- package/lib/chevre/repo/note.d.ts +3 -4
- package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +4 -0
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +40 -0
- package/lib/chevre/repo/offerCatalog.d.ts +2 -3
- package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
- package/lib/chevre/repo/order.d.ts +2 -0
- package/lib/chevre/repo/order.js +14 -14
- package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
- package/lib/chevre/repo/orderInTransaction.js +181 -3
- package/lib/chevre/repo/person.d.ts +0 -15
- package/lib/chevre/repo/person.js +122 -108
- package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
- package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
- package/lib/chevre/repo/place/seat.d.ts +4 -5
- package/lib/chevre/repo/place/section.d.ts +3 -4
- package/lib/chevre/repo/product.d.ts +3 -4
- package/lib/chevre/repo/rateLimit/offer.js +0 -12
- package/lib/chevre/repo/reservation.d.ts +2 -3
- package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
- package/lib/chevre/repo/stockHolder.d.ts +1 -1
- package/lib/chevre/repo/stockHolder.js +0 -146
- package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
- package/lib/chevre/repo/transaction/placeOrder.js +43 -83
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/repo/transactionNumberCounter.js +0 -34
- package/lib/chevre/repo/transactionProcess.js +0 -13
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/notification/factory.d.ts +2 -4
- package/lib/chevre/service/notification/factory.js +26 -24
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +11 -5
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +11 -3
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
- package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +17 -14
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +95 -33
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
- package/lib/chevre/service/order/placeOrder/factory.js +3 -21
- package/lib/chevre/service/order/placeOrder.d.ts +4 -5
- package/lib/chevre/service/order/placeOrder.js +20 -31
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
- package/lib/chevre/service/payment/any/authorize.js +13 -37
- package/lib/chevre/service/payment/any/factory.d.ts +7 -7
- package/lib/chevre/service/payment/any/factory.js +19 -22
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
- package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
- package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +17 -8
- package/lib/chevre/service/reserve/searchByOrder.js +2 -6
- package/lib/chevre/service/reserve.d.ts +2 -2
- package/lib/chevre/service/reserve.js +3 -3
- package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
- package/lib/chevre/service/task/aggregateOffers.js +2 -1
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
- package/lib/chevre/service/task/cancelReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
- package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
- package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
- package/lib/chevre/service/task/onEventChanged.js +2 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated.js +2 -1
- package/lib/chevre/service/task/placeOrder.d.ts +2 -2
- package/lib/chevre/service/task/placeOrder.js +6 -3
- package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
- package/lib/chevre/service/task/refund.d.ts +2 -2
- package/lib/chevre/service/task/refund.js +4 -10
- package/lib/chevre/service/task/reserve.d.ts +2 -2
- package/lib/chevre/service/task/reserve.js +2 -1
- package/lib/chevre/service/task/returnOrder.d.ts +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -1
- package/lib/chevre/service/task/sendOrder.d.ts +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -1
- package/lib/chevre/service/task/voidPayTransaction.js +3 -7
- package/lib/chevre/service/task/voidPayment.d.ts +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +36 -37
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +35 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +17 -13
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +11 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +112 -91
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +33 -78
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/taskSettings.d.ts +1 -3
- package/package.json +8 -11
- package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
- package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
- package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
- package/lib/chevre/service/reserve/findReservations.js +0 -61
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts
CHANGED
|
@@ -2,6 +2,39 @@ import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
|
|
|
2
2
|
import { factory } from '../../../../factory';
|
|
3
3
|
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction;
|
|
4
4
|
type IOrderAcceptedOffer = Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'offeredThrough' | 'serialNumber' | 'priceSpecification' | 'id'>;
|
|
5
|
+
interface IAcceptedOfferInResult extends Pick<factory.product.ITicketOffer, 'acceptedPaymentMethod' | 'id' | 'typeOf'> {
|
|
6
|
+
typeOf: factory.offerType.Offer;
|
|
7
|
+
id: string;
|
|
8
|
+
includesObject: {
|
|
9
|
+
amountOfThisGood: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 取引確定時の検証に必要な情報のみ保管する
|
|
13
|
+
*/
|
|
14
|
+
priceSpecification?: Pick<factory.priceSpecification.unitPrice.IPriceSpecification, 'eligibleQuantity'>;
|
|
15
|
+
}
|
|
16
|
+
export type IAggregateProgramMembershipUsed = (factory.assetTransaction.reserve.IPermitIssuedThroughFaceToFace | factory.assetTransaction.reserve.IPermitIssuedThroughMembershipService)[];
|
|
17
|
+
type IPreparedResult = Pick<factory.action.authorize.offer.eventService.IResult, 'price' | 'typeOf'> & {
|
|
18
|
+
/**
|
|
19
|
+
* オファーIDごとの集計
|
|
20
|
+
*/
|
|
21
|
+
offers?: IAcceptedOfferInResult[];
|
|
22
|
+
itemOffered?: {
|
|
23
|
+
serviceOutput: {
|
|
24
|
+
/**
|
|
25
|
+
* programMembershipUsed required(2024-08-15~)
|
|
26
|
+
*/
|
|
27
|
+
programMembershipUsed: IAggregateProgramMembershipUsed;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 注文ドキュメントと予約取引ドキュメントを参照することによって生成した、単価オファー検証条件
|
|
33
|
+
* 元々オファー承認アクションのresultに保管されていた
|
|
34
|
+
*/
|
|
35
|
+
type IPreparedUnitPriceOfferConditions = Pick<IAuthorizeEventServiceOffer, 'id'> & {
|
|
36
|
+
result?: IPreparedResult;
|
|
37
|
+
};
|
|
5
38
|
export declare function createAuthorizeOfferResultsExpected(params: {
|
|
6
39
|
authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
7
40
|
}): Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
@@ -13,5 +46,5 @@ declare function prepareUnitPriceOfferConditions(params: {
|
|
|
13
46
|
authorizeEventServiceOfferActions: IAuthorizeEventServiceOffer[];
|
|
14
47
|
}): (repos: {
|
|
15
48
|
offer: OfferRepo;
|
|
16
|
-
}) => Promise<
|
|
17
|
-
export { prepareUnitPriceOfferConditions };
|
|
49
|
+
}) => Promise<IPreparedUnitPriceOfferConditions[]>;
|
|
50
|
+
export { IPreparedUnitPriceOfferConditions, prepareUnitPriceOfferConditions };
|
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.createAuthorizeOfferResultsExpected = createAuthorizeOfferResultsExpected;
|
|
4
7
|
exports.prepareUnitPriceOfferConditions = prepareUnitPriceOfferConditions;
|
|
5
|
-
const
|
|
8
|
+
const debug_1 = __importDefault(require("debug"));
|
|
6
9
|
const factory_1 = require("../../../../factory");
|
|
10
|
+
const debug = (0, debug_1.default)('chevre-domain:service:transaction:placeOrder:confirm:prepareUnitPriceOfferConditions');
|
|
7
11
|
function acceptedOffers2authorizeResult(params) {
|
|
8
12
|
const { acceptedOffers4result, unitPriceOffers } = params;
|
|
9
13
|
const programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
|
|
@@ -32,7 +36,7 @@ function acceptedOffers2authorizeResult(params) {
|
|
|
32
36
|
};
|
|
33
37
|
});
|
|
34
38
|
return {
|
|
35
|
-
amount: [],
|
|
39
|
+
// amount: [], // discontinue(2026-07-06~)
|
|
36
40
|
itemOffered: {
|
|
37
41
|
serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
38
42
|
},
|
|
@@ -77,11 +81,20 @@ function createAuthorizeOfferResultsExpected(params) {
|
|
|
77
81
|
}
|
|
78
82
|
function prepareUnitPriceOfferConditions(params) {
|
|
79
83
|
return async (repos) => {
|
|
84
|
+
// COAの場合は単価オファーを参照せずにそのまま返す
|
|
85
|
+
const isCOA = params.authorizeEventServiceOfferActions.some((action) => action.instrument.typeOf === factory_1.factory.assetTransactionType.COAReserveTransaction);
|
|
86
|
+
if (isCOA) {
|
|
87
|
+
return params.authorizeEventServiceOfferActions.map(({ id, result }) => ({ id, result }));
|
|
88
|
+
}
|
|
80
89
|
const conditions = [];
|
|
81
90
|
const offerIds = [...new Set(params.acceptedOffers.map((o) => String(o.id)))];
|
|
82
|
-
const unitPriceOffers = await repos.offer.
|
|
91
|
+
const unitPriceOffers = await repos.offer.findUnitPriceOffers({
|
|
83
92
|
id: { $in: offerIds }
|
|
93
|
+
}, {
|
|
94
|
+
acceptedPaymentMethod: 1,
|
|
95
|
+
priceSpecification: 1,
|
|
84
96
|
});
|
|
97
|
+
debug('unitPriceOffers:', unitPriceOffers);
|
|
85
98
|
for (const authorizeEventServiceOfferAction of params.authorizeEventServiceOfferActions) {
|
|
86
99
|
if (authorizeEventServiceOfferAction.result === undefined) {
|
|
87
100
|
throw new Error('authorizeEventServiceOfferAction.result should exist');
|
|
@@ -93,7 +106,7 @@ function prepareUnitPriceOfferConditions(params) {
|
|
|
93
106
|
id: authorizeEventServiceOfferAction.id,
|
|
94
107
|
result: {
|
|
95
108
|
typeOf: authorizeEventServiceOfferAction.result.typeOf,
|
|
96
|
-
priceCurrency: authorizeEventServiceOfferAction.result.priceCurrency,
|
|
109
|
+
// priceCurrency: authorizeEventServiceOfferAction.result.priceCurrency,
|
|
97
110
|
price: authorizeEventServiceOfferAction.result.price,
|
|
98
111
|
...acceptedOffers2authorizeResult({
|
|
99
112
|
acceptedOffers4result: acceptedOffers4action,
|
|
@@ -102,15 +115,6 @@ function prepareUnitPriceOfferConditions(params) {
|
|
|
102
115
|
}
|
|
103
116
|
});
|
|
104
117
|
}
|
|
105
|
-
// 承認アクションと比較する
|
|
106
|
-
for (const authorizeEventServiceOfferAction of params.authorizeEventServiceOfferActions) {
|
|
107
|
-
const conditionExpected = conditions.find(({ id }) => id === authorizeEventServiceOfferAction.id);
|
|
108
|
-
const resultMatched = (0, util_1.isDeepStrictEqual)(conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
109
|
-
console.log('resultMatched?', resultMatched, authorizeEventServiceOfferAction.id, authorizeEventServiceOfferAction.instrument.transactionNumber);
|
|
110
|
-
if (!resultMatched) {
|
|
111
|
-
console.log(conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
118
|
return conditions;
|
|
115
119
|
};
|
|
116
120
|
}
|
|
@@ -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;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import { PlaceOrderFactory } from '../../../../factory/transaction';
|
|
3
|
+
import { IPreparedUnitPriceOfferConditions } from './prepareUnitPriceOfferConditions';
|
|
3
4
|
import { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction, IPayTransaction } from './validation/factory';
|
|
4
5
|
export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction, IPayTransaction };
|
|
5
6
|
/**
|
|
6
7
|
* 取引が確定可能な状態かどうかをチェックする
|
|
7
8
|
*/
|
|
8
|
-
export declare function validateTransaction(transaction:
|
|
9
|
+
export declare function validateTransaction(transaction: {
|
|
10
|
+
id: string;
|
|
11
|
+
}, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'priceSpecification'>[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer, options: {
|
|
12
|
+
paymentMethodIdByTransaction?: string;
|
|
13
|
+
}): void;
|
|
9
14
|
/**
|
|
10
15
|
* 注文オファー数検証
|
|
11
16
|
*/
|
|
@@ -35,6 +40,9 @@ export declare function validatePaymentMethods(params: {
|
|
|
35
40
|
* 興行オファー適用条件確認
|
|
36
41
|
*/
|
|
37
42
|
export declare function validateEventOffers(params: {
|
|
43
|
+
project: {
|
|
44
|
+
id: string;
|
|
45
|
+
};
|
|
38
46
|
order: {
|
|
39
47
|
price: number;
|
|
40
48
|
};
|
|
@@ -42,5 +50,6 @@ export declare function validateEventOffers(params: {
|
|
|
42
50
|
/**
|
|
43
51
|
* 承認アクションのresultに条件が保管されているはず(2026-07-06時点で)
|
|
44
52
|
*/
|
|
45
|
-
|
|
53
|
+
authorizeOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
54
|
+
unitPriceOfferConditions: IPreparedUnitPriceOfferConditions[];
|
|
46
55
|
}): void;
|
|
@@ -17,23 +17,20 @@ const factory_1 = require("../../../../factory");
|
|
|
17
17
|
const validateInvoiceReferencesOrder_1 = require("./validation/validateInvoiceReferencesOrder");
|
|
18
18
|
const validateMovieTicket_1 = require("./validation/validateMovieTicket");
|
|
19
19
|
const validatePrice_1 = require("./validation/validatePrice");
|
|
20
|
-
const debug = (0, debug_1.default)('chevre-domain:service:transaction');
|
|
20
|
+
const debug = (0, debug_1.default)('chevre-domain:service:transaction:placeOrder:confirm:validation');
|
|
21
21
|
/**
|
|
22
22
|
* 取引が確定可能な状態かどうかをチェックする
|
|
23
23
|
*/
|
|
24
|
-
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
25
|
-
|
|
26
|
-
eventReservationAcceptedOffers, payTransactions, customer) {
|
|
27
|
-
// validateProfile(transaction);
|
|
24
|
+
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions, eventReservationAcceptedOffers, payTransactions, customer, options) {
|
|
25
|
+
const { paymentMethodIdByTransaction } = options;
|
|
28
26
|
validateProfile({ customer });
|
|
29
27
|
(0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
30
28
|
// 請求のreferencesOrder検証(2025-11-23~)
|
|
31
29
|
(0, validateInvoiceReferencesOrder_1.validateInvoiceReferencesOrder)(authorizePaymentActions, eventReservationAcceptedOffers);
|
|
32
|
-
// 利用可能な通貨単位に対して取引検証
|
|
33
|
-
validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
30
|
+
// // 利用可能な通貨単位に対して取引検証
|
|
31
|
+
// validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions); // discontinue(2026-07-06~)
|
|
34
32
|
// 利用可能なMovieTicketIF決済方法タイプに対して動的にコーディング
|
|
35
33
|
const movieTicketPaymentMethodTypes = findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentActions, eventReservationAcceptedOffers);
|
|
36
|
-
debug('processing validateMovieTicket... movieTicketPaymentMethodTypes:', movieTicketPaymentMethodTypes);
|
|
37
34
|
if (Array.isArray(movieTicketPaymentMethodTypes) && movieTicketPaymentMethodTypes.length > 0) {
|
|
38
35
|
movieTicketPaymentMethodTypes.forEach((paymentMethodType) => {
|
|
39
36
|
const authorizeMovieTicketActions = authorizePaymentActions.filter((a) => {
|
|
@@ -59,13 +56,12 @@ eventReservationAcceptedOffers, payTransactions, customer) {
|
|
|
59
56
|
authorizedMovieTickets.push(...object.paymentMethod.movieTickets);
|
|
60
57
|
}
|
|
61
58
|
});
|
|
62
|
-
debug(authorizedMovieTickets.length, 'movie tickets authorized', 'transaction:', transaction.id);
|
|
63
59
|
// validateMovieTicket(paymentMethodType, { id: transaction.id }, authorizePaymentActions, eventReservationAcceptedOffers);
|
|
64
60
|
(0, validateMovieTicket_1.validateMovieTicket)(paymentMethodType, { id: transaction.id }, authorizedMovieTickets, eventReservationAcceptedOffers);
|
|
65
61
|
});
|
|
66
62
|
}
|
|
67
63
|
// 決済URLが発行されている場合、検証
|
|
68
|
-
validatePaymentUrl(
|
|
64
|
+
validatePaymentUrl({ paymentMethodIdByTransaction, acceptPayActions, authorizePaymentActions });
|
|
69
65
|
}
|
|
70
66
|
function findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentActions, eventReservationAcceptedOffers) {
|
|
71
67
|
const paymentMethodTypes = [];
|
|
@@ -95,18 +91,6 @@ function findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentAction
|
|
|
95
91
|
// ];
|
|
96
92
|
return [...new Set(paymentMethodTypes)];
|
|
97
93
|
}
|
|
98
|
-
// function validateProfile(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'object'>) {
|
|
99
|
-
// // object.customerで検証(2022-05-26~)
|
|
100
|
-
// const profile = transaction.object.customer;
|
|
101
|
-
// const profileSatisfied = typeof profile?.typeOf === 'string' && profile.typeOf.length > 0
|
|
102
|
-
// && typeof profile.email === 'string' && profile.email.length > 0
|
|
103
|
-
// && typeof profile.familyName === 'string' && profile.familyName.length > 0
|
|
104
|
-
// && typeof profile.givenName === 'string' && profile.givenName.length > 0
|
|
105
|
-
// && typeof profile.telephone === 'string' && profile.telephone.length > 0;
|
|
106
|
-
// if (!profileSatisfied) {
|
|
107
|
-
// throw new factory.errors.Argument('Transaction', 'Customer Profile Required');
|
|
108
|
-
// }
|
|
109
|
-
// }
|
|
110
94
|
function validateProfile(params) {
|
|
111
95
|
const profile = params.customer;
|
|
112
96
|
const profileSatisfied = typeof profile?.typeOf === 'string' && profile.typeOf.length > 0
|
|
@@ -122,16 +106,19 @@ function validateProfile(params) {
|
|
|
122
106
|
throw new factory_1.factory.errors.Argument('Transaction', 'customer name required');
|
|
123
107
|
}
|
|
124
108
|
}
|
|
125
|
-
function validatePaymentUrl(
|
|
109
|
+
function validatePaymentUrl(params) {
|
|
110
|
+
const { paymentMethodIdByTransaction, acceptPayActions, authorizePaymentActions } = params;
|
|
126
111
|
// 決済URLが発行されている場合、検証
|
|
127
|
-
const paymentMethodId =
|
|
112
|
+
const paymentMethodId = paymentMethodIdByTransaction;
|
|
113
|
+
debug('validatePaymentUrl: paymentMethodIdByTransaction:', paymentMethodIdByTransaction);
|
|
128
114
|
if (typeof paymentMethodId === 'string' && paymentMethodId.length > 0) {
|
|
129
115
|
// check existing accept action(2025-02-26~)
|
|
130
116
|
const acceptActionExists = acceptPayActions.some(({ object, result }) => {
|
|
131
117
|
return object.transactionNumber === paymentMethodId
|
|
132
|
-
&& result?.paymentMethodId === paymentMethodId
|
|
133
|
-
|
|
118
|
+
&& result?.paymentMethodId === paymentMethodId;
|
|
119
|
+
// && typeof result?.paymentUrl === 'string'; // result.paymentUrlは廃止(2026-07-14~)
|
|
134
120
|
});
|
|
121
|
+
debug('validatePaymentUrl: acceptActionExists:', acceptActionExists);
|
|
135
122
|
if (!acceptActionExists) {
|
|
136
123
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.actionType.AcceptAction);
|
|
137
124
|
}
|
|
@@ -143,68 +130,69 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
|
|
|
143
130
|
: undefined;
|
|
144
131
|
return resultAsInvoice?.paymentMethodId === paymentMethodId;
|
|
145
132
|
});
|
|
133
|
+
debug('validatePaymentUrl: authorizePaymentAction4paymentUrlExists:', authorizePaymentAction4paymentUrlExists);
|
|
146
134
|
if (!authorizePaymentAction4paymentUrlExists) {
|
|
147
135
|
throw new factory_1.factory.errors.Argument('Transaction', 'Payment for published payment URL required');
|
|
148
136
|
}
|
|
149
137
|
}
|
|
150
138
|
}
|
|
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
|
-
}
|
|
139
|
+
// JPY以外の通貨決済はひとまず廃止(2026-07-06~)
|
|
140
|
+
// /**
|
|
141
|
+
// * JPY以外の通貨について取引を検証する
|
|
142
|
+
// */
|
|
143
|
+
// function validateMonetaryAmount(
|
|
144
|
+
// _authorizePaymentActions: IAuthorizePaymentAction[],
|
|
145
|
+
// authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'result'>[]
|
|
146
|
+
// ) {
|
|
147
|
+
// // PaymentCard決済を廃止したので、JPY以外の通貨に対しての承認はありえない(2026-04-18~)
|
|
148
|
+
// const authorizeMonetaryAmountActions: IAuthorizePaymentAction[] = [];
|
|
149
|
+
// const requiredMonetaryAmountByCurrencyType: {
|
|
150
|
+
// currency: string;
|
|
151
|
+
// value: number;
|
|
152
|
+
// }[] = [];
|
|
153
|
+
// authorizeEventServiceOfferActions.forEach(
|
|
154
|
+
// (a) => {
|
|
155
|
+
// const amount = a.result?.amount;
|
|
156
|
+
// if (Array.isArray(amount)) {
|
|
157
|
+
// amount.forEach((monetaryAmount) => {
|
|
158
|
+
// if (typeof monetaryAmount.value === 'number') {
|
|
159
|
+
// requiredMonetaryAmountByCurrencyType.push({ currency: monetaryAmount.currency, value: monetaryAmount.value });
|
|
160
|
+
// }
|
|
161
|
+
// });
|
|
162
|
+
// }
|
|
163
|
+
// },
|
|
164
|
+
// 0
|
|
165
|
+
// );
|
|
166
|
+
// const requiredCurrencyTypes = [...new Set(requiredMonetaryAmountByCurrencyType.map((m) => m.currency))];
|
|
167
|
+
// const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map(({ result }) => {
|
|
168
|
+
// const resultAsInvoice = (Array.isArray(result))
|
|
169
|
+
// ? result[0]
|
|
170
|
+
// : undefined;
|
|
171
|
+
// return resultAsInvoice?.totalPaymentDue?.currency as string;
|
|
172
|
+
// }
|
|
173
|
+
// ))];
|
|
174
|
+
// if (requiredCurrencyTypes.length !== authorizedCurrencyTypes.length) {
|
|
175
|
+
// throw new factory.errors.Argument('Transaction', 'MonetaryAmount account types not matched');
|
|
176
|
+
// }
|
|
177
|
+
// const requireMonetaryAmountSatisfied = requiredCurrencyTypes.every((currencyType) => {
|
|
178
|
+
// const requiredMonetaryAmount = requiredMonetaryAmountByCurrencyType
|
|
179
|
+
// .filter((m) => m.currency === currencyType)
|
|
180
|
+
// .reduce((a, b) => a + b.value, 0);
|
|
181
|
+
// let authorizedMonetaryAmount = 0;
|
|
182
|
+
// authorizeMonetaryAmountActions.forEach(({ result }) => {
|
|
183
|
+
// const resultAsInvoice = (Array.isArray(result))
|
|
184
|
+
// ? result[0]
|
|
185
|
+
// : undefined;
|
|
186
|
+
// if (resultAsInvoice?.totalPaymentDue?.currency === currencyType) {
|
|
187
|
+
// authorizedMonetaryAmount += resultAsInvoice.totalPaymentDue.value;
|
|
188
|
+
// }
|
|
189
|
+
// });
|
|
190
|
+
// return requiredMonetaryAmount === authorizedMonetaryAmount;
|
|
191
|
+
// });
|
|
192
|
+
// if (!requireMonetaryAmountSatisfied) {
|
|
193
|
+
// throw new factory.errors.Argument('Transaction', 'Required MonetaryAmount not satisfied');
|
|
194
|
+
// }
|
|
195
|
+
// }
|
|
208
196
|
/**
|
|
209
197
|
* 注文オファー数検証
|
|
210
198
|
*/
|
|
@@ -257,7 +245,6 @@ function validateAcceptedOffers(params) {
|
|
|
257
245
|
});
|
|
258
246
|
if (ticketIdentifiers.length > 0) {
|
|
259
247
|
ticketIdentifiers = [...new Set(ticketIdentifiers)];
|
|
260
|
-
debug('ticketIdentifiers unique?', ticketIdentifiers.join(' '), 'numAcceptedOffers:', numAcceptedOffers);
|
|
261
248
|
// チケット識別子が注文内ユニークなので、注文オファー数に一致するはず
|
|
262
249
|
if (ticketIdentifiers.length !== numAcceptedOffers) {
|
|
263
250
|
throw new factory_1.factory.errors.Argument('Transaction', 'ticketIdentifiers must be unique');
|
|
@@ -274,7 +261,6 @@ function validateAcceptedOffers(params) {
|
|
|
274
261
|
});
|
|
275
262
|
if (ticketNumbers.length > 0) {
|
|
276
263
|
ticketNumbers = [...new Set(ticketNumbers)];
|
|
277
|
-
debug('ticketNumbers unique?', ticketNumbers.join(' '), 'numAcceptedOffers:', numAcceptedOffers);
|
|
278
264
|
// チケット識別子が注文内ユニークなので、注文オファー数に一致するはず
|
|
279
265
|
if (ticketNumbers.length !== numAcceptedOffers) {
|
|
280
266
|
throw new factory_1.factory.errors.Argument('Transaction', 'ticketNumbers must be unique');
|
|
@@ -313,6 +299,44 @@ function validatePaymentMethods(params, options) {
|
|
|
313
299
|
* 興行オファー適用条件確認
|
|
314
300
|
*/
|
|
315
301
|
function validateEventOffers(params) {
|
|
302
|
+
const { unitPriceOfferConditions } = params;
|
|
303
|
+
/**
|
|
304
|
+
* 以下処理で検証に使用するアクション結果リスト
|
|
305
|
+
*/
|
|
306
|
+
let validatingAuthorizeOfferActions;
|
|
307
|
+
// 承認アクションと比較する
|
|
308
|
+
if (Array.isArray(unitPriceOfferConditions)) {
|
|
309
|
+
const everyActionsMatched = unitPriceOfferConditions.length === params.authorizeOfferActions.length
|
|
310
|
+
&& params.authorizeOfferActions.every((authorizeEventServiceOfferAction) => {
|
|
311
|
+
const conditionExpected = unitPriceOfferConditions.find(({ id }) => id === authorizeEventServiceOfferAction.id);
|
|
312
|
+
let resultMatched;
|
|
313
|
+
// 承認アクションのresultが最適化済の場合,price以外を比較しても意味がないので比較しない(2026-07-10~)
|
|
314
|
+
if (authorizeEventServiceOfferAction.result?.onlyPrice === true) {
|
|
315
|
+
resultMatched = typeof conditionExpected?.result?.price === 'number'
|
|
316
|
+
&& conditionExpected?.result.price === authorizeEventServiceOfferAction.result.price;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
resultMatched = (0, util_1.isDeepStrictEqual)(conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
320
|
+
}
|
|
321
|
+
debug('validateEventOffers: unitPriceOfferConditions: resultMatched?', resultMatched, params.project.id, authorizeEventServiceOfferAction.id);
|
|
322
|
+
if (!resultMatched) {
|
|
323
|
+
console.error('validateEventOffers: unitPriceOfferConditions not matched!', params.project.id, authorizeEventServiceOfferAction.id, conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
324
|
+
}
|
|
325
|
+
return resultMatched;
|
|
326
|
+
});
|
|
327
|
+
// 全アクションについて結果が一致していればunitPriceOfferConditionsを採用する(2026-07-07~)
|
|
328
|
+
if (everyActionsMatched) {
|
|
329
|
+
validatingAuthorizeOfferActions = [...unitPriceOfferConditions];
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
validatingAuthorizeOfferActions = [...params.authorizeOfferActions];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
// unitPriceOfferConditionsの準備は必須化(2026-07-13~)
|
|
337
|
+
throw new factory_1.factory.errors.NotImplemented('unitPriceOfferConditions must be an array');
|
|
338
|
+
// validatingAuthorizeOfferActions = [...params.authorizeOfferActions];
|
|
339
|
+
}
|
|
316
340
|
const { paymentMethods } = params;
|
|
317
341
|
const firstCreditCardPaymentMethodIdentifier = paymentMethods.find((referenceInvoice) => {
|
|
318
342
|
return referenceInvoice.issuedThrough.typeOf === factory_1.factory.service.paymentService.PaymentServiceType.CreditCard
|
|
@@ -322,7 +346,7 @@ function validateEventOffers(params) {
|
|
|
322
346
|
return referenceInvoice.issuedThrough.typeOf === factory_1.factory.service.paymentService.PaymentServiceType.CreditCard
|
|
323
347
|
|| referenceInvoice.issuedThrough.typeOf === factory_1.factory.service.paymentService.PaymentServiceType.FaceToFace;
|
|
324
348
|
}).length;
|
|
325
|
-
|
|
349
|
+
validatingAuthorizeOfferActions.forEach((a) => {
|
|
326
350
|
// support result.offers(2024-06-18~)
|
|
327
351
|
const acceptedOffersInResult = a.result?.offers;
|
|
328
352
|
if (Array.isArray(acceptedOffersInResult) && acceptedOffersInResult.length > 0) {
|
|
@@ -348,20 +372,18 @@ function validateEventOffers(params) {
|
|
|
348
372
|
// }
|
|
349
373
|
// 適用数量検証(全興行オファー承認アクションについて)(2023-11-15~)
|
|
350
374
|
// 適用数量要件を満たしていなければエラー
|
|
351
|
-
const numAcceptedOffersByOfferId =
|
|
375
|
+
const numAcceptedOffersByOfferId = validatingAuthorizeOfferActions.reduce((previousNumOffer, { result }) => {
|
|
352
376
|
const numOfferOnCurrentAction = result?.offers?.find(({ id }) => id === offerId)?.includesObject.amountOfThisGood;
|
|
353
377
|
return previousNumOffer + ((typeof numOfferOnCurrentAction === 'number') ? numOfferOnCurrentAction : 0);
|
|
354
378
|
}, 0);
|
|
355
379
|
const eligibleQuantityMaxValue = unitPriceSpec?.eligibleQuantity?.maxValue;
|
|
356
380
|
if (typeof eligibleQuantityMaxValue === 'number') {
|
|
357
|
-
debug('validateEventOffers: numAcceptedOffersByOfferId > eligibleQuantityMaxValue?', numAcceptedOffersByOfferId, eligibleQuantityMaxValue);
|
|
358
381
|
if (numAcceptedOffersByOfferId > eligibleQuantityMaxValue) {
|
|
359
382
|
throw new factory_1.factory.errors.Argument('Transaction', `Number of offer:${offerId} must be less than or equal to ${eligibleQuantityMaxValue}`);
|
|
360
383
|
}
|
|
361
384
|
}
|
|
362
385
|
const eligibleQuantityMinValue = unitPriceSpec?.eligibleQuantity?.minValue;
|
|
363
386
|
if (typeof eligibleQuantityMinValue === 'number') {
|
|
364
|
-
debug('validateEventOffers: numAcceptedOffersByOfferId < eligibleQuantityMinValue?', numAcceptedOffersByOfferId, eligibleQuantityMinValue);
|
|
365
387
|
if (numAcceptedOffersByOfferId < eligibleQuantityMinValue) {
|
|
366
388
|
throw new factory_1.factory.errors.Argument('Transaction', `Number of offer:${offerId} must be more than or equal to ${eligibleQuantityMinValue}`);
|
|
367
389
|
}
|
|
@@ -372,7 +394,6 @@ function validateEventOffers(params) {
|
|
|
372
394
|
const satisfyAcceptedPaymentMethod = numCreditCardOrFaceToFacePaymentMethod === 1
|
|
373
395
|
&& typeof firstCreditCardPaymentMethodIdentifier === 'string'
|
|
374
396
|
&& acceptedPaymentMethodTypes.includes(firstCreditCardPaymentMethodIdentifier);
|
|
375
|
-
debug('validateEventOffers: satisfyAcceptedPaymentMethod?', JSON.stringify(acceptedPaymentMethodTypes));
|
|
376
397
|
if (!satisfyAcceptedPaymentMethod) {
|
|
377
398
|
throw new factory_1.factory.errors.Argument('Transaction', `acceptedPaymentMethod requirement not satisfied`);
|
|
378
399
|
}
|
|
@@ -381,7 +402,7 @@ function validateEventOffers(params) {
|
|
|
381
402
|
}
|
|
382
403
|
});
|
|
383
404
|
// check programMembershipUsed(2024-08-15~)
|
|
384
|
-
const programMembershipRequired =
|
|
405
|
+
const programMembershipRequired = validatingAuthorizeOfferActions.reduce((a, b) => {
|
|
385
406
|
const programMembershipUsedfromResult = b.result?.itemOffered?.serviceOutput.programMembershipUsed;
|
|
386
407
|
if (Array.isArray(programMembershipUsedfromResult)) {
|
|
387
408
|
a.push(...programMembershipUsedfromResult);
|
|
@@ -13,6 +13,7 @@ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
|
13
13
|
import { factory } from '../../../factory';
|
|
14
14
|
import { PlaceOrderFactory } from '../../../factory/transaction';
|
|
15
15
|
import { IOrderAsResult } from './confirm/factory/result';
|
|
16
|
+
import { IPotentialActionsParams } from './confirm/potentialActions';
|
|
16
17
|
interface IConfirmOperationRepos {
|
|
17
18
|
acceptPayAction: AcceptPayActionRepo;
|
|
18
19
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
@@ -41,13 +42,13 @@ interface IConfirmOptions {
|
|
|
41
42
|
* 注文における最大CreditCardIF決済方法数
|
|
42
43
|
*/
|
|
43
44
|
maxNumCreditCardPaymentMethod: number;
|
|
45
|
+
}
|
|
46
|
+
type IConfirmParams = PlaceOrderFactory.IConfirmParams & {
|
|
44
47
|
/**
|
|
45
|
-
*
|
|
46
|
-
* 実験的に
|
|
48
|
+
* 取引確定後アクション
|
|
47
49
|
*/
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
type IConfirmParams = PlaceOrderFactory.IConfirmParams;
|
|
50
|
+
potentialActions?: IPotentialActionsParams;
|
|
51
|
+
};
|
|
51
52
|
interface IConfirmResult {
|
|
52
53
|
order: Pick<IOrderAsResult, 'confirmationNumber' | 'orderNumber'>;
|
|
53
54
|
customer: factory.order.ICustomer;
|