@chevre/domain 22.2.0-alpha.3 → 22.2.0-alpha.30
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/createProject.ts +19 -0
- package/example/src/chevre/findValidAuthorization.ts +1 -2
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +1 -1
- package/example/src/chevre/{migrateMovieTheaterAdditionalProperties.ts → migrateRoomAdditionalProperties.ts} +17 -17
- package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +119 -0
- package/example/src/chevre/playAroundTicket.ts +3 -2
- package/example/src/chevre/processAction.ts +3 -1
- package/example/src/chevre/projectFields.ts +42 -0
- package/example/src/chevre/{projectEventFieldsById.ts → projectFieldsById.ts} +7 -12
- package/example/src/chevre/{projectReservationFieldsById.ts → projectOwnershipInfoFieldsById.ts} +4 -4
- package/example/src/chevre/searchActionsByPurpose.ts +38 -0
- package/example/src/chevre/searchProjects.ts +9 -4
- package/example/src/chevre/searchSellersByAggregate.ts +3 -3
- package/example/src/chevre/searchTransactions.ts +1 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +2 -41
- package/lib/chevre/repo/accountTitle.d.ts +9 -3
- package/lib/chevre/repo/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/action.d.ts +64 -47
- package/lib/chevre/repo/action.js +170 -133
- package/lib/chevre/repo/aggregateReservation.d.ts +1 -14
- package/lib/chevre/repo/assetTransaction.d.ts +134 -7
- package/lib/chevre/repo/assetTransaction.js +2 -2
- package/lib/chevre/repo/authorization.d.ts +3 -1
- package/lib/chevre/repo/authorization.js +21 -10
- package/lib/chevre/repo/categoryCode.d.ts +18 -2
- package/lib/chevre/repo/categoryCode.js +47 -19
- package/lib/chevre/repo/comment.d.ts +5 -1
- package/lib/chevre/repo/creativeWork.d.ts +14 -2
- package/lib/chevre/repo/customer.d.ts +5 -1
- package/lib/chevre/repo/customerType.d.ts +1 -1
- package/lib/chevre/repo/event.d.ts +49 -2
- package/lib/chevre/repo/member.d.ts +5 -1
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +22 -2
- package/lib/chevre/repo/message.d.ts +1 -15
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -2
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -5
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +12 -12
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +7 -3
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +22 -24
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -2
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +9 -3
- package/lib/chevre/repo/mongoose/schemas/customerType.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +19 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +23 -3
- package/lib/chevre/repo/mongoose/schemas/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/note.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/note.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +13 -4
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +16 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -13
- package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/productModel.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +5 -5
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +9 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +22 -24
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +7 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ticket.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -2
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +3 -3
- package/lib/chevre/repo/offer.d.ts +13 -4
- package/lib/chevre/repo/offerCatalog.d.ts +15 -2
- package/lib/chevre/repo/order.d.ts +13 -1
- package/lib/chevre/repo/ownershipInfo.d.ts +23 -7
- package/lib/chevre/repo/ownershipInfo.js +75 -19
- package/lib/chevre/repo/paymentService.d.ts +2 -2
- package/lib/chevre/repo/paymentService.js +108 -58
- package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
- package/lib/chevre/repo/place/movieTheater.d.ts +54 -2
- package/lib/chevre/repo/priceSpecification.d.ts +42 -1
- package/lib/chevre/repo/product.d.ts +8 -3
- package/lib/chevre/repo/product.js +67 -33
- package/lib/chevre/repo/productModel.d.ts +1 -22
- package/lib/chevre/repo/project.d.ts +25 -5
- package/lib/chevre/repo/project.js +69 -28
- package/lib/chevre/repo/reservation.d.ts +35 -3
- package/lib/chevre/repo/reservation.js +1 -1
- package/lib/chevre/repo/role.d.ts +2 -9
- package/lib/chevre/repo/role.js +20 -10
- package/lib/chevre/repo/seller.d.ts +64 -14
- package/lib/chevre/repo/seller.js +61 -27
- package/lib/chevre/repo/task.d.ts +64 -3
- package/lib/chevre/repo/telemetry.d.ts +3 -2
- package/lib/chevre/repo/ticket.d.ts +4 -20
- package/lib/chevre/repo/ticket.js +23 -10
- package/lib/chevre/repo/transaction.d.ts +30 -14
- package/lib/chevre/repo/transaction.js +106 -77
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/aggregation/project.js +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +3 -3
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +3 -3
- package/lib/chevre/service/assetTransaction/registerService.js +4 -6
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +26 -23
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
- package/lib/chevre/service/code.d.ts +0 -4
- package/lib/chevre/service/code.js +22 -18
- package/lib/chevre/service/event.js +4 -4
- package/lib/chevre/service/moneyTransfer.js +3 -5
- package/lib/chevre/service/notification.js +2 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +34 -6
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +22 -22
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -4
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -4
- package/lib/chevre/service/offer/event/authorize.js +3 -2
- package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +3 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +41 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +7 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +10 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +14 -6
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +8 -5
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
- package/lib/chevre/service/offer/product.d.ts +4 -2
- package/lib/chevre/service/offer/product.js +12 -12
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -3
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.js +9 -5
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any/onPaid.d.ts +1 -1
- package/lib/chevre/service/payment/any/onRefund.d.ts +1 -1
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -6
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -34
- package/lib/chevre/service/payment/any.d.ts +3 -3
- package/lib/chevre/service/payment/any.js +21 -13
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -2
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +12 -5
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +13 -3
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/faceToFace.d.ts +2 -2
- package/lib/chevre/service/payment/faceToFace.js +28 -10
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/authorize.js +8 -3
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -2
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +12 -4
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +15 -4
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +2 -2
- package/lib/chevre/service/payment/paymentCard.js +29 -16
- package/lib/chevre/service/payment.d.ts +1 -1
- package/lib/chevre/service/report/ownershipInfo.d.ts +3 -1
- package/lib/chevre/service/report/telemetry.js +2 -2
- package/lib/chevre/service/reserve/cancelReservation.js +1 -1
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/task/authorizePayment.js +0 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +16 -4
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +4 -4
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +36 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +2 -2
- package/lib/chevre/service/transaction.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/findTransactionById.ts +0 -23
- package/example/src/chevre/findTransactionInProgressById.ts +0 -23
- package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +0 -154
- package/example/src/chevre/projectReservationFields.ts +0 -31
- package/example/src/chevre/searchActions.ts +0 -40
- package/example/src/chevre/searchProducts.ts +0 -28
|
@@ -31,7 +31,7 @@ function payMovieTicket(params) {
|
|
|
31
31
|
processSeatInfoSyncResult: { seatInfoSyncIn },
|
|
32
32
|
project: { id: params.project.id }
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
const action = yield repos.action.start(startingAction, { recipe });
|
|
35
35
|
let processSeatInfoSyncResult;
|
|
36
36
|
try {
|
|
37
37
|
// 着券済に対する冪等性を確保する必要はあるが、
|
|
@@ -91,9 +91,17 @@ function payMovieTicket(params) {
|
|
|
91
91
|
// ? { seatInfoSyncResult: <factory.action.trade.pay.ISeatInfoSyncResult>seatInfoSyncResult }
|
|
92
92
|
// : undefined
|
|
93
93
|
};
|
|
94
|
-
|
|
95
|
-
yield (0, onPaid_1.onPaid)(
|
|
96
|
-
|
|
94
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe });
|
|
95
|
+
yield (0, onPaid_1.onPaid)({
|
|
96
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
97
|
+
id: action.id,
|
|
98
|
+
object: startingAction.object,
|
|
99
|
+
potentialActions: startingAction.potentialActions,
|
|
100
|
+
project: startingAction.project,
|
|
101
|
+
purpose: startingAction.purpose,
|
|
102
|
+
typeOf: action.typeOf
|
|
103
|
+
})(repos);
|
|
104
|
+
// return action;
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
exports.payMovieTicket = payMovieTicket;
|
|
@@ -58,7 +58,7 @@ function refundMovieTicket(params) {
|
|
|
58
58
|
const refundActionAttributes = Object.assign({ agent, object, potentialActions, project, purpose, recipient, typeOf }, (typeof (sameAs === null || sameAs === void 0 ? void 0 : sameAs.id) === 'string') ? { sameAs: { id: sameAs.id, typeOf: 'Task' } } : undefined
|
|
59
59
|
// instrument // discontinue(2024-06-10~)
|
|
60
60
|
);
|
|
61
|
-
|
|
61
|
+
const action = yield repos.action.start(refundActionAttributes, { recipe });
|
|
62
62
|
let processSeatInfoSyncCancelResult;
|
|
63
63
|
let processSeatInfoSyncResult;
|
|
64
64
|
try {
|
|
@@ -92,8 +92,10 @@ function refundMovieTicket(params) {
|
|
|
92
92
|
}
|
|
93
93
|
// アクションとしてはFailedだが後続処理を実行するケースに対応(2024-03-21~)
|
|
94
94
|
const seatInfoSyncResultAsError = processSeatInfoSyncResult === null || processSeatInfoSyncResult === void 0 ? void 0 : processSeatInfoSyncResult.seatInfoSyncResultAsError;
|
|
95
|
+
let actionStatus;
|
|
95
96
|
if (seatInfoSyncResultAsError !== undefined) {
|
|
96
|
-
|
|
97
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: seatInfoSyncResultAsError });
|
|
98
|
+
actionStatus = factory.actionStatusType.FailedActionStatus;
|
|
97
99
|
}
|
|
98
100
|
else {
|
|
99
101
|
// add recipe(2024-06-04~)
|
|
@@ -107,9 +109,18 @@ function refundMovieTicket(params) {
|
|
|
107
109
|
// ? { seatInfoSyncCancelResult: processSeatInfoSyncCancelResult.seatInfoSyncCancelResult }
|
|
108
110
|
// : undefined
|
|
109
111
|
};
|
|
110
|
-
|
|
112
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
113
|
+
actionStatus = factory.actionStatusType.CompletedActionStatus;
|
|
111
114
|
}
|
|
112
|
-
yield (0, onRefund_1.onRefund)(
|
|
115
|
+
yield (0, onRefund_1.onRefund)({
|
|
116
|
+
actionStatus,
|
|
117
|
+
id: action.id,
|
|
118
|
+
object: refundActionAttributes.object,
|
|
119
|
+
potentialActions: refundActionAttributes.potentialActions,
|
|
120
|
+
project: refundActionAttributes.project,
|
|
121
|
+
purpose: refundActionAttributes.purpose,
|
|
122
|
+
typeOf: action.typeOf
|
|
123
|
+
})(repos);
|
|
113
124
|
});
|
|
114
125
|
}
|
|
115
126
|
exports.refundMovieTicket = refundMovieTicket;
|
|
@@ -150,7 +150,7 @@ function checkByIdentifierIfNotYet(params) {
|
|
|
150
150
|
reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['
|
|
153
|
+
} }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'], [])).shift();
|
|
154
154
|
debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
|
|
155
155
|
if (alreadyCheckedAction !== undefined) {
|
|
156
156
|
const recipe = yield repos.action.findRecipeByAction({
|
|
@@ -21,7 +21,7 @@ declare function payPaymentCard(params: factory.action.trade.pay.IAttributes): (
|
|
|
21
21
|
accountingReport: AccountingReportRepo;
|
|
22
22
|
product: ProductRepo;
|
|
23
23
|
task: TaskRepo;
|
|
24
|
-
}) => Promise<
|
|
24
|
+
}) => Promise<void>;
|
|
25
25
|
declare function refundPaymentCard(params: factory.task.refund.IData): (repos: {
|
|
26
26
|
action: ActionRepo;
|
|
27
27
|
accountingReport: AccountingReportRepo;
|
|
@@ -29,5 +29,5 @@ declare function refundPaymentCard(params: factory.task.refund.IData): (repos: {
|
|
|
29
29
|
task: TaskRepo;
|
|
30
30
|
assetTransaction: AssetTransactionRepo;
|
|
31
31
|
transactionNumber: TransactionNumberRepo;
|
|
32
|
-
}) => Promise<
|
|
32
|
+
}) => Promise<void>;
|
|
33
33
|
export { authorize, payPaymentCard, refundPaymentCard, voidTransaction };
|
|
@@ -79,9 +79,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
79
79
|
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
80
80
|
}
|
|
81
81
|
// プロダクトから通貨区分を取得
|
|
82
|
-
|
|
83
|
-
// await repos.product.findProductById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
84
|
-
const paymentCatdProduct = (yield repos.product.searchProducts({
|
|
82
|
+
const paymentCatdProduct = (yield repos.product.projectFields({
|
|
85
83
|
limit: 1,
|
|
86
84
|
page: 1,
|
|
87
85
|
id: { $eq: paymentServiceId },
|
|
@@ -235,12 +233,11 @@ function payPaymentCard(params) {
|
|
|
235
233
|
var _a, _b, _c;
|
|
236
234
|
const payObject = params.object;
|
|
237
235
|
const paymentServiceId = payObject[0].id;
|
|
238
|
-
|
|
239
|
-
let action = yield repos.action.start(params);
|
|
236
|
+
const action = yield repos.action.start(params);
|
|
240
237
|
try {
|
|
241
238
|
const transactionNumber = payObject[0].paymentMethod.paymentMethodId;
|
|
242
239
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
243
|
-
project: { id:
|
|
240
|
+
project: { id: params.project.id },
|
|
244
241
|
typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard,
|
|
245
242
|
id: paymentServiceId
|
|
246
243
|
});
|
|
@@ -267,9 +264,17 @@ function payPaymentCard(params) {
|
|
|
267
264
|
}
|
|
268
265
|
// アクション完了
|
|
269
266
|
const actionResult = {};
|
|
270
|
-
|
|
271
|
-
yield (0, onPaid_1.onPaid)(
|
|
272
|
-
|
|
267
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
268
|
+
yield (0, onPaid_1.onPaid)({
|
|
269
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
270
|
+
id: action.id,
|
|
271
|
+
object: params.object,
|
|
272
|
+
potentialActions: params.potentialActions,
|
|
273
|
+
project: params.project,
|
|
274
|
+
purpose: params.purpose,
|
|
275
|
+
typeOf: action.typeOf
|
|
276
|
+
})(repos);
|
|
277
|
+
// return action;
|
|
273
278
|
});
|
|
274
279
|
}
|
|
275
280
|
exports.payPaymentCard = payPaymentCard;
|
|
@@ -289,11 +294,11 @@ function refundPaymentCard(params) {
|
|
|
289
294
|
if (typeof accountNumber !== 'string') {
|
|
290
295
|
throw new factory.errors.ArgumentNull('serviceOutput.paymentAccount.accountNumber');
|
|
291
296
|
}
|
|
292
|
-
|
|
297
|
+
const action = yield repos.action.start(params);
|
|
293
298
|
let accountTransactionNumber4refund;
|
|
294
299
|
try {
|
|
295
300
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
296
|
-
project: { id:
|
|
301
|
+
project: { id: params.project.id },
|
|
297
302
|
typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard,
|
|
298
303
|
id: paymentServiceId
|
|
299
304
|
});
|
|
@@ -309,7 +314,7 @@ function refundPaymentCard(params) {
|
|
|
309
314
|
});
|
|
310
315
|
// 返金のユニークネスを保証するため識別子を指定する
|
|
311
316
|
const accountTransactionIdentifier = (0, accountTransactionIdentifier_1.createRefundIdentifier)({
|
|
312
|
-
project: { id:
|
|
317
|
+
project: { id: params.project.id },
|
|
313
318
|
paymentMethodId
|
|
314
319
|
});
|
|
315
320
|
// すでに返金済かどうか確認
|
|
@@ -318,7 +323,7 @@ function refundPaymentCard(params) {
|
|
|
318
323
|
// 口座取引で確認する(2022-10-27~)
|
|
319
324
|
const searchAccountTransactionsResult = yield accountTransactionService.search({
|
|
320
325
|
limit: 100,
|
|
321
|
-
project: { id: { $eq:
|
|
326
|
+
project: { id: { $eq: params.project.id } },
|
|
322
327
|
identifier: { $eq: accountTransactionIdentifier }
|
|
323
328
|
});
|
|
324
329
|
const existingAccountTransactions = searchAccountTransactionsResult.data;
|
|
@@ -381,9 +386,17 @@ function refundPaymentCard(params) {
|
|
|
381
386
|
const result = {
|
|
382
387
|
accountTransaction: { transactionNumber: accountTransactionNumber4refund }
|
|
383
388
|
};
|
|
384
|
-
|
|
385
|
-
yield (0, onRefund_1.onRefund)(
|
|
386
|
-
|
|
389
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
390
|
+
yield (0, onRefund_1.onRefund)({
|
|
391
|
+
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
392
|
+
id: action.id,
|
|
393
|
+
object: params.object,
|
|
394
|
+
potentialActions: params.potentialActions,
|
|
395
|
+
project: params.project,
|
|
396
|
+
purpose: params.purpose,
|
|
397
|
+
typeOf: action.typeOf
|
|
398
|
+
})(repos);
|
|
399
|
+
// return action;
|
|
387
400
|
});
|
|
388
401
|
}
|
|
389
402
|
exports.refundPaymentCard = refundPaymentCard;
|
|
@@ -29,7 +29,7 @@ export declare function fixOrderAsPurpose(params: {
|
|
|
29
29
|
}, transaction: factory.assetTransaction.pay.ITransaction): (repos: {
|
|
30
30
|
acceptedOffer: AcceptedOfferRepo;
|
|
31
31
|
order: OrderRepo;
|
|
32
|
-
}) => Promise<Pick<factory.order.IOrder, "
|
|
32
|
+
}) => Promise<Pick<factory.order.IOrder, "confirmationNumber" | "typeOf" | "orderNumber"> & {
|
|
33
33
|
acceptedOffersMovieTicketUsed: IAcceptedOfferMovieTicketUsed[];
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
@@ -21,5 +21,7 @@ export interface IOwnershipInfoReport {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export declare function ownershipInfo2report(params: {
|
|
24
|
-
ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood
|
|
24
|
+
ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
25
27
|
}): IOwnershipInfoReport;
|
|
@@ -217,7 +217,7 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
217
217
|
startThrough: measuredThrough
|
|
218
218
|
});
|
|
219
219
|
// 計測期間内に開始され、かつ、すでに終了している取引を検索
|
|
220
|
-
const startedAndEndedTransactions = yield repos.transaction.
|
|
220
|
+
const startedAndEndedTransactions = yield repos.transaction.projectFields({
|
|
221
221
|
typeOf: factory.transactionType.PlaceOrder,
|
|
222
222
|
seller: { ids: [sellerId] },
|
|
223
223
|
startFrom: measuredFrom,
|
|
@@ -227,7 +227,7 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
227
227
|
});
|
|
228
228
|
const numberOfStartedAndConfirmed = startedAndEndedTransactions.filter((transaction) => transaction.status === factory.transactionStatusType.Confirmed).length;
|
|
229
229
|
const numberOfStartedAndExpired = startedAndEndedTransactions.filter((transaction) => transaction.status === factory.transactionStatusType.Expired).length;
|
|
230
|
-
const endedTransactions = yield repos.transaction.
|
|
230
|
+
const endedTransactions = yield repos.transaction.projectFields({
|
|
231
231
|
typeOf: factory.transactionType.PlaceOrder,
|
|
232
232
|
seller: { ids: [sellerId] },
|
|
233
233
|
endFrom: measuredFrom,
|
|
@@ -61,7 +61,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
61
61
|
id: { $in: [params.purpose.id] },
|
|
62
62
|
typeOf: { $in: [params.purpose.typeOf] }
|
|
63
63
|
}
|
|
64
|
-
}, ['
|
|
64
|
+
}, ['id'], []);
|
|
65
65
|
if (completedActions.length === 0) {
|
|
66
66
|
const actionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction: reserveTransaction });
|
|
67
67
|
if (actionAttributes !== undefined) {
|
|
@@ -133,7 +133,7 @@ params, options) {
|
|
|
133
133
|
id: { $in: [actionAttributes.purpose.id] },
|
|
134
134
|
typeOf: { $in: [actionAttributes.purpose.typeOf] }
|
|
135
135
|
}
|
|
136
|
-
}, ['
|
|
136
|
+
}, ['id'], []);
|
|
137
137
|
debug(completedActions.length, 'completed reserveAction found. byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
138
138
|
if (completedActions.length === 0) {
|
|
139
139
|
const action = yield repos.action.start(actionAttributes);
|
|
@@ -17,7 +17,6 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
17
17
|
const authorization_1 = require("../../repo/authorization");
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
19
|
const event_1 = require("../../repo/event");
|
|
20
|
-
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
21
20
|
const paymentService_1 = require("../../repo/paymentService");
|
|
22
21
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
23
22
|
const product_1 = require("../../repo/product");
|
|
@@ -55,7 +54,6 @@ function call(params) {
|
|
|
55
54
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
56
55
|
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
|
|
57
56
|
event: new event_1.EventRepo(connection),
|
|
58
|
-
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
59
57
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
60
58
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
61
59
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
@@ -67,22 +67,26 @@ function onAuthorizationCreated(params) {
|
|
|
67
67
|
}
|
|
68
68
|
break;
|
|
69
69
|
case 'OwnershipInfo':
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
// 所有権に対する承認はいったん廃止したので、所有権のケースは処理不要(2024-08-21~)
|
|
71
|
+
reservationIds = [];
|
|
72
|
+
// const ownershipInfoId = authorization.object.id;
|
|
73
|
+
// if (typeof ownershipInfoId === 'string' && ownershipInfoId.length > 0) {
|
|
74
|
+
// const ownershipInfo = <Pick<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, 'id' | 'typeOfGood'>>
|
|
75
|
+
// await repos.ownershipInfo.projectFieldsById({ id: ownershipInfoId }, ['typeOfGood']);
|
|
76
|
+
// // 予約に対する所有権であれば発券
|
|
77
|
+
// if (ownershipInfo.typeOfGood.typeOf === factory.reservationType.EventReservation
|
|
78
|
+
// || ownershipInfo.typeOfGood.typeOf === factory.reservationType.BusReservation) {
|
|
79
|
+
// const reservationId = String(ownershipInfo.typeOfGood.id);
|
|
80
|
+
// reservationIds = [reservationId];
|
|
81
|
+
// const { reservationFor } = <{ reservationFor: { id: string } }>await repos.reservation.projectFieldsById<
|
|
82
|
+
// factory.reservationType.EventReservation | factory.reservationType.BusReservation
|
|
83
|
+
// >({
|
|
84
|
+
// id: reservationId,
|
|
85
|
+
// inclusion: ['reservationFor.id']
|
|
86
|
+
// });
|
|
87
|
+
// reservationForIds = [String(reservationFor.id)];
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
86
90
|
break;
|
|
87
91
|
default:
|
|
88
92
|
// no op
|
|
@@ -343,10 +343,10 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
343
343
|
const action = yield repos.action.start(deleteActionAttributes);
|
|
344
344
|
try {
|
|
345
345
|
// カタログからプロダクト検索
|
|
346
|
-
const productsWithCatalog = yield repos.product.
|
|
346
|
+
const productsWithCatalog = yield repos.product.projectFields({
|
|
347
347
|
project: { id: { $eq: params.project.id } },
|
|
348
348
|
hasOfferCatalog: { id: { $eq: catalogId } }
|
|
349
|
-
}, ['
|
|
349
|
+
}, ['id'], []);
|
|
350
350
|
let deleteEventResult;
|
|
351
351
|
let updateOfferResult;
|
|
352
352
|
if (productsWithCatalog.length > 0) {
|
|
@@ -29,7 +29,7 @@ function syncCategoryCode(params) {
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
for (const categoryCodeId of params.ids) {
|
|
32
|
-
const syncingCategoryCode = (yield repos.categoryCode.
|
|
32
|
+
const syncingCategoryCode = (yield repos.categoryCode.projectFields({
|
|
33
33
|
limit: 1,
|
|
34
34
|
page: 1,
|
|
35
35
|
project: { id: { $eq: params.project.id } },
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.call = void 0;
|
|
13
24
|
const factory = require("../../factory");
|
|
@@ -275,7 +286,7 @@ function createInformMovieTasks(params) {
|
|
|
275
286
|
}
|
|
276
287
|
function createInformProductTasks(params) {
|
|
277
288
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
const products4inform = yield repos.product.
|
|
289
|
+
const products4inform = yield repos.product.projectFields({
|
|
279
290
|
typeOf: { $eq: params.typeOf },
|
|
280
291
|
id: { $in: params.ids }
|
|
281
292
|
}, ['additionalProperty', 'description', 'name', 'productID', 'project', 'typeOf', 'serviceType'], []);
|
|
@@ -322,7 +333,7 @@ function createInformProductTasks(params) {
|
|
|
322
333
|
}
|
|
323
334
|
function createInformCategoryCodeTasks(params) {
|
|
324
335
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
const categoryCodes4inform = yield repos.categoryCode.
|
|
336
|
+
const categoryCodes4inform = yield repos.categoryCode.projectFields({
|
|
326
337
|
id: { $in: params.ids },
|
|
327
338
|
// ひとまずDistributorTypeのみ
|
|
328
339
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
|
@@ -484,10 +495,11 @@ function createInformAccountTitleTasks(params) {
|
|
|
484
495
|
accountTitles4inform.forEach((accountTitle4inform) => {
|
|
485
496
|
var _a;
|
|
486
497
|
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
487
|
-
delete accountTitle4inform._id;
|
|
498
|
+
// delete accountTitle4inform._id;
|
|
499
|
+
const { _id } = accountTitle4inform, informObject = __rest(accountTitle4inform, ["_id"]);
|
|
488
500
|
const informActionAttributes = {
|
|
489
501
|
// agent: accountTitle4inform.project,
|
|
490
|
-
object:
|
|
502
|
+
object: informObject,
|
|
491
503
|
// project: accountTitle4inform.project,
|
|
492
504
|
recipient: {
|
|
493
505
|
id: '',
|
|
@@ -13,9 +13,11 @@ exports.call = void 0;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const authorization_1 = require("../../repo/authorization");
|
|
16
17
|
const paymentService_1 = require("../../repo/paymentService");
|
|
17
18
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
18
19
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
20
|
+
const ticket_1 = require("../../repo/ticket");
|
|
19
21
|
const transaction_1 = require("../../repo/transaction");
|
|
20
22
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
21
23
|
const transactionProcess_1 = require("../../repo/transactionProcess");
|
|
@@ -38,9 +40,11 @@ function call(params) {
|
|
|
38
40
|
yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
|
|
39
41
|
action: actionRepo,
|
|
40
42
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
43
|
+
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
41
44
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
42
45
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
43
46
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
47
|
+
ticket: new ticket_1.TicketRepo(connection),
|
|
44
48
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
45
49
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo(redisClient)
|
|
46
50
|
}, settings);
|
|
@@ -76,7 +76,7 @@ function fixOrderAndTransaction(params) {
|
|
|
76
76
|
}
|
|
77
77
|
// const orderNumber = params.purpose.orderNumber;
|
|
78
78
|
const orderNumber = orderByPaymentMethodId.orderNumber;
|
|
79
|
-
const returnOrderTransaction = (yield repos.transaction.
|
|
79
|
+
const returnOrderTransaction = (yield repos.transaction.projectFields({
|
|
80
80
|
limit: 1,
|
|
81
81
|
page: 1,
|
|
82
82
|
typeOf: factory.transactionType.ReturnOrder,
|
|
@@ -39,7 +39,7 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
39
39
|
// agentIdによる全取引についてDeleteTransactionタスクを作成する
|
|
40
40
|
if (typeof agentIdSpecified === 'string' && agentIdSpecified.length > 0) {
|
|
41
41
|
const transactionTypeOf = params.object.typeOf;
|
|
42
|
-
const transactions = yield repos.transaction.
|
|
42
|
+
const transactions = yield repos.transaction.projectFields({
|
|
43
43
|
project: { id: { $eq: params.object.project.id } },
|
|
44
44
|
agent: {
|
|
45
45
|
ids: [agentIdSpecified],
|
|
@@ -128,7 +128,7 @@ function deleteTransactionById(params) {
|
|
|
128
128
|
if (typeof deletingTransactionId !== 'string' || deletingTransactionId.length === 0) {
|
|
129
129
|
throw new factory.errors.ArgumentNull('object.id');
|
|
130
130
|
}
|
|
131
|
-
const transaction = (yield repos.transaction.
|
|
131
|
+
const transaction = (yield repos.transaction.projectFields({
|
|
132
132
|
ids: [deletingTransactionId],
|
|
133
133
|
typeOf: params.object.typeOf,
|
|
134
134
|
inclusion: ['typeOf', 'project', 'status', 'result']
|
|
@@ -28,7 +28,7 @@ const CodeService = require("../code");
|
|
|
28
28
|
function start(params) {
|
|
29
29
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const { passport } = yield repos.passport.validatePassportTokenIfExist(params);
|
|
31
|
-
const sellers = yield repos.seller.
|
|
31
|
+
const sellers = yield repos.seller.projectFields({
|
|
32
32
|
limit: 1,
|
|
33
33
|
page: 1,
|
|
34
34
|
id: { $eq: params.seller.id }
|
|
@@ -162,7 +162,7 @@ function fixToLocation(params) {
|
|
|
162
162
|
function processAuthorizePaymentCard(params) {
|
|
163
163
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
164
164
|
var _a;
|
|
165
|
-
const transaction = yield repos.transaction.
|
|
165
|
+
const transaction = yield repos.transaction.projectFieldsInProgressById({
|
|
166
166
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
167
167
|
id: params.purpose.id
|
|
168
168
|
}, ['agent', 'project', 'recipient', 'seller', 'typeOf', 'object']);
|
|
@@ -504,7 +504,7 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
|
|
|
504
504
|
function confirm(params) {
|
|
505
505
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
506
506
|
const now = new Date();
|
|
507
|
-
const transaction = yield repos.transaction.
|
|
507
|
+
const transaction = yield repos.transaction.projectFieldsById({
|
|
508
508
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
509
509
|
id: params.id
|
|
510
510
|
}, ['typeOf', 'status', 'project']);
|
|
@@ -562,7 +562,7 @@ function searchAuthorizeActions(params) {
|
|
|
562
562
|
*/
|
|
563
563
|
function exportTasksById(params) {
|
|
564
564
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
565
|
-
const transaction = yield repos.transaction.
|
|
565
|
+
const transaction = yield repos.transaction.projectFieldsById({
|
|
566
566
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
567
567
|
id: params.id
|
|
568
568
|
}, ['endDate', 'status', 'project', 'startDate', 'typeOf', 'object', 'potentialActions']);
|
|
@@ -41,7 +41,7 @@ export declare function validatePaymentMethods(params: {
|
|
|
41
41
|
* 興行オファー適用条件確認
|
|
42
42
|
*/
|
|
43
43
|
export declare function validateEventOffers(params: {
|
|
44
|
-
order: factory.transaction.placeOrder.IOrderAsResult
|
|
44
|
+
order: Pick<factory.transaction.placeOrder.IOrderAsResult, 'price'>;
|
|
45
45
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
46
46
|
authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'instrument' | 'object' | 'result'>[];
|
|
47
47
|
}): void;
|
|
@@ -350,11 +350,12 @@ exports.validatePaymentMethods = validatePaymentMethods;
|
|
|
350
350
|
// tslint:disable-next-line:max-func-body-length
|
|
351
351
|
function validateEventOffers(params) {
|
|
352
352
|
var _a, _b;
|
|
353
|
-
const
|
|
353
|
+
const { paymentMethods } = params;
|
|
354
|
+
const firstCreditCardPaymentMethodIdentifier = (_b = (_a = paymentMethods.find((referenceInvoice) => {
|
|
354
355
|
return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
355
356
|
|| referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
|
|
356
357
|
})) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
357
|
-
const numCreditCardOrFaceToFacePaymentMethod =
|
|
358
|
+
const numCreditCardOrFaceToFacePaymentMethod = paymentMethods.filter((referenceInvoice) => {
|
|
358
359
|
return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
359
360
|
|| referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
|
|
360
361
|
}).length;
|
|
@@ -411,5 +412,38 @@ function validateEventOffers(params) {
|
|
|
411
412
|
});
|
|
412
413
|
}
|
|
413
414
|
});
|
|
415
|
+
// check programMembershipUsed(2024-08-15~)
|
|
416
|
+
const programMembershipRequired = params.authorizeEventServiceOfferActions.reduce((a, b) => {
|
|
417
|
+
var _a, _b;
|
|
418
|
+
const programMembershipUsedfromResult = (_b = (_a = b.result) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.serviceOutput.programMembershipUsed;
|
|
419
|
+
if (Array.isArray(programMembershipUsedfromResult)) {
|
|
420
|
+
a.push(...programMembershipUsedfromResult);
|
|
421
|
+
}
|
|
422
|
+
return a;
|
|
423
|
+
}, []);
|
|
424
|
+
const satisfyProgramMembershipRequirement = programMembershipRequired.every(({ identifier, issuedThrough }) => {
|
|
425
|
+
let satisfyThisRequirement = false;
|
|
426
|
+
switch (issuedThrough.typeOf) {
|
|
427
|
+
case factory.product.ProductType.MembershipService:
|
|
428
|
+
// 検証の必要なし
|
|
429
|
+
satisfyThisRequirement = true;
|
|
430
|
+
break;
|
|
431
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
432
|
+
satisfyThisRequirement = paymentMethods.some((paymentMethod) => paymentMethod.paymentMethodId === identifier
|
|
433
|
+
&& paymentMethod.issuedThrough.id === issuedThrough.id
|
|
434
|
+
&& paymentMethod.issuedThrough.typeOf === issuedThrough.typeOf);
|
|
435
|
+
break;
|
|
436
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
437
|
+
satisfyThisRequirement = paymentMethods.some((paymentMethod) => paymentMethod.paymentMethodId === identifier
|
|
438
|
+
&& paymentMethod.issuedThrough.typeOf === issuedThrough.typeOf);
|
|
439
|
+
break;
|
|
440
|
+
default:
|
|
441
|
+
// no op
|
|
442
|
+
}
|
|
443
|
+
return satisfyThisRequirement;
|
|
444
|
+
});
|
|
445
|
+
if (!satisfyProgramMembershipRequirement) {
|
|
446
|
+
throw new factory.errors.Argument('Transaction', `programMembershipUsed requirement not satisfied`);
|
|
447
|
+
}
|
|
414
448
|
}
|
|
415
449
|
exports.validateEventOffers = validateEventOffers;
|
|
@@ -59,7 +59,7 @@ function confirm(params, options) {
|
|
|
59
59
|
status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
|
|
60
60
|
object: { orderDate: params.result.order.orderDate }
|
|
61
61
|
})(repos);
|
|
62
|
-
const transaction = yield repos.transaction.
|
|
62
|
+
const transaction = yield repos.transaction.projectFieldsById({ typeOf: factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
|
|
63
63
|
const confirmResult = yield processTransactionNotInProgress(transaction)(repos);
|
|
64
64
|
if (confirmResult !== undefined) {
|
|
65
65
|
return confirmResult;
|
|
@@ -293,7 +293,7 @@ function createResult(params, options) {
|
|
|
293
293
|
price
|
|
294
294
|
});
|
|
295
295
|
(0, validation_1.validateEventOffers)({
|
|
296
|
-
order:
|
|
296
|
+
order: { price },
|
|
297
297
|
paymentMethods,
|
|
298
298
|
authorizeEventServiceOfferActions: params.authorizeEventServiceOfferActions
|
|
299
299
|
});
|
|
@@ -18,7 +18,7 @@ const factory_1 = require("./exportTasks/factory");
|
|
|
18
18
|
*/
|
|
19
19
|
function exportTasksById(params) {
|
|
20
20
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const transaction = yield repos.transaction.
|
|
21
|
+
const transaction = yield repos.transaction.projectFieldsById({
|
|
22
22
|
typeOf: factory.transactionType.PlaceOrder,
|
|
23
23
|
id: params.id
|
|
24
24
|
}, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MemberRepo } from '../../../../repo/member';
|
|
2
2
|
import type { ProjectMakesOfferRepo } from '../../../../repo/projectMakesOffer';
|
|
3
|
-
import type { SellerRepo } from '../../../../repo/seller';
|
|
3
|
+
import type { ISellerWithId, SellerRepo } from '../../../../repo/seller';
|
|
4
4
|
import * as factory from '../../../../factory';
|
|
5
|
-
type ISeller = Pick<
|
|
5
|
+
type ISeller = Pick<ISellerWithId, 'id' | 'name' | 'project' | 'typeOf' | 'makesOffer' | 'additionalProperty'>;
|
|
6
6
|
declare function validateStartRequest(params: {
|
|
7
7
|
project: {
|
|
8
8
|
id: string;
|
|
@@ -67,7 +67,7 @@ function validateStartRequest(params) {
|
|
|
67
67
|
if (projectMakesOffer === undefined) {
|
|
68
68
|
throw new factory.errors.Argument('project', 'project makes no offers');
|
|
69
69
|
}
|
|
70
|
-
const seller = (yield repos.seller.
|
|
70
|
+
const seller = (yield repos.seller.projectFields({
|
|
71
71
|
limit: 1,
|
|
72
72
|
page: 1,
|
|
73
73
|
project: { id: { $eq: params.project.id } },
|
|
@@ -35,7 +35,7 @@ function start(params, options) {
|
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
37
|
// in case already locked
|
|
38
|
-
const alreadyStartedTransaction = (yield repos.transaction.
|
|
38
|
+
const alreadyStartedTransaction = (yield repos.transaction.projectFields({
|
|
39
39
|
limit: 1, page: 1,
|
|
40
40
|
typeOf: factory.transactionType.PlaceOrder,
|
|
41
41
|
project: { id: { $eq: startParams.project.id } },
|