@chevre/domain 26.0.0-alpha.4 → 26.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/eventEmitter/task.d.ts +8 -23
- package/lib/chevre/eventEmitter/task.js +2 -2
- package/lib/chevre/repo/acceptedOffer.d.ts +0 -7
- package/lib/chevre/repo/acceptedOffer.js +27 -27
- package/lib/chevre/repo/action/acceptCOAOffer.d.ts +3 -1
- package/lib/chevre/repo/action/acceptCOAOffer.js +8 -2
- package/lib/chevre/repo/action/acceptPay.d.ts +3 -1
- package/lib/chevre/repo/action/acceptPay.js +8 -4
- package/lib/chevre/repo/action/{actionProcess.d.ts → anyAction/actionProcess.d.ts} +18 -45
- package/lib/chevre/repo/action/{actionProcess.js → anyAction/actionProcess.js} +26 -91
- package/lib/chevre/repo/action/anyAction/actionRecipe.d.ts +37 -0
- package/lib/chevre/repo/action/anyAction/actionRecipe.js +53 -0
- package/lib/chevre/repo/action/authorizeInvoice.d.ts +5 -8
- package/lib/chevre/repo/action/authorizeInvoice.js +7 -4
- package/lib/chevre/repo/action/authorizeOffer.d.ts +3 -1
- package/lib/chevre/repo/action/authorizeOffer.js +7 -2
- package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +3 -1
- package/lib/chevre/repo/action/authorizePaymentMethod.js +7 -4
- package/lib/chevre/repo/action/authorizeTicketedObject.d.ts +3 -1
- package/lib/chevre/repo/action/authorizeTicketedObject.js +7 -2
- package/lib/chevre/repo/action/checkMovieTicket.d.ts +3 -1
- package/lib/chevre/repo/action/checkMovieTicket.js +8 -1
- package/lib/chevre/repo/action/create.d.ts +10 -0
- package/lib/chevre/repo/action/create.js +17 -0
- package/lib/chevre/repo/action/inform.d.ts +38 -0
- package/lib/chevre/repo/action/inform.js +146 -0
- package/lib/chevre/repo/action/pay.d.ts +3 -1
- package/lib/chevre/repo/action/pay.js +7 -4
- package/lib/chevre/repo/action/refund.d.ts +3 -1
- package/lib/chevre/repo/action/refund.js +7 -4
- package/lib/chevre/repo/action/sendEmailMessage.d.ts +10 -0
- package/lib/chevre/repo/action/sendEmailMessage.js +17 -0
- package/lib/chevre/repo/action/sendOrder.d.ts +10 -0
- package/lib/chevre/repo/action/sendOrder.js +16 -0
- package/lib/chevre/repo/action/unknown2actionError.d.ts +6 -0
- package/lib/chevre/repo/action/unknown2actionError.js +15 -0
- package/lib/chevre/repo/action/update.d.ts +48 -0
- package/lib/chevre/repo/action/update.js +166 -0
- package/lib/chevre/repo/action/use.d.ts +39 -0
- package/lib/chevre/repo/action/use.js +153 -0
- package/lib/chevre/repo/action.d.ts +5 -101
- package/lib/chevre/repo/action.js +7 -453
- package/lib/chevre/repo/adminAction.d.ts +87 -0
- package/lib/chevre/repo/adminAction.js +170 -0
- package/lib/chevre/repo/adminAssetTransaction.d.ts +126 -0
- package/lib/chevre/repo/adminAssetTransaction.js +491 -0
- package/lib/chevre/repo/adminAsyncAction.d.ts +2 -2
- package/lib/chevre/repo/adminScheduledTask.d.ts +1 -1
- package/lib/chevre/repo/adminTask.d.ts +25 -8
- package/lib/chevre/repo/adminTask.js +31 -32
- package/lib/chevre/repo/adminTransaction.d.ts +131 -0
- package/lib/chevre/repo/adminTransaction.js +237 -0
- package/lib/chevre/repo/aggregateAction.d.ts +8 -11
- package/lib/chevre/repo/aggregateAction.js +0 -61
- package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
- package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
- package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
- package/lib/chevre/repo/aggregateTransaction.js +166 -0
- package/lib/chevre/repo/aggregateUseAction.d.ts +35 -0
- package/lib/chevre/repo/aggregateUseAction.js +164 -0
- package/lib/chevre/repo/aggregation.d.ts +0 -8
- package/lib/chevre/repo/aggregation.js +0 -10
- package/lib/chevre/repo/assetTransaction.d.ts +10 -235
- package/lib/chevre/repo/assetTransaction.js +48 -636
- package/lib/chevre/repo/asyncAction.d.ts +2 -2
- package/lib/chevre/repo/authorization.d.ts +0 -6
- package/lib/chevre/repo/authorization.js +15 -27
- package/lib/chevre/repo/message.d.ts +0 -7
- package/lib/chevre/repo/message.js +0 -38
- package/lib/chevre/repo/migrateAction.d.ts +48 -0
- package/lib/chevre/repo/migrateAction.js +32 -0
- package/lib/chevre/repo/mongoose/schemas/action/inform.d.ts +11 -0
- package/lib/chevre/repo/mongoose/schemas/action/inform.js +82 -0
- package/lib/chevre/repo/mongoose/schemas/action/update.d.ts +12 -0
- package/lib/chevre/repo/mongoose/schemas/action/update.js +112 -0
- package/lib/chevre/repo/mongoose/schemas/{ownershipInfo.d.ts → action/use.d.ts} +4 -6
- package/lib/chevre/repo/mongoose/schemas/action/use.js +92 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +22 -7
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +19 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +8 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +95 -76
- package/lib/chevre/repo/mongoose/schemas/authorization.js +25 -18
- package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/message.js +8 -1
- package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +2 -5
- package/lib/chevre/repo/mongoose/schemas/task.js +134 -118
- package/lib/chevre/repo/mongoose/schemas/ticket.js +8 -1
- package/lib/chevre/repo/orderInTransaction.d.ts +0 -3
- package/lib/chevre/repo/orderInTransaction.js +30 -22
- package/lib/chevre/repo/scheduledTask.d.ts +5 -2
- package/lib/chevre/repo/scheduledTask.js +3 -25
- package/lib/chevre/repo/task.d.ts +45 -171
- package/lib/chevre/repo/task.js +20 -475
- package/lib/chevre/repo/taskDelayed.d.ts +74 -0
- package/lib/chevre/repo/taskDelayed.js +195 -0
- package/lib/chevre/repo/taskRunning.d.ts +35 -0
- package/lib/chevre/repo/taskRunning.js +89 -0
- package/lib/chevre/repo/ticket.d.ts +0 -6
- package/lib/chevre/repo/ticket.js +0 -11
- package/lib/chevre/repo/transaction.d.ts +1 -187
- package/lib/chevre/repo/transaction.js +2 -383
- package/lib/chevre/repository.d.ts +50 -10
- package/lib/chevre/repository.js +112 -24
- package/lib/chevre/service/aggregation/system.d.ts +9 -8
- package/lib/chevre/service/aggregation/system.js +5 -5
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/asyncAction.d.ts +2 -2
- package/lib/chevre/service/asyncAction.js +1 -4
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +2 -2
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +0 -2
- package/lib/chevre/service/asyncActionHandler.d.ts +4 -4
- package/lib/chevre/service/asyncActionHandler.js +11 -13
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +4 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
- package/lib/chevre/service/event.d.ts +4 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/notification/sendEmailMessage.d.ts +4 -2
- package/lib/chevre/service/notification/sendEmailMessage.js +3 -3
- package/lib/chevre/service/notification/triggerWebhook.d.ts +4 -2
- package/lib/chevre/service/notification/triggerWebhook.js +5 -16
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +0 -4
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +19 -19
- package/lib/chevre/service/offer/onEventChanged.js +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +4 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +2 -56
- package/lib/chevre/service/order/deleteOrder.d.ts +2 -2
- package/lib/chevre/service/order/deleteOrder.js +1 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +4 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +2 -10
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +4 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -11
- package/lib/chevre/service/order/onOrderUpdated/factory.js +0 -3
- package/lib/chevre/service/order/returnOrder.d.ts +0 -2
- package/lib/chevre/service/order/returnOrder.js +8 -40
- package/lib/chevre/service/order/sendOrder.d.ts +4 -6
- package/lib/chevre/service/order/sendOrder.js +30 -72
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findAcceptAction.js +19 -19
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +19 -19
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findCheckAction.js +19 -19
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -2
- package/lib/chevre/service/project.d.ts +0 -6
- package/lib/chevre/service/project.js +0 -2
- package/lib/chevre/service/reserve/cancelReservation.js +3 -3
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
- package/lib/chevre/service/reserve/useReservation.d.ts +4 -0
- package/lib/chevre/service/reserve/useReservation.js +6 -24
- package/lib/chevre/service/scheduledTask.d.ts +1 -4
- package/lib/chevre/service/scheduledTask.js +3 -10
- package/lib/chevre/service/scheduledTaskHandler/onOperationFailed.js +1 -2
- package/lib/chevre/service/scheduledTaskHandler.js +0 -13
- package/lib/chevre/service/task/acceptCOAOffer.js +1 -14
- package/lib/chevre/service/task/authorizePayment.js +1 -7
- package/lib/chevre/service/task/checkMovieTicket.js +1 -7
- package/lib/chevre/service/task/checkResource.js +14 -57
- package/lib/chevre/service/task/confirmReserveTransaction.js +3 -1
- package/lib/chevre/service/task/createAccountingReport.js +8 -15
- package/lib/chevre/service/task/deleteTransaction.js +10 -41
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted.js +4 -3
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated.js +0 -8
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -13
- package/lib/chevre/service/task/returnOrder.js +2 -5
- package/lib/chevre/service/task/returnPayTransaction.js +2 -5
- package/lib/chevre/service/task/sendEmailMessage.js +2 -2
- package/lib/chevre/service/task/sendOrder.js +4 -8
- package/lib/chevre/service/task/syncResourcesFromCOA.js +31 -23
- package/lib/chevre/service/task/triggerWebhook.js +4 -2
- package/lib/chevre/service/task/useReservation.js +4 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +5 -8
- package/lib/chevre/service/task.d.ts +3 -22
- package/lib/chevre/service/task.js +8 -40
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +0 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +3 -2
- package/lib/chevre/service/taskHandler/onOperationFailed.js +5 -16
- package/lib/chevre/service/taskHandler.d.ts +1 -2
- package/lib/chevre/service/taskHandler.js +7 -19
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +8 -4
- package/lib/chevre/service/transaction/deleteTransaction.js +7 -7
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +8 -4
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +55 -103
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +2 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +14 -10
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.d.ts +13 -3
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +48 -51
- package/lib/chevre/service/transaction/returnOrder.d.ts +2 -0
- package/lib/chevre/service/transaction/returnOrder.js +15 -13
- package/lib/chevre/service/transaction.d.ts +2 -0
- package/lib/chevre/service/transaction.js +0 -2
- package/lib/chevre/service/validation/validateOrder.d.ts +0 -4
- package/lib/chevre/service/validation/validateOrder.js +3 -3
- package/lib/chevre/taskSettings.d.ts +4 -4
- package/package.json +2 -2
- package/lib/chevre/repo/action/checkThing.d.ts +0 -8
- package/lib/chevre/repo/action/checkThing.js +0 -13
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -227
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.d.ts +0 -25
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.js +0 -100
- package/lib/chevre/repo/ownershipInfo.d.ts +0 -122
- package/lib/chevre/repo/ownershipInfo.js +0 -466
- package/lib/chevre/service/validation/validateEvent.d.ts +0 -11
- package/lib/chevre/service/validation/validateEvent.js +0 -21
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* プロジェクトサービス
|
|
3
3
|
*/
|
|
4
4
|
import type { AccountTitleRepo } from '../repo/accountTitle';
|
|
5
|
-
import type { ActionRepo } from '../repo/action';
|
|
6
5
|
import type { AssetTransactionRepo } from '../repo/assetTransaction';
|
|
7
6
|
import type { CategoryCodeRepo } from '../repo/categoryCode';
|
|
8
7
|
import type { CreativeWorkRepo } from '../repo/creativeWork';
|
|
@@ -18,12 +17,10 @@ import type { ProductRepo } from '../repo/product';
|
|
|
18
17
|
import type { ProjectRepo } from '../repo/project';
|
|
19
18
|
import type { ReservationRepo } from '../repo/reservation';
|
|
20
19
|
import type { SellerRepo } from '../repo/seller';
|
|
21
|
-
import type { TaskRepo } from '../repo/task';
|
|
22
20
|
export declare function deleteProject(params: {
|
|
23
21
|
id: string;
|
|
24
22
|
}): (repos: {
|
|
25
23
|
accountTitle: AccountTitleRepo;
|
|
26
|
-
action: ActionRepo;
|
|
27
24
|
categoryCode: CategoryCodeRepo;
|
|
28
25
|
creativeWork: CreativeWorkRepo;
|
|
29
26
|
event: EventRepo;
|
|
@@ -38,14 +35,12 @@ export declare function deleteProject(params: {
|
|
|
38
35
|
movieTheater: MovieTheaterRepo;
|
|
39
36
|
screeningRoom: ScreeningRoomRepo;
|
|
40
37
|
seller: SellerRepo;
|
|
41
|
-
task: TaskRepo;
|
|
42
38
|
assetTransaction: AssetTransactionRepo;
|
|
43
39
|
}) => Promise<void>;
|
|
44
40
|
export declare function cleanUpDatabaseByProject(params: {
|
|
45
41
|
id: string;
|
|
46
42
|
}): (repos: {
|
|
47
43
|
accountTitle: AccountTitleRepo;
|
|
48
|
-
action: ActionRepo;
|
|
49
44
|
assetTransaction: AssetTransactionRepo;
|
|
50
45
|
categoryCode: CategoryCodeRepo;
|
|
51
46
|
creativeWork: CreativeWorkRepo;
|
|
@@ -59,5 +54,4 @@ export declare function cleanUpDatabaseByProject(params: {
|
|
|
59
54
|
movieTheater: MovieTheaterRepo;
|
|
60
55
|
screeningRoom: ScreeningRoomRepo;
|
|
61
56
|
seller: SellerRepo;
|
|
62
|
-
task: TaskRepo;
|
|
63
57
|
}) => Promise<void>;
|
|
@@ -13,7 +13,6 @@ function cleanUpDatabaseByProject(params) {
|
|
|
13
13
|
return async (repos) => {
|
|
14
14
|
// プロジェクトに所属する全データをリポジトリから削除する
|
|
15
15
|
await repos.accountTitle.deleteByProject({ project: { id: params.id } });
|
|
16
|
-
await repos.action.deleteByProject({ project: { id: params.id } });
|
|
17
16
|
await repos.assetTransaction.deleteByProject({ project: { id: params.id } });
|
|
18
17
|
await repos.categoryCode.deleteCategoryCodesByProject({ project: { id: params.id } });
|
|
19
18
|
await repos.movieTicketType.deleteMovieTicketTypesByProject({ project: { id: params.id } });
|
|
@@ -26,6 +25,5 @@ function cleanUpDatabaseByProject(params) {
|
|
|
26
25
|
await repos.product.deleteByProject({ project: { id: params.id } });
|
|
27
26
|
await repos.reservation.deleteByProject({ project: { id: params.id } });
|
|
28
27
|
await repos.seller.deleteByProject({ project: { id: params.id } });
|
|
29
|
-
await repos.task.deleteByProject({ project: { id: params.id } });
|
|
30
28
|
};
|
|
31
29
|
}
|
|
@@ -39,7 +39,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
39
39
|
return async (repos) => {
|
|
40
40
|
const reserveTransactionId = params.purpose.id;
|
|
41
41
|
// 予約取引を検索
|
|
42
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
42
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
43
43
|
limit: 1,
|
|
44
44
|
page: 1,
|
|
45
45
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -169,7 +169,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
169
169
|
try {
|
|
170
170
|
if (actionAttributes.object.typeOf === factory_1.factory.reservationType.ReservationPackage) {
|
|
171
171
|
// 予約取引を検索
|
|
172
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
172
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
173
173
|
limit: 1,
|
|
174
174
|
page: 1,
|
|
175
175
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -226,7 +226,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
226
226
|
inclusion: ['reservationNumber', 'reservationStatus', 'project', 'reservedTicket', 'subReservation', 'reservationFor']
|
|
227
227
|
});
|
|
228
228
|
// 予約取引を検索
|
|
229
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
229
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
230
230
|
limit: 1,
|
|
231
231
|
page: 1,
|
|
232
232
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -90,7 +90,7 @@ function reserveIfNotYet(params) {
|
|
|
90
90
|
) => {
|
|
91
91
|
let reserveTransactions = [];
|
|
92
92
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
93
|
-
reserveTransactions = await repos.assetTransaction.
|
|
93
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
94
94
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
95
95
|
object: {
|
|
96
96
|
reservations: { id: { $in: params.object.ids } }
|
|
@@ -100,7 +100,7 @@ function reserveIfNotYet(params) {
|
|
|
100
100
|
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. ids:', params.object.ids, 'reserveTransactions:', JSON.stringify(reserveTransactions));
|
|
101
101
|
}
|
|
102
102
|
if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
103
|
-
reserveTransactions = await repos.assetTransaction.
|
|
103
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
104
104
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
105
105
|
object: {
|
|
106
106
|
reservationNumber: { $in: params.object.reservationNumbers }
|
|
@@ -140,7 +140,7 @@ function reserveIfNotYet(
|
|
|
140
140
|
params, options) {
|
|
141
141
|
return async (repos) => {
|
|
142
142
|
const reservationPackage = params.object;
|
|
143
|
-
const reserveTransaction = (await repos.assetTransaction.
|
|
143
|
+
const reserveTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
144
144
|
limit: 1,
|
|
145
145
|
page: 1,
|
|
146
146
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -42,7 +42,7 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
|
42
42
|
// );
|
|
43
43
|
const taskIdentifier = `${project.id}:${factory_1.factory.taskName.OnAuthorizationCreated}:${factory_1.factory.assetTransactionType.Reserve}:${reservationNumber}:onReservationConfirmed`;
|
|
44
44
|
onAuthorizationCreatedTask = {
|
|
45
|
-
alternateName: taskIdentifier,
|
|
45
|
+
// alternateName: taskIdentifier,
|
|
46
46
|
identifier: taskIdentifier,
|
|
47
47
|
name: factory_1.factory.taskName.OnAuthorizationCreated,
|
|
48
48
|
status: factory_1.factory.taskStatus.Ready,
|
|
@@ -137,7 +137,7 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
|
137
137
|
await repos.task.saveMany(taskAttributes);
|
|
138
138
|
}
|
|
139
139
|
if (onAuthorizationCreatedTask !== undefined) {
|
|
140
|
-
await repos.task.
|
|
140
|
+
await repos.task.runTaskByIdentifier(onAuthorizationCreatedTask);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
2
|
import type { ActionRepo } from '../../repo/action';
|
|
3
|
+
import type { UseActionRepo } from '../../repo/action/use';
|
|
3
4
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
5
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
5
6
|
import type { OrderRepo } from '../../repo/order';
|
|
@@ -26,6 +27,9 @@ export declare function useReservation(params: {
|
|
|
26
27
|
};
|
|
27
28
|
}): (repos: {
|
|
28
29
|
action: ActionRepo;
|
|
30
|
+
actions: {
|
|
31
|
+
use: UseActionRepo;
|
|
32
|
+
};
|
|
29
33
|
assetTransaction: AssetTransactionRepo;
|
|
30
34
|
code: AuthorizationRepo;
|
|
31
35
|
order: OrderRepo;
|
|
@@ -23,8 +23,6 @@ function useReservation(params) {
|
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
// } else {
|
|
27
|
-
// ticketToken = params?.instrument?.ticketToken;
|
|
28
26
|
}
|
|
29
27
|
// if (params.verifyToken === true) {} // タスク作成前に検証済なので検証不要
|
|
30
28
|
// confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
|
|
@@ -33,29 +31,15 @@ function useReservation(params) {
|
|
|
33
31
|
const reservation = await repos.reservation.findReservationById({
|
|
34
32
|
id: reservationId,
|
|
35
33
|
inclusion: [
|
|
36
|
-
// 'issuedThrough',
|
|
37
|
-
// 'reservedTicket',
|
|
38
34
|
'project', 'reservationFor', 'reservationNumber', 'typeOf'
|
|
39
35
|
]
|
|
40
36
|
});
|
|
41
|
-
// if (typeof reservation.issuedThrough.id !== 'string') {
|
|
42
|
-
// // COA予約では予約使用アクションを想定していないので、興行idは必ず存在するはず
|
|
43
|
-
// throw new factory.errors.Internal('reservation.issuedThrough.id must be string');
|
|
44
|
-
// }
|
|
45
|
-
// const { reservedTicket } = reservation;
|
|
46
37
|
// optimize(2026-05-06~)
|
|
47
38
|
const reservationAsObject = {
|
|
48
39
|
id: reservation.id,
|
|
49
40
|
reservationNumber: reservation.reservationNumber,
|
|
50
41
|
typeOf: reservation.typeOf,
|
|
51
|
-
reservationFor: { id: reservation.reservationFor.id, typeOf: reservation.reservationFor.typeOf }
|
|
52
|
-
// discontinue issuedThrough,reservedTicket(2026-05-06~)
|
|
53
|
-
// issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
|
|
54
|
-
// reservedTicket: {
|
|
55
|
-
// typeOf: reservedTicket.typeOf,
|
|
56
|
-
// ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
|
|
57
|
-
// ...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
|
|
58
|
-
// }
|
|
42
|
+
reservationFor: { id: reservation.reservationFor.id, typeOf: reservation.reservationFor.typeOf }
|
|
59
43
|
};
|
|
60
44
|
// extend instrument to array(2025-02-18~)
|
|
61
45
|
const instrument = [
|
|
@@ -79,7 +63,7 @@ function useReservation(params) {
|
|
|
79
63
|
? { location: { typeOf: factory_1.factory.placeType.Place, identifier: params.location.identifier } }
|
|
80
64
|
: undefined
|
|
81
65
|
};
|
|
82
|
-
const action = await repos.
|
|
66
|
+
const action = await repos.actions.use.startUseAction(actionAttributes);
|
|
83
67
|
// ひとまず予約数:1に限定する
|
|
84
68
|
if (actionAttributes.object.length !== 1) {
|
|
85
69
|
throw new factory_1.factory.errors.Argument('object', 'number of using reservations must be 1');
|
|
@@ -91,14 +75,14 @@ function useReservation(params) {
|
|
|
91
75
|
}
|
|
92
76
|
catch (error) {
|
|
93
77
|
try {
|
|
94
|
-
await repos.
|
|
78
|
+
await repos.actions.use.giveUpUseAction({ typeOf: action.typeOf, id: action.id, error });
|
|
95
79
|
}
|
|
96
80
|
catch (__) {
|
|
97
81
|
// 失敗したら仕方ない
|
|
98
82
|
}
|
|
99
83
|
throw error;
|
|
100
84
|
}
|
|
101
|
-
await repos.
|
|
85
|
+
await repos.actions.use.completeUseAction({ typeOf: action.typeOf, id: action.id });
|
|
102
86
|
await (0, onReservationUsed_1.onReservationUsed)(attendedReservation, {
|
|
103
87
|
...actionAttributes,
|
|
104
88
|
id: action.id,
|
|
@@ -107,12 +91,10 @@ function useReservation(params) {
|
|
|
107
91
|
};
|
|
108
92
|
}
|
|
109
93
|
function reserveIfNotYet(params) {
|
|
110
|
-
return async (repos
|
|
111
|
-
// settings: Settings
|
|
112
|
-
) => {
|
|
94
|
+
return async (repos) => {
|
|
113
95
|
let reserveTransactions = [];
|
|
114
96
|
if (typeof params.object.id === 'string' && params.object.id.length > 0) {
|
|
115
|
-
reserveTransactions = await repos.assetTransaction.
|
|
97
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
116
98
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
117
99
|
object: {
|
|
118
100
|
reservations: { id: { $in: [params.object.id] } }
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { IExecuteSettings as IMinimumExecuteSettings, IRunningTask } from '../eventEmitter/task';
|
|
2
|
-
|
|
3
|
-
interface IExecuteSettings extends IMinimumExecuteSettings {
|
|
4
|
-
aggregationSettings?: AggregationSettings;
|
|
5
|
-
}
|
|
2
|
+
type IExecuteSettings = IMinimumExecuteSettings;
|
|
6
3
|
type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
7
4
|
/**
|
|
8
5
|
* Runningの予定タスクを実行する
|
|
@@ -19,22 +19,15 @@ function executeScheduledTaskById(params) {
|
|
|
19
19
|
const { id } = params;
|
|
20
20
|
let task = null;
|
|
21
21
|
try {
|
|
22
|
-
task = await scheduledTaskRepo.findRunningScheduledTaskById({
|
|
23
|
-
id,
|
|
24
|
-
// status,
|
|
25
|
-
// executor: { name: executor.name }
|
|
26
|
-
});
|
|
22
|
+
task = await scheduledTaskRepo.findRunningScheduledTaskById({ id });
|
|
27
23
|
}
|
|
28
24
|
catch (error) {
|
|
29
25
|
/* istanbul ignore next */
|
|
30
|
-
debug('
|
|
26
|
+
debug('scheduledTaskRepo.findRunningScheduledTaskById error:', error);
|
|
31
27
|
}
|
|
32
28
|
// タスクがなければ終了
|
|
33
29
|
if (task !== null) {
|
|
34
|
-
await (0, scheduledTaskHandler_1.executeScheduledTask)(task)(settings, {
|
|
35
|
-
executeById: true,
|
|
36
|
-
executeByName: false
|
|
37
|
-
});
|
|
30
|
+
await (0, scheduledTaskHandler_1.executeScheduledTask)(task)(settings, {});
|
|
38
31
|
}
|
|
39
32
|
};
|
|
40
33
|
}
|
|
@@ -13,7 +13,7 @@ function onOperationFailed(params) {
|
|
|
13
13
|
error = { message: String(error) };
|
|
14
14
|
}
|
|
15
15
|
const endDate = new Date();
|
|
16
|
-
// remainingNumberOfTries<=0ならAborted
|
|
16
|
+
// remainingNumberOfTries<=0ならAborted
|
|
17
17
|
const isRetryable = task.remainingNumberOfTries > 0;
|
|
18
18
|
if (isRetryable) {
|
|
19
19
|
const result = {
|
|
@@ -35,7 +35,6 @@ function onOperationFailed(params) {
|
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
// 予定タスクは分析連携不要
|
|
38
|
-
// await informTaskIfNeeded({ task, executionEndDate: endDate })(repos);
|
|
39
38
|
const result = {
|
|
40
39
|
executedAt: now,
|
|
41
40
|
endDate,
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.taskLoader = void 0;
|
|
7
4
|
exports.executeScheduledTask = executeScheduledTask;
|
|
8
|
-
const debug_1 = __importDefault(require("debug"));
|
|
9
5
|
const factory_1 = require("../factory");
|
|
10
6
|
const onOperationFailed_1 = require("./scheduledTaskHandler/onOperationFailed");
|
|
11
|
-
const debug = (0, debug_1.default)('chevre-domain:service:scheduledTaskHandler');
|
|
12
7
|
exports.taskLoader = {
|
|
13
8
|
load: (taskName) => {
|
|
14
9
|
return import(`./task/${taskName}.js`);
|
|
@@ -19,18 +14,10 @@ exports.taskLoader = {
|
|
|
19
14
|
*/
|
|
20
15
|
function executeScheduledTask(task) {
|
|
21
16
|
const now = new Date();
|
|
22
|
-
debug('executing an executableTask...', task, now);
|
|
23
17
|
return async (settings, options) => {
|
|
24
18
|
const scheduledTaskRepo = new (await import('../repo/scheduledTask.js')).ScheduledTaskRepo(settings.connection);
|
|
25
19
|
try {
|
|
26
20
|
// 予定タスクのexpiresはDBのttl基準なので期限検証はしない
|
|
27
|
-
// if (task.expires instanceof Date) {
|
|
28
|
-
// const taskExpired: boolean = moment(now)
|
|
29
|
-
// .isAfter(task.expires);
|
|
30
|
-
// if (taskExpired) {
|
|
31
|
-
// throw new factory.errors.Internal(`task expired [expires:${task.expires}]`);
|
|
32
|
-
// }
|
|
33
|
-
// }
|
|
34
21
|
// remainingNumberOfTries<0ならcallを実行しない(2025-08-04~)
|
|
35
22
|
// リトライを繰り返した後、不明の原因でRunningのまま残ってしまったタスクがリトライされたケース
|
|
36
23
|
const { remainingNumberOfTries } = task;
|
|
@@ -7,9 +7,6 @@ const acceptCOAOffer_1 = require("../../repo/action/acceptCOAOffer");
|
|
|
7
7
|
const authorizeOffer_1 = require("../../repo/action/authorizeOffer");
|
|
8
8
|
const credentials_1 = require("../../repo/credentials");
|
|
9
9
|
const event_1 = require("../../repo/event");
|
|
10
|
-
// import { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
11
|
-
// import { OrderNumberRepo } from '../../repo/orderNumber';
|
|
12
|
-
// import { ProjectRepo } from '../../repo/project';
|
|
13
10
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
14
11
|
const integration_1 = require("../../repo/setting/integration");
|
|
15
12
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -19,14 +16,10 @@ let coaAuthClient;
|
|
|
19
16
|
* タスク実行関数
|
|
20
17
|
*/
|
|
21
18
|
function call(params) {
|
|
22
|
-
return async ({ connection, redisClient }
|
|
19
|
+
return async ({ connection, redisClient }) => {
|
|
23
20
|
if (redisClient === undefined) {
|
|
24
21
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
25
22
|
}
|
|
26
|
-
// 遅延実行(executeByName)には対応しない
|
|
27
|
-
if (!options.executeById) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
23
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
31
24
|
const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
|
|
32
25
|
const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
@@ -57,7 +50,6 @@ function call(params) {
|
|
|
57
50
|
});
|
|
58
51
|
}
|
|
59
52
|
const actionRepo = new acceptCOAOffer_1.AcceptCOAOfferActionRepo(connection);
|
|
60
|
-
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
61
53
|
try {
|
|
62
54
|
const coaIntegrationSettings = await settings.getByKey('coa');
|
|
63
55
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
@@ -86,8 +78,6 @@ function call(params) {
|
|
|
86
78
|
action: actionRepo,
|
|
87
79
|
authorizeOfferAction: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
|
|
88
80
|
event: new event_1.EventRepo(connection),
|
|
89
|
-
// orderNumber: new OrderNumberRepo({ connection }),
|
|
90
|
-
// project: new ProjectRepo(connection),
|
|
91
81
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
92
82
|
reserveService,
|
|
93
83
|
masterService
|
|
@@ -104,9 +94,6 @@ function call(params) {
|
|
|
104
94
|
})({
|
|
105
95
|
action: actionRepo,
|
|
106
96
|
event: new event_1.EventRepo(connection),
|
|
107
|
-
// orderInTransaction: new OrderInTransactionRepo(connection),
|
|
108
|
-
// orderNumber: new OrderNumberRepo({ connection }),
|
|
109
|
-
// project: new ProjectRepo(connection),
|
|
110
97
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
111
98
|
reserveService,
|
|
112
99
|
masterService
|
|
@@ -34,19 +34,13 @@ const any_1 = require("../payment/any");
|
|
|
34
34
|
* タスク実行関数
|
|
35
35
|
*/
|
|
36
36
|
function call(params) {
|
|
37
|
-
return async ({ connection, redisClient }
|
|
37
|
+
return async ({ connection, redisClient }) => {
|
|
38
38
|
if (redisClient === undefined) {
|
|
39
39
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
40
40
|
}
|
|
41
|
-
// 遅延実行(executeByName)には対応しない
|
|
42
|
-
if (!options.executeById) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
41
|
let callResult;
|
|
46
42
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
47
|
-
// const actionRepo = new ActionRepo(connection);
|
|
48
43
|
const authorizePaymentMethodActionRepo = new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection);
|
|
49
|
-
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
50
44
|
const paymentServiceId = params.data.object.issuedThrough.id;
|
|
51
45
|
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
52
46
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
@@ -9,23 +9,17 @@ const paymentService_1 = require("../../repo/paymentService");
|
|
|
9
9
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
10
10
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
11
11
|
const integration_1 = require("../../repo/setting/integration");
|
|
12
|
-
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
13
12
|
const pay_1 = require("../assetTransaction/pay");
|
|
14
13
|
/**
|
|
15
14
|
* タスク実行関数
|
|
16
15
|
*/
|
|
17
16
|
function call(params) {
|
|
18
|
-
return async ({ connection, redisClient }
|
|
17
|
+
return async ({ connection, redisClient }) => {
|
|
19
18
|
if (redisClient === undefined) {
|
|
20
19
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
21
20
|
}
|
|
22
|
-
// 遅延実行(executeByName)には対応しない
|
|
23
|
-
if (!options.executeById) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
21
|
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
27
22
|
const actionRepo = new checkMovieTicket_1.CheckMovieTicketActionRepo(connection);
|
|
28
|
-
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
29
23
|
const paymentServiceId = params.data.object[0]?.id;
|
|
30
24
|
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
31
25
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
@@ -3,72 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
5
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
6
|
-
const checkThing_1 = require("../../repo/action/checkThing");
|
|
7
6
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
8
|
-
const event_1 = require("../../repo/event");
|
|
9
7
|
const order_1 = require("../../repo/order");
|
|
10
|
-
const setting_1 = require("../../repo/setting");
|
|
11
|
-
const stockHolder_1 = require("../../repo/stockHolder");
|
|
12
|
-
const task_1 = require("../../repo/task");
|
|
13
|
-
const validateEvent_1 = require("../validation/validateEvent");
|
|
14
8
|
const validateOrder_1 = require("../validation/validateOrder");
|
|
15
9
|
/**
|
|
16
10
|
* タスク実行関数
|
|
17
11
|
*/
|
|
18
12
|
function call(params) {
|
|
19
|
-
return async ({ connection
|
|
20
|
-
if (redisClient === undefined) {
|
|
21
|
-
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
22
|
-
}
|
|
23
|
-
const actionRepo = new checkThing_1.CheckThingActionRepo(connection);
|
|
13
|
+
return async ({ connection }) => {
|
|
24
14
|
const { data } = params;
|
|
25
|
-
const actionAttributes = {
|
|
26
|
-
agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
27
|
-
object: data.object,
|
|
28
|
-
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
29
|
-
typeOf: factory_1.factory.actionType.CheckAction,
|
|
30
|
-
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-22~)
|
|
31
|
-
};
|
|
32
|
-
const action = await actionRepo.start(actionAttributes);
|
|
33
15
|
const objectTypeOf = data.object.typeOf;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
break;
|
|
48
|
-
// support ScreeningEvent(2025-05-01~)
|
|
49
|
-
case factory_1.factory.eventType.ScreeningEvent:
|
|
50
|
-
await (0, validateEvent_1.validateEvent)({
|
|
51
|
-
id: data.object.id,
|
|
52
|
-
project: { id: params.project.id }
|
|
53
|
-
})({
|
|
54
|
-
event: new event_1.EventRepo(connection),
|
|
55
|
-
stockHolder: new stockHolder_1.StockHolderRepo({ connection })
|
|
56
|
-
});
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
throw new factory_1.factory.errors.NotImplemented(`${objectTypeOf} not implemented`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
try {
|
|
64
|
-
await actionRepo.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
65
|
-
}
|
|
66
|
-
catch (__) {
|
|
67
|
-
// 失敗したら仕方ない
|
|
68
|
-
}
|
|
69
|
-
throw error;
|
|
16
|
+
switch (objectTypeOf) {
|
|
17
|
+
case factory_1.factory.order.OrderType.Order:
|
|
18
|
+
await (0, validateOrder_1.validateOrder)({
|
|
19
|
+
orderNumber: data.object.orderNumber,
|
|
20
|
+
project: { id: params.project.id }
|
|
21
|
+
})({
|
|
22
|
+
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
23
|
+
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
24
|
+
order: new order_1.OrderRepo(connection),
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
throw new factory_1.factory.errors.NotImplemented(`${objectTypeOf} not implemented`);
|
|
70
29
|
}
|
|
71
|
-
const actionResult = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
72
|
-
await actionRepo.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
73
30
|
};
|
|
74
31
|
}
|
|
@@ -247,7 +247,9 @@ function onConfirmed(params, options) {
|
|
|
247
247
|
},
|
|
248
248
|
useOnOrderStatusChanged: options.useOnOrderStatusChanged === true
|
|
249
249
|
};
|
|
250
|
+
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s', params.project.id, factory_1.factory.taskName.OnAssetTransactionStatusChanged, onAssetTransactionStatusChangedTaskData.purpose.orderNumber, onAssetTransactionStatusChangedTaskData.object.transactionNumber);
|
|
250
251
|
const onAssetTransactionStatusChangedTask = {
|
|
252
|
+
identifier: taskIdentifier,
|
|
251
253
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
252
254
|
name: factory_1.factory.taskName.OnAssetTransactionStatusChanged,
|
|
253
255
|
status: factory_1.factory.taskStatus.Ready,
|
|
@@ -257,7 +259,7 @@ function onConfirmed(params, options) {
|
|
|
257
259
|
executionResults: [],
|
|
258
260
|
data: onAssetTransactionStatusChangedTaskData
|
|
259
261
|
};
|
|
260
|
-
await repos.task.
|
|
262
|
+
await repos.task.runTaskByIdentifier(onAssetTransactionStatusChangedTask);
|
|
261
263
|
}
|
|
262
264
|
};
|
|
263
265
|
}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
6
5
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
7
|
-
const
|
|
6
|
+
const create_1 = require("../../repo/action/create");
|
|
8
7
|
const order_1 = require("../../repo/order");
|
|
9
8
|
const createAccountingReportIfNotExist_1 = require("../order/createAccountingReportIfNotExist");
|
|
10
9
|
/**
|
|
@@ -13,9 +12,10 @@ const createAccountingReportIfNotExist_1 = require("../order/createAccountingRep
|
|
|
13
12
|
function call(params) {
|
|
14
13
|
return async ({ connection }) => {
|
|
15
14
|
await createAccountingReport(params)({
|
|
16
|
-
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
17
15
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
18
|
-
|
|
16
|
+
actions: {
|
|
17
|
+
create: new create_1.CreateActionRepo(connection)
|
|
18
|
+
},
|
|
19
19
|
order: new order_1.OrderRepo(connection)
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -28,10 +28,6 @@ function createAccountingReport(params) {
|
|
|
28
28
|
project: { id: params.project.id },
|
|
29
29
|
inclusion: [
|
|
30
30
|
'orderNumber', 'project', 'paymentMethods', 'seller', 'typeOf', 'orderDate'
|
|
31
|
-
// 'customer', 'confirmationNumber',
|
|
32
|
-
// 'orderedItem',
|
|
33
|
-
// 'broker',
|
|
34
|
-
// 'price', 'priceCurrency',
|
|
35
31
|
]
|
|
36
32
|
});
|
|
37
33
|
const simpleOrder = {
|
|
@@ -51,16 +47,13 @@ function createAccountingReport(params) {
|
|
|
51
47
|
purpose: simpleOrder,
|
|
52
48
|
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-21~)
|
|
53
49
|
};
|
|
54
|
-
const action = await repos.
|
|
50
|
+
const action = await repos.actions.create.start(actionAttributes);
|
|
55
51
|
try {
|
|
56
|
-
await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(
|
|
57
|
-
...order,
|
|
58
|
-
// acceptedOffers
|
|
59
|
-
})(repos);
|
|
52
|
+
await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(order)(repos);
|
|
60
53
|
}
|
|
61
54
|
catch (error) {
|
|
62
55
|
try {
|
|
63
|
-
await repos.
|
|
56
|
+
await repos.actions.create.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
64
57
|
}
|
|
65
58
|
catch (__) {
|
|
66
59
|
// 失敗したら仕方ない
|
|
@@ -68,6 +61,6 @@ function createAccountingReport(params) {
|
|
|
68
61
|
throw error;
|
|
69
62
|
}
|
|
70
63
|
const result = {};
|
|
71
|
-
await repos.
|
|
64
|
+
await repos.actions.create.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
72
65
|
};
|
|
73
66
|
}
|