@chevre/domain 26.0.0-alpha.9 → 26.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/eventEmitter/task.d.ts +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 +11 -1
- package/lib/chevre/repo/action/acceptCOAOffer.js +25 -2
- package/lib/chevre/repo/action/acceptPay.d.ts +11 -1
- package/lib/chevre/repo/action/acceptPay.js +27 -6
- package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +111 -0
- package/lib/chevre/repo/action/anyAction/actionProcess.js +290 -0
- 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 +8 -5
- package/lib/chevre/repo/action/authorizeOffer.d.ts +3 -1
- package/lib/chevre/repo/action/authorizeOffer.js +8 -7
- package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +11 -1
- package/lib/chevre/repo/action/authorizePaymentMethod.js +25 -5
- 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 +11 -1
- package/lib/chevre/repo/action/checkMovieTicket.js +25 -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/dedicatedAction/dedicatedActionProcess.d.ts +46 -0
- package/lib/chevre/repo/action/dedicatedAction/dedicatedActionProcess.js +92 -0
- package/lib/chevre/repo/action/inform.d.ts +39 -0
- package/lib/chevre/repo/action/inform.js +115 -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 +8 -5
- 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 +50 -0
- package/lib/chevre/repo/action/update.js +129 -0
- package/lib/chevre/repo/action/use.d.ts +40 -0
- package/lib/chevre/repo/action/use.js +122 -0
- package/lib/chevre/repo/{action.d.ts → adminAction.d.ts} +11 -37
- package/lib/chevre/repo/adminAction.js +202 -0
- package/lib/chevre/repo/adminAssetTransaction.d.ts +126 -0
- package/lib/chevre/repo/adminAssetTransaction.js +491 -0
- 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/authorization.d.ts +0 -6
- package/lib/chevre/repo/authorization.js +15 -27
- package/lib/chevre/repo/factory/action/createMongoConditions.d.ts +4 -0
- package/lib/chevre/repo/factory/action/createMongoConditions.js +335 -0
- 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/abstractAction.d.ts +5 -0
- package/lib/chevre/repo/mongoose/schemas/action/abstractAction.js +2 -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 -155
- package/lib/chevre/repo/task.js +13 -555
- 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/check.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -2
- 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 +23 -24
- 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 +1 -2
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findAcceptAction.js +23 -24
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +0 -4
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +23 -24
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +3 -5
- package/lib/chevre/service/payment/any/findCheckAction.js +24 -25
- 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 +1 -2
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +3 -1
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +3 -3
- 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/payment/movieTicket/validation.d.ts +3 -1
- package/lib/chevre/service/payment/movieTicket/validation.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.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 +5 -19
- package/lib/chevre/service/task/authorizePayment.js +6 -13
- 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 +8 -13
- 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 +3 -3
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/payByTask.d.ts +3 -2
- package/lib/chevre/service/task/payment/payByTask.js +1 -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 +6 -18
- 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 +4 -4
- package/lib/chevre/service/task.js +8 -12
- 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/actionProcess.js +0 -775
- 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 -39
- package/lib/chevre/repo/scheduledTaskLegacy.js +0 -96
- 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
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionProcessRepo = exports.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = exports.DEFAULT_EXPIRE_AFTER_SECONDS = exports.AVAILABLE_PROJECT_FIELDS = void 0;
|
|
4
|
+
const factory_1 = require("../../../factory");
|
|
5
|
+
const settings_1 = require("../../../settings");
|
|
6
|
+
const action_1 = require("../../mongoose/schemas/action");
|
|
7
|
+
const unknown2actionError_1 = require("../unknown2actionError");
|
|
8
|
+
const createMongoConditions_1 = require("../../factory/action/createMongoConditions");
|
|
9
|
+
const actionRecipe_1 = require("./actionRecipe");
|
|
10
|
+
exports.AVAILABLE_PROJECT_FIELDS = [
|
|
11
|
+
'project',
|
|
12
|
+
'actionStatus',
|
|
13
|
+
'typeOf',
|
|
14
|
+
'description',
|
|
15
|
+
'agent',
|
|
16
|
+
'recipient',
|
|
17
|
+
'result',
|
|
18
|
+
'error',
|
|
19
|
+
'object',
|
|
20
|
+
'startDate',
|
|
21
|
+
'endDate',
|
|
22
|
+
'purpose',
|
|
23
|
+
'potentialActions',
|
|
24
|
+
'instrument',
|
|
25
|
+
'location',
|
|
26
|
+
'sameAs',
|
|
27
|
+
'cancelAction',
|
|
28
|
+
'about',
|
|
29
|
+
'identifier',
|
|
30
|
+
'expires'
|
|
31
|
+
];
|
|
32
|
+
exports.DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; // 200 days
|
|
33
|
+
exports.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS = 17280000; // 200 days
|
|
34
|
+
/**
|
|
35
|
+
* アクション状態管理リポジトリ
|
|
36
|
+
*/
|
|
37
|
+
class ActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
|
|
38
|
+
actionModel;
|
|
39
|
+
options;
|
|
40
|
+
constructor(params, options) {
|
|
41
|
+
super(params, options);
|
|
42
|
+
this.actionModel = params.connection.model(action_1.modelName, (0, action_1.createSchema)());
|
|
43
|
+
this.options = options;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* アクション開始
|
|
47
|
+
*/
|
|
48
|
+
async start(attributes, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
49
|
+
options) {
|
|
50
|
+
const startDate = new Date();
|
|
51
|
+
const expires = new Date(startDate.getTime() + this.options.expireAfterSeconds * 1000);
|
|
52
|
+
const creatingAction = {
|
|
53
|
+
...attributes,
|
|
54
|
+
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
55
|
+
startDate,
|
|
56
|
+
expires
|
|
57
|
+
};
|
|
58
|
+
// reimplemnt with insertMany(2024-08-29~)
|
|
59
|
+
const result = await this.actionModel.insertMany(creatingAction, { rawResult: true });
|
|
60
|
+
const id = result.insertedIds?.[0]?.toHexString();
|
|
61
|
+
if (typeof id !== 'string') {
|
|
62
|
+
throw new factory_1.factory.errors.Internal('action not saved');
|
|
63
|
+
}
|
|
64
|
+
// add recipe(2024-06-09~)
|
|
65
|
+
const savingRecipe = options?.recipe;
|
|
66
|
+
if (savingRecipe?.typeOf === 'Recipe') {
|
|
67
|
+
await this.upsertRecipe({ ...savingRecipe, recipeFor: { id, typeOf: creatingAction.typeOf } });
|
|
68
|
+
}
|
|
69
|
+
return { id, startDate, typeOf: creatingAction.typeOf };
|
|
70
|
+
}
|
|
71
|
+
async completeWithVoid(params) {
|
|
72
|
+
const endDate = new Date();
|
|
73
|
+
if (params.recipe?.typeOf === 'Recipe') {
|
|
74
|
+
await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
75
|
+
}
|
|
76
|
+
const doc = await this.actionModel.findOneAndUpdate({
|
|
77
|
+
_id: { $eq: params.id },
|
|
78
|
+
typeOf: { $eq: params.typeOf }
|
|
79
|
+
}, {
|
|
80
|
+
$set: {
|
|
81
|
+
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
82
|
+
result: params.result,
|
|
83
|
+
endDate
|
|
84
|
+
}
|
|
85
|
+
}, { new: false, projection: { _id: 1 } })
|
|
86
|
+
.lean()
|
|
87
|
+
.exec();
|
|
88
|
+
if (doc === null) {
|
|
89
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* アクション取消
|
|
94
|
+
*/
|
|
95
|
+
async cancelWithVoid(params) {
|
|
96
|
+
const cancelDate = new Date();
|
|
97
|
+
const cancelAction = (params.cancelAction !== undefined)
|
|
98
|
+
? {
|
|
99
|
+
...params.cancelAction,
|
|
100
|
+
endTime: cancelDate,
|
|
101
|
+
typeOf: factory_1.factory.actionType.CancelAction
|
|
102
|
+
}
|
|
103
|
+
: undefined;
|
|
104
|
+
const doc = await this.actionModel.findOneAndUpdate({
|
|
105
|
+
_id: { $eq: params.id },
|
|
106
|
+
typeOf: { $eq: params.typeOf },
|
|
107
|
+
actionStatus: { $ne: factory_1.factory.actionStatusType.CanceledActionStatus } // 冪等性確保(2024-05-26~)
|
|
108
|
+
}, {
|
|
109
|
+
$set: {
|
|
110
|
+
actionStatus: factory_1.factory.actionStatusType.CanceledActionStatus,
|
|
111
|
+
...(cancelAction !== undefined) ? { cancelAction } : undefined // cancelAction連携(2024-05-26~)
|
|
112
|
+
}
|
|
113
|
+
}, { new: false, projection: { _id: 1 } })
|
|
114
|
+
.lean()
|
|
115
|
+
.exec();
|
|
116
|
+
if (doc === null) {
|
|
117
|
+
// 既にCanceledActionStatusであればok
|
|
118
|
+
const existingAction = await this.findActionStatusById({ id: params.id, typeOf: params.typeOf });
|
|
119
|
+
if (existingAction.actionStatus !== factory_1.factory.actionStatusType.CanceledActionStatus) {
|
|
120
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// endDateが存在しなければセット(2024-04-22~)
|
|
124
|
+
await this.actionModel.updateOne({
|
|
125
|
+
_id: { $eq: params.id },
|
|
126
|
+
endDate: { $exists: false }
|
|
127
|
+
}, { $set: { endDate: cancelDate } })
|
|
128
|
+
.exec();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* アクション失敗
|
|
132
|
+
*/
|
|
133
|
+
async giveUp(params) {
|
|
134
|
+
const endDate = new Date();
|
|
135
|
+
const actionError = Array.isArray(params.error)
|
|
136
|
+
? params.error.map(unknown2actionError_1.unknown2actionError)
|
|
137
|
+
: (0, unknown2actionError_1.unknown2actionError)(params.error);
|
|
138
|
+
if (params.recipe?.typeOf === 'Recipe') {
|
|
139
|
+
await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
140
|
+
}
|
|
141
|
+
const doc = await this.actionModel.findOneAndUpdate({
|
|
142
|
+
typeOf: { $eq: params.typeOf },
|
|
143
|
+
_id: { $eq: params.id }
|
|
144
|
+
}, {
|
|
145
|
+
$set: {
|
|
146
|
+
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
147
|
+
error: actionError,
|
|
148
|
+
endDate
|
|
149
|
+
}
|
|
150
|
+
}, { new: false, projection: { _id: 1 } })
|
|
151
|
+
.lean()
|
|
152
|
+
.exec();
|
|
153
|
+
if (doc === null) {
|
|
154
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async findAnyActionById(params, inclusion, exclusion) {
|
|
158
|
+
let positiveProjectionFields = exports.AVAILABLE_PROJECT_FIELDS;
|
|
159
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
160
|
+
positiveProjectionFields = inclusion.filter((key) => exports.AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
164
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const projection = {
|
|
168
|
+
_id: 0,
|
|
169
|
+
id: { $toString: '$_id' },
|
|
170
|
+
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
171
|
+
};
|
|
172
|
+
const doc = await this.actionModel.findOne({
|
|
173
|
+
typeOf: { $eq: params.typeOf },
|
|
174
|
+
_id: { $eq: params.id }
|
|
175
|
+
}, projection)
|
|
176
|
+
.lean() // 2024-08-26~
|
|
177
|
+
.exec();
|
|
178
|
+
if (doc === null) {
|
|
179
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
180
|
+
}
|
|
181
|
+
return doc;
|
|
182
|
+
}
|
|
183
|
+
async findActionStatusById(params) {
|
|
184
|
+
const projection = {
|
|
185
|
+
_id: 0,
|
|
186
|
+
id: { $toString: '$_id' },
|
|
187
|
+
actionStatus: 1
|
|
188
|
+
};
|
|
189
|
+
const doc = await this.actionModel.findOne({
|
|
190
|
+
typeOf: { $eq: params.typeOf },
|
|
191
|
+
_id: { $eq: params.id }
|
|
192
|
+
}, projection)
|
|
193
|
+
.lean() // 2024-08-26~
|
|
194
|
+
.exec();
|
|
195
|
+
if (doc === null) {
|
|
196
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
197
|
+
}
|
|
198
|
+
return doc;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 汎用アクション検索
|
|
202
|
+
* 継承クラスから呼ぶ想定
|
|
203
|
+
*/
|
|
204
|
+
async findAnyActionsLegacy(params, inclusion) {
|
|
205
|
+
const conditions = (0, createMongoConditions_1.createMongoConditions)(params);
|
|
206
|
+
let positiveProjectionFields = exports.AVAILABLE_PROJECT_FIELDS;
|
|
207
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
208
|
+
positiveProjectionFields = inclusion.filter((key) => exports.AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
209
|
+
}
|
|
210
|
+
const projection = {
|
|
211
|
+
_id: 0,
|
|
212
|
+
id: { $toString: '$_id' },
|
|
213
|
+
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
214
|
+
};
|
|
215
|
+
const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
216
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
217
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
218
|
+
query.limit(params.limit)
|
|
219
|
+
.skip(params.limit * (page - 1));
|
|
220
|
+
}
|
|
221
|
+
// const explainResult = await (<any>query).explain();
|
|
222
|
+
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
223
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
224
|
+
.lean() // 2024-08-26~
|
|
225
|
+
.exec();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 取引に対する汎用アクション検索
|
|
229
|
+
* 継承クラスから呼ぶ想定
|
|
230
|
+
* 件数はlimitされない
|
|
231
|
+
*/
|
|
232
|
+
async findAnyActionsByPurpose(params) {
|
|
233
|
+
const andConditions = [
|
|
234
|
+
{ 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf } },
|
|
235
|
+
{ 'purpose.id': { $exists: true, $eq: params.purpose.id } }
|
|
236
|
+
];
|
|
237
|
+
const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
|
|
238
|
+
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
239
|
+
andConditions.push({ 'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq } });
|
|
240
|
+
}
|
|
241
|
+
const objectTypeOfEq = params.object?.typeOf?.$eq;
|
|
242
|
+
if (typeof objectTypeOfEq === 'string') {
|
|
243
|
+
andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
|
|
244
|
+
}
|
|
245
|
+
const objectTypeOfIn = params.object?.typeOf?.$in;
|
|
246
|
+
if (Array.isArray(objectTypeOfIn)) {
|
|
247
|
+
andConditions.push({ 'object.typeOf': { $exists: true, $in: objectTypeOfIn } });
|
|
248
|
+
}
|
|
249
|
+
if (typeof params.typeOf === 'string') {
|
|
250
|
+
andConditions.push({ typeOf: { $eq: params.typeOf } });
|
|
251
|
+
}
|
|
252
|
+
const actionStatusEq = params.actionStatus?.$eq;
|
|
253
|
+
if (typeof actionStatusEq === 'string') {
|
|
254
|
+
andConditions.push({ actionStatus: { $eq: actionStatusEq } });
|
|
255
|
+
}
|
|
256
|
+
const positiveProjectionFields = [
|
|
257
|
+
'project',
|
|
258
|
+
'actionStatus',
|
|
259
|
+
'typeOf',
|
|
260
|
+
'description',
|
|
261
|
+
'agent',
|
|
262
|
+
'recipient',
|
|
263
|
+
'result',
|
|
264
|
+
'error',
|
|
265
|
+
'object',
|
|
266
|
+
'startDate',
|
|
267
|
+
'endDate',
|
|
268
|
+
'purpose',
|
|
269
|
+
'potentialActions',
|
|
270
|
+
'instrument',
|
|
271
|
+
'location',
|
|
272
|
+
'sameAs',
|
|
273
|
+
'cancelAction',
|
|
274
|
+
'identifier'
|
|
275
|
+
];
|
|
276
|
+
const projection = {
|
|
277
|
+
_id: 0,
|
|
278
|
+
id: { $toString: '$_id' },
|
|
279
|
+
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
280
|
+
};
|
|
281
|
+
const query = this.actionModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
|
282
|
+
if (typeof params.sort?.startDate === 'number') {
|
|
283
|
+
query.sort({ startDate: params.sort.startDate });
|
|
284
|
+
}
|
|
285
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
286
|
+
.lean()
|
|
287
|
+
.exec();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.ActionProcessRepo = ActionProcessRepo;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../../../factory';
|
|
3
|
+
import { IModel as IActionRecipeModel } from '../../mongoose/schemas/actionRecipe';
|
|
4
|
+
export type IActionRecipe<T extends factory.recipe.RecipeCategory> = T extends factory.recipe.RecipeCategory.checkMovieTicket ? factory.action.check.paymentMethod.movieTicket.IRecipe : T extends factory.recipe.RecipeCategory.payCreditCard ? factory.action.trade.pay.IPayCreditCardRecipe : T extends factory.recipe.RecipeCategory.payMovieTicket ? factory.action.trade.pay.IPayMovieTicketRecipe : T extends factory.recipe.RecipeCategory.publishPaymentUrl ? factory.action.accept.pay.IRecipe : T extends factory.recipe.RecipeCategory.refundCreditCard ? factory.action.trade.refund.IRefundCreditCardRecipe : T extends factory.recipe.RecipeCategory.refundMovieTicket ? factory.action.trade.refund.IRefundMovieTicketRecipe : T extends factory.recipe.RecipeCategory.authorizeInvoice ? factory.action.authorize.invoice.IAuthorizeInvoiceRecipe : T extends factory.recipe.RecipeCategory.authorizeInvoice3ds ? factory.action.authorize.invoice.IAuthorizeInvoice3dsRecipe : T extends factory.recipe.RecipeCategory.acceptCOAOffer ? factory.action.accept.coaOffer.IRecipe : T extends factory.recipe.RecipeCategory.confirmCOAReserve ? factory.action.interact.confirm.reservation.IConfirmCOAReserveRecipe : T extends factory.recipe.RecipeCategory.cancelPendingCOAReserve ? factory.action.cancel.coaReserve.ICancelPendingCOAReserveRecipe : T extends factory.recipe.RecipeCategory.returnCOAReserve ? factory.action.transfer.returnAction.reserveTransaction.IReturnCOAReserveRecipe : T extends factory.recipe.RecipeCategory.sendEmailMessage ? factory.action.transfer.send.message.email.IRecipe : never;
|
|
5
|
+
export type IRecipeAsDocument = factory.recipe.IRecipe & {
|
|
6
|
+
recipeFor: {
|
|
7
|
+
id: string;
|
|
8
|
+
typeOf: factory.actionType;
|
|
9
|
+
};
|
|
10
|
+
dateCreated: Date;
|
|
11
|
+
dateModified?: Date;
|
|
12
|
+
expires: Date;
|
|
13
|
+
};
|
|
14
|
+
export type IRecipeAsActionAttributes<T extends factory.recipe.RecipeCategory> = Pick<IActionRecipe<T>, 'project' | 'recipeCategory' | 'step' | 'typeOf'>;
|
|
15
|
+
interface IOptions {
|
|
16
|
+
recipeExpireAfterSeconds: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* アクションレシピリポジトリ
|
|
20
|
+
*/
|
|
21
|
+
export declare class ActionRecipeRepo<TActionRecipe extends IActionRecipe<factory.recipe.RecipeCategory>> {
|
|
22
|
+
protected readonly actionRecipeModel: IActionRecipeModel;
|
|
23
|
+
private recipeOptions;
|
|
24
|
+
protected constructor(params: {
|
|
25
|
+
connection: Connection;
|
|
26
|
+
}, options: IOptions);
|
|
27
|
+
findRecipeByAction<T extends TActionRecipe['recipeCategory']>(params: {
|
|
28
|
+
project: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
recipeFor: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null>;
|
|
35
|
+
protected upsertRecipe(savingRecipe: Pick<IRecipeAsDocument, 'project' | 'recipeCategory' | 'recipeFor' | 'step' | 'typeOf'>): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionRecipeRepo = void 0;
|
|
4
|
+
const actionRecipe_1 = require("../../mongoose/schemas/actionRecipe");
|
|
5
|
+
/**
|
|
6
|
+
* アクションレシピリポジトリ
|
|
7
|
+
*/
|
|
8
|
+
class ActionRecipeRepo {
|
|
9
|
+
actionRecipeModel;
|
|
10
|
+
recipeOptions;
|
|
11
|
+
constructor(params, options) {
|
|
12
|
+
this.actionRecipeModel = params.connection.model(actionRecipe_1.modelName, (0, actionRecipe_1.createSchema)());
|
|
13
|
+
this.recipeOptions = options;
|
|
14
|
+
}
|
|
15
|
+
async findRecipeByAction(params) {
|
|
16
|
+
return this.actionRecipeModel.findOne({
|
|
17
|
+
'project.id': { $eq: params.project.id },
|
|
18
|
+
'recipeFor.id': { $eq: params.recipeFor.id }
|
|
19
|
+
}, { step: 1, recipeCategory: 1 }
|
|
20
|
+
// { lean: true }
|
|
21
|
+
)
|
|
22
|
+
.lean()
|
|
23
|
+
.exec();
|
|
24
|
+
// if (result === null) {
|
|
25
|
+
// throw new factory.errors.NotFound(this.actionRecipeModel.modelName);
|
|
26
|
+
// }
|
|
27
|
+
// return result;
|
|
28
|
+
}
|
|
29
|
+
async upsertRecipe(savingRecipe) {
|
|
30
|
+
const dateModified = new Date();
|
|
31
|
+
const expires = new Date(dateModified.getTime() + this.recipeOptions.recipeExpireAfterSeconds * 1000);
|
|
32
|
+
const { typeOf, project, recipeCategory, recipeFor, step } = savingRecipe;
|
|
33
|
+
const filter = {
|
|
34
|
+
'recipeFor.id': { $eq: recipeFor.id }
|
|
35
|
+
};
|
|
36
|
+
const setOnInsert = {
|
|
37
|
+
project, typeOf, recipeCategory, recipeFor,
|
|
38
|
+
dateCreated: dateModified,
|
|
39
|
+
expires // 必須化(2026-08-16~)
|
|
40
|
+
};
|
|
41
|
+
const setKeys = { step, dateModified };
|
|
42
|
+
const update = {
|
|
43
|
+
$setOnInsert: setOnInsert,
|
|
44
|
+
$set: setKeys
|
|
45
|
+
};
|
|
46
|
+
await this.actionRecipeModel.updateOne(filter, update, {
|
|
47
|
+
upsert: true
|
|
48
|
+
// includeResultMetadata: true
|
|
49
|
+
})
|
|
50
|
+
.exec();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ActionRecipeRepo = ActionRecipeRepo;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './actionProcess';
|
|
3
|
-
export type IAuthorizeInvoiceAction = factory.action.authorize.invoice.IAction
|
|
4
|
-
/**
|
|
5
|
-
* 実際存在しない属性だが、ActionProcessRepoのTActionに適合させるために補完
|
|
6
|
-
*/
|
|
7
|
-
recipient: any;
|
|
8
|
-
};
|
|
3
|
+
import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './anyAction/actionProcess';
|
|
4
|
+
export type IAuthorizeInvoiceAction = factory.action.authorize.invoice.IAction;
|
|
9
5
|
/**
|
|
10
6
|
* インボイス承認リポジトリ
|
|
11
7
|
*/
|
|
12
8
|
export declare class AuthorizeInvoiceActionRepo extends ActionProcessRepo<IAuthorizeInvoiceAction, IActionRecipe<factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds>> {
|
|
9
|
+
constructor(connection: Connection);
|
|
13
10
|
/**
|
|
14
11
|
* 決済取引からインボイス承認アクションをひとつ参照する
|
|
15
12
|
*/
|
|
@@ -22,5 +19,5 @@ export declare class AuthorizeInvoiceActionRepo extends ActionProcessRepo<IAutho
|
|
|
22
19
|
* 決済取引ID
|
|
23
20
|
*/
|
|
24
21
|
payTransactionId: string;
|
|
25
|
-
}, inclusion: IKeyOfProjection[]): Promise<
|
|
22
|
+
}, inclusion: IKeyOfProjection[]): Promise<import("@chevre/factory/lib/chevre/action/authorize/invoice").IAction[]>;
|
|
26
23
|
}
|
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizeInvoiceActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
|
|
6
|
-
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
7
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
8
|
-
const actionProcess_1 = require("./actionProcess");
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
9
6
|
/**
|
|
10
7
|
* インボイス承認リポジトリ
|
|
11
8
|
*/
|
|
12
9
|
class AuthorizeInvoiceActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
10
|
+
constructor(connection) {
|
|
11
|
+
super({ connection }, {
|
|
12
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
13
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
13
16
|
/**
|
|
14
17
|
* 決済取引からインボイス承認アクションをひとつ参照する
|
|
15
18
|
*/
|
|
16
19
|
async findAuthorizeInvoiceActionsByPayTransaction(params, inclusion) {
|
|
17
|
-
return this.
|
|
20
|
+
return this.findAnyActionsLegacy({
|
|
18
21
|
limit: 1, // ひとまず1でok
|
|
19
22
|
page: 1,
|
|
20
23
|
typeOf: { $eq: factory_1.factory.actionType.AuthorizeAction },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAuthorizeEventServiceOfferAction = factory.action.authorize.offer.eventService.IAction;
|
|
4
5
|
export type IAuthorizeOfferAction = IAuthorizeEventServiceOfferAction;
|
|
5
6
|
export type IAuthorizeOfferActionWithInstrument = Pick<IAuthorizeEventServiceOfferAction, 'instrument'>;
|
|
@@ -7,6 +8,7 @@ export type IAuthorizeOfferActionWithInstrument = Pick<IAuthorizeEventServiceOff
|
|
|
7
8
|
* オファー承認リポジトリ
|
|
8
9
|
*/
|
|
9
10
|
export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthorizeOfferAction, never> {
|
|
11
|
+
constructor(connection: Connection);
|
|
10
12
|
findAuthorizeOfferInstrumentsByIds(params: {
|
|
11
13
|
/**
|
|
12
14
|
* 注文取引
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizeOfferActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
|
|
6
|
-
const actionProcess_1 = require("./actionProcess");
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
7
6
|
/**
|
|
8
7
|
* オファー承認リポジトリ
|
|
9
8
|
*/
|
|
10
9
|
class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
10
|
+
constructor(connection) {
|
|
11
|
+
super({ connection }, {
|
|
12
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
13
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
11
16
|
async findAuthorizeOfferInstrumentsByIds(params) {
|
|
12
17
|
if (!Array.isArray(params.ids)) {
|
|
13
18
|
throw new factory_1.factory.errors.Argument('ids', 'must be Array');
|
|
14
19
|
}
|
|
15
|
-
return this.
|
|
20
|
+
return this.findAnyActionsLegacy({
|
|
16
21
|
typeOf: factory_1.factory.actionType.AuthorizeAction,
|
|
17
22
|
purpose: {
|
|
18
23
|
typeOf: { $in: [factory_1.factory.transactionType.PlaceOrder] },
|
|
@@ -84,10 +89,6 @@ class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
84
89
|
if (doc === null) {
|
|
85
90
|
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
86
91
|
}
|
|
87
|
-
// // add recipe(2024-06-09~)
|
|
88
|
-
// if (params.recipe?.typeOf === 'Recipe') {
|
|
89
|
-
// await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
90
|
-
// }
|
|
91
92
|
}
|
|
92
93
|
async reCompleteAuthorizeEventOfferAction(params) {
|
|
93
94
|
return this.actionModel.findOneAndUpdate({
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAuthorizePaymentMethodAction = factory.action.authorize.paymentMethod.any.IAction;
|
|
4
5
|
export type IActionRecipe = never;
|
|
5
6
|
/**
|
|
6
7
|
* 決済承認リポジトリ
|
|
7
8
|
*/
|
|
8
9
|
export declare class AuthorizePaymentMethodActionRepo extends ActionProcessRepo<IAuthorizePaymentMethodAction, IActionRecipe> {
|
|
10
|
+
constructor(connection: Connection);
|
|
11
|
+
findActionBySameAs(params: {
|
|
12
|
+
sameAs: {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
purpose?: {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
}): Promise<Pick<import("@chevre/factory/lib/chevre/action/authorize/paymentMethod/any").IAction, "error" | "id" | "purpose" | "actionStatus"> | null>;
|
|
9
19
|
/**
|
|
10
20
|
* 取引に対する決済承認アクションを検索する
|
|
11
21
|
*/
|
|
@@ -2,14 +2,34 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizePaymentMethodActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
|
|
6
|
-
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
7
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
8
|
-
const actionProcess_1 = require("./actionProcess");
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
9
6
|
/**
|
|
10
7
|
* 決済承認リポジトリ
|
|
11
8
|
*/
|
|
12
9
|
class AuthorizePaymentMethodActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
10
|
+
constructor(connection) {
|
|
11
|
+
super({ connection }, {
|
|
12
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
13
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async findActionBySameAs(params) {
|
|
17
|
+
return this.actionModel.findOne({
|
|
18
|
+
typeOf: { $eq: factory_1.factory.actionType.AuthorizeAction }, // 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
|
|
19
|
+
'sameAs.id': { $exists: true, $eq: params.sameAs.id },
|
|
20
|
+
...(typeof params.purpose?.id === 'string')
|
|
21
|
+
? { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
|
|
22
|
+
: undefined
|
|
23
|
+
}, {
|
|
24
|
+
_id: 0,
|
|
25
|
+
id: { $toString: '$_id' },
|
|
26
|
+
actionStatus: 1,
|
|
27
|
+
error: 1,
|
|
28
|
+
purpose: 1
|
|
29
|
+
})
|
|
30
|
+
.lean()
|
|
31
|
+
.exec();
|
|
32
|
+
}
|
|
13
33
|
/**
|
|
14
34
|
* 取引に対する決済承認アクションを検索する
|
|
15
35
|
*/
|
|
@@ -27,7 +47,7 @@ class AuthorizePaymentMethodActionRepo extends actionProcess_1.ActionProcessRepo
|
|
|
27
47
|
if (!Array.isArray(params.ids)) {
|
|
28
48
|
throw new factory_1.factory.errors.Argument('ids', 'must be Array');
|
|
29
49
|
}
|
|
30
|
-
return this.
|
|
50
|
+
return this.findAnyActionsLegacy({
|
|
31
51
|
typeOf: factory_1.factory.actionType.AuthorizeAction,
|
|
32
52
|
purpose: {
|
|
33
53
|
typeOf: { $in: [factory_1.factory.transactionType.PlaceOrder] },
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
3
4
|
export type IAuthorizeTicketedObjectAction = factory.action.authorize.ticketedObject.IAction;
|
|
4
5
|
/**
|
|
5
6
|
* 決済とオファー以外に対する汎用承認リポジトリ
|
|
6
7
|
*/
|
|
7
8
|
export declare class AuthorizeTicketedObjectActionRepo extends ActionProcessRepo<IAuthorizeTicketedObjectAction, never> {
|
|
9
|
+
constructor(connection: Connection);
|
|
8
10
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthorizeTicketedObjectActionRepo = void 0;
|
|
4
|
-
|
|
5
|
-
const actionProcess_1 = require("./actionProcess");
|
|
4
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
6
5
|
/**
|
|
7
6
|
* 決済とオファー以外に対する汎用承認リポジトリ
|
|
8
7
|
*/
|
|
9
8
|
class AuthorizeTicketedObjectActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
9
|
+
constructor(connection) {
|
|
10
|
+
super({ connection }, {
|
|
11
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
12
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
13
|
+
});
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
exports.AuthorizeTicketedObjectActionRepo = AuthorizeTicketedObjectActionRepo;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../../factory';
|
|
3
|
+
import { ActionProcessRepo } from './anyAction/actionProcess';
|
|
4
|
+
export type ICancelAction = factory.action.cancel.coaReserve.IAction | factory.action.cancel.reservation.IAction;
|
|
5
|
+
export type IActionRecipe = factory.action.cancel.coaReserve.ICancelPendingCOAReserveRecipe;
|
|
6
|
+
/**
|
|
7
|
+
* 予約取消アクションリポジトリ
|
|
8
|
+
*/
|
|
9
|
+
export declare class CancelActionRepo extends ActionProcessRepo<ICancelAction, IActionRecipe> {
|
|
10
|
+
constructor(connection: Connection);
|
|
11
|
+
/**
|
|
12
|
+
* 完了済取消アクション検索
|
|
13
|
+
*/
|
|
14
|
+
findCompletedCancelAction(params: {
|
|
15
|
+
object: {
|
|
16
|
+
reservationNumber: string;
|
|
17
|
+
};
|
|
18
|
+
purpose: {
|
|
19
|
+
/**
|
|
20
|
+
* 予約取引ID
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
}): Promise<Pick<ICancelAction, 'id'> | null>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancelActionRepo = void 0;
|
|
4
|
+
const factory_1 = require("../../factory");
|
|
5
|
+
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
6
|
+
const settings_1 = require("../../settings");
|
|
7
|
+
/**
|
|
8
|
+
* 予約取消アクションリポジトリ
|
|
9
|
+
*/
|
|
10
|
+
class CancelActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
super({ connection }, {
|
|
13
|
+
expireAfterSeconds: actionProcess_1.DEFAULT_EXPIRE_AFTER_SECONDS,
|
|
14
|
+
recipeExpireAfterSeconds: actionProcess_1.RECIPE_DEFAULT_EXPIRE_AFTER_SECONDS
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 完了済取消アクション検索
|
|
19
|
+
*/
|
|
20
|
+
async findCompletedCancelAction(params) {
|
|
21
|
+
const query = this.actionModel.findOne({
|
|
22
|
+
// limit: 1,
|
|
23
|
+
// page: 1,
|
|
24
|
+
// actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
25
|
+
// typeOf: { $eq: factory.actionType.CancelAction },
|
|
26
|
+
// object: {
|
|
27
|
+
// typeOf: { $eq: factory.reservationType.ReservationPackage },
|
|
28
|
+
// reservationNumber: { $eq: reserveTransaction.transactionNumber }
|
|
29
|
+
// },
|
|
30
|
+
// purpose: {
|
|
31
|
+
// id: { $in: [params.purpose.id] },
|
|
32
|
+
// typeOf: { $in: [params.purpose.typeOf] }
|
|
33
|
+
// }
|
|
34
|
+
actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus },
|
|
35
|
+
typeOf: { $eq: factory_1.factory.actionType.CancelAction },
|
|
36
|
+
'object.reservationNumber': { $exists: true, $eq: params.object.reservationNumber },
|
|
37
|
+
'purpose.id': { $exists: true, $eq: params.purpose.id }
|
|
38
|
+
}, {
|
|
39
|
+
_id: 0,
|
|
40
|
+
id: { $toString: '$_id' }
|
|
41
|
+
});
|
|
42
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
43
|
+
.lean()
|
|
44
|
+
.exec();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.CancelActionRepo = CancelActionRepo;
|