@chevre/domain 21.2.0-alpha.13 → 21.2.0-alpha.130
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/findMovieTheaterById.ts +40 -0
- 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/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchScreeningRooms.ts +23 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -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/updateScreeningRoom.ts +41 -0
- 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 +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- 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 +62 -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 +49 -3
- 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/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 +20 -5
- package/lib/chevre/repo/place.js +63 -23
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +1 -3
- package/lib/chevre/repo/product.js +25 -4
- 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 +137 -7
- package/lib/chevre/repo/stockHolder.js +527 -102
- package/lib/chevre/repo/task.d.ts +45 -2
- package/lib/chevre/repo/task.js +94 -15
- package/lib/chevre/repo/transaction.d.ts +21 -2
- package/lib/chevre/repo/transaction.js +171 -50
- 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 +8 -6
- 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.js +25 -6
- 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 +55 -32
- 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 +7 -0
- package/lib/chevre/service/task/onResourceUpdated.js +352 -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/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 +9 -0
- package/lib/chevre/service/task.js +43 -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 -1
- package/lib/chevre/settings.js +56 -6
- 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
|
@@ -168,50 +168,67 @@ function placeOrder(params) {
|
|
|
168
168
|
confirmationNumber: params.object.confirmationNumber,
|
|
169
169
|
orderNumber: params.object.orderNumber
|
|
170
170
|
})({ transaction: repos.transaction });
|
|
171
|
-
// アクションを作成する(2022-04-11~)
|
|
172
171
|
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
173
172
|
const simpleOrder = {
|
|
174
|
-
// project: order.project,
|
|
175
173
|
typeOf: order.typeOf,
|
|
176
174
|
seller: order.seller,
|
|
177
175
|
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
178
|
-
// IOrderへ移行(2022-11-17~)
|
|
179
|
-
// confirmationNumber: order.confirmationNumber,
|
|
180
176
|
orderNumber: order.orderNumber,
|
|
181
177
|
price: order.price,
|
|
182
178
|
priceCurrency: order.priceCurrency,
|
|
183
179
|
orderDate: order.orderDate
|
|
184
180
|
};
|
|
181
|
+
const orderActionPurpose = {
|
|
182
|
+
typeOf: placeOrderTransaction.typeOf, id: placeOrderTransaction.id
|
|
183
|
+
};
|
|
185
184
|
const orderActionAttributes = {
|
|
186
185
|
agent: (typeof ((_a = params.agent) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.agent : order.project,
|
|
187
186
|
object: simpleOrder,
|
|
188
187
|
potentialActions: {},
|
|
189
188
|
project: order.project,
|
|
190
|
-
purpose:
|
|
189
|
+
purpose: orderActionPurpose,
|
|
191
190
|
typeOf: factory.actionType.OrderAction
|
|
192
191
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
192
|
+
// 冪等性を担保(2023-05-31~)
|
|
193
|
+
const completedActions = yield repos.action.search({
|
|
194
|
+
limit: 1,
|
|
195
|
+
page: 1,
|
|
196
|
+
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
197
|
+
typeOf: { $eq: orderActionAttributes.typeOf },
|
|
198
|
+
object: {
|
|
199
|
+
orderNumber: { $in: [orderActionAttributes.object.orderNumber] }
|
|
200
|
+
},
|
|
201
|
+
purpose: {
|
|
202
|
+
id: { $in: [orderActionPurpose.id] },
|
|
203
|
+
typeOf: { $in: [orderActionPurpose.typeOf] }
|
|
204
|
+
}
|
|
205
|
+
}, ['_id'], []);
|
|
206
|
+
if (completedActions.length === 0) {
|
|
207
|
+
const action = yield repos.action.start(orderActionAttributes);
|
|
199
208
|
try {
|
|
200
|
-
|
|
201
|
-
yield repos.action.giveUp({ typeOf: orderActionAttributes.typeOf, id: action.id, error: actionError });
|
|
209
|
+
yield repos.order.createIfNotExist(order);
|
|
202
210
|
}
|
|
203
|
-
catch (
|
|
204
|
-
//
|
|
211
|
+
catch (error) {
|
|
212
|
+
// actionにエラー結果を追加
|
|
213
|
+
try {
|
|
214
|
+
const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
|
|
215
|
+
yield repos.action.giveUp({ typeOf: orderActionAttributes.typeOf, id: action.id, error: actionError });
|
|
216
|
+
}
|
|
217
|
+
catch (__) {
|
|
218
|
+
// 失敗したら仕方ない
|
|
219
|
+
}
|
|
220
|
+
throw error;
|
|
205
221
|
}
|
|
206
|
-
|
|
222
|
+
yield repos.action.complete({ typeOf: orderActionAttributes.typeOf, id: action.id, result: {} });
|
|
223
|
+
}
|
|
224
|
+
if (params.useOnOrderStatusChanged || params.useOnOrderStatusChanged === undefined) {
|
|
225
|
+
// 経理レポートを保管
|
|
226
|
+
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(order)({ accountingReport: repos.accountingReport });
|
|
227
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order })({
|
|
228
|
+
registerActionInProgress: repos.registerActionInProgress,
|
|
229
|
+
task: repos.task
|
|
230
|
+
});
|
|
207
231
|
}
|
|
208
|
-
yield repos.action.complete({ typeOf: orderActionAttributes.typeOf, id: action.id, result: {} });
|
|
209
|
-
// 経理レポートを保管
|
|
210
|
-
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(order)({ accountingReport: repos.accountingReport });
|
|
211
|
-
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order })({
|
|
212
|
-
registerActionInProgress: repos.registerActionInProgress,
|
|
213
|
-
task: repos.task
|
|
214
|
-
});
|
|
215
232
|
// 潜在アクション
|
|
216
233
|
yield onPlaceOrder({
|
|
217
234
|
object: order,
|
|
@@ -269,6 +286,6 @@ function onPlaceOrder(params) {
|
|
|
269
286
|
}
|
|
270
287
|
}
|
|
271
288
|
// タスク保管
|
|
272
|
-
yield repos.task.saveMany(taskAttributes);
|
|
289
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
273
290
|
});
|
|
274
291
|
}
|
|
@@ -42,12 +42,9 @@ function returnOrder(params) {
|
|
|
42
42
|
throw new factory.errors.NotFound(factory.transactionType.ReturnOrder);
|
|
43
43
|
}
|
|
44
44
|
const simpleOrder = {
|
|
45
|
-
// project: order.project,
|
|
46
45
|
typeOf: order.typeOf,
|
|
47
46
|
seller: order.seller,
|
|
48
47
|
customer: (0, order_1.createMaskedCustomer)(order),
|
|
49
|
-
// IOrderへ移行(2022-11-17~)
|
|
50
|
-
// confirmationNumber: order.confirmationNumber,
|
|
51
48
|
orderNumber: order.orderNumber,
|
|
52
49
|
price: order.price,
|
|
53
50
|
priceCurrency: order.priceCurrency,
|
|
@@ -80,10 +77,12 @@ function returnOrder(params) {
|
|
|
80
77
|
}
|
|
81
78
|
const result = returnedOwnershipInfos;
|
|
82
79
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
if (params.useOnOrderStatusChanged || params.useOnOrderStatusChanged === undefined) {
|
|
81
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order, returnOrderTransaction })({
|
|
82
|
+
registerActionInProgress: repos.registerServiceInProgress,
|
|
83
|
+
task: repos.task
|
|
84
|
+
});
|
|
85
|
+
}
|
|
87
86
|
// 潜在アクション
|
|
88
87
|
yield onReturn(returnOrderActionAttributes)({ task: repos.task });
|
|
89
88
|
});
|
|
@@ -204,10 +203,6 @@ function onReturn(returnActionAttributes) {
|
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
// タスク保管
|
|
207
|
-
|
|
208
|
-
yield repos.task.saveMany(taskAttributes);
|
|
209
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
210
|
-
// return repos.task.save(taskAttribute);
|
|
211
|
-
// }));
|
|
206
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
212
207
|
});
|
|
213
208
|
}
|
|
@@ -40,16 +40,11 @@ function sendOrder(params) {
|
|
|
40
40
|
if (order.confirmationNumber !== confirmationNumber) {
|
|
41
41
|
throw new factory.errors.NotFound('Order');
|
|
42
42
|
}
|
|
43
|
-
// SendOrderアクションを作成する
|
|
44
|
-
// minimizeする(2022-04-18~)
|
|
45
43
|
const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
|
|
46
44
|
const simpleOrder = {
|
|
47
|
-
// project: order.project,
|
|
48
45
|
typeOf: order.typeOf,
|
|
49
46
|
seller: order.seller,
|
|
50
47
|
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
51
|
-
// IOrderへ移行(2022-11-17~)
|
|
52
|
-
// confirmationNumber: order.confirmationNumber,
|
|
53
48
|
orderNumber: order.orderNumber,
|
|
54
49
|
price: order.price,
|
|
55
50
|
priceCurrency: order.priceCurrency,
|
|
@@ -91,10 +86,12 @@ function sendOrder(params) {
|
|
|
91
86
|
}
|
|
92
87
|
const result = ownershipInfos;
|
|
93
88
|
yield repos.action.complete({ typeOf: sendOrderActionAttributes.typeOf, id: action.id, result: result });
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
if (params.useOnOrderStatusChanged || params.useOnOrderStatusChanged === undefined) {
|
|
90
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order, placeOrderTransaction })({
|
|
91
|
+
registerActionInProgress: repos.registerActionInProgress,
|
|
92
|
+
task: repos.task
|
|
93
|
+
});
|
|
94
|
+
}
|
|
98
95
|
}
|
|
99
96
|
catch (error) {
|
|
100
97
|
let throwsError = true;
|
|
@@ -178,6 +175,6 @@ function onSend(params) {
|
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
177
|
// タスク保管
|
|
181
|
-
yield repos.task.saveMany(taskAttributes);
|
|
178
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
182
179
|
});
|
|
183
180
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { deleteOrder } from './order/deleteOrder';
|
|
5
5
|
import { onOrderStatusChanged } from './order/onOrderStatusChanged';
|
|
6
|
+
import { onOrderUpdated } from './order/onOrderUpdated';
|
|
6
7
|
import { placeOrder, placeOrderWithoutTransaction } from './order/placeOrder';
|
|
7
8
|
import { returnOrder } from './order/returnOrder';
|
|
8
9
|
import { sendOrder } from './order/sendOrder';
|
|
9
|
-
export { deleteOrder, onOrderStatusChanged, placeOrder, placeOrderWithoutTransaction, returnOrder, sendOrder };
|
|
10
|
+
export { deleteOrder, onOrderStatusChanged, onOrderUpdated, placeOrder, placeOrderWithoutTransaction, returnOrder, sendOrder };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendOrder = exports.returnOrder = exports.placeOrderWithoutTransaction = exports.placeOrder = exports.onOrderStatusChanged = exports.deleteOrder = void 0;
|
|
3
|
+
exports.sendOrder = exports.returnOrder = exports.placeOrderWithoutTransaction = exports.placeOrder = exports.onOrderUpdated = exports.onOrderStatusChanged = exports.deleteOrder = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 注文サービス
|
|
6
6
|
*/
|
|
@@ -8,6 +8,8 @@ const deleteOrder_1 = require("./order/deleteOrder");
|
|
|
8
8
|
Object.defineProperty(exports, "deleteOrder", { enumerable: true, get: function () { return deleteOrder_1.deleteOrder; } });
|
|
9
9
|
const onOrderStatusChanged_1 = require("./order/onOrderStatusChanged");
|
|
10
10
|
Object.defineProperty(exports, "onOrderStatusChanged", { enumerable: true, get: function () { return onOrderStatusChanged_1.onOrderStatusChanged; } });
|
|
11
|
+
const onOrderUpdated_1 = require("./order/onOrderUpdated");
|
|
12
|
+
Object.defineProperty(exports, "onOrderUpdated", { enumerable: true, get: function () { return onOrderUpdated_1.onOrderUpdated; } });
|
|
11
13
|
const placeOrder_1 = require("./order/placeOrder");
|
|
12
14
|
Object.defineProperty(exports, "placeOrder", { enumerable: true, get: function () { return placeOrder_1.placeOrder; } });
|
|
13
15
|
Object.defineProperty(exports, "placeOrderWithoutTransaction", { enumerable: true, get: function () { return placeOrder_1.placeOrderWithoutTransaction; } });
|
|
@@ -108,10 +108,14 @@ declare function authorize(params: {
|
|
|
108
108
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
109
109
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
110
110
|
location?: factory.action.trade.pay.ILocation;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
options: {
|
|
112
|
+
/**
|
|
113
|
+
* アクション失敗時に即時に決済取引を中止するかどうか
|
|
114
|
+
*/
|
|
115
|
+
useCancelPayTransactionOnFailed: boolean;
|
|
116
|
+
useCheckMovieTicketBeforePay: boolean;
|
|
117
|
+
useCheckByIdentifierIfNotYet: boolean;
|
|
118
|
+
useSearchTrade4accountId: boolean;
|
|
119
|
+
};
|
|
116
120
|
}): IAuthorizeOperation<IAuthorizePaymentAction>;
|
|
117
121
|
export { onPaymentStatusChanged, authorize, invalidatePaymentUrl, voidPayTransaction, person2username, processVoidPayTransaction, publishPaymentUrl };
|
|
@@ -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
|
+
}>;
|