@chevre/domain 26.0.0-alpha.8 → 26.0.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 +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/anyAction/actionProcess.d.ts +120 -0
- package/lib/chevre/repo/action/{actionProcess.js → anyAction/actionProcess.js} +28 -157
- 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/cancel.d.ts +25 -0
- package/lib/chevre/repo/action/cancel.js +47 -0
- package/lib/chevre/repo/action/checkMovieTicket.d.ts +3 -1
- package/lib/chevre/repo/action/checkMovieTicket.js +8 -1
- package/lib/chevre/repo/action/confirm.d.ts +11 -0
- package/lib/chevre/repo/action/confirm.js +16 -0
- 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/order.d.ts +21 -0
- package/lib/chevre/repo/action/order.js +35 -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/reserve.d.ts +21 -0
- package/lib/chevre/repo/action/reserve.js +37 -0
- package/lib/chevre/repo/action/returnAction.d.ts +11 -0
- package/lib/chevre/repo/action/returnAction.js +16 -0
- 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 → adminAction.d.ts} +11 -37
- package/lib/chevre/repo/adminAction.js +176 -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 +5 -16
- 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 +4 -1
- package/lib/chevre/repo/scheduledTask.js +3 -25
- package/lib/chevre/repo/task.d.ts +44 -150
- package/lib/chevre/repo/task.js +13 -446
- 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 +65 -25
- package/lib/chevre/repository.js +144 -56
- 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/pay/confirm.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/refund.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +8 -4
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -1
- 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/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +0 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +4 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +9 -5
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +6 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -9
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +6 -4
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -15
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- 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.d.ts +4 -10
- package/lib/chevre/service/order/confirmPayTransaction.js +7 -11
- 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 +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +1 -9
- 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 +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/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +4 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +6 -4
- package/lib/chevre/service/order/placeOrder.js +9 -17
- package/lib/chevre/service/order/returnOrder.d.ts +4 -4
- package/lib/chevre/service/order/returnOrder.js +11 -43
- 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/authorize/fixTransactionNumber.d.ts +0 -1
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +0 -1
- package/lib/chevre/service/payment/any/authorize.d.ts +0 -1
- 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/invalidatePaymentUrl.d.ts +0 -1
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +0 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +0 -1
- package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +0 -1
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
- 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/payment/any/voidPayTransaction.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +0 -1
- package/lib/chevre/service/project.d.ts +0 -6
- package/lib/chevre/service/project.js +0 -2
- package/lib/chevre/service/reserve/cancelReservation.d.ts +7 -3
- package/lib/chevre/service/reserve/cancelReservation.js +15 -25
- package/lib/chevre/service/reserve/checkInReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/confirmReservation.js +10 -36
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -1
- package/lib/chevre/service/reserve/useReservation.d.ts +6 -2
- package/lib/chevre/service/reserve/useReservation.js +6 -24
- package/lib/chevre/service/reserveCOA/cancelReservation.d.ts +4 -2
- package/lib/chevre/service/reserveCOA/cancelReservation.js +3 -3
- 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/cancelPendingReservation.js +3 -4
- package/lib/chevre/service/task/cancelReservation.js +3 -5
- package/lib/chevre/service/task/checkMovieTicket.js +1 -7
- package/lib/chevre/service/task/checkResource.js +14 -57
- package/lib/chevre/service/task/confirmPayTransaction.js +11 -12
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +12 -7
- 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/invalidatePaymentUrl.js +0 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +4 -13
- 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 -10
- package/lib/chevre/service/task/pay.js +0 -1
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/payByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/refundByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +0 -2
- package/lib/chevre/service/task/placeOrder.js +8 -6
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -13
- package/lib/chevre/service/task/refund.js +0 -1
- package/lib/chevre/service/task/reserve.js +3 -6
- package/lib/chevre/service/task/returnOrder.js +3 -7
- package/lib/chevre/service/task/returnPayTransaction.js +9 -19
- package/lib/chevre/service/task/returnReserveTransaction.js +5 -6
- 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 +6 -2
- package/lib/chevre/service/task/voidPayment.js +0 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +11 -13
- 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 +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +11 -17
- package/lib/chevre/service/transaction/returnOrder.js +11 -17
- 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/actionProcess.d.ts +0 -147
- package/lib/chevre/repo/action/checkThing.d.ts +0 -8
- package/lib/chevre/repo/action/checkThing.js +0 -13
- package/lib/chevre/repo/action.js +0 -468
- package/lib/chevre/repo/asyncActionLegacy.d.ts +0 -23
- package/lib/chevre/repo/asyncActionLegacy.js +0 -59
- 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/repo/scheduledTaskLegacy.d.ts +0 -19
- package/lib/chevre/repo/scheduledTaskLegacy.js +0 -42
- package/lib/chevre/repo/scheduledTaskMigration.d.ts +0 -21
- package/lib/chevre/repo/scheduledTaskMigration.js +0 -70
- package/lib/chevre/service/validation/validateEvent.d.ts +0 -11
- package/lib/chevre/service/validation/validateEvent.js +0 -21
|
@@ -7,7 +7,6 @@ import type { PayActionRepo } from '../../../repo/action/pay';
|
|
|
7
7
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
8
8
|
import type { TaskRepo } from '../../../repo/task';
|
|
9
9
|
interface IOnPayActionCompletedRepos {
|
|
10
|
-
action?: never;
|
|
11
10
|
actions: {
|
|
12
11
|
pay: PayActionRepo;
|
|
13
12
|
refund: RefundActionRepo;
|
|
@@ -13,7 +13,7 @@ function onPaymentStatusChanged(params) {
|
|
|
13
13
|
case factory_1.factory.actionType.PayAction: {
|
|
14
14
|
// アクションリポジトリから実アクションを参照する
|
|
15
15
|
// そうすることで、通知する情報は最低限で済む
|
|
16
|
-
const action = await repos.actions.pay.
|
|
16
|
+
const action = await repos.actions.pay.findAnyActionById({ id: params.id, typeOf: params.typeOf });
|
|
17
17
|
const optimizedAction = optimizeAction4report((action));
|
|
18
18
|
await (0, onPaid_1.onPaid)(optimizedAction, { id: action.project.id })(repos);
|
|
19
19
|
break;
|
|
@@ -21,7 +21,7 @@ function onPaymentStatusChanged(params) {
|
|
|
21
21
|
case factory_1.factory.actionType.RefundAction: {
|
|
22
22
|
// アクションリポジトリから実アクションを参照する
|
|
23
23
|
// そうすることで、通知する情報は最低限で済む
|
|
24
|
-
const action = await repos.actions.refund.
|
|
24
|
+
const action = await repos.actions.refund.findAnyActionById({ id: params.id, typeOf: params.typeOf });
|
|
25
25
|
const optimizedAction = optimizeAction4report((action));
|
|
26
26
|
await (0, onRefunded_1.onRefunded)(optimizedAction, { id: action.project.id })(repos);
|
|
27
27
|
break;
|
|
@@ -4,7 +4,6 @@ import type { PayActionRepo } from '../../../repo/action/pay';
|
|
|
4
4
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
interface IOnRefundActionCompletedOrFailedRepos {
|
|
7
|
-
action?: never;
|
|
8
7
|
actions: {
|
|
9
8
|
pay: PayActionRepo;
|
|
10
9
|
refund: RefundActionRepo;
|
|
@@ -5,7 +5,6 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
7
7
|
interface IProcessVoidPayTransactionRepos {
|
|
8
|
-
action?: never;
|
|
9
8
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
10
9
|
accountingReport: AccountingReportRepo;
|
|
11
10
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -58,7 +58,7 @@ function processVoidPayTransaction(params) {
|
|
|
58
58
|
// 承認アクションを取得
|
|
59
59
|
let authorizeActions;
|
|
60
60
|
if (typeof params.id === 'string') {
|
|
61
|
-
const authorizeAction = await repos.authorizePaymentMethodAction.
|
|
61
|
+
const authorizeAction = await repos.authorizePaymentMethodAction.findAnyActionById({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id });
|
|
62
62
|
// 取引内のアクションかどうか確認
|
|
63
63
|
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
64
64
|
throw new factory_1.factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
@@ -109,7 +109,7 @@ function processVoidPayTransaction(params) {
|
|
|
109
109
|
// 取引が存在すれば中止
|
|
110
110
|
const transactionNumber = action.object.paymentMethodId;
|
|
111
111
|
if (typeof transactionNumber === 'string' && transactionNumber.length > 0) {
|
|
112
|
-
const payTransaction = (await repos.assetTransaction.
|
|
112
|
+
const payTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
113
113
|
limit: 1,
|
|
114
114
|
page: 1,
|
|
115
115
|
project: { id: { $eq: action.project.id } },
|
|
@@ -60,7 +60,5 @@ declare function publishPaymentUrl(params: {
|
|
|
60
60
|
*/
|
|
61
61
|
identifier?: string;
|
|
62
62
|
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
63
|
-
}, options: {
|
|
64
|
-
savePaymentMethodIdInTransaction: boolean;
|
|
65
63
|
}): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
|
|
66
64
|
export { IPublishPaymentUrlRepos, publishPaymentUrl };
|
|
@@ -41,7 +41,7 @@ const factory_2 = require("./factory");
|
|
|
41
41
|
/**
|
|
42
42
|
* 外部決済ロケーションを発行する
|
|
43
43
|
*/
|
|
44
|
-
function publishPaymentUrl(params
|
|
44
|
+
function publishPaymentUrl(params) {
|
|
45
45
|
return async (repos, settings) => {
|
|
46
46
|
const { paymentServiceType, purpose, project } = params;
|
|
47
47
|
if (purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
|
|
@@ -107,7 +107,7 @@ function publishPaymentUrl(params, options) {
|
|
|
107
107
|
await repos.orderInTransaction.savePaymentMethodId({
|
|
108
108
|
id: transaction.id,
|
|
109
109
|
paymentMethod: { paymentMethodId: result.paymentMethodId }
|
|
110
|
-
}
|
|
110
|
+
});
|
|
111
111
|
return {
|
|
112
112
|
paymentMethodId: result.paymentMethodId,
|
|
113
113
|
paymentUrl: result.paymentUrl
|
|
@@ -22,7 +22,6 @@ declare function voidPayTransaction(params: factory.task.IData<factory.taskName.
|
|
|
22
22
|
};
|
|
23
23
|
}): (repos: {
|
|
24
24
|
accountingReport: AccountingReportRepo;
|
|
25
|
-
action?: never;
|
|
26
25
|
acceptPayAction: AcceptPayActionRepo;
|
|
27
26
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
28
27
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -9,7 +9,6 @@ interface ICreditCardPaymentAgencyTransaction3ds {
|
|
|
9
9
|
secureTran2Result: GMO.factory.service.credit.ISecureTran2Result;
|
|
10
10
|
}
|
|
11
11
|
interface IProcessAuthorizeCreditCard3dsRepos {
|
|
12
|
-
action?: never;
|
|
13
12
|
authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
|
|
14
13
|
creditCardService: GMO.service.Credit;
|
|
15
14
|
}
|
|
@@ -41,7 +41,6 @@ payTransaction: IPayTransactionAsAuthorizeInvoiceAction, paymentServiceId: strin
|
|
|
41
41
|
id?: string;
|
|
42
42
|
};
|
|
43
43
|
}): (repos: {
|
|
44
|
-
action?: never;
|
|
45
44
|
authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
|
|
46
45
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
47
46
|
paymentService: PaymentServiceRepo;
|
|
@@ -11,7 +11,6 @@ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/i
|
|
|
11
11
|
* クレジットカード決済
|
|
12
12
|
*/
|
|
13
13
|
declare function payCreditCard(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
14
|
-
action?: never;
|
|
15
14
|
actions: {
|
|
16
15
|
pay: PayActionRepo;
|
|
17
16
|
refund: RefundActionRepo;
|
|
@@ -11,7 +11,6 @@ declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
|
|
|
11
11
|
product: ProductRepo;
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
14
|
-
action?: never;
|
|
15
14
|
actions: {
|
|
16
15
|
pay: PayActionRepo;
|
|
17
16
|
refund: RefundActionRepo;
|
|
@@ -21,7 +20,6 @@ declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (r
|
|
|
21
20
|
task: TaskRepo;
|
|
22
21
|
}) => Promise<void>;
|
|
23
22
|
declare function refundFaceToFace(params: factory.task.refund.IData): (repos: {
|
|
24
|
-
action?: never;
|
|
25
23
|
actions: {
|
|
26
24
|
pay: PayActionRepo;
|
|
27
25
|
refund: RefundActionRepo;
|
|
@@ -10,7 +10,6 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
10
10
|
import { factory } from '../../../factory';
|
|
11
11
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
12
12
|
interface IPayOperationRepos {
|
|
13
|
-
action?: never;
|
|
14
13
|
actions: {
|
|
15
14
|
pay: PayActionRepo;
|
|
16
15
|
refund: RefundActionRepo;
|
|
@@ -7,7 +7,6 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
7
7
|
import { factory } from '../../../factory';
|
|
8
8
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
9
9
|
interface IRefundOperationRepos {
|
|
10
|
-
action?: never;
|
|
11
10
|
actions: {
|
|
12
11
|
pay: PayActionRepo;
|
|
13
12
|
refund: RefundActionRepo;
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CancelActionRepo } from '../../repo/action/cancel';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
4
|
import { OfferRateLimitRepo } from '../../repo/rateLimit/offer';
|
|
5
5
|
import { ReservationRepo } from '../../repo/reservation';
|
|
@@ -10,7 +10,9 @@ import type { TaskRepo } from '../../repo/task';
|
|
|
10
10
|
* 保留予約取消
|
|
11
11
|
*/
|
|
12
12
|
declare function cancelPendingReservation(actionAttributes: factory.task.cancelPendingReservation.IPotentialCancelAction): (repos: {
|
|
13
|
-
|
|
13
|
+
actions: {
|
|
14
|
+
cancel: CancelActionRepo;
|
|
15
|
+
};
|
|
14
16
|
assetTransaction: AssetTransactionRepo;
|
|
15
17
|
stockHolder: StockHolderRepo;
|
|
16
18
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -22,7 +24,9 @@ declare function cancelPendingReservation(actionAttributes: factory.task.cancelP
|
|
|
22
24
|
* 予約をキャンセルする
|
|
23
25
|
*/
|
|
24
26
|
declare function cancelReservation(actionAttributesList: factory.action.cancel.reservation.IAttributes[]): (repos: {
|
|
25
|
-
|
|
27
|
+
actions: {
|
|
28
|
+
cancel: CancelActionRepo;
|
|
29
|
+
};
|
|
26
30
|
stockHolder: StockHolderRepo;
|
|
27
31
|
offerRateLimit: OfferRateLimitRepo;
|
|
28
32
|
reservation: ReservationRepo;
|
|
@@ -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,
|
|
@@ -52,24 +52,14 @@ function cancelPengindIfNotYet(params) {
|
|
|
52
52
|
let actionId;
|
|
53
53
|
const actionAttributes = (0, factory_2.createCancelPendingReservationAction)({ transaction: reserveTransaction });
|
|
54
54
|
// 冪等性を担保(2023-06-05~)
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
object: {
|
|
61
|
-
typeOf: { $eq: factory_1.factory.reservationType.ReservationPackage },
|
|
62
|
-
reservationNumber: { $eq: reserveTransaction.transactionNumber }
|
|
63
|
-
},
|
|
64
|
-
purpose: {
|
|
65
|
-
id: { $in: [params.purpose.id] },
|
|
66
|
-
typeOf: { $in: [params.purpose.typeOf] }
|
|
67
|
-
}
|
|
68
|
-
}, ['id']);
|
|
69
|
-
if (completedActions.length === 0) {
|
|
55
|
+
const completedAction = await repos.actions.cancel.findCompletedCancelAction({
|
|
56
|
+
object: { reservationNumber: reserveTransaction.transactionNumber },
|
|
57
|
+
purpose: { id: params.purpose.id }
|
|
58
|
+
});
|
|
59
|
+
if (completedAction === null) {
|
|
70
60
|
if (actionAttributes !== undefined) {
|
|
71
61
|
// アクション開始
|
|
72
|
-
const action = await repos.
|
|
62
|
+
const action = await repos.actions.cancel.start(actionAttributes);
|
|
73
63
|
actionId = action.id;
|
|
74
64
|
const actionObject = actionAttributes.object;
|
|
75
65
|
// let cancelResult: ICancelResult | undefined;
|
|
@@ -126,7 +116,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
126
116
|
}
|
|
127
117
|
catch (error) {
|
|
128
118
|
try {
|
|
129
|
-
await repos.
|
|
119
|
+
await repos.actions.cancel.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
130
120
|
}
|
|
131
121
|
catch (__) {
|
|
132
122
|
// 失敗したら仕方ない
|
|
@@ -134,11 +124,11 @@ function cancelPengindIfNotYet(params) {
|
|
|
134
124
|
throw error;
|
|
135
125
|
}
|
|
136
126
|
const actionResult = {};
|
|
137
|
-
await repos.
|
|
127
|
+
await repos.actions.cancel.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
138
128
|
}
|
|
139
129
|
}
|
|
140
130
|
else {
|
|
141
|
-
actionId =
|
|
131
|
+
actionId = completedAction.id;
|
|
142
132
|
}
|
|
143
133
|
return {
|
|
144
134
|
reserveTransaction,
|
|
@@ -163,13 +153,13 @@ function cancelReservation(actionAttributesList) {
|
|
|
163
153
|
const now = new Date();
|
|
164
154
|
if (actionAttributesList.length > 0) {
|
|
165
155
|
await Promise.all(actionAttributesList.map(async (actionAttributes) => {
|
|
166
|
-
const action = await repos.
|
|
156
|
+
const action = await repos.actions.cancel.start(actionAttributes);
|
|
167
157
|
let cancelResult;
|
|
168
158
|
let canceledReservationForId;
|
|
169
159
|
try {
|
|
170
160
|
if (actionAttributes.object.typeOf === factory_1.factory.reservationType.ReservationPackage) {
|
|
171
161
|
// 予約取引を検索
|
|
172
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
162
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
173
163
|
limit: 1,
|
|
174
164
|
page: 1,
|
|
175
165
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -226,7 +216,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
226
216
|
inclusion: ['reservationNumber', 'reservationStatus', 'project', 'reservedTicket', 'subReservation', 'reservationFor']
|
|
227
217
|
});
|
|
228
218
|
// 予約取引を検索
|
|
229
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
219
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
230
220
|
limit: 1,
|
|
231
221
|
page: 1,
|
|
232
222
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -275,7 +265,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
275
265
|
}
|
|
276
266
|
catch (error) {
|
|
277
267
|
try {
|
|
278
|
-
await repos.
|
|
268
|
+
await repos.actions.cancel.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
279
269
|
}
|
|
280
270
|
catch (__) {
|
|
281
271
|
// 失敗したら仕方ない
|
|
@@ -294,7 +284,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
294
284
|
} : undefined
|
|
295
285
|
// canceledReservationId: canceledReservation?.id
|
|
296
286
|
};
|
|
297
|
-
await repos.
|
|
287
|
+
await repos.actions.cancel.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
298
288
|
let canceledReservations = [];
|
|
299
289
|
if (actionAttributes.object.typeOf === factory_1.factory.reservationType.ReservationPackage) {
|
|
300
290
|
const reservationNumber = actionAttributes.object.reservationNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReserveActionRepo } from '../../repo/action/reserve';
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
3
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
4
4
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
@@ -32,7 +32,9 @@ interface ICheckInReservationParams {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
export declare function checkInReservation(params: ICheckInReservationParams): (repos: {
|
|
35
|
-
|
|
35
|
+
actions: {
|
|
36
|
+
reserve: ReserveActionRepo;
|
|
37
|
+
};
|
|
36
38
|
assetTransaction: AssetTransactionRepo;
|
|
37
39
|
code: AuthorizationRepo;
|
|
38
40
|
reservation: ReservationRepo;
|
|
@@ -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 }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReserveActionRepo } from '../../repo/action/reserve';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
4
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
5
5
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
@@ -13,7 +13,9 @@ export declare function confirmReservation(params: {
|
|
|
13
13
|
useOnReservationConfirmed: boolean;
|
|
14
14
|
byTask: boolean;
|
|
15
15
|
}): (repos: {
|
|
16
|
-
|
|
16
|
+
actions: {
|
|
17
|
+
reserve: ReserveActionRepo;
|
|
18
|
+
};
|
|
17
19
|
assetTransaction: AssetTransactionRepo;
|
|
18
20
|
code: AuthorizationRepo;
|
|
19
21
|
reservation: ReservationRepo;
|
|
@@ -78,19 +78,6 @@ function reserveTransaction2action(params) {
|
|
|
78
78
|
// if (typeof transaction.object.underName?.typeOf === 'string') {
|
|
79
79
|
// underName = transaction.object.underName;
|
|
80
80
|
// }
|
|
81
|
-
// const moneyTransferActions: factory.action.transfer.moneyTransfer.IAttributes[] = [];
|
|
82
|
-
// const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
83
|
-
// pendingReservations.forEach((reservation) => {
|
|
84
|
-
// const acceptedOffer4reservation = transaction.object.acceptedOffer?.find(
|
|
85
|
-
// (o) => o.itemOffered?.serviceOutput?.id === reservation.id
|
|
86
|
-
// );
|
|
87
|
-
// moneyTransferActions.push(...createMoneyTransferActions({
|
|
88
|
-
// acceptedOffer: acceptedOffer4reservation,
|
|
89
|
-
// reservation,
|
|
90
|
-
// transaction: params.transaction,
|
|
91
|
-
// underName
|
|
92
|
-
// }));
|
|
93
|
-
// });
|
|
94
81
|
const reservationPackage = {
|
|
95
82
|
reservationFor: {
|
|
96
83
|
id: String(reservationFor.id),
|
|
@@ -135,12 +122,10 @@ function createReservationUnderName(params) {
|
|
|
135
122
|
...((typeof telephone === 'string') && { telephone })
|
|
136
123
|
};
|
|
137
124
|
}
|
|
138
|
-
function reserveIfNotYet(
|
|
139
|
-
// params: factory.action.reserve.IAttributes,
|
|
140
|
-
params, options) {
|
|
125
|
+
function reserveIfNotYet(params, options) {
|
|
141
126
|
return async (repos) => {
|
|
142
127
|
const reservationPackage = params.object;
|
|
143
|
-
const reserveTransaction = (await repos.assetTransaction.
|
|
128
|
+
const reserveTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
144
129
|
limit: 1,
|
|
145
130
|
page: 1,
|
|
146
131
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -152,23 +137,12 @@ params, options) {
|
|
|
152
137
|
const actionAttributes = reserveTransaction2action({ transaction: reserveTransaction });
|
|
153
138
|
// 冪等性を担保(2023-05-31~)
|
|
154
139
|
debug('searching completed reserveAction... byTask:', options?.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
typeOf: { $eq: actionAttributes.object.typeOf }
|
|
162
|
-
// reservationNumber: { $eq: params.object.reservationNumber }
|
|
163
|
-
},
|
|
164
|
-
purpose: {
|
|
165
|
-
id: { $in: [actionAttributes.purpose.id] },
|
|
166
|
-
typeOf: { $in: [actionAttributes.purpose.typeOf] }
|
|
167
|
-
}
|
|
168
|
-
}, ['id']);
|
|
169
|
-
debug(completedActions.length, 'completed reserveAction found. byTask:', options?.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
170
|
-
if (completedActions.length === 0) {
|
|
171
|
-
const action = await repos.action.start(actionAttributes);
|
|
140
|
+
const completedAction = await repos.actions.reserve.findCompletedReserveAction({
|
|
141
|
+
purpose: { id: actionAttributes.purpose.id }
|
|
142
|
+
});
|
|
143
|
+
debug(completedAction?.id, 'completed reserveAction found. byTask:', options?.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
144
|
+
if (completedAction === null) {
|
|
145
|
+
const action = await repos.actions.reserve.start(actionAttributes);
|
|
172
146
|
try {
|
|
173
147
|
let underName;
|
|
174
148
|
const underNameByTransaction = reserveTransaction.object.underName;
|
|
@@ -217,7 +191,7 @@ params, options) {
|
|
|
217
191
|
}
|
|
218
192
|
catch (error) {
|
|
219
193
|
try {
|
|
220
|
-
await repos.
|
|
194
|
+
await repos.actions.reserve.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
221
195
|
}
|
|
222
196
|
catch (__) {
|
|
223
197
|
// 失敗したら仕方ない
|
|
@@ -225,7 +199,7 @@ params, options) {
|
|
|
225
199
|
throw error;
|
|
226
200
|
}
|
|
227
201
|
const actionResult = {};
|
|
228
|
-
await repos.
|
|
202
|
+
await repos.actions.reserve.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
229
203
|
}
|
|
230
204
|
return { actionAttributes, reserveTransaction };
|
|
231
205
|
};
|
|
@@ -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,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReserveActionRepo } from '../../repo/action/reserve';
|
|
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';
|
|
@@ -25,7 +26,10 @@ export declare function useReservation(params: {
|
|
|
25
26
|
identifier?: string;
|
|
26
27
|
};
|
|
27
28
|
}): (repos: {
|
|
28
|
-
|
|
29
|
+
actions: {
|
|
30
|
+
use: UseActionRepo;
|
|
31
|
+
reserve: ReserveActionRepo;
|
|
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] } }
|