@chevre/domain 25.2.0-alpha.5 → 25.2.0-alpha.51
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/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 +3 -14
- package/lib/chevre/repo/aggregateOffer.js +16 -125
- 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/action.js +67 -66
- package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +11 -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/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/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/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.d.ts +2 -1
- package/lib/chevre/repo/transactionProcess.js +0 -13
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +12 -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/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 +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 +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 +22 -9
- 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/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.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 +15 -11
- 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 +53 -32
- 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/service.d.ts +4 -0
- package/lib/chevre/service.js +12 -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
|
@@ -8,14 +8,13 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
8
8
|
acceptAction: {
|
|
9
9
|
id: string;
|
|
10
10
|
};
|
|
11
|
-
event: {
|
|
12
|
-
id: string;
|
|
13
|
-
typeOf: factory.eventType.ScreeningEvent;
|
|
14
|
-
};
|
|
15
11
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
/**
|
|
13
|
+
* 仮予約済のCOA予約取引
|
|
14
|
+
*/
|
|
15
|
+
pendingTransaction: {
|
|
16
|
+
transactionNumber: string;
|
|
17
|
+
};
|
|
19
18
|
}): factory.action.authorize.offer.eventService.IAttributes;
|
|
20
19
|
/**
|
|
21
20
|
* 供給情報から承認アクションの価格を導き出す
|
|
@@ -9,20 +9,20 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
|
|
|
9
9
|
const moment_1 = __importDefault(require("moment"));
|
|
10
10
|
const util_1 = require("util");
|
|
11
11
|
const factory_1 = require("../../../../factory");
|
|
12
|
-
function createAuthorizeSeatReservationActionAttributes(params
|
|
13
|
-
const { useLegacyAuthorizeOfferObject } = options;
|
|
12
|
+
function createAuthorizeSeatReservationActionAttributes(params) {
|
|
13
|
+
// const { useLegacyAuthorizeOfferObject } = options;
|
|
14
14
|
const transaction = params.transaction;
|
|
15
|
-
const authorizeObjectEvent = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
15
|
+
// const authorizeObjectEvent: factory.action.authorize.offer.eventService.IEventInObject = {
|
|
16
|
+
// id: params.event.id,
|
|
17
|
+
// typeOf: params.event.typeOf
|
|
18
|
+
// };
|
|
19
19
|
const authorizeObject = {
|
|
20
20
|
typeOf: factory_1.factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
21
21
|
id: params.acceptAction.id,
|
|
22
|
-
...((useLegacyAuthorizeOfferObject) && {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
22
|
+
// ...((useLegacyAuthorizeOfferObject) && {
|
|
23
|
+
// event: authorizeObjectEvent,
|
|
24
|
+
// pendingTransaction: params.pendingTransaction
|
|
25
|
+
// })
|
|
26
26
|
};
|
|
27
27
|
const instrument = {
|
|
28
28
|
typeOf: factory_1.factory.assetTransactionType.COAReserveTransaction, // 変更(2024-03-08~)
|
|
@@ -310,7 +310,8 @@ function validateAcceptedOffers(params) {
|
|
|
310
310
|
// 指定された単価オファーを検索
|
|
311
311
|
// ticketCodeで検索(2023-03-22~)
|
|
312
312
|
if (offerIdentifiers.length > 0) {
|
|
313
|
-
availableUnitPriceOffers = await repos.offer.search({
|
|
313
|
+
// availableUnitPriceOffers = await repos.offer.search({
|
|
314
|
+
availableUnitPriceOffers = await repos.offer.findUnitPriceOffers({
|
|
314
315
|
identifier: { $in: offerIdentifiers },
|
|
315
316
|
project: { id: { $eq: params.project.id } }
|
|
316
317
|
});
|
|
@@ -53,11 +53,6 @@ export declare function authorize(params: {
|
|
|
53
53
|
requestBody: IRequestBody;
|
|
54
54
|
responseBody: IResponseBody;
|
|
55
55
|
};
|
|
56
|
-
}, options: {
|
|
57
|
-
/**
|
|
58
|
-
* 2026-07-04~
|
|
59
|
-
*/
|
|
60
|
-
useLegacyAuthorizeOfferObject: boolean;
|
|
61
56
|
}): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
|
|
62
57
|
result: IAuthorizeOfferAction['result'];
|
|
63
58
|
}>;
|
|
@@ -12,7 +12,7 @@ const factory_2 = require("../../../factory");
|
|
|
12
12
|
/**
|
|
13
13
|
* COA興行オファー承認
|
|
14
14
|
*/
|
|
15
|
-
function authorize(params
|
|
15
|
+
function authorize(params) {
|
|
16
16
|
return async (repos) => {
|
|
17
17
|
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
18
18
|
typeOf: factory_2.factory.transactionType.PlaceOrder,
|
|
@@ -28,15 +28,18 @@ function authorize(params, options) {
|
|
|
28
28
|
}
|
|
29
29
|
let screeningEvent;
|
|
30
30
|
let acceptedOffers;
|
|
31
|
+
// const pendingTransaction: factory.action.authorize.offer.eventService.ICOAPendingTransaction = {
|
|
32
|
+
// theaterCode: params.result.requestBody.theaterCode,
|
|
33
|
+
// dateJouei: params.result.requestBody.dateJouei,
|
|
34
|
+
// titleCode: params.result.requestBody.titleCode,
|
|
35
|
+
// titleBranchNum: params.result.requestBody.titleBranchNum,
|
|
36
|
+
// timeBegin: params.result.requestBody.timeBegin,
|
|
37
|
+
// tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
38
|
+
// transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
39
|
+
// typeOf: factory.assetTransactionType.COAReserveTransaction
|
|
40
|
+
// };
|
|
31
41
|
const pendingTransaction = {
|
|
32
|
-
theaterCode: params.result.requestBody.theaterCode,
|
|
33
|
-
dateJouei: params.result.requestBody.dateJouei,
|
|
34
|
-
titleCode: params.result.requestBody.titleCode,
|
|
35
|
-
titleBranchNum: params.result.requestBody.titleBranchNum,
|
|
36
|
-
timeBegin: params.result.requestBody.timeBegin,
|
|
37
|
-
tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
38
42
|
transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
39
|
-
typeOf: factory_2.factory.assetTransactionType.COAReserveTransaction
|
|
40
43
|
};
|
|
41
44
|
try {
|
|
42
45
|
screeningEvent = await repos.event.projectEventFieldsById({ id: params.object.event.id }, [
|
|
@@ -71,10 +74,10 @@ function authorize(params, options) {
|
|
|
71
74
|
// アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
|
|
72
75
|
const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
73
76
|
acceptAction: params.object.acceptAction,
|
|
74
|
-
event: { id: params.object.event.id, typeOf:
|
|
77
|
+
// event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
|
|
75
78
|
transaction,
|
|
76
79
|
pendingTransaction
|
|
77
|
-
}
|
|
80
|
+
});
|
|
78
81
|
const failedAction = await repos.action.start(failedActionAttributes);
|
|
79
82
|
await repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
80
83
|
throw error;
|
|
@@ -88,10 +91,10 @@ function authorize(params, options) {
|
|
|
88
91
|
// 承認アクションを開始
|
|
89
92
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
90
93
|
acceptAction: params.object.acceptAction,
|
|
91
|
-
event: { id: screeningEvent.id, typeOf: screeningEvent.typeOf },
|
|
94
|
+
// event: { id: screeningEvent.id, typeOf: screeningEvent.typeOf },
|
|
92
95
|
transaction,
|
|
93
96
|
pendingTransaction
|
|
94
|
-
}
|
|
97
|
+
});
|
|
95
98
|
const action = await repos.action.start(actionAttributes);
|
|
96
99
|
try {
|
|
97
100
|
// 座席仮予約からオファー情報を生成する
|
|
@@ -26,11 +26,6 @@ export declare function authorizeByAcceptAction(params: {
|
|
|
26
26
|
*/
|
|
27
27
|
id: string;
|
|
28
28
|
};
|
|
29
|
-
}, options: {
|
|
30
|
-
/**
|
|
31
|
-
* 2026-07-04~
|
|
32
|
-
*/
|
|
33
|
-
useLegacyAuthorizeOfferObject: boolean;
|
|
34
29
|
}): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
|
|
35
30
|
result: IAuthorizeOfferAction['result'];
|
|
36
31
|
}>;
|
|
@@ -7,7 +7,7 @@ const factory_1 = require("../../../factory");
|
|
|
7
7
|
/**
|
|
8
8
|
* 採用アクションからCOA興行オファー承認
|
|
9
9
|
*/
|
|
10
|
-
function authorizeByAcceptAction(params
|
|
10
|
+
function authorizeByAcceptAction(params) {
|
|
11
11
|
return async (repos) => {
|
|
12
12
|
const acceptAction = await repos.accpetCOAOfferAction.findCompletedById({
|
|
13
13
|
project: { id: params.project.id },
|
|
@@ -57,7 +57,7 @@ function authorizeByAcceptAction(params, options) {
|
|
|
57
57
|
store: { id: params.store.id },
|
|
58
58
|
result: { requestBody, responseBody }
|
|
59
59
|
};
|
|
60
|
-
action = await (0, authorize_1.authorize)(authorizeParams
|
|
60
|
+
action = await (0, authorize_1.authorize)(authorizeParams)(repos);
|
|
61
61
|
}
|
|
62
62
|
return action;
|
|
63
63
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
|
|
3
|
+
import type { AsyncActionRepo } from '../../../repo/asyncAction';
|
|
3
4
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
5
|
interface IFindAcceptActionResult {
|
|
5
6
|
/**
|
|
@@ -34,8 +35,11 @@ declare function findAcceptAction(params: {
|
|
|
34
35
|
*/
|
|
35
36
|
id: string;
|
|
36
37
|
};
|
|
38
|
+
}, options: {
|
|
39
|
+
useAsyncAction: boolean;
|
|
37
40
|
}): (repos: {
|
|
38
41
|
action: AcceptCOAOfferActionRepo;
|
|
42
|
+
asyncAction: AsyncActionRepo;
|
|
39
43
|
task: TaskRepo;
|
|
40
44
|
}) => Promise<IFindAcceptActionResult>;
|
|
41
45
|
export { findAcceptAction };
|
|
@@ -2,16 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findAcceptAction = findAcceptAction;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
function findAcceptAction(params) {
|
|
5
|
+
function findAcceptAction(params, options) {
|
|
6
6
|
return async (repos) => {
|
|
7
|
-
//
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
// 非同期アクションに対応(2026-07-27~)
|
|
8
|
+
const { useAsyncAction } = options;
|
|
9
|
+
let task;
|
|
10
|
+
if (useAsyncAction) {
|
|
11
|
+
// まず非同期アクションを参照
|
|
12
|
+
task = await repos.asyncAction.findAsyncActionById({
|
|
13
|
+
id: { $eq: params.sameAs.id },
|
|
14
|
+
project: { id: { $eq: params.project.id } },
|
|
15
|
+
name: factory_1.factory.taskName.AcceptCOAOffer
|
|
16
|
+
}, ['status', 'executionResults']);
|
|
17
|
+
}
|
|
18
|
+
// 非同期アクションが存在しなければタスクを参照
|
|
19
|
+
if (task === undefined) {
|
|
20
|
+
task = (await repos.task.projectFields({
|
|
21
|
+
limit: 1,
|
|
22
|
+
page: 1,
|
|
23
|
+
id: { $eq: params.sameAs.id },
|
|
24
|
+
project: { id: { $eq: params.project.id } },
|
|
25
|
+
name: factory_1.factory.taskName.AcceptCOAOffer
|
|
26
|
+
}, ['status', 'executionResults'])).shift();
|
|
27
|
+
}
|
|
15
28
|
if (task === undefined) {
|
|
16
29
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.taskName.AcceptCOAOffer);
|
|
17
30
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
|
+
import type { IDeleteActionResult, ActionRepo } from '../../repo/action';
|
|
3
4
|
import type { NoteRepo } from '../../repo/note';
|
|
4
5
|
import type { OrderRepo } from '../../repo/order';
|
|
5
6
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
@@ -17,8 +18,11 @@ declare function deleteOrder(params: {
|
|
|
17
18
|
}): (repos: {
|
|
18
19
|
acceptedOffer: AcceptedOfferRepo;
|
|
19
20
|
accountingReport: AccountingReportRepo;
|
|
21
|
+
action: ActionRepo;
|
|
20
22
|
note: NoteRepo;
|
|
21
23
|
order: OrderRepo;
|
|
22
24
|
reservation: ReservationRepo;
|
|
23
|
-
}) => Promise<
|
|
25
|
+
}) => Promise<{
|
|
26
|
+
deleteActionsResult: IDeleteActionResult[];
|
|
27
|
+
}>;
|
|
24
28
|
export { deleteOrder };
|
|
@@ -12,6 +12,7 @@ function deleteOrder(params) {
|
|
|
12
12
|
if (typeof params.object.identifier !== 'string' || params.object.identifier === '') {
|
|
13
13
|
throw new factory_1.factory.errors.ArgumentNull('object.identifier');
|
|
14
14
|
}
|
|
15
|
+
let deleteActionsResult = [];
|
|
15
16
|
const orders = await repos.order.projectFields({
|
|
16
17
|
limit: 1,
|
|
17
18
|
page: 1,
|
|
@@ -21,7 +22,7 @@ function deleteOrder(params) {
|
|
|
21
22
|
const order = orders.shift();
|
|
22
23
|
if (order === undefined) {
|
|
23
24
|
// すでに削除済
|
|
24
|
-
return;
|
|
25
|
+
return { deleteActionsResult: [] };
|
|
25
26
|
}
|
|
26
27
|
if (typeof order.id !== 'string') {
|
|
27
28
|
throw new factory_1.factory.errors.Internal(`order.id undefined. orderNumber: ${order.orderNumber}`);
|
|
@@ -43,8 +44,14 @@ function deleteOrder(params) {
|
|
|
43
44
|
typeOf: factory_1.factory.order.OrderType.Order
|
|
44
45
|
}
|
|
45
46
|
});
|
|
47
|
+
// アクション削除(2026-07-10~)
|
|
48
|
+
deleteActionsResult = await repos.action.deleteActionsByOrderNumber({
|
|
49
|
+
orderNumber: order.orderNumber,
|
|
50
|
+
project: { id: order.project.id },
|
|
51
|
+
});
|
|
46
52
|
// 注文削除
|
|
47
53
|
await repos.order.deleteByOrderNumber({ orderNumber: order.orderNumber });
|
|
54
|
+
return { deleteActionsResult };
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
57
|
function deleteReservationsByOrder(order) {
|
package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onPayTransactionCanceled = onPayTransactionCanceled;
|
|
4
|
-
const findConfirmedPlaceOrder_1 = require("../findConfirmedPlaceOrder");
|
|
5
4
|
const onOrderStatusChanged_1 = require("../onOrderStatusChanged");
|
|
6
5
|
const factory_1 = require("../../../factory");
|
|
7
6
|
function onPayTransactionCanceled(params) {
|
|
8
|
-
return async (repos
|
|
9
|
-
// settings: Settings
|
|
10
|
-
) => {
|
|
7
|
+
return async (repos) => {
|
|
11
8
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
12
9
|
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
13
10
|
}
|
|
14
|
-
//
|
|
11
|
+
// 中止された決済取引に依存した注文ドキュメントがもし存在すればキャンセル(2023-08-30~)
|
|
15
12
|
await cancelOrderIfExist({
|
|
16
13
|
project: { id: params.project.id },
|
|
17
14
|
paymentMethodId: params.object.transactionNumber,
|
|
@@ -32,14 +29,25 @@ function cancelOrderIfExist(params) {
|
|
|
32
29
|
paymentMethodIds: [params.paymentMethodId]
|
|
33
30
|
},
|
|
34
31
|
project: { id: { $eq: params.project.id } }
|
|
35
|
-
}, { inclusion: ['
|
|
32
|
+
}, { inclusion: ['orderNumber'] });
|
|
36
33
|
const orderByPaymentMethodId = ordersByPaymentMethodId.shift();
|
|
37
34
|
if (orderByPaymentMethodId !== undefined) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
const placeOrderTransactions = await repos.placeOrder.findPlaceOrderTransactions({
|
|
36
|
+
limit: 1,
|
|
37
|
+
page: 1,
|
|
38
|
+
project: { id: { $eq: params.project.id } },
|
|
39
|
+
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
40
|
+
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
41
|
+
// resultではなくobjectで参照するように変更(2026-06-16~)
|
|
42
|
+
object: {
|
|
43
|
+
orderNumber: { $eq: orderByPaymentMethodId.orderNumber },
|
|
44
|
+
},
|
|
45
|
+
inclusion: ['project', 'typeOf']
|
|
46
|
+
});
|
|
47
|
+
const placeOrderTransaction = placeOrderTransactions.shift();
|
|
48
|
+
if (placeOrderTransaction === undefined) {
|
|
49
|
+
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
50
|
+
}
|
|
43
51
|
const order = await repos.order.changeStatus({
|
|
44
52
|
project: { id: params.project.id },
|
|
45
53
|
orderNumber: orderByPaymentMethodId.orderNumber,
|
package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../../repo/acceptedOffer';
|
|
2
2
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
3
|
+
import type { MessageRepo } from '../../../repo/message';
|
|
3
4
|
import type { OrderRepo } from '../../../repo/order';
|
|
4
5
|
import type { SettingRepo } from '../../../repo/setting';
|
|
5
6
|
import type { TaskRepo } from '../../../repo/task';
|
|
@@ -9,6 +10,7 @@ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/i
|
|
|
9
10
|
interface IOnPayTransactionConfirmedRepos {
|
|
10
11
|
acceptedOffer: AcceptedOfferRepo;
|
|
11
12
|
assetTransaction: AssetTransactionRepo;
|
|
13
|
+
message: MessageRepo;
|
|
12
14
|
order: OrderRepo;
|
|
13
15
|
setting: SettingRepo;
|
|
14
16
|
task: TaskRepo;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../../repo/acceptedOffer';
|
|
2
|
+
import type { MessageRepo } from '../../../repo/message';
|
|
2
3
|
import type { OrderRepo } from '../../../repo/order';
|
|
3
4
|
import type { SettingRepo } from '../../../repo/setting';
|
|
4
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
5
|
-
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
6
6
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
7
7
|
interface IPaymentDue2ProcessingRepos {
|
|
8
8
|
acceptedOffer: AcceptedOfferRepo;
|
|
9
|
+
message: MessageRepo;
|
|
9
10
|
order: OrderRepo;
|
|
10
11
|
setting: SettingRepo;
|
|
11
12
|
task: TaskRepo;
|
|
12
|
-
placeOrder: PlaceOrderRepo;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* 全決済取引確定を完了した注文に関して、アイテムを処理する
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.paymentDue2Processing = paymentDue2Processing;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
const findConfirmedPlaceOrder_1 = require("../findConfirmedPlaceOrder");
|
|
9
8
|
const onOrderStatusChanged_1 = require("../onOrderStatusChanged");
|
|
10
9
|
const factory_1 = require("../../../factory");
|
|
11
10
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
@@ -14,11 +13,6 @@ const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
|
14
13
|
*/
|
|
15
14
|
function paymentDue2Processing(params) {
|
|
16
15
|
return async (repos, settings) => {
|
|
17
|
-
const placeOrderTransaction = await (0, findConfirmedPlaceOrder_1.findConfirmedPlaceOrder)({
|
|
18
|
-
project: { id: params.project.id },
|
|
19
|
-
confirmationNumber: params.confirmationNumber,
|
|
20
|
-
orderNumber: params.orderNumber
|
|
21
|
-
})(repos);
|
|
22
16
|
let order;
|
|
23
17
|
try {
|
|
24
18
|
order = await repos.order.changeStatus({
|
|
@@ -74,7 +68,7 @@ function paymentDue2Processing(params) {
|
|
|
74
68
|
offeredThroughIdentifier,
|
|
75
69
|
orderStatus: factory_1.factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
76
70
|
},
|
|
77
|
-
placeOrderTransaction
|
|
71
|
+
// placeOrderTransaction
|
|
78
72
|
})(repos, settings);
|
|
79
73
|
}
|
|
80
74
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
|
+
import type { MessageRepo } from '../../repo/message';
|
|
3
4
|
import type { OrderRepo } from '../../repo/order';
|
|
4
5
|
import type { SettingRepo } from '../../repo/setting';
|
|
5
6
|
import type { TaskRepo } from '../../repo/task';
|
|
@@ -11,6 +12,7 @@ import type { IntegrationSettingRepo as Settings } from '../../repo/setting/inte
|
|
|
11
12
|
interface IOnAssetTransactionStatusChangedRepos {
|
|
12
13
|
acceptedOffer: AcceptedOfferRepo;
|
|
13
14
|
assetTransaction: AssetTransactionRepo;
|
|
15
|
+
message: MessageRepo;
|
|
14
16
|
order: OrderRepo;
|
|
15
17
|
setting: SettingRepo;
|
|
16
18
|
task: TaskRepo;
|
|
@@ -12,7 +12,9 @@ Object.defineProperty(exports, "processing2inTransit", { enumerable: true, get:
|
|
|
12
12
|
const factory_1 = require("../../factory");
|
|
13
13
|
function onAssetTransactionStatusChanged(params) {
|
|
14
14
|
return async (repos, settings) => {
|
|
15
|
+
/* istanbul ignore else -- @preserve */
|
|
15
16
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
17
|
+
/* istanbul ignore next -- @preserve */
|
|
16
18
|
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
17
19
|
}
|
|
18
20
|
switch (params.object.status) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { MessageRepo } from '../../../../repo/message';
|
|
1
2
|
import type { TaskRepo } from '../../../../repo/task';
|
|
2
3
|
import { factory } from '../../../../factory';
|
|
3
4
|
declare function createSendEmailMessageTaskIfNotExist(params: {
|
|
4
|
-
sendEmailMessage?:
|
|
5
|
+
sendEmailMessage?: {
|
|
6
|
+
object: factory.action.transfer.send.message.email.IOptimizedObject;
|
|
7
|
+
}[];
|
|
5
8
|
order: Pick<factory.order.IOrder, 'customer' | 'orderDate' | 'orderNumber' | 'price' | 'priceCurrency' | 'project' | 'typeOf'>;
|
|
6
9
|
}): (repos: {
|
|
10
|
+
message: MessageRepo;
|
|
7
11
|
task: TaskRepo;
|
|
8
12
|
}) => Promise<void>;
|
|
9
13
|
export { createSendEmailMessageTaskIfNotExist };
|
|
@@ -1,45 +1,107 @@
|
|
|
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.createSendEmailMessageTaskIfNotExist = createSendEmailMessageTaskIfNotExist;
|
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
|
4
8
|
const util_1 = require("util");
|
|
5
9
|
const factory_1 = require("../../../../factory");
|
|
10
|
+
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
6
11
|
function createSendEmailMessageTaskIfNotExist(params) {
|
|
7
12
|
return async (repos) => {
|
|
8
13
|
const sendEmailMessageActions = params.sendEmailMessage;
|
|
9
14
|
const now = new Date();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
// 取引のpotentialActions参照を廃止して、messageリポジトリを参照して存在すればタスクを作成(2026-07-16~)
|
|
16
|
+
const message4order = (await repos.message.findMessages({
|
|
17
|
+
limit: 1,
|
|
18
|
+
page: 1,
|
|
19
|
+
about: { identifier: { $eq: factory_1.factory.creativeWork.message.email.AboutIdentifier.OnOrderSent } },
|
|
20
|
+
mainEntity: { orderNumber: { $eq: params.order.orderNumber } }
|
|
21
|
+
}, ['identifier'])).shift();
|
|
22
|
+
debug('createSendEmailMessageTaskIfNotExist: message4order:', JSON.stringify(message4order));
|
|
23
|
+
if (typeof message4order?.identifier === 'string') {
|
|
24
|
+
// 取引のpotentialActionsが存在する間は、メッセージ識別子が想定通りか確認する
|
|
25
|
+
const messageIdentifierByTransaction = sendEmailMessageActions?.at(0)?.object.identifier;
|
|
26
|
+
if (typeof messageIdentifierByTransaction === 'string') {
|
|
27
|
+
debug('createSendEmailMessageTaskIfNotExist: identifier matched?', message4order.identifier, messageIdentifierByTransaction);
|
|
28
|
+
if (message4order.identifier !== messageIdentifierByTransaction) {
|
|
29
|
+
throw new factory_1.factory.errors.Internal(`message identifier not matched. ${message4order.identifier} ${messageIdentifierByTransaction}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s:%s:%s', params.order.project.id, factory_1.factory.taskName.SendEmailMessage, params.order.typeOf, params.order.orderNumber, factory_1.factory.orderStatus.OrderProcessing, 0 // 複数メッセージに対応していた時期の名残(2026-07-16~)
|
|
33
|
+
);
|
|
34
|
+
const simpleOrder = {
|
|
35
|
+
typeOf: params.order.typeOf,
|
|
36
|
+
orderNumber: params.order.orderNumber,
|
|
37
|
+
orderDate: params.order.orderDate
|
|
38
|
+
};
|
|
39
|
+
const actionAttributes = {
|
|
40
|
+
project: params.order.project,
|
|
41
|
+
typeOf: factory_1.factory.actionType.SendAction,
|
|
42
|
+
object: {
|
|
43
|
+
identifier: message4order.identifier,
|
|
44
|
+
typeOf: factory_1.factory.creativeWorkType.EmailMessage
|
|
45
|
+
},
|
|
46
|
+
agent: params.order.project,
|
|
47
|
+
recipient: { typeOf: params.order.customer.typeOf, id: params.order.customer.id },
|
|
48
|
+
purpose: simpleOrder
|
|
49
|
+
};
|
|
50
|
+
const sendEmailMessageTask = {
|
|
51
|
+
alternateName: taskIdentifier,
|
|
52
|
+
identifier: taskIdentifier,
|
|
53
|
+
project: params.order.project,
|
|
54
|
+
name: factory_1.factory.taskName.SendEmailMessage,
|
|
55
|
+
status: factory_1.factory.taskStatus.Ready,
|
|
56
|
+
runsAt: now, // なるはやで実行
|
|
57
|
+
remainingNumberOfTries: 10,
|
|
58
|
+
numberOfTried: 0,
|
|
59
|
+
executionResults: [],
|
|
60
|
+
data: { actionAttributes }
|
|
61
|
+
};
|
|
62
|
+
await repos.task.createIfNotExistByAlternateName(sendEmailMessageTask, { emitImmediately: true });
|
|
43
63
|
}
|
|
64
|
+
// if (Array.isArray(sendEmailMessageActions)) {
|
|
65
|
+
// await Promise.all(sendEmailMessageActions.map(async (sendEmailMessageAction, index) => {
|
|
66
|
+
// const taskIdentifier: string = format(
|
|
67
|
+
// '%s:%s:%s:%s:%s:%s',
|
|
68
|
+
// params.order.project.id,
|
|
69
|
+
// factory.taskName.SendEmailMessage,
|
|
70
|
+
// params.order.typeOf,
|
|
71
|
+
// params.order.orderNumber,
|
|
72
|
+
// factory.orderStatus.OrderProcessing,
|
|
73
|
+
// index
|
|
74
|
+
// );
|
|
75
|
+
// const simpleOrder: factory.order.ISimpleOrder = {
|
|
76
|
+
// typeOf: params.order.typeOf,
|
|
77
|
+
// orderNumber: params.order.orderNumber,
|
|
78
|
+
// orderDate: params.order.orderDate
|
|
79
|
+
// };
|
|
80
|
+
// const actionAttributes: factory.task.sendEmailMessage.IData['actionAttributes'] = {
|
|
81
|
+
// project: params.order.project,
|
|
82
|
+
// typeOf: factory.actionType.SendAction,
|
|
83
|
+
// object: sendEmailMessageAction.object,
|
|
84
|
+
// agent: params.order.project,
|
|
85
|
+
// recipient: { typeOf: params.order.customer.typeOf, id: params.order.customer.id },
|
|
86
|
+
// purpose: simpleOrder
|
|
87
|
+
// };
|
|
88
|
+
// const sendEmailMessageTask: factory.task.IAttributes<factory.taskName.SendEmailMessage> & {
|
|
89
|
+
// alternateName: string;
|
|
90
|
+
// identifier: string;
|
|
91
|
+
// } = {
|
|
92
|
+
// alternateName: taskIdentifier,
|
|
93
|
+
// identifier: taskIdentifier,
|
|
94
|
+
// project: params.order.project,
|
|
95
|
+
// name: factory.taskName.SendEmailMessage,
|
|
96
|
+
// status: factory.taskStatus.Ready,
|
|
97
|
+
// runsAt: now, // なるはやで実行
|
|
98
|
+
// remainingNumberOfTries: 10,
|
|
99
|
+
// numberOfTried: 0,
|
|
100
|
+
// executionResults: [],
|
|
101
|
+
// data: { actionAttributes }
|
|
102
|
+
// };
|
|
103
|
+
// await repos.task.createIfNotExistByAlternateName(sendEmailMessageTask, { emitImmediately: true });
|
|
104
|
+
// }));
|
|
105
|
+
// }
|
|
44
106
|
};
|
|
45
107
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import type { MessageRepo } from '../../../repo/message';
|
|
1
2
|
import type { SettingRepo } from '../../../repo/setting';
|
|
2
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
3
4
|
import { factory } from '../../../factory';
|
|
4
5
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
5
6
|
import { IExternalOrder, IProcessingOrder } from './onOrderProcessing/factory';
|
|
6
7
|
import { processOrder } from './onOrderProcessing/processOrder';
|
|
7
|
-
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf' | 'potentialActions'>;
|
|
8
8
|
declare function onOrderProcessing(params: {
|
|
9
9
|
order: IProcessingOrder & {
|
|
10
10
|
itemOfferedTypeOf: factory.order.IItemOffered['typeOf'];
|
|
11
11
|
serialNumbers: string[];
|
|
12
12
|
offeredThroughIdentifier?: factory.service.webAPI.Identifier;
|
|
13
13
|
};
|
|
14
|
-
placeOrderTransaction?: IPlaceOrderTransaction;
|
|
15
14
|
}): (repos: {
|
|
15
|
+
message: MessageRepo;
|
|
16
16
|
setting: SettingRepo;
|
|
17
17
|
task: TaskRepo;
|
|
18
18
|
}, settings: Settings) => Promise<void>;
|
|
@@ -15,6 +15,7 @@ const factory_2 = require("./onOrderProcessing/factory");
|
|
|
15
15
|
const processOrder_1 = require("./onOrderProcessing/processOrder");
|
|
16
16
|
Object.defineProperty(exports, "processOrder", { enumerable: true, get: function () { return processOrder_1.processOrder; } });
|
|
17
17
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
18
|
+
// type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf'>;
|
|
18
19
|
function onOrderProcessing(params) {
|
|
19
20
|
return async (repos, settings) => {
|
|
20
21
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
|
|
@@ -23,7 +24,8 @@ function onOrderProcessing(params) {
|
|
|
23
24
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
24
25
|
let tasks;
|
|
25
26
|
let creatingCheckResourceTask;
|
|
26
|
-
const sendEmailMessageByOnOrderProcessing =
|
|
27
|
+
// const sendEmailMessageByOnOrderProcessing =
|
|
28
|
+
// params.placeOrderTransaction?.potentialActions?.order?.onOrderProcessing?.sendEmailMessage;
|
|
27
29
|
switch (params.order.orderStatus) {
|
|
28
30
|
case factory_1.factory.orderStatus.OrderProcessing:
|
|
29
31
|
tasks = (0, factory_2.createInformProcessingOrderTasks)(params.order, setting);
|
|
@@ -49,7 +51,7 @@ function onOrderProcessing(params) {
|
|
|
49
51
|
// OrderProcessingにおけるEメール送信に対応(2024-01-17~)
|
|
50
52
|
await (0, createSendEmailMessageTaskIfNotExist_1.createSendEmailMessageTaskIfNotExist)({
|
|
51
53
|
sendEmailMessage: [
|
|
52
|
-
|
|
54
|
+
// ...(Array.isArray(sendEmailMessageByOnOrderProcessing)) ? sendEmailMessageByOnOrderProcessing : []
|
|
53
55
|
],
|
|
54
56
|
order: params.order
|
|
55
57
|
})(repos);
|