@chevre/domain 25.2.0-alpha.9 → 26.0.0-alpha.0
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/eventEmitter/task.d.ts +2 -1
- 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.d.ts +16 -9
- package/lib/chevre/repo/action.js +99 -180
- package/lib/chevre/repo/adminTask.d.ts +37 -0
- package/lib/chevre/repo/adminTask.js +163 -0
- package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
- package/lib/chevre/repo/aggregateOffer.js +16 -125
- package/lib/chevre/repo/aggregateTask.d.ts +37 -0
- package/lib/chevre/repo/aggregateTask.js +136 -0
- package/lib/chevre/repo/asyncAction.d.ts +69 -0
- package/lib/chevre/repo/asyncAction.js +237 -0
- package/lib/chevre/repo/concurrentLock.d.ts +3 -1
- package/lib/chevre/repo/creativeWork.d.ts +2 -3
- package/lib/chevre/repo/credentials.d.ts +2 -1
- 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/asyncAction.d.ts +13 -0
- package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
- 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/scheduledTasks.d.ts +16 -0
- package/lib/chevre/repo/mongoose/schemas/scheduledTasks.js +103 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +6 -1
- 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/offerInCatalogReadOnly.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
- 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/passport.d.ts +2 -1
- 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/priceSpecification.d.ts +4 -4
- package/lib/chevre/repo/product.d.ts +3 -4
- package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
- package/lib/chevre/repo/rateLimit/offer.js +0 -12
- package/lib/chevre/repo/reservation.d.ts +2 -3
- package/lib/chevre/repo/scheduledTask.d.ts +90 -0
- package/lib/chevre/repo/scheduledTask.js +223 -0
- 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/task.d.ts +30 -71
- package/lib/chevre/repo/task.js +59 -345
- 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.d.ts +2 -1
- package/lib/chevre/repo/transactionProcess.js +0 -13
- package/lib/chevre/repository.d.ts +20 -0
- package/lib/chevre/repository.js +46 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/system.d.ts +2 -2
- package/lib/chevre/service/aggregation/system.js +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +1 -1
- 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/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +1 -1
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -67
- package/lib/chevre/service/asyncAction.d.ts +16 -0
- package/lib/chevre/service/asyncAction.js +36 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
- package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
- package/lib/chevre/service/asyncActionHandler.js +89 -0
- 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 +12 -6
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +12 -4
- 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/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
- 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 +15 -12
- 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/findAcceptAction.d.ts +4 -0
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +20 -9
- package/lib/chevre/service/offer/onEventChanged.js +2 -2
- package/lib/chevre/service/order/confirmPayTransaction.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/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +3 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +0 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +73 -44
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +53 -33
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +6 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +3 -7
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- 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 +7 -5
- package/lib/chevre/service/payment/any/factory.d.ts +7 -7
- package/lib/chevre/service/payment/any/factory.js +18 -21
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +7 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +34 -15
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +4 -0
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +20 -9
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +4 -0
- package/lib/chevre/service/payment/any/findCheckAction.js +20 -9
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +5 -67
- package/lib/chevre/service/payment/any/onPayActionCompleted.js +1 -1
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.js +1 -1
- 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/onPendingReservationCanceled.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +20 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +1 -1
- 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/scheduledTask.d.ts +11 -0
- package/lib/chevre/service/scheduledTask.js +40 -0
- package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.d.ts +14 -0
- package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +56 -0
- package/lib/chevre/service/scheduledTaskHandler.d.ts +12 -0
- package/lib/chevre/service/scheduledTaskHandler.js +66 -0
- 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 +3 -8
- 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 +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated.js +10 -9
- 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/returnPayTransaction.js +1 -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/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +1 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -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.d.ts +1 -1
- 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 +32 -4
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +10 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +6 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +23 -9
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +30 -40
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- 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/service/transaction/returnOrder.js +1 -1
- package/lib/chevre/service.d.ts +8 -0
- package/lib/chevre/service.js +23 -1
- package/lib/chevre/taskSettings.d.ts +3 -4
- 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/potentialActions/sendEmailMessage.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { factory } from '../../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../../repo/setting';
|
|
3
3
|
import type { IOrderAsResult } from '../factory/result';
|
|
4
|
+
/**
|
|
5
|
+
* Eメール送信パラメータ
|
|
6
|
+
*/
|
|
7
|
+
interface ISendEmailMessageParams {
|
|
8
|
+
/**
|
|
9
|
+
* Eメールカスタマイズ
|
|
10
|
+
* メール本文をカスタマイズしたい場合、PUGテンプレートを指定
|
|
11
|
+
* 挿入変数として`order`を使用できます
|
|
12
|
+
* {@link https://pugjs.org/api/getting-started.html}
|
|
13
|
+
*/
|
|
14
|
+
object?: factory.creativeWork.message.email.ICustomization;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 取引確定後アクションパラメータ
|
|
18
|
+
*/
|
|
19
|
+
export interface IPotentialActionsParams {
|
|
20
|
+
order?: {
|
|
21
|
+
potentialActions?: {
|
|
22
|
+
sendOrder?: {
|
|
23
|
+
potentialActions?: {
|
|
24
|
+
sendEmailMessage?: ISendEmailMessageParams[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
4
30
|
export declare function createSendEmailMessageActions(params: {
|
|
5
31
|
order: IOrderAsResult & {
|
|
6
32
|
confirmationNumber: string;
|
|
@@ -12,8 +38,8 @@ export declare function createSendEmailMessageActions(params: {
|
|
|
12
38
|
customer: factory.order.ICustomer;
|
|
13
39
|
seller: Pick<factory.order.ISeller, 'name' | 'typeOf'>;
|
|
14
40
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
15
|
-
potentialActions?:
|
|
41
|
+
potentialActions?: IPotentialActionsParams;
|
|
16
42
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
17
43
|
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
18
|
-
sendEmailMessageActions: factory.transaction.placeOrder.IPotentialSendEmailMessageAction[];
|
|
19
44
|
}>;
|
|
45
|
+
export {};
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSendEmailMessageActions = createSendEmailMessageActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../../emailMessageBuilder");
|
|
5
|
-
const factory_1 = require("../../../../../factory");
|
|
6
5
|
async function createSendEmailMessageActions(params, setting) {
|
|
7
6
|
// 注文配送メール送信設定
|
|
8
7
|
const emailMessages = [];
|
|
9
|
-
const sendEmailMessageActions = [];
|
|
8
|
+
// const sendEmailMessageActions: factory.transaction.placeOrder.IPotentialSendEmailMessageAction[] = [];
|
|
10
9
|
const sendEmailMessageOnOrderSentParams = params.potentialActions?.order?.potentialActions?.sendOrder?.potentialActions?.sendEmailMessage;
|
|
11
10
|
if (Array.isArray(sendEmailMessageOnOrderSentParams)) {
|
|
12
11
|
// pugテンプレートに渡す変数を最小化(2026-06-19~)
|
|
@@ -27,16 +26,16 @@ async function createSendEmailMessageActions(params, setting) {
|
|
|
27
26
|
// ...(params.emailMessage !== undefined) ? { emailMessage: params.emailMessage } : undefined
|
|
28
27
|
}, setting);
|
|
29
28
|
emailMessages.push(emailMessage);
|
|
30
|
-
// 送信アクション最適化に対応(2024-04-29~)
|
|
31
|
-
const sendEmailMessageActionObject = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
// optimize(2024-05-07~)
|
|
36
|
-
sendEmailMessageActions.push({
|
|
37
|
-
|
|
38
|
-
});
|
|
29
|
+
// // 送信アクション最適化に対応(2024-04-29~)
|
|
30
|
+
// const sendEmailMessageActionObject: factory.action.transfer.send.message.email.IObject = {
|
|
31
|
+
// identifier: emailMessage.identifier,
|
|
32
|
+
// typeOf: factory.creativeWorkType.EmailMessage
|
|
33
|
+
// };
|
|
34
|
+
// // optimize(2024-05-07~)
|
|
35
|
+
// sendEmailMessageActions.push({
|
|
36
|
+
// object: sendEmailMessageActionObject
|
|
37
|
+
// });
|
|
39
38
|
}));
|
|
40
39
|
}
|
|
41
|
-
return {
|
|
40
|
+
return { emailMessages };
|
|
42
41
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
|
+
import { IPotentialActionsParams } from './potentialActions/sendEmailMessage';
|
|
3
4
|
import { IOrderAsResult } from './factory/result';
|
|
5
|
+
export { IPotentialActionsParams };
|
|
4
6
|
/**
|
|
5
7
|
* 取引のポストアクションを作成する
|
|
6
8
|
*/
|
|
@@ -15,8 +17,8 @@ export declare function createPotentialActions(params: {
|
|
|
15
17
|
customer: factory.order.ICustomer;
|
|
16
18
|
seller: Pick<factory.order.ISeller, 'name' | 'typeOf'>;
|
|
17
19
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
18
|
-
potentialActions?:
|
|
20
|
+
potentialActions?: IPotentialActionsParams;
|
|
19
21
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
20
|
-
potentialActions
|
|
22
|
+
potentialActions?: never;
|
|
21
23
|
emailMessages: factory.creativeWork.message.email.ICreativeWork[];
|
|
22
24
|
}>;
|
|
@@ -7,14 +7,13 @@ const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
|
7
7
|
*/
|
|
8
8
|
async function createPotentialActions(params, setting) {
|
|
9
9
|
// 注文処理開始メール送信設定
|
|
10
|
-
const { emailMessages
|
|
10
|
+
const { emailMessages } = await (0, sendEmailMessage_1.createSendEmailMessageActions)(params, setting);
|
|
11
11
|
return {
|
|
12
12
|
emailMessages,
|
|
13
|
-
potentialActions: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
// potentialActions: {
|
|
14
|
+
// order: {
|
|
15
|
+
// onOrderProcessing: { sendEmailMessage: sendEmailMessageActions } // optimize(2024-06-29~)
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
19
18
|
};
|
|
20
19
|
}
|
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts
CHANGED
|
@@ -2,14 +2,42 @@ 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
};
|
|
8
31
|
/**
|
|
9
32
|
* 注文ドキュメントと予約取引ドキュメントを参照することによって生成した、単価オファー検証条件
|
|
10
33
|
* 元々オファー承認アクションのresultに保管されていた
|
|
11
34
|
*/
|
|
12
|
-
type IPreparedUnitPriceOfferConditions = Pick<IAuthorizeEventServiceOffer, 'id'
|
|
35
|
+
type IPreparedUnitPriceOfferConditions = Pick<IAuthorizeEventServiceOffer, 'id'> & {
|
|
36
|
+
result?: IPreparedResult;
|
|
37
|
+
};
|
|
38
|
+
export declare function createAuthorizeOfferResultsExpected(params: {
|
|
39
|
+
authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
40
|
+
}): Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
13
41
|
declare function prepareUnitPriceOfferConditions(params: {
|
|
14
42
|
project: {
|
|
15
43
|
id: string;
|
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js
CHANGED
|
@@ -1,8 +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;
|
|
8
|
+
const debug_1 = __importDefault(require("debug"));
|
|
5
9
|
const factory_1 = require("../../../../factory");
|
|
10
|
+
const debug = (0, debug_1.default)('chevre-domain:service:transaction:placeOrder:confirm:prepareUnitPriceOfferConditions');
|
|
6
11
|
function acceptedOffers2authorizeResult(params) {
|
|
7
12
|
const { acceptedOffers4result, unitPriceOffers } = params;
|
|
8
13
|
const programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
|
|
@@ -83,9 +88,13 @@ function prepareUnitPriceOfferConditions(params) {
|
|
|
83
88
|
}
|
|
84
89
|
const conditions = [];
|
|
85
90
|
const offerIds = [...new Set(params.acceptedOffers.map((o) => String(o.id)))];
|
|
86
|
-
const unitPriceOffers = await repos.offer.
|
|
91
|
+
const unitPriceOffers = await repos.offer.findUnitPriceOffers({
|
|
87
92
|
id: { $in: offerIds }
|
|
93
|
+
}, {
|
|
94
|
+
acceptedPaymentMethod: 1,
|
|
95
|
+
priceSpecification: 1,
|
|
88
96
|
});
|
|
97
|
+
debug('unitPriceOffers:', unitPriceOffers);
|
|
89
98
|
for (const authorizeEventServiceOfferAction of params.authorizeEventServiceOfferActions) {
|
|
90
99
|
if (authorizeEventServiceOfferAction.result === undefined) {
|
|
91
100
|
throw new Error('authorizeEventServiceOfferAction.result should exist');
|
|
@@ -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;
|
|
@@ -6,7 +6,11 @@ export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction,
|
|
|
6
6
|
/**
|
|
7
7
|
* 取引が確定可能な状態かどうかをチェックする
|
|
8
8
|
*/
|
|
9
|
-
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;
|
|
10
14
|
/**
|
|
11
15
|
* 注文オファー数検証
|
|
12
16
|
*/
|
|
@@ -47,5 +51,5 @@ export declare function validateEventOffers(params: {
|
|
|
47
51
|
* 承認アクションのresultに条件が保管されているはず(2026-07-06時点で)
|
|
48
52
|
*/
|
|
49
53
|
authorizeOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
50
|
-
unitPriceOfferConditions
|
|
54
|
+
unitPriceOfferConditions: IPreparedUnitPriceOfferConditions[];
|
|
51
55
|
}): void;
|
|
@@ -21,8 +21,8 @@ const debug = (0, debug_1.default)('chevre-domain:service:transaction:placeOrder
|
|
|
21
21
|
/**
|
|
22
22
|
* 取引が確定可能な状態かどうかをチェックする
|
|
23
23
|
*/
|
|
24
|
-
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions, eventReservationAcceptedOffers, payTransactions, customer) {
|
|
25
|
-
|
|
24
|
+
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions, eventReservationAcceptedOffers, payTransactions, customer, options) {
|
|
25
|
+
const { paymentMethodIdByTransaction } = options;
|
|
26
26
|
validateProfile({ customer });
|
|
27
27
|
(0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
28
28
|
// 請求のreferencesOrder検証(2025-11-23~)
|
|
@@ -61,7 +61,7 @@ function validateTransaction(transaction, acceptPayActions, authorizePaymentActi
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
// 決済URLが発行されている場合、検証
|
|
64
|
-
validatePaymentUrl(
|
|
64
|
+
validatePaymentUrl({ paymentMethodIdByTransaction, acceptPayActions, authorizePaymentActions });
|
|
65
65
|
}
|
|
66
66
|
function findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentActions, eventReservationAcceptedOffers) {
|
|
67
67
|
const paymentMethodTypes = [];
|
|
@@ -106,16 +106,19 @@ function validateProfile(params) {
|
|
|
106
106
|
throw new factory_1.factory.errors.Argument('Transaction', 'customer name required');
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
function validatePaymentUrl(
|
|
109
|
+
function validatePaymentUrl(params) {
|
|
110
|
+
const { paymentMethodIdByTransaction, acceptPayActions, authorizePaymentActions } = params;
|
|
110
111
|
// 決済URLが発行されている場合、検証
|
|
111
|
-
const paymentMethodId =
|
|
112
|
+
const paymentMethodId = paymentMethodIdByTransaction;
|
|
113
|
+
debug('validatePaymentUrl: paymentMethodIdByTransaction:', paymentMethodIdByTransaction);
|
|
112
114
|
if (typeof paymentMethodId === 'string' && paymentMethodId.length > 0) {
|
|
113
115
|
// check existing accept action(2025-02-26~)
|
|
114
116
|
const acceptActionExists = acceptPayActions.some(({ object, result }) => {
|
|
115
117
|
return object.transactionNumber === paymentMethodId
|
|
116
|
-
&& result?.paymentMethodId === paymentMethodId
|
|
117
|
-
|
|
118
|
+
&& result?.paymentMethodId === paymentMethodId;
|
|
119
|
+
// && typeof result?.paymentUrl === 'string'; // result.paymentUrlは廃止(2026-07-14~)
|
|
118
120
|
});
|
|
121
|
+
debug('validatePaymentUrl: acceptActionExists:', acceptActionExists);
|
|
119
122
|
if (!acceptActionExists) {
|
|
120
123
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.actionType.AcceptAction);
|
|
121
124
|
}
|
|
@@ -127,6 +130,7 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
|
|
|
127
130
|
: undefined;
|
|
128
131
|
return resultAsInvoice?.paymentMethodId === paymentMethodId;
|
|
129
132
|
});
|
|
133
|
+
debug('validatePaymentUrl: authorizePaymentAction4paymentUrlExists:', authorizePaymentAction4paymentUrlExists);
|
|
130
134
|
if (!authorizePaymentAction4paymentUrlExists) {
|
|
131
135
|
throw new factory_1.factory.errors.Argument('Transaction', 'Payment for published payment URL required');
|
|
132
136
|
}
|
|
@@ -305,7 +309,15 @@ function validateEventOffers(params) {
|
|
|
305
309
|
const everyActionsMatched = unitPriceOfferConditions.length === params.authorizeOfferActions.length
|
|
306
310
|
&& params.authorizeOfferActions.every((authorizeEventServiceOfferAction) => {
|
|
307
311
|
const conditionExpected = unitPriceOfferConditions.find(({ id }) => id === authorizeEventServiceOfferAction.id);
|
|
308
|
-
|
|
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
|
+
}
|
|
309
321
|
debug('validateEventOffers: unitPriceOfferConditions: resultMatched?', resultMatched, params.project.id, authorizeEventServiceOfferAction.id);
|
|
310
322
|
if (!resultMatched) {
|
|
311
323
|
console.error('validateEventOffers: unitPriceOfferConditions not matched!', params.project.id, authorizeEventServiceOfferAction.id, conditionExpected?.result, authorizeEventServiceOfferAction.result);
|
|
@@ -321,7 +333,9 @@ function validateEventOffers(params) {
|
|
|
321
333
|
}
|
|
322
334
|
}
|
|
323
335
|
else {
|
|
324
|
-
|
|
336
|
+
// unitPriceOfferConditionsの準備は必須化(2026-07-13~)
|
|
337
|
+
throw new factory_1.factory.errors.NotImplemented('unitPriceOfferConditions must be an array');
|
|
338
|
+
// validatingAuthorizeOfferActions = [...params.authorizeOfferActions];
|
|
325
339
|
}
|
|
326
340
|
const { paymentMethods } = params;
|
|
327
341
|
const firstCreditCardPaymentMethodIdentifier = paymentMethods.find((referenceInvoice) => {
|
|
@@ -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;
|
|
@@ -58,9 +58,9 @@ function processTransactionNotInProgress(params) {
|
|
|
58
58
|
function confirm(params, options) {
|
|
59
59
|
return async (repos) => {
|
|
60
60
|
// 確認番号を事前発行
|
|
61
|
-
await (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
61
|
+
const confirmationNumber = await (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
62
62
|
id: params.id,
|
|
63
|
-
status: { $in: [
|
|
63
|
+
// status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
|
|
64
64
|
object: { orderDate: params.result.order.orderDate }
|
|
65
65
|
})(repos);
|
|
66
66
|
const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: factory_1.factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
|
|
@@ -82,10 +82,12 @@ function confirm(params, options) {
|
|
|
82
82
|
// if (typeof orderNumber !== 'string' || orderNumber === '') {
|
|
83
83
|
// throw new factory.errors.Argument('transactionId', 'orderNumber not issued');
|
|
84
84
|
// }
|
|
85
|
+
// 注文に決済方法IDが発行済か確認(2026-07-12)
|
|
86
|
+
const paymentMethodIdByTransaction = await repos.orderInTransaction.findPaymentMethodId({ id: params.id });
|
|
85
87
|
// 取引に対する全ての承認アクションをマージ
|
|
86
88
|
const completedAuthorizeActions = await searchAuthorizeActions(params)(repos);
|
|
87
89
|
let acceptPayActions = [];
|
|
88
|
-
if (typeof
|
|
90
|
+
if (typeof paymentMethodIdByTransaction === 'string') {
|
|
89
91
|
acceptPayActions = await searchAcceptPayActions(params)(repos);
|
|
90
92
|
}
|
|
91
93
|
// 必要あらば注文コード発行(2024-02-05~)
|
|
@@ -110,21 +112,16 @@ function confirm(params, options) {
|
|
|
110
112
|
serialNumbers } = dissolveAuthorizeActions(completedAuthorizeActions);
|
|
111
113
|
// orderInTransactionから検索する(2024-03-04~)
|
|
112
114
|
const acceptedOffers = (await repos.orderInTransaction.findAcceptedOffersWithPriceByIdentifier({
|
|
113
|
-
// orderNumber,
|
|
114
115
|
identifier: transaction.id,
|
|
115
116
|
project: { id: transaction.project.id }
|
|
116
|
-
}))
|
|
117
|
+
}, { onlyPlaceOrder: true }))
|
|
117
118
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
118
119
|
// 単価オファーの全適用条件を検証するために、単価オファーを参照(2026-07-06~)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
acceptedOffers,
|
|
125
|
-
authorizeEventServiceOfferActions
|
|
126
|
-
})({ offer: repos.offer });
|
|
127
|
-
}
|
|
120
|
+
const unitPriceOfferConditions = await (0, prepareUnitPriceOfferConditions_1.prepareUnitPriceOfferConditions)({
|
|
121
|
+
project: { id: transaction.project.id, },
|
|
122
|
+
acceptedOffers,
|
|
123
|
+
authorizeEventServiceOfferActions
|
|
124
|
+
})({ offer: repos.offer });
|
|
128
125
|
// authorizePaymentActionsからpayTransactionsを参照(2024-06-20~)
|
|
129
126
|
let payTransactions = [];
|
|
130
127
|
// 決済承認アクションのinstrument依存をobject依存へ変更(2025-12-14~)
|
|
@@ -142,30 +139,28 @@ function confirm(params, options) {
|
|
|
142
139
|
const seller = (0, factory_2.createSeller)({ transaction });
|
|
143
140
|
const { paymentMethods, placingOrder, result, eventId, reservationIds } = createResult({
|
|
144
141
|
...params,
|
|
145
|
-
orderNumber,
|
|
142
|
+
orderNumber,
|
|
143
|
+
confirmationNumber,
|
|
144
|
+
transaction,
|
|
146
145
|
acceptPayActions,
|
|
147
146
|
authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
148
147
|
acceptedOffers, payTransactions, customer,
|
|
148
|
+
unitPriceOfferConditions,
|
|
149
149
|
...(typeof code === 'string') ? { code } : undefined,
|
|
150
|
-
|
|
150
|
+
paymentMethodIdByTransaction
|
|
151
151
|
}, options);
|
|
152
152
|
// ポストアクションを作成
|
|
153
153
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
|
|
154
154
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
155
155
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
156
156
|
}
|
|
157
|
-
const { emailMessages
|
|
157
|
+
const { emailMessages } = await (0, potentialActions_1.createPotentialActions)({
|
|
158
158
|
order: placingOrder, // createEmailMessageでのorder.acceptedOffersへの依存性を排除したのでこちらでよいはず(2024-02-21~)
|
|
159
159
|
customer,
|
|
160
160
|
seller,
|
|
161
161
|
paymentMethods,
|
|
162
|
-
// order: orderWithAcceptedOffers, // 現時点でcreateEmailMessageでorder.acceptedOffersを使用している(2024-02-06~)
|
|
163
|
-
// transaction: transaction,
|
|
164
162
|
...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined,
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
// settings
|
|
168
|
-
setting);
|
|
163
|
+
}, setting);
|
|
169
164
|
// メッセージ保管(2024-04-28~)
|
|
170
165
|
await saveMessagesIfNeeded({
|
|
171
166
|
project: { id: transaction.project.id },
|
|
@@ -178,10 +173,11 @@ function confirm(params, options) {
|
|
|
178
173
|
id: transaction.id,
|
|
179
174
|
object: {
|
|
180
175
|
orderDate: params.result.order.orderDate,
|
|
181
|
-
orderNumber
|
|
176
|
+
orderNumber,
|
|
177
|
+
confirmationNumber: placingOrder.confirmationNumber
|
|
182
178
|
},
|
|
183
179
|
result: result,
|
|
184
|
-
potentialActions
|
|
180
|
+
// ...((options.useTransactionPotentialActions) && { potentialActions }) // support undefined(2026-07-17~)
|
|
185
181
|
});
|
|
186
182
|
}
|
|
187
183
|
catch (error) {
|
|
@@ -318,7 +314,10 @@ function createResult(params, options) {
|
|
|
318
314
|
}
|
|
319
315
|
});
|
|
320
316
|
// 取引の確定条件が全て整っているかどうか確認
|
|
321
|
-
|
|
317
|
+
const { paymentMethodIdByTransaction } = params;
|
|
318
|
+
(0, validation_1.validateTransaction)({ id: transaction.id }, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions, eventReservationAcceptedOffers, params.payTransactions, params.customer, {
|
|
319
|
+
...((typeof paymentMethodIdByTransaction === 'string') && { paymentMethodIdByTransaction })
|
|
320
|
+
});
|
|
322
321
|
const { paymentMethods, price } = (0, factory_2.createPaymentMethods)({ authorizePaymentActions: params.authorizePaymentActions });
|
|
323
322
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
324
323
|
eventReservationAcceptedOffers
|
|
@@ -328,7 +327,7 @@ function createResult(params, options) {
|
|
|
328
327
|
order: { price },
|
|
329
328
|
paymentMethods,
|
|
330
329
|
authorizeOfferActions: params.authorizeEventServiceOfferActions,
|
|
331
|
-
|
|
330
|
+
unitPriceOfferConditions: params.unitPriceOfferConditions
|
|
332
331
|
});
|
|
333
332
|
// 注文オファー検証
|
|
334
333
|
(0, validation_1.validateAcceptedOffers)({
|
|
@@ -341,8 +340,10 @@ function createResult(params, options) {
|
|
|
341
340
|
result: params.result
|
|
342
341
|
});
|
|
343
342
|
(0, validation_1.validatePaymentMethods)({ order: { paymentMethods } }, options);
|
|
344
|
-
//
|
|
345
|
-
const { confirmationNumber } =
|
|
343
|
+
// 取引のobjectへの依存を排除する(2026-07-08~)
|
|
344
|
+
const { confirmationNumber } = params;
|
|
345
|
+
// // 確認番号を発行
|
|
346
|
+
// const { confirmationNumber } = createConfirmationNumber({ transaction });
|
|
346
347
|
// 注文作成
|
|
347
348
|
const orderAsResult = (0, result_1.createOrderAsResult)({
|
|
348
349
|
orderNumber: params.orderNumber,
|
|
@@ -433,14 +434,3 @@ function searchAuthorizeActions(params) {
|
|
|
433
434
|
return authorizeActions;
|
|
434
435
|
};
|
|
435
436
|
}
|
|
436
|
-
function createConfirmationNumber(params) {
|
|
437
|
-
const confirmationNumber = params.transaction.object.confirmationNumber;
|
|
438
|
-
// 取引に確認番号が保管されていなければ、確認番号を発行
|
|
439
|
-
if (typeof confirmationNumber !== 'string') {
|
|
440
|
-
// 事前に発行済なはずなので、ありえないフロー
|
|
441
|
-
throw new factory_1.factory.errors.Internal('object.confirmationNumber undefined');
|
|
442
|
-
}
|
|
443
|
-
return {
|
|
444
|
-
confirmationNumber,
|
|
445
|
-
};
|
|
446
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
|
-
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.IAttributes
|
|
3
|
+
type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceOrder> | factory.task.deleteTransaction.IAttributes | factory.task.IAttributes<factory.taskName.VoidPayTransaction> | factory.task.voidReserveTransaction.IAttributes;
|
|
4
4
|
/**
|
|
5
5
|
* 取引のタスクを作成する
|
|
6
6
|
*/
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
2
|
-
import type {
|
|
3
|
-
import { factory } from '../../../factory';
|
|
2
|
+
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* 未発行であれば、確認番号を発行して注文ドキュメントに保管する
|
|
5
|
+
* reimplement using OrderInTransactionRepo(2026-07-09~)
|
|
6
6
|
*/
|
|
7
7
|
declare function publishConfirmationNumberIfNotExist(params: {
|
|
8
8
|
/**
|
|
9
9
|
* 取引ID
|
|
10
10
|
*/
|
|
11
11
|
id: string;
|
|
12
|
-
status: {
|
|
13
|
-
$in: factory.transactionStatusType[];
|
|
14
|
-
};
|
|
15
12
|
object: {
|
|
16
13
|
orderDate: Date;
|
|
17
14
|
};
|
|
18
15
|
}): (repos: {
|
|
19
|
-
placeOrder: PlaceOrderRepo;
|
|
20
16
|
confirmationNumber: ConfirmationNumberRepo;
|
|
17
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
21
18
|
}) => Promise<string>;
|
|
22
19
|
export { publishConfirmationNumberIfNotExist };
|
|
@@ -1,36 +1,54 @@
|
|
|
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.publishConfirmationNumberIfNotExist = publishConfirmationNumberIfNotExist;
|
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
|
8
|
+
// import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
4
9
|
const factory_1 = require("../../../factory");
|
|
10
|
+
const debug = (0, debug_1.default)('chevre-domain:service:transaction:placeOrder:publishConfirmationNumberIfNotExist');
|
|
5
11
|
/**
|
|
6
|
-
*
|
|
12
|
+
* 未発行であれば、確認番号を発行して注文ドキュメントに保管する
|
|
13
|
+
* reimplement using OrderInTransactionRepo(2026-07-09~)
|
|
7
14
|
*/
|
|
8
15
|
function publishConfirmationNumberIfNotExist(params) {
|
|
9
16
|
return async (repos) => {
|
|
10
|
-
let confirmationNumber = await repos.placeOrder.findInProgressConfirmationNumberById({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
17
|
+
// let confirmationNumber = await repos.placeOrder.findInProgressConfirmationNumberById({
|
|
18
|
+
// id: params.id,
|
|
19
|
+
// status: { $in: params.status.$in }
|
|
20
|
+
// });
|
|
21
|
+
let confirmationNumber = await repos.orderInTransaction.findConfirmationNumberByIdentifier({ identifier: params.id });
|
|
22
|
+
debug('already exists?', confirmationNumber);
|
|
14
23
|
// すでに発行済であれば何もしない
|
|
15
24
|
if (typeof confirmationNumber === 'string') {
|
|
16
25
|
return confirmationNumber;
|
|
17
26
|
}
|
|
18
27
|
// 確認番号を発行
|
|
19
28
|
confirmationNumber = await repos.confirmationNumber.publish({ orderDate: params.object.orderDate });
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
debug('saving new confirmationNumber...', confirmationNumber);
|
|
30
|
+
// // 取引に存在しなければ保管
|
|
31
|
+
// await repos.placeOrder.saveConfirmationNumberIfNotExist({
|
|
32
|
+
// id: params.id,
|
|
33
|
+
// status: { $in: params.status.$in },
|
|
34
|
+
// confirmationNumber
|
|
35
|
+
// });
|
|
36
|
+
// 注文ドキュメントにも保管(2026-07-08~)
|
|
37
|
+
const saveResult = await repos.orderInTransaction.saveConfirmationNumberIfNotExist({
|
|
38
|
+
identifier: params.id,
|
|
24
39
|
confirmationNumber
|
|
25
|
-
});
|
|
40
|
+
}, { onlyPlaceOrder: true });
|
|
41
|
+
debug('saveConfirmationNumberIfNotExist result:', JSON.stringify(saveResult));
|
|
26
42
|
// 確認番号を取引から再取得
|
|
27
|
-
confirmationNumber = await repos.placeOrder.findInProgressConfirmationNumberById({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
43
|
+
// confirmationNumber = await repos.placeOrder.findInProgressConfirmationNumberById({
|
|
44
|
+
// id: params.id,
|
|
45
|
+
// status: { $in: params.status.$in }
|
|
46
|
+
// });
|
|
47
|
+
confirmationNumber = await repos.orderInTransaction.findConfirmationNumberByIdentifier({ identifier: params.id });
|
|
48
|
+
debug('confirmationNumber should exist:', confirmationNumber);
|
|
31
49
|
// 万が一処理が想定通りでない場合confirmationNumberが存在しない
|
|
32
50
|
if (typeof confirmationNumber !== 'string') {
|
|
33
|
-
throw new factory_1.factory.errors.Internal('
|
|
51
|
+
throw new factory_1.factory.errors.Internal('orderInTransaction.confirmationNumber not found');
|
|
34
52
|
}
|
|
35
53
|
return confirmationNumber;
|
|
36
54
|
};
|
|
@@ -9,7 +9,7 @@ import type { ProjectMakesOfferRepo } from '../../../repo/projectMakesOffer';
|
|
|
9
9
|
import type { SellerRepo } from '../../../repo/seller';
|
|
10
10
|
import type { IStartedPlaceOrder, PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
11
11
|
import { IStartPlaceOrderParams } from './start/factory';
|
|
12
|
-
interface IStartOperationRepos {
|
|
12
|
+
export interface IStartOperationRepos {
|
|
13
13
|
issuer: IssuerRepo;
|
|
14
14
|
member: MemberRepo;
|
|
15
15
|
memberProgram: MemberProgramRepo;
|