@chevre/domain 21.2.0-alpha.14 → 21.2.0-alpha.140
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/example/src/chevre/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/aggregation/aggregateSystem.ts +85 -27
- package/example/src/chevre/countDelayedTasks.ts +7 -2
- package/example/src/chevre/deleteTasksByName.ts +10 -2
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/lockStockHolder.ts +5 -2
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
- package/example/src/chevre/processPay.ts +5 -1
- package/example/src/chevre/processRegisterMembership.ts +8 -4
- package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
- package/example/src/chevre/processReserve.ts +5 -2
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +34 -0
- package/example/src/chevre/searchActions.ts +33 -0
- package/example/src/chevre/searchEventSeats.ts +5 -2
- package/example/src/chevre/searchHoldReservations.ts +38 -0
- package/example/src/chevre/searchPaymentServiceProviders.ts +38 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchScreeningRooms.ts +23 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/syncScreeningRooms.ts +21 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
- package/example/src/chevre/transaction/startExportTasks.ts +2 -1
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/example/src/playOnMoment.ts +24 -0
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +2 -1
- package/lib/chevre/eventEmitter/task.js +1 -4
- package/lib/chevre/eventEmitter/transaction.d.ts +1 -1
- package/lib/chevre/eventEmitter/transaction.js +1 -4
- package/lib/chevre/eventEmitter.d.ts +2 -1
- package/lib/chevre/eventEmitter.js +3 -1
- package/lib/chevre/index.d.ts +1 -1
- package/lib/chevre/index.js +2 -2
- package/lib/chevre/repo/account.js +3 -2
- package/lib/chevre/repo/accountTransaction.d.ts +3 -1
- package/lib/chevre/repo/accountTransaction.js +3 -2
- package/lib/chevre/repo/action.d.ts +42 -2
- package/lib/chevre/repo/action.js +130 -57
- package/lib/chevre/repo/additionalProperty.js +2 -1
- package/lib/chevre/repo/aggregation.d.ts +3 -0
- package/lib/chevre/repo/aggregation.js +3 -0
- package/lib/chevre/repo/assetTransaction.d.ts +23 -8
- package/lib/chevre/repo/assetTransaction.js +253 -80
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +37 -25
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +22 -6
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +2 -4
- package/lib/chevre/repo/creativeWork.js +35 -12
- package/lib/chevre/repo/customer.js +2 -1
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +2 -1
- package/lib/chevre/repo/event.d.ts +27 -1
- package/lib/chevre/repo/event.js +67 -33
- package/lib/chevre/repo/member.js +4 -3
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +55 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
- package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.js +0 -27
- package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +121 -0
- package/lib/chevre/repo/order.d.ts +55 -3
- package/lib/chevre/repo/order.js +62 -10
- package/lib/chevre/repo/ownershipInfo.js +2 -7
- package/lib/chevre/repo/place.d.ts +93 -24
- package/lib/chevre/repo/place.js +224 -78
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +18 -3
- package/lib/chevre/repo/product.js +139 -5
- package/lib/chevre/repo/project.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +20 -4
- package/lib/chevre/repo/reservation.js +40 -59
- package/lib/chevre/repo/role.js +3 -2
- package/lib/chevre/repo/seller.d.ts +1 -1
- package/lib/chevre/repo/seller.js +44 -23
- package/lib/chevre/repo/serviceOutput.js +2 -1
- package/lib/chevre/repo/stockHolder.d.ts +143 -7
- package/lib/chevre/repo/stockHolder.js +622 -104
- package/lib/chevre/repo/task.d.ts +42 -2
- package/lib/chevre/repo/task.js +68 -20
- package/lib/chevre/repo/transaction.d.ts +21 -2
- package/lib/chevre/repo/transaction.js +160 -48
- package/lib/chevre/repo/trip.js +2 -1
- package/lib/chevre/repository.d.ts +5 -2
- package/lib/chevre/repository.js +8 -4
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
- package/lib/chevre/service/aggregation/system.d.ts +110 -23
- package/lib/chevre/service/aggregation/system.js +213 -91
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/pay.js +20 -34
- package/lib/chevre/service/assetTransaction/refund.js +2 -24
- package/lib/chevre/service/assetTransaction/registerService.js +1 -25
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
- package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
- package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
- package/lib/chevre/service/assetTransaction/reserve.js +92 -69
- package/lib/chevre/service/assetTransaction.d.ts +6 -0
- package/lib/chevre/service/assetTransaction.js +9 -4
- package/lib/chevre/service/event.d.ts +3 -0
- package/lib/chevre/service/event.js +54 -22
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +41 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
- package/lib/chevre/service/offer/event/authorize.js +8 -2
- package/lib/chevre/service/offer/event/factory.d.ts +3 -0
- package/lib/chevre/service/offer/event/factory.js +16 -5
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/offer.d.ts +16 -8
- package/lib/chevre/service/offer.js +71 -8
- package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
- package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
- package/lib/chevre/service/order/onOrderUpdated.js +22 -0
- package/lib/chevre/service/order/placeOrder.d.ts +1 -0
- package/lib/chevre/service/order/placeOrder.js +41 -24
- package/lib/chevre/service/order/returnOrder.d.ts +1 -0
- package/lib/chevre/service/order/returnOrder.js +7 -12
- package/lib/chevre/service/order/sendOrder.d.ts +1 -0
- package/lib/chevre/service/order/sendOrder.js +7 -10
- package/lib/chevre/service/order.d.ts +2 -1
- package/lib/chevre/service/order.js +3 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +9 -5
- package/lib/chevre/service/payment/any.js +80 -18
- package/lib/chevre/service/payment/creditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +23 -17
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
- package/lib/chevre/service/payment/movieTicket/validation.js +65 -37
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +7 -6
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
- package/lib/chevre/service/reserve/cancelReservation.js +162 -142
- package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
- package/lib/chevre/service/reserve/checkInReservation.js +77 -3
- package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
- package/lib/chevre/service/reserve/confirmReservation.js +133 -58
- package/lib/chevre/service/reserve/factory.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
- package/lib/chevre/service/reserve/useReservation.js +61 -71
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
- package/lib/chevre/service/reserve.d.ts +3 -2
- package/lib/chevre/service/reserve.js +4 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
- package/lib/chevre/service/task/cancelReservation.js +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +10 -8
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
- package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
- package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
- package/lib/chevre/service/task/onResourceUpdated.d.ts +10 -0
- package/lib/chevre/service/task/onResourceUpdated.js +423 -0
- package/lib/chevre/service/task/placeOrder.js +1 -1
- package/lib/chevre/service/task/reserve.js +10 -7
- package/lib/chevre/service/task/returnOrder.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +2 -12
- package/lib/chevre/service/task/sendOrder.js +1 -1
- package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
- package/lib/chevre/service/task/syncScreeningRooms.js +23 -0
- package/lib/chevre/service/task/useReservation.d.ts +7 -0
- package/lib/chevre/service/task/useReservation.js +36 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
- package/lib/chevre/service/task.d.ts +6 -0
- package/lib/chevre/service/task.js +22 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
- package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder.js +228 -36
- package/lib/chevre/service/transaction.d.ts +7 -13
- package/lib/chevre/service/transaction.js +12 -139
- package/lib/chevre/settings.d.ts +13 -2
- package/lib/chevre/settings.js +56 -7
- package/package.json +5 -5
- package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
- package/example/src/chevre/eventCatalog2eventService.ts +0 -123
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
- package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
- package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
- package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
|
@@ -52,10 +52,18 @@ exports.voidPayTransaction = voidPayTransaction;
|
|
|
52
52
|
function invalidatePaymentUrl(params) {
|
|
53
53
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
var _a, _b, _c, _d, _e;
|
|
55
|
+
if (params.purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
56
|
+
throw new factory.errors.Argument('purpose.typeOf', `must be ${factory.transactionType.PlaceOrder}`);
|
|
57
|
+
}
|
|
55
58
|
const transaction = yield repos.transaction.findById({
|
|
56
59
|
typeOf: params.purpose.typeOf,
|
|
57
60
|
id: params.purpose.id
|
|
58
61
|
});
|
|
62
|
+
// 確定取引に対応(2023-05-03~)
|
|
63
|
+
if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
64
|
+
// no op
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
59
67
|
const paymentMethodIdByPaymentUrl = (_a = transaction.object.paymentMethods) === null || _a === void 0 ? void 0 : _a.paymentMethodId;
|
|
60
68
|
const paymentMethodType = (_b = transaction.object.paymentMethods) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
61
69
|
if (typeof paymentMethodIdByPaymentUrl === 'string' && paymentMethodIdByPaymentUrl.length > 0
|
|
@@ -70,12 +78,10 @@ function invalidatePaymentUrl(params) {
|
|
|
70
78
|
? transaction.seller.name
|
|
71
79
|
: String((_c = transaction.seller.name) === null || _c === void 0 ? void 0 : _c.ja),
|
|
72
80
|
id: transaction.seller.id
|
|
73
|
-
// project: transaction.seller.project
|
|
74
81
|
},
|
|
75
82
|
recipient: { typeOf: transaction.agent.typeOf, name: transaction.agent.name },
|
|
76
83
|
object: [{
|
|
77
84
|
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
78
|
-
// tslint:disable-next-line:max-line-length
|
|
79
85
|
id: (_e = (_d = transaction.object.paymentMethods) === null || _d === void 0 ? void 0 : _d.issuedThrough) === null || _e === void 0 ? void 0 : _e.id,
|
|
80
86
|
paymentMethod: {
|
|
81
87
|
additionalProperty: [],
|
|
@@ -96,17 +102,20 @@ exports.invalidatePaymentUrl = invalidatePaymentUrl;
|
|
|
96
102
|
* apiもしくはタスクから決済承認を取り消す
|
|
97
103
|
*/
|
|
98
104
|
function processVoidPayTransaction(params) {
|
|
105
|
+
// tslint:disable-next-line:max-func-body-length
|
|
99
106
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
var _a, _b;
|
|
100
108
|
let transaction;
|
|
101
109
|
// アクションID指定の場合、進行中取引検証(2023-02-24~)
|
|
102
110
|
if (typeof params.id === 'string') {
|
|
103
111
|
transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id });
|
|
104
112
|
}
|
|
105
113
|
else {
|
|
106
|
-
transaction = yield repos.transaction.findById({
|
|
114
|
+
transaction = (yield repos.transaction.findById({
|
|
107
115
|
typeOf: params.purpose.typeOf,
|
|
108
|
-
id: params.purpose.id
|
|
109
|
-
|
|
116
|
+
id: params.purpose.id,
|
|
117
|
+
inclusion: ['_id', 'typeOf', 'status', 'result.order.paymentMethods']
|
|
118
|
+
}));
|
|
110
119
|
}
|
|
111
120
|
// 承認アクションを取得
|
|
112
121
|
let authorizeActions;
|
|
@@ -122,7 +131,7 @@ function processVoidPayTransaction(params) {
|
|
|
122
131
|
const authorizeActionsOnTransaction = yield repos.action.searchByPurpose({
|
|
123
132
|
typeOf: factory.actionType.AuthorizeAction,
|
|
124
133
|
purpose: {
|
|
125
|
-
typeOf:
|
|
134
|
+
typeOf: transaction.typeOf,
|
|
126
135
|
id: transaction.id
|
|
127
136
|
}
|
|
128
137
|
});
|
|
@@ -131,12 +140,37 @@ function processVoidPayTransaction(params) {
|
|
|
131
140
|
return ((_a = a.object) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
132
141
|
&& ((_b = a.instrument) === null || _b === void 0 ? void 0 : _b.identifier) === factory.action.authorize.paymentMethod.any.ServiceIdentifier.Chevre;
|
|
133
142
|
});
|
|
143
|
+
switch (transaction.status) {
|
|
144
|
+
case factory.transactionStatusType.InProgress:
|
|
145
|
+
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
146
|
+
// 確定取引に対応(2023-05-03~)
|
|
147
|
+
case factory.transactionStatusType.Confirmed:
|
|
148
|
+
// アクションステータスを検証する
|
|
149
|
+
authorizeActions = authorizeActions.filter((a) => a.actionStatus !== factory.actionStatusType.CompletedActionStatus);
|
|
150
|
+
if (transaction.typeOf === factory.transactionType.PlaceOrder) {
|
|
151
|
+
const paymentMethodIds = (_b = (_a = transaction.result) === null || _a === void 0 ? void 0 : _a.order) === null || _b === void 0 ? void 0 : _b.paymentMethods.map((p) => {
|
|
152
|
+
return p.paymentMethodId;
|
|
153
|
+
});
|
|
154
|
+
if (!Array.isArray(paymentMethodIds)) {
|
|
155
|
+
throw new factory.errors.Argument('Transaction', `${transaction.id} must have result.order.paymentMethods`);
|
|
156
|
+
}
|
|
157
|
+
if (paymentMethodIds.length > 0) {
|
|
158
|
+
authorizeActions = authorizeActions.filter((a) => {
|
|
159
|
+
// paymentMethodIdが存在しない、あるいは、注文のpaymentMethodIdsに含まれなければ、アクション取消対象
|
|
160
|
+
const paymentMethodIdByAction = a.object.paymentMethodId;
|
|
161
|
+
const includedInOrder = typeof paymentMethodIdByAction === 'string'
|
|
162
|
+
&& paymentMethodIds.includes(paymentMethodIdByAction);
|
|
163
|
+
return !includedInOrder;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
default:
|
|
169
|
+
// no op
|
|
170
|
+
}
|
|
134
171
|
}
|
|
135
172
|
const errors = [];
|
|
136
173
|
for (const action of authorizeActions) {
|
|
137
|
-
// 直列にゆっくり処理する場合↓
|
|
138
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
139
|
-
// await new Promise((resolve) => setTimeout(() => { resolve(); }, 1000));
|
|
140
174
|
// 失敗するケースがあっても、残りが少なくとも処理されるようにエラーハンドリング
|
|
141
175
|
try {
|
|
142
176
|
// 取引が存在すれば中止
|
|
@@ -194,7 +228,7 @@ function publishPaymentUrl(params) {
|
|
|
194
228
|
paymentUrl: result.paymentUrl,
|
|
195
229
|
issuedThrough: { id: (typeof startParams.object.id === 'string') ? startParams.object.id : '' }
|
|
196
230
|
};
|
|
197
|
-
yield repos.transaction.
|
|
231
|
+
yield repos.transaction.findByIdAndUpdateInProgress({
|
|
198
232
|
id: transaction.id,
|
|
199
233
|
update: { $set: { 'object.paymentMethods': paymentMethodByPaymentUrl } }
|
|
200
234
|
});
|
|
@@ -206,6 +240,7 @@ exports.publishPaymentUrl = publishPaymentUrl;
|
|
|
206
240
|
* 決済承認
|
|
207
241
|
*/
|
|
208
242
|
function authorize(params) {
|
|
243
|
+
// tslint:disable-next-line:max-func-body-length
|
|
209
244
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
210
245
|
var _a, _b;
|
|
211
246
|
const transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id });
|
|
@@ -217,6 +252,21 @@ function authorize(params) {
|
|
|
217
252
|
const paymentMethodIdByTransaction = (_a = transaction.object.paymentMethods) === null || _a === void 0 ? void 0 : _a.paymentMethodId;
|
|
218
253
|
if (params.object.paymentMethodId === paymentMethodIdByTransaction) {
|
|
219
254
|
transactionNumber = params.object.paymentMethodId;
|
|
255
|
+
// 既に承認済であれば何もしない(2023-05-15~)
|
|
256
|
+
const existingCompletedAuthorizeActions = yield repos.action.searchByPurpose({
|
|
257
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
258
|
+
purpose: { id: transaction.id, typeOf: transaction.typeOf },
|
|
259
|
+
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus },
|
|
260
|
+
object: {
|
|
261
|
+
paymentMethodId: { $eq: transactionNumber },
|
|
262
|
+
typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment }
|
|
263
|
+
},
|
|
264
|
+
sort: { startDate: factory.sortType.Ascending }
|
|
265
|
+
});
|
|
266
|
+
const existingCompletedAuthorizeAction = existingCompletedAuthorizeActions.shift();
|
|
267
|
+
if (existingCompletedAuthorizeAction !== undefined) {
|
|
268
|
+
return existingCompletedAuthorizeAction;
|
|
269
|
+
}
|
|
220
270
|
}
|
|
221
271
|
else {
|
|
222
272
|
// 取引にないpaymentMethodIdの指定はクライアントエラー
|
|
@@ -264,7 +314,11 @@ function authorize(params) {
|
|
|
264
314
|
transactionNumber: transactionNumber,
|
|
265
315
|
location: params.location
|
|
266
316
|
});
|
|
267
|
-
payTransaction = yield PayTransactionService.start(startParams,
|
|
317
|
+
payTransaction = yield PayTransactionService.start(startParams, {
|
|
318
|
+
useCheckMovieTicketBeforePay: params.options.useCheckMovieTicketBeforePay,
|
|
319
|
+
useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
|
|
320
|
+
searchTrade4accountId: params.options.useSearchTrade4accountId
|
|
321
|
+
})(repos);
|
|
268
322
|
}
|
|
269
323
|
catch (error) {
|
|
270
324
|
try {
|
|
@@ -275,13 +329,21 @@ function authorize(params) {
|
|
|
275
329
|
// no op
|
|
276
330
|
}
|
|
277
331
|
// 即時に決済取引を中止するか?(2023-02-03~)
|
|
278
|
-
if (params.useCancelPayTransactionOnFailed) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
332
|
+
if (params.options.useCancelPayTransactionOnFailed) {
|
|
333
|
+
// abortエラーの場合は状態不明なので即時中止しない(2023-06-01~)
|
|
334
|
+
// {
|
|
335
|
+
// "type": "aborted",
|
|
336
|
+
// "message": "The user aborted a request.",
|
|
337
|
+
// "name": "AbortError"
|
|
338
|
+
// }
|
|
339
|
+
if (error.name !== 'AbortError') {
|
|
340
|
+
yield processVoidPayTransaction({
|
|
341
|
+
project: action.project,
|
|
342
|
+
agent: { id: action.project.id },
|
|
343
|
+
id: action.id,
|
|
344
|
+
purpose: action.purpose
|
|
345
|
+
})(repos);
|
|
346
|
+
}
|
|
285
347
|
}
|
|
286
348
|
throw error;
|
|
287
349
|
}
|
|
@@ -13,7 +13,7 @@ import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
|
13
13
|
/**
|
|
14
14
|
* クレジットカード決済承認
|
|
15
15
|
*/
|
|
16
|
-
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
|
|
16
|
+
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, searchTrade4accountId: boolean): (repos: {
|
|
17
17
|
person: PersonRepo;
|
|
18
18
|
product: ProductRepo;
|
|
19
19
|
project: ProjectRepo;
|
|
@@ -21,11 +21,11 @@ const factory = require("../../factory");
|
|
|
21
21
|
const onPaid_1 = require("./any/onPaid");
|
|
22
22
|
const onRefund_1 = require("./any/onRefund");
|
|
23
23
|
const person2username_1 = require("./any/person2username");
|
|
24
|
-
const debug = createDebug('chevre-domain:service');
|
|
24
|
+
const debug = createDebug('chevre-domain:service:payment');
|
|
25
25
|
/**
|
|
26
26
|
* クレジットカード決済承認
|
|
27
27
|
*/
|
|
28
|
-
function authorize(params, paymentServiceId) {
|
|
28
|
+
function authorize(params, paymentServiceId, searchTrade4accountId) {
|
|
29
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
var _a, _b, _c, _d;
|
|
31
31
|
const project = yield repos.project.findById({ id: params.project.id });
|
|
@@ -65,19 +65,25 @@ function authorize(params, paymentServiceId) {
|
|
|
65
65
|
catch (error) {
|
|
66
66
|
throw handleAuthorizeError(error);
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
if (searchTrade4accountId) {
|
|
69
|
+
try {
|
|
70
|
+
const creditCardService = new GMO.service.Credit({ endpoint: String(availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
|
|
71
|
+
// ベストエフォートでクレジットカード詳細情報を取得
|
|
72
|
+
const startSearchTradeDate = Date.now();
|
|
73
|
+
debug('searchTrade processing...orderId:', orderId, startSearchTradeDate);
|
|
74
|
+
searchTradeResult = yield creditCardService.searchTrade({
|
|
75
|
+
shopId: shopId,
|
|
76
|
+
shopPass: shopPass,
|
|
77
|
+
orderId: orderId,
|
|
78
|
+
siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
|
|
79
|
+
sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
80
|
+
});
|
|
81
|
+
debug('searchTrade processed. orderId:', orderId, 'execution time:', (Date.now() - startSearchTradeDate), 'ms');
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
// no op
|
|
85
|
+
debug('searchTrade throwed an error. orderId:', orderId, error);
|
|
86
|
+
}
|
|
81
87
|
}
|
|
82
88
|
return {
|
|
83
89
|
accountId: (searchTradeResult !== undefined) ? searchTradeResult.cardNo : '',
|
|
@@ -515,7 +521,7 @@ function processChangeTransaction(params) {
|
|
|
515
521
|
function getGMOInfoFromSeller(params) {
|
|
516
522
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
517
523
|
var _a, _b, _c, _d;
|
|
518
|
-
const seller = yield repos.seller.findById({ id: String(params.seller.id) });
|
|
524
|
+
const seller = yield repos.seller.findById({ id: String(params.seller.id) }, ['paymentAccepted', 'project'], []);
|
|
519
525
|
const paymentAccepted = (_a = seller.paymentAccepted) === null || _a === void 0 ? void 0 : _a.some((a) => a.paymentMethodType === params.paymentMethodType);
|
|
520
526
|
if (paymentAccepted !== true) {
|
|
521
527
|
throw new factory.errors.Argument('transaction', 'payment not accepted');
|
|
@@ -528,7 +534,7 @@ function getGMOInfoFromSeller(params) {
|
|
|
528
534
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard },
|
|
529
535
|
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
530
536
|
id: { $eq: params.paymentServiceId }
|
|
531
|
-
});
|
|
537
|
+
}, [], []);
|
|
532
538
|
const paymentService = paymentServices.shift();
|
|
533
539
|
if (paymentService === undefined) {
|
|
534
540
|
throw new factory.errors.NotFound('PaymentService');
|
|
@@ -6,16 +6,17 @@ interface ICheckResult {
|
|
|
6
6
|
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
7
7
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
* MovieTicket認証
|
|
11
|
-
*/
|
|
12
|
-
declare function checkByIdentifier(params: {
|
|
9
|
+
interface ICheckByIdentifierParams {
|
|
13
10
|
movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
|
|
14
|
-
seller: factory.seller.ISeller
|
|
11
|
+
seller: Pick<factory.seller.ISeller, 'id' | 'project'>;
|
|
15
12
|
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
16
13
|
paymentServiceId: string;
|
|
17
|
-
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* MovieTicket認証
|
|
17
|
+
*/
|
|
18
|
+
declare function checkByIdentifier(params: ICheckByIdentifierParams): (repos: {
|
|
18
19
|
product: ProductRepo;
|
|
19
20
|
project: ProjectRepo;
|
|
20
21
|
}) => Promise<ICheckResult>;
|
|
21
|
-
export { ICheckResult, checkByIdentifier };
|
|
22
|
+
export { ICheckByIdentifierParams, ICheckResult, checkByIdentifier };
|
|
@@ -6,7 +6,7 @@ export declare function createSeatInfoSyncIn(params: {
|
|
|
6
6
|
movieTickets: factory.action.trade.pay.IMovieTicket[];
|
|
7
7
|
event: factory.event.screeningEvent.IEvent;
|
|
8
8
|
purpose: factory.action.trade.pay.IPurpose;
|
|
9
|
-
seller: factory.seller.ISeller
|
|
9
|
+
seller: Pick<factory.seller.ISeller, 'paymentAccepted'>;
|
|
10
10
|
credentials: {
|
|
11
11
|
kgygishCd: string;
|
|
12
12
|
stCd: string;
|
|
@@ -2,7 +2,7 @@ import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
declare function getCredentials(params: {
|
|
4
4
|
paymentMethodType: string;
|
|
5
|
-
seller: factory.seller.ISeller
|
|
5
|
+
seller: Pick<factory.seller.ISeller, 'id' | 'project'>;
|
|
6
6
|
paymentServiceId: string;
|
|
7
7
|
}): (repos: {
|
|
8
8
|
product: ProductRepo;
|
|
@@ -22,7 +22,7 @@ function getCredentials(params) {
|
|
|
22
22
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
23
23
|
// serviceType: { codeValue: { $eq: params.paymentMethodType } },
|
|
24
24
|
id: { $eq: params.paymentServiceId }
|
|
25
|
-
});
|
|
25
|
+
}, [], []);
|
|
26
26
|
const paymentService = paymentServices.shift();
|
|
27
27
|
if (paymentService === undefined) {
|
|
28
28
|
throw new factory.errors.NotFound('PaymentService');
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 決済取引サービス
|
|
3
|
-
*/
|
|
4
1
|
import * as factory from '../../../factory';
|
|
2
|
+
import { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
5
3
|
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
6
4
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
7
5
|
import { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
8
6
|
import { MongoRepository as SellerRepo } from '../../../repo/seller';
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
|
|
8
|
+
action: ActionRepo;
|
|
11
9
|
event: EventRepo;
|
|
12
10
|
product: ProductRepo;
|
|
13
11
|
project: ProjectRepo;
|
|
14
12
|
seller: SellerRepo;
|
|
15
|
-
}) => Promise<
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
|
|
15
|
+
}>;
|
|
@@ -10,29 +10,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.validateMovieTicket = void 0;
|
|
13
|
-
|
|
14
|
-
* 決済取引サービス
|
|
15
|
-
*/
|
|
13
|
+
const createDebug = require("debug");
|
|
16
14
|
const factory = require("../../../factory");
|
|
17
15
|
const checkByIdentifier_1 = require("./checkByIdentifier");
|
|
18
|
-
|
|
19
|
-
function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay) {
|
|
16
|
+
const debug = createDebug('chevre-domain:service:payment');
|
|
17
|
+
function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
20
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
20
|
var _a, _b, _c, _d;
|
|
22
21
|
const movieTickets = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.movieTickets;
|
|
23
22
|
if (!Array.isArray(movieTickets)) {
|
|
24
|
-
throw new factory.errors.Argument('object.paymentMethod.movieTickets must be an array');
|
|
23
|
+
throw new factory.errors.Argument('movieTickets', 'object.paymentMethod.movieTickets must be an array');
|
|
25
24
|
}
|
|
26
25
|
// イベント1つのみ許可
|
|
27
|
-
const eventIds = [...new Set(movieTickets
|
|
26
|
+
const eventIds = [...new Set(movieTickets.map((t) => t.serviceOutput.reservationFor.id))];
|
|
28
27
|
if (eventIds.length !== 1) {
|
|
29
28
|
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
30
29
|
}
|
|
31
|
-
//
|
|
32
|
-
const movieTicketIdentifiers = [...new Set(movieTickets
|
|
30
|
+
// 決済カードidentifierは1つのみ許可
|
|
31
|
+
const movieTicketIdentifiers = [...new Set(movieTickets.map((t) => t.identifier))];
|
|
33
32
|
if (movieTicketIdentifiers.length !== 1) {
|
|
34
33
|
throw new factory.errors.Argument('movieTickets', 'Number of movie ticket identifiers must be 1');
|
|
35
34
|
}
|
|
35
|
+
const movieTicketIdentifier = movieTicketIdentifiers[0];
|
|
36
|
+
// 決済カードaccessCodeは1つのみ許可(2023-06-23~)
|
|
37
|
+
const accessCodes = [...new Set(movieTickets.map((t) => t.accessCode))];
|
|
38
|
+
if (accessCodes.length !== 1) {
|
|
39
|
+
throw new factory.errors.Argument('movieTickets', 'Number of movie ticket accessCodes must be 1');
|
|
40
|
+
}
|
|
36
41
|
// ムビチケ系統の決済方法タイプは動的
|
|
37
42
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
38
43
|
if (typeof paymentMethodType !== 'string') {
|
|
@@ -47,39 +52,33 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
47
52
|
if (typeof sellerId !== 'string') {
|
|
48
53
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
49
54
|
}
|
|
50
|
-
const seller = yield repos.seller.findById({ id: sellerId });
|
|
55
|
+
const seller = yield repos.seller.findById({ id: sellerId }, ['paymentAccepted', 'project'], []);
|
|
51
56
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
52
57
|
if (paymentAccepted !== true) {
|
|
53
58
|
throw new factory.errors.Argument('recipient', 'payment not accepted');
|
|
54
59
|
}
|
|
55
60
|
// オプション追加(2023-03-06~)
|
|
56
61
|
if (!useCheckMovieTicketBeforePay) {
|
|
57
|
-
return;
|
|
62
|
+
return { accountsReceivablesByServiceType: [] };
|
|
58
63
|
}
|
|
59
|
-
const checkResult = yield (
|
|
64
|
+
const checkResult = yield checkByIdentifierIfNotYet({
|
|
65
|
+
movieTicketIdentifier,
|
|
60
66
|
movieTickets: movieTickets,
|
|
61
67
|
seller: seller,
|
|
62
68
|
screeningEvent: screeningEvent,
|
|
63
|
-
paymentServiceId
|
|
69
|
+
paymentServiceId,
|
|
70
|
+
useCheckByIdentifierIfNotYet
|
|
64
71
|
})(repos);
|
|
65
|
-
|
|
66
|
-
// 要求に対して十分かどうか検証する
|
|
67
|
-
// const availableMovieTickets = checkResult.movieTickets.filter((t) => t.amount?.validThrough === undefined);
|
|
68
|
-
// 総数が足りているか(券種ごとに枚数検証を実行するので不要)
|
|
69
|
-
// if (availableMovieTickets.length < movieTickets.length) {
|
|
70
|
-
// throw new factory.errors.Argument(
|
|
71
|
-
// 'movieTickets',
|
|
72
|
-
// `${movieTickets.length - availableMovieTickets.length} movie tickets short`
|
|
73
|
-
// );
|
|
74
|
-
// }
|
|
72
|
+
const accountsReceivablesByServiceType = [];
|
|
75
73
|
// 券種ごとに枚数が足りているか
|
|
76
74
|
const serviceTypes = [...new Set(movieTickets.map((t) => t.serviceType))];
|
|
77
75
|
serviceTypes.forEach((serviceType) => {
|
|
78
|
-
var _a, _b
|
|
76
|
+
var _a, _b;
|
|
79
77
|
const requiredMovieTicketsCountByServiceType = movieTickets.filter((t) => t.serviceType === serviceType).length;
|
|
80
78
|
let availableMovieTicketsCountByServiceType = 0;
|
|
81
|
-
const ykknInfos = (_b = (_a = checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find((knyknrNoInfoOut) => knyknrNoInfoOut.knyknrNo ===
|
|
82
|
-
const
|
|
79
|
+
const ykknInfos = (_b = (_a = checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find((knyknrNoInfoOut) => knyknrNoInfoOut.knyknrNo === movieTicketIdentifier)) === null || _b === void 0 ? void 0 : _b.ykknInfo;
|
|
80
|
+
const ykknInfoOfServiceType = ykknInfos === null || ykknInfos === void 0 ? void 0 : ykknInfos.find((ykknInfo) => ykknInfo.ykknshTyp === serviceType);
|
|
81
|
+
const ykknKnshbtsmiNum = ykknInfoOfServiceType === null || ykknInfoOfServiceType === void 0 ? void 0 : ykknInfoOfServiceType.ykknKnshbtsmiNum;
|
|
83
82
|
if (typeof ykknKnshbtsmiNum === 'string') {
|
|
84
83
|
availableMovieTicketsCountByServiceType = Number(ykknKnshbtsmiNum);
|
|
85
84
|
}
|
|
@@ -87,18 +86,47 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
87
86
|
const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsCountByServiceType;
|
|
88
87
|
throw new factory.errors.Argument('movieTickets', `${shortNumber} movie tickets by service type ${serviceType} short`);
|
|
89
88
|
}
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
// `${shortNumber} movie tickets by service type ${serviceType} short`
|
|
96
|
-
// );
|
|
97
|
-
// }
|
|
89
|
+
// checkResultから計上金額を取得
|
|
90
|
+
const accountsReceivableByResponse = ykknInfoOfServiceType === null || ykknInfoOfServiceType === void 0 ? void 0 : ykknInfoOfServiceType.kijUnip;
|
|
91
|
+
accountsReceivablesByServiceType.push(Object.assign({ serviceType }, (typeof accountsReceivableByResponse === 'string')
|
|
92
|
+
? { accountsReceivable: Number(accountsReceivableByResponse) }
|
|
93
|
+
: undefined));
|
|
98
94
|
});
|
|
99
|
-
|
|
100
|
-
return;
|
|
101
|
-
// return checkResult;
|
|
95
|
+
return { accountsReceivablesByServiceType };
|
|
102
96
|
});
|
|
103
97
|
}
|
|
104
98
|
exports.validateMovieTicket = validateMovieTicket;
|
|
99
|
+
function checkByIdentifierIfNotYet(params) {
|
|
100
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
102
|
+
let checkResult;
|
|
103
|
+
if (params.useCheckByIdentifierIfNotYet === true) {
|
|
104
|
+
// すでにCheckActionが存在すれば認証しない(2023-06-06~)
|
|
105
|
+
debug('searching alreadyCheckedActions...movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
|
|
106
|
+
const alreadyCheckedAction = yield repos.action.search({
|
|
107
|
+
limit: 1,
|
|
108
|
+
page: 1,
|
|
109
|
+
sort: { startDate: factory.sortType.Descending },
|
|
110
|
+
typeOf: { $eq: factory.actionType.CheckAction },
|
|
111
|
+
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
112
|
+
object: {
|
|
113
|
+
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
114
|
+
id: { $eq: params.paymentServiceId },
|
|
115
|
+
movieTickets: {
|
|
116
|
+
identifier: { $eq: params.movieTicketIdentifier },
|
|
117
|
+
serviceOutput: {
|
|
118
|
+
reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, ['result'], []);
|
|
123
|
+
debug('alreadyCheckedAction found', alreadyCheckedAction, 'movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
|
|
124
|
+
checkResult = (_a = alreadyCheckedAction.shift()) === null || _a === void 0 ? void 0 : _a.result;
|
|
125
|
+
}
|
|
126
|
+
if (checkResult === undefined) {
|
|
127
|
+
debug('checkByIdentifier processing because movieTickets not checked yet...', checkResult);
|
|
128
|
+
checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)(params)(repos);
|
|
129
|
+
}
|
|
130
|
+
return checkResult;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
@@ -42,14 +42,14 @@ declare function checkMovieTicket(params: factory.action.check.paymentMethod.mov
|
|
|
42
42
|
}>;
|
|
43
43
|
interface IAuthorizeResult {
|
|
44
44
|
accountId: string;
|
|
45
|
-
|
|
45
|
+
accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
|
|
46
46
|
payAction: factory.action.trade.pay.IAction;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* MovieTicket承認
|
|
50
50
|
* オーソリサービスが存在するわけではないので、実質着券する
|
|
51
51
|
*/
|
|
52
|
-
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean): (repos: {
|
|
52
|
+
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
|
|
53
53
|
action: ActionRepo;
|
|
54
54
|
accountingReport: AccountingReportRepo;
|
|
55
55
|
event: EventRepo;
|
|
@@ -58,7 +58,7 @@ function checkMovieTicket(params) {
|
|
|
58
58
|
id: eventIds[0]
|
|
59
59
|
});
|
|
60
60
|
// ショップ情報取得
|
|
61
|
-
const seller = yield repos.seller.findById({ id: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id });
|
|
61
|
+
const seller = yield repos.seller.findById({ id: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id }, ['paymentAccepted', 'project'], []);
|
|
62
62
|
const paymentAccepted = (_f = seller.paymentAccepted) === null || _f === void 0 ? void 0 : _f.some((a) => a.paymentMethodType === paymentMethodType);
|
|
63
63
|
if (paymentAccepted !== true) {
|
|
64
64
|
throw new factory.errors.Argument('transactionId', 'payment not accepted');
|
|
@@ -102,15 +102,16 @@ exports.checkMovieTicket = checkMovieTicket;
|
|
|
102
102
|
* MovieTicket承認
|
|
103
103
|
* オーソリサービスが存在するわけではないので、実質着券する
|
|
104
104
|
*/
|
|
105
|
-
function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay) {
|
|
105
|
+
function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
|
|
106
106
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
var _a, _b;
|
|
108
108
|
let accountId;
|
|
109
|
-
let checkResult;
|
|
110
109
|
let payAction;
|
|
110
|
+
let accountsReceivablesByServiceType = [];
|
|
111
111
|
try {
|
|
112
112
|
// MovieTicket決済の場合、認証
|
|
113
|
-
|
|
113
|
+
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
|
|
114
|
+
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
114
115
|
const paymentMethod = transaction.object.paymentMethod;
|
|
115
116
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
116
117
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
@@ -141,7 +142,7 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
141
142
|
catch (error) {
|
|
142
143
|
throw (0, errorHandler_1.handleMvtkReserveError)(error);
|
|
143
144
|
}
|
|
144
|
-
return { accountId,
|
|
145
|
+
return { accountId, payAction, accountsReceivablesByServiceType };
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
exports.authorize = authorize;
|
|
@@ -301,7 +302,7 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
301
302
|
// イベント取得属性最適化(2023-01-23~)
|
|
302
303
|
// const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
|
|
303
304
|
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
304
|
-
const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) });
|
|
305
|
+
const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) }, ['paymentAccepted', 'project'], []);
|
|
305
306
|
// 全購入管理番号のMovieTicketをマージ
|
|
306
307
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
307
308
|
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
@@ -77,10 +77,6 @@ function onRegistered(actionAttributes, __) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
// タスク保管
|
|
80
|
-
|
|
81
|
-
yield repos.task.saveMany(taskAttributes);
|
|
82
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
83
|
-
// return repos.task.save(taskAttribute);
|
|
84
|
-
// }));
|
|
80
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
85
81
|
});
|
|
86
82
|
}
|
|
@@ -148,19 +148,15 @@ export interface ISellerFlowTransactionResult {
|
|
|
148
148
|
/**
|
|
149
149
|
* イベントまでの合計残り時間(ミリ秒)
|
|
150
150
|
*/
|
|
151
|
-
totalTimeLeftUntilEventInMilliseconds: number;
|
|
152
151
|
/**
|
|
153
152
|
* イベントまでの最大残り時間(ミリ秒)
|
|
154
153
|
*/
|
|
155
|
-
maxTimeLeftUntilEventInMilliseconds: number;
|
|
156
154
|
/**
|
|
157
155
|
* イベントまでの最小残り時間(ミリ秒)
|
|
158
156
|
*/
|
|
159
|
-
minTimeLeftUntilEventInMilliseconds: number;
|
|
160
157
|
/**
|
|
161
158
|
* イベントまでの平均残り時間(ミリ秒)
|
|
162
159
|
*/
|
|
163
|
-
averageTimeLeftUntilEventInMilliseconds: number;
|
|
164
160
|
/**
|
|
165
161
|
* 取引の合計金額(yen)
|
|
166
162
|
*/
|
|
@@ -180,15 +176,12 @@ export interface ISellerFlowTransactionResult {
|
|
|
180
176
|
/**
|
|
181
177
|
* アクション数合計値(成立取引)
|
|
182
178
|
*/
|
|
183
|
-
totalNumberOfActionsOnConfirmed: number;
|
|
184
179
|
/**
|
|
185
180
|
* 最大アクション数(成立取引)
|
|
186
181
|
*/
|
|
187
|
-
maxNumberOfActionsOnConfirmed: number;
|
|
188
182
|
/**
|
|
189
183
|
* 最小アクション数(成立取引)
|
|
190
184
|
*/
|
|
191
|
-
minNumberOfActionsOnConfirmed: number;
|
|
192
185
|
/**
|
|
193
186
|
* 注文アイテム数合計値
|
|
194
187
|
*/
|
|
@@ -205,10 +198,6 @@ export interface ISellerFlowTransactionResult {
|
|
|
205
198
|
* 平均注文アイテム数
|
|
206
199
|
*/
|
|
207
200
|
averageNumberOfOrderItems: number;
|
|
208
|
-
/**
|
|
209
|
-
* 平均アクション数(成立取引)
|
|
210
|
-
*/
|
|
211
|
-
averageNumberOfActionsOnConfirmed: number;
|
|
212
201
|
}
|
|
213
202
|
/**
|
|
214
203
|
* 販売者が対象のフローデータ
|