@chevre/domain 24.0.0-alpha.40 → 24.0.0-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/accountTitle.d.ts +3 -3
- package/lib/chevre/repo/action/pay.d.ts +25 -0
- package/lib/chevre/repo/action/pay.js +54 -0
- package/lib/chevre/repo/action/refund.d.ts +9 -0
- package/lib/chevre/repo/action/refund.js +13 -0
- package/lib/chevre/repo/action.d.ts +5 -14
- package/lib/chevre/repo/action.js +20 -13
- package/lib/chevre/repo/additionalProperty.js +2 -2
- package/lib/chevre/repo/advanceBookingRequirement.d.ts +1 -3
- package/lib/chevre/repo/advanceBookingRequirement.js +2 -2
- package/lib/chevre/repo/aggregateOffer.d.ts +5 -9
- package/lib/chevre/repo/aggregateOffer.js +3 -3
- package/lib/chevre/repo/assetTransaction.d.ts +3 -3
- package/lib/chevre/repo/assetTransaction.js +12 -6
- package/lib/chevre/repo/categoryCode.d.ts +4 -6
- package/lib/chevre/repo/categoryCode.js +2 -2
- package/lib/chevre/repo/comment.d.ts +3 -3
- package/lib/chevre/repo/creativeWork.d.ts +3 -3
- package/lib/chevre/repo/creativeWork.js +3 -3
- package/lib/chevre/repo/customer.d.ts +3 -3
- package/lib/chevre/repo/customer.js +2 -2
- package/lib/chevre/repo/emailMessage.js +1 -1
- package/lib/chevre/repo/event.d.ts +6 -6
- package/lib/chevre/repo/event.js +10 -4
- package/lib/chevre/repo/eventSeries.d.ts +6 -6
- package/lib/chevre/repo/eventSeries.js +2 -2
- package/lib/chevre/repo/identity.d.ts +4 -6
- package/lib/chevre/repo/identityProvider.d.ts +4 -6
- package/lib/chevre/repo/identityProvider.js +2 -2
- package/lib/chevre/repo/issuer.d.ts +3 -3
- package/lib/chevre/repo/issuer.js +3 -3
- package/lib/chevre/repo/member.d.ts +3 -3
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +3 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/advanceBookingRequirement.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOrder.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/civicStructure.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/eventOffer.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/identity.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/identityProvider.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/member/global.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/note.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/paymentServiceChannel.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/pendingReservation.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/pendingReservationAggregate.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/potentialAction.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/productOffer.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/reserveInterface.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/schedule.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/sellerReturnPolicy.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/service/availableHour.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/transactionNumber.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/webSite.d.ts +2 -2
- package/lib/chevre/repo/movieTicketType.d.ts +1 -3
- package/lib/chevre/repo/movieTicketType.js +2 -2
- package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +1 -3
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +1 -3
- package/lib/chevre/repo/offerCatalog.d.ts +3 -3
- package/lib/chevre/repo/offerCatalog.js +5 -4
- package/lib/chevre/repo/offerCatalogItem.js +4 -4
- package/lib/chevre/repo/offerItemCondition.js +2 -2
- package/lib/chevre/repo/order.d.ts +3 -3
- package/lib/chevre/repo/ownershipInfo.d.ts +3 -3
- package/lib/chevre/repo/passport.js +1 -1
- package/lib/chevre/repo/paymentService.d.ts +1 -3
- package/lib/chevre/repo/paymentService.js +2 -2
- package/lib/chevre/repo/paymentServiceChannel.d.ts +1 -3
- package/lib/chevre/repo/paymentServiceChannel.js +2 -2
- package/lib/chevre/repo/person.js +2 -2
- package/lib/chevre/repo/place/busStop.js +1 -1
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -3
- package/lib/chevre/repo/place/movieTheater.js +10 -4
- package/lib/chevre/repo/place/screeningRoom.d.ts +3 -3
- package/lib/chevre/repo/place/screeningRoom.js +2 -2
- package/lib/chevre/repo/place/seat.d.ts +2 -4
- package/lib/chevre/repo/potentialAction.d.ts +4 -6
- package/lib/chevre/repo/potentialAction.js +2 -2
- package/lib/chevre/repo/priceSpecification.d.ts +3 -3
- package/lib/chevre/repo/priceSpecification.js +2 -2
- package/lib/chevre/repo/product.d.ts +5 -9
- package/lib/chevre/repo/product.js +3 -3
- package/lib/chevre/repo/productModel.js +2 -2
- package/lib/chevre/repo/project.d.ts +3 -3
- package/lib/chevre/repo/rateLimit/offer.js +1 -1
- package/lib/chevre/repo/reservation.d.ts +4 -6
- package/lib/chevre/repo/seller.d.ts +5 -9
- package/lib/chevre/repo/seller.js +2 -2
- package/lib/chevre/repo/sellerReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/sellerReturnPolicy.js +2 -2
- package/lib/chevre/repo/task.d.ts +3 -3
- package/lib/chevre/repo/task.js +1 -1
- package/lib/chevre/repo/transaction.d.ts +3 -3
- package/lib/chevre/repo/transactionProcess.js +1 -1
- package/lib/chevre/repo/trip.d.ts +4 -12
- package/lib/chevre/repo/trip.js +3 -3
- package/lib/chevre/repo/webSite.d.ts +1 -3
- package/lib/chevre/repo/webSite.js +3 -2
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +22 -0
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +8 -5
- package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +2 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +2 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +2 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/refund.d.ts +5 -2
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +6 -3
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +3 -2
- package/lib/chevre/service/delivery/factory.js +2 -1
- package/lib/chevre/service/event/saveScreeningEvents.js +2 -2
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/notification/notifyByEmail.d.ts +1 -1
- package/lib/chevre/service/notification/triggerWebhook.js +1 -1
- package/lib/chevre/service/offer/event/authorize.js +2 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +2 -1
- package/lib/chevre/service/offer/event/searchOffersByIds.js +2 -1
- package/lib/chevre/service/offer/event/voidTransaction.js +6 -3
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +14 -11
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +2 -1
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +4 -2
- package/lib/chevre/service/payment/any/authorize.d.ts +7 -2
- package/lib/chevre/service/payment/any/findAcceptAction.js +2 -1
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +2 -1
- package/lib/chevre/service/payment/any/findCheckAction.js +2 -1
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +2 -1
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +7 -2
- package/lib/chevre/service/payment/any/onPayActionCompleted.js +7 -2
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.d.ts +10 -5
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +21 -11
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +13 -10
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.js +9 -6
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -1
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +2 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +7 -2
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +8 -4
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +7 -2
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +11 -7
- package/lib/chevre/service/payment/faceToFace.d.ts +12 -3
- package/lib/chevre/service/payment/faceToFace.js +16 -8
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +2 -1
- package/lib/chevre/service/payment/factory.js +4 -2
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +7 -2
- package/lib/chevre/service/payment/movieTicket/authorize.js +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.d.ts +12 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.js +72 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/processSeatInfoSync.d.ts +8 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/processSeatInfoSync.js +29 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +8 -3
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +14 -77
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncCancelInOnRefund.d.ts +14 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncCancelInOnRefund.js +49 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncInOnRefund.d.ts +14 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncInOnRefund.js +46 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.d.ts +12 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.js +72 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.d.ts +8 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.js +60 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +8 -3
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +20 -125
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +1 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +37 -29
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +6 -2
- package/lib/chevre/service/payment/movieTicket/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +12 -3
- package/lib/chevre/service/payment/paymentCard.js +16 -8
- package/lib/chevre/service/permit.js +4 -2
- package/lib/chevre/service/reserve/factory.d.ts +1 -1
- package/lib/chevre/service/reserve/findByCode.js +2 -1
- package/lib/chevre/service/reserve/searchByOrder.js +2 -1
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +8 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +4 -2
- package/lib/chevre/service/task/invalidatePaymentUrl.js +8 -2
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/lib/chevre/service/task/pay.js +8 -2
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +7 -2
- package/lib/chevre/service/task/payment/payByTask.d.ts +7 -2
- package/lib/chevre/service/task/payment/payByTask.js +2 -1
- package/lib/chevre/service/task/payment/refundByTask.d.ts +7 -2
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +6 -0
- package/lib/chevre/service/task/refund.js +8 -2
- package/lib/chevre/service/task/returnPayTransaction.js +5 -2
- package/lib/chevre/service/task/returnReserveTransaction.js +2 -1
- package/lib/chevre/service/task/voidPayment.js +6 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +4 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +2 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +2 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart/getReturnPolicyByProject.js +5 -3
- package/lib/chevre/service/validation/validateOrder.js +4 -2
- package/package.json +2 -2
|
@@ -32,19 +32,27 @@ const onRefunded_1 = require("./onPaymentStatusChanged/onRefunded");
|
|
|
32
32
|
*/
|
|
33
33
|
function onPaymentStatusChanged(params) {
|
|
34
34
|
return async (repos) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
switch (params.typeOf) {
|
|
36
|
+
case factory.actionType.PayAction: {
|
|
37
|
+
// アクションリポジトリから実アクションを参照する
|
|
38
|
+
// そうすることで、通知する情報は最低限で済む
|
|
39
|
+
const action = await repos.actions.pay.findById({ id: params.id, typeOf: params.typeOf });
|
|
40
|
+
const optimizedAction = optimizeAction4report((action));
|
|
41
41
|
await (0, onPaid_1.onPaid)(optimizedAction, { id: action.project.id })(repos);
|
|
42
42
|
break;
|
|
43
|
-
|
|
43
|
+
}
|
|
44
|
+
case factory.actionType.RefundAction: {
|
|
45
|
+
// アクションリポジトリから実アクションを参照する
|
|
46
|
+
// そうすることで、通知する情報は最低限で済む
|
|
47
|
+
const action = await repos.actions.refund.findById({ id: params.id, typeOf: params.typeOf });
|
|
48
|
+
const optimizedAction = optimizeAction4report((action));
|
|
44
49
|
await (0, onRefunded_1.onRefunded)(optimizedAction, { id: action.project.id })(repos);
|
|
45
50
|
break;
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
}
|
|
52
|
+
/* istanbul ignore next */
|
|
53
|
+
default: {
|
|
54
|
+
// no op
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
57
|
};
|
|
50
58
|
}
|
|
@@ -56,7 +64,7 @@ function optimizeAction4report(action) {
|
|
|
56
64
|
// 現時点で経理レポートで使用されているのは、typeOf,object,purpose,startDate
|
|
57
65
|
const actionTypeOf = action.typeOf;
|
|
58
66
|
switch (actionTypeOf) {
|
|
59
|
-
case factory.actionType.PayAction:
|
|
67
|
+
case factory.actionType.PayAction: {
|
|
60
68
|
const optimizedPayActionObject = action.object.map((o) => {
|
|
61
69
|
return {
|
|
62
70
|
id: o.id,
|
|
@@ -77,7 +85,8 @@ function optimizeAction4report(action) {
|
|
|
77
85
|
};
|
|
78
86
|
optimizedAction = optimizedPayAction;
|
|
79
87
|
break;
|
|
80
|
-
|
|
88
|
+
}
|
|
89
|
+
case factory.actionType.RefundAction: {
|
|
81
90
|
const optimizedRefundActionObject = action.object.map((o) => {
|
|
82
91
|
return {
|
|
83
92
|
id: o.id,
|
|
@@ -100,6 +109,7 @@ function optimizeAction4report(action) {
|
|
|
100
109
|
};
|
|
101
110
|
optimizedAction = optimizedRefundAction;
|
|
102
111
|
break;
|
|
112
|
+
}
|
|
103
113
|
default:
|
|
104
114
|
throw new factory.errors.NotImplemented(`action type '${actionTypeOf}' not implemented`);
|
|
105
115
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 汎用決済サービス
|
|
3
|
-
*/
|
|
4
1
|
import * as factory from '../../../factory';
|
|
5
2
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
6
|
-
import type {
|
|
3
|
+
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
4
|
+
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
7
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
|
+
interface IOnRefundActionCompletedOrFailedRepos {
|
|
7
|
+
action?: never;
|
|
8
|
+
actions: {
|
|
9
|
+
pay: PayActionRepo;
|
|
10
|
+
refund: RefundActionRepo;
|
|
11
|
+
};
|
|
12
|
+
accountingReport: AccountingReportRepo;
|
|
13
|
+
task: TaskRepo;
|
|
14
|
+
}
|
|
8
15
|
/**
|
|
9
16
|
* 返金後のアクション
|
|
10
17
|
*/
|
|
11
18
|
declare function onRefundActionCompletedOrFailed(refundAction: Pick<factory.action.trade.refund.IAction, 'id' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'typeOf'> & {
|
|
12
19
|
actionStatus: factory.actionStatusType.CompletedActionStatus | factory.actionStatusType.FailedActionStatus;
|
|
13
|
-
}): (repos:
|
|
14
|
-
|
|
15
|
-
accountingReport: AccountingReportRepo;
|
|
16
|
-
task: TaskRepo;
|
|
17
|
-
}) => Promise<void>;
|
|
18
|
-
export { onRefundActionCompletedOrFailed };
|
|
20
|
+
}): (repos: IOnRefundActionCompletedOrFailedRepos) => Promise<void>;
|
|
21
|
+
export { IOnRefundActionCompletedOrFailedRepos, onRefundActionCompletedOrFailed };
|
|
@@ -24,9 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.onRefundActionCompletedOrFailed = onRefundActionCompletedOrFailed;
|
|
27
|
-
/**
|
|
28
|
-
* 汎用決済サービス
|
|
29
|
-
*/
|
|
30
27
|
const factory = __importStar(require("../../../factory"));
|
|
31
28
|
const factory_1 = require("./factory");
|
|
32
29
|
const onPaymentStatusChanged_1 = require("./onPaymentStatusChanged");
|
|
@@ -54,12 +51,14 @@ function onRefundActionCompletedOrFailed(refundAction) {
|
|
|
54
51
|
// CreditCardIFのみ(2023-06-29~)
|
|
55
52
|
const firstObject = refundAction.object[0];
|
|
56
53
|
const paymentServiceType = firstObject?.typeOf;
|
|
54
|
+
/* istanbul ignore else -- @preserve */
|
|
57
55
|
if (paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
58
56
|
const refundFee = firstObject?.refundFee;
|
|
59
57
|
if (typeof refundFee === 'number' && refundFee > 0) {
|
|
60
58
|
// purpose.typeOf:PlaceOrderは外部決済URL無効化における返金アクションのみなので、手数料決済から除外してよい(2024-03-19~)
|
|
61
59
|
// purpose.typeOf:Orderは決済カード承認時着券の取消なので、手数料決済から除外してよい
|
|
62
60
|
// 手数料決済は注文返品による返金アクションからしか発生しないはず(2024-06-13~)
|
|
61
|
+
/* istanbul ignore else -- @preserve */
|
|
63
62
|
if (refundAction.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
64
63
|
const payReturnFeeObject = [{
|
|
65
64
|
typeOf: firstObject.typeOf,
|
|
@@ -86,7 +85,7 @@ function onRefundActionCompletedOrFailed(refundAction) {
|
|
|
86
85
|
object: payReturnFeeObject,
|
|
87
86
|
purpose: refundAction.purpose,
|
|
88
87
|
potentialActions: {
|
|
89
|
-
informPayment: (Array.isArray(informPayment)) ? informPayment : [],
|
|
88
|
+
informPayment: (Array.isArray(informPayment)) ? informPayment : /* istanbul ignore next -- @preserve */ [],
|
|
90
89
|
add2report: true
|
|
91
90
|
},
|
|
92
91
|
instrument // add(2025-02-19~)
|
|
@@ -105,11 +104,13 @@ function onRefundActionCompletedOrFailed(refundAction) {
|
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
}
|
|
107
|
+
/* istanbul ignore else -- @preserve */
|
|
108
108
|
if (Array.isArray(informPayment)) {
|
|
109
109
|
taskAttributes.push(...informPayment.map(({ purpose, id }) => {
|
|
110
110
|
let data;
|
|
111
111
|
if (typeof id === 'string' && id !== '') {
|
|
112
112
|
let about;
|
|
113
|
+
/* istanbul ignore else -- @preserve */
|
|
113
114
|
if (refundAction.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
114
115
|
about = {
|
|
115
116
|
orderNumber: refundAction.purpose.object.orderNumber,
|
|
@@ -122,8 +123,10 @@ function onRefundActionCompletedOrFailed(refundAction) {
|
|
|
122
123
|
object: aciton4inform,
|
|
123
124
|
id, // add potentialAction(2025-02-05~)
|
|
124
125
|
typeOf: factory.actionType.InformAction,
|
|
125
|
-
...(typeof purpose?.typeOf === 'string') ? { purpose } : undefined,
|
|
126
|
-
...(typeof about?.typeOf === 'string') ? { about } : undefined // add(2025-02-14~)
|
|
126
|
+
// ...(typeof purpose?.typeOf === 'string') ? { purpose } : undefined,
|
|
127
|
+
// ...(typeof about?.typeOf === 'string') ? { about } : undefined // add(2025-02-14~)
|
|
128
|
+
...(typeof purpose?.typeOf === 'string' && { purpose }),
|
|
129
|
+
...(typeof about?.typeOf === 'string' && { about }),
|
|
127
130
|
};
|
|
128
131
|
}
|
|
129
132
|
else {
|
|
@@ -64,7 +64,7 @@ function processVoidPayTransaction(params) {
|
|
|
64
64
|
switch (transaction.status) {
|
|
65
65
|
case factory.transactionStatusType.InProgress:
|
|
66
66
|
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
67
|
-
case factory.transactionStatusType.Confirmed:
|
|
67
|
+
case factory.transactionStatusType.Confirmed: {
|
|
68
68
|
// OrderCancelledを考慮(2023-08-30~)
|
|
69
69
|
const orderCancelled = params.purpose.result?.order?.orderStatus === factory.orderStatus.OrderCancelled;
|
|
70
70
|
if (!orderCancelled) {
|
|
@@ -86,6 +86,7 @@ function processVoidPayTransaction(params) {
|
|
|
86
86
|
authorizeActions.filter(({ object }) => !authorizedPaymentMethodIds.includes(object.paymentMethodId));
|
|
87
87
|
}
|
|
88
88
|
break;
|
|
89
|
+
}
|
|
89
90
|
default:
|
|
90
91
|
// no op
|
|
91
92
|
}
|
|
@@ -35,7 +35,7 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
35
35
|
switch (paymentServiceType) {
|
|
36
36
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
37
37
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
38
|
-
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
38
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace: {
|
|
39
39
|
const ticket = (await repos.ticket.findTickets({
|
|
40
40
|
limit: 1,
|
|
41
41
|
page: 1,
|
|
@@ -88,6 +88,7 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
88
88
|
throw new factory.errors.Argument('ticketToken', 'must be OwnershipInfo');
|
|
89
89
|
}
|
|
90
90
|
break;
|
|
91
|
+
}
|
|
91
92
|
default:
|
|
92
93
|
// no op
|
|
93
94
|
throw new factory.errors.NotImplemented(`ticketToken issued through ${paymentServiceType} not implemented`);
|
|
@@ -45,7 +45,7 @@ function processAuthorizeCreditCard(params) {
|
|
|
45
45
|
try {
|
|
46
46
|
returnUrlObject = new URL(retUrl);
|
|
47
47
|
}
|
|
48
|
-
catch (
|
|
48
|
+
catch (_error) {
|
|
49
49
|
throw new factory.errors.Argument('object.creditCard.retUrl', 'retUrl unparsable');
|
|
50
50
|
}
|
|
51
51
|
const returnUrlShouldBeIncluded = `${returnUrlObject.origin}${returnUrlObject.pathname}`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
3
|
+
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
3
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
4
5
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
5
6
|
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
@@ -10,7 +11,11 @@ import { Settings } from '../../../settings';
|
|
|
10
11
|
* クレジットカード決済
|
|
11
12
|
*/
|
|
12
13
|
declare function payCreditCard(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
13
|
-
action
|
|
14
|
+
action?: never;
|
|
15
|
+
actions: {
|
|
16
|
+
pay: PayActionRepo;
|
|
17
|
+
refund: RefundActionRepo;
|
|
18
|
+
};
|
|
14
19
|
accountingReport: AccountingReportRepo;
|
|
15
20
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
16
21
|
paymentService: PaymentServiceRepo;
|
|
@@ -55,7 +55,7 @@ function payCreditCard(params) {
|
|
|
55
55
|
paymentMethodType, seller: { id: sellerId }, paymentServiceId,
|
|
56
56
|
requirePaymentAccepted
|
|
57
57
|
})(repos);
|
|
58
|
-
const action = await repos.
|
|
58
|
+
const action = await repos.actions.pay.start(params);
|
|
59
59
|
const alterTranResults = [];
|
|
60
60
|
const processAlterTranResults = [];
|
|
61
61
|
let recipe;
|
|
@@ -86,7 +86,7 @@ function payCreditCard(params) {
|
|
|
86
86
|
try {
|
|
87
87
|
// add recipe(2024-06-29~)
|
|
88
88
|
recipe = (0, factory_1.processAlterTranResult2payRecipe)({ processAlterTranResults, project: { id: params.project.id } });
|
|
89
|
-
await repos.
|
|
89
|
+
await repos.actions.pay.giveUp({ typeOf: action.typeOf, id: action.id, error, recipe });
|
|
90
90
|
}
|
|
91
91
|
catch (__) {
|
|
92
92
|
// 失敗したら仕方ない
|
|
@@ -96,7 +96,7 @@ function payCreditCard(params) {
|
|
|
96
96
|
const actionResult = {
|
|
97
97
|
// creditCardSales: alterTranResults // discontinue(2024-06-10~)
|
|
98
98
|
};
|
|
99
|
-
await repos.
|
|
99
|
+
await repos.actions.pay.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
100
100
|
await (0, onPayActionCompleted_1.onPayActionCompleted)({
|
|
101
101
|
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
102
102
|
id: action.id,
|
|
@@ -105,7 +105,11 @@ function payCreditCard(params) {
|
|
|
105
105
|
project: params.project,
|
|
106
106
|
purpose: params.purpose,
|
|
107
107
|
typeOf: action.typeOf
|
|
108
|
-
})(
|
|
108
|
+
})({
|
|
109
|
+
actions: repos.actions,
|
|
110
|
+
accountingReport: repos.accountingReport,
|
|
111
|
+
task: repos.task
|
|
112
|
+
});
|
|
109
113
|
// return action;
|
|
110
114
|
};
|
|
111
115
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
3
|
+
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
3
4
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
4
5
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
5
6
|
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
@@ -15,7 +16,11 @@ declare function refundCreditCard(params: Pick<factory.action.trade.refund.IAttr
|
|
|
15
16
|
id: string;
|
|
16
17
|
};
|
|
17
18
|
}): (repos: {
|
|
18
|
-
action
|
|
19
|
+
action?: never;
|
|
20
|
+
actions: {
|
|
21
|
+
pay: PayActionRepo;
|
|
22
|
+
refund: RefundActionRepo;
|
|
23
|
+
};
|
|
19
24
|
accountingReport: AccountingReportRepo;
|
|
20
25
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
21
26
|
paymentService: PaymentServiceRepo;
|
|
@@ -53,11 +53,11 @@ function refundCreditCard(params
|
|
|
53
53
|
let payAction;
|
|
54
54
|
let alterTranResultByPayAction;
|
|
55
55
|
if (requirePayAction) {
|
|
56
|
-
payAction = await repos.
|
|
56
|
+
payAction = await repos.actions.pay.findPayActionByPaymentMethodId({ project: { id: params.project.id }, paymentMethodId });
|
|
57
57
|
if (payAction === undefined) {
|
|
58
58
|
throw new factory.errors.NotFound(factory.actionType.PayAction);
|
|
59
59
|
}
|
|
60
|
-
const payRecipe = await repos.
|
|
60
|
+
const payRecipe = await repos.actions.pay.findRecipeByAction({
|
|
61
61
|
project: { id: params.project.id },
|
|
62
62
|
recipeFor: { id: payAction.id }
|
|
63
63
|
});
|
|
@@ -72,8 +72,8 @@ function refundCreditCard(params
|
|
|
72
72
|
project: params.project,
|
|
73
73
|
id: paymentServiceId
|
|
74
74
|
});
|
|
75
|
-
const { sameAs, ...startingActionParams } = params;
|
|
76
|
-
const action = await repos.
|
|
75
|
+
const { sameAs, ...startingActionParams } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
76
|
+
const action = await repos.actions.refund.start({
|
|
77
77
|
...startingActionParams,
|
|
78
78
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
79
79
|
});
|
|
@@ -106,7 +106,7 @@ function refundCreditCard(params
|
|
|
106
106
|
}
|
|
107
107
|
catch (error) {
|
|
108
108
|
try {
|
|
109
|
-
await repos.
|
|
109
|
+
await repos.actions.refund.giveUp({
|
|
110
110
|
typeOf: action.typeOf, id: action.id, error,
|
|
111
111
|
...(recipe !== undefined) ? { recipe } : undefined
|
|
112
112
|
});
|
|
@@ -118,7 +118,7 @@ function refundCreditCard(params
|
|
|
118
118
|
}
|
|
119
119
|
const actionResult = {}; // optimize(2024-06-10~)
|
|
120
120
|
// add recipe(2024-06-04~)
|
|
121
|
-
await repos.
|
|
121
|
+
await repos.actions.refund.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
122
122
|
await (0, onRefundActionCompletedOrFailed_1.onRefundActionCompletedOrFailed)({
|
|
123
123
|
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
124
124
|
id: action.id,
|
|
@@ -127,7 +127,11 @@ function refundCreditCard(params
|
|
|
127
127
|
project: startingActionParams.project,
|
|
128
128
|
purpose: startingActionParams.purpose,
|
|
129
129
|
typeOf: action.typeOf
|
|
130
|
-
})(
|
|
130
|
+
})({
|
|
131
|
+
actions: repos.actions,
|
|
132
|
+
accountingReport: repos.accountingReport,
|
|
133
|
+
task: repos.task
|
|
134
|
+
});
|
|
131
135
|
};
|
|
132
136
|
}
|
|
133
137
|
function processAlterTran(params) {
|
|
@@ -3,20 +3,29 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
6
|
-
import type {
|
|
6
|
+
import type { PayActionRepo } from '../../repo/action/pay';
|
|
7
|
+
import type { RefundActionRepo } from '../../repo/action/refund';
|
|
7
8
|
import type { ProductRepo } from '../../repo/product';
|
|
8
9
|
import type { TaskRepo } from '../../repo/task';
|
|
9
10
|
declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
|
|
10
11
|
product: ProductRepo;
|
|
11
12
|
}) => Promise<void>;
|
|
12
13
|
declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
13
|
-
action
|
|
14
|
+
action?: never;
|
|
15
|
+
actions: {
|
|
16
|
+
pay: PayActionRepo;
|
|
17
|
+
refund: RefundActionRepo;
|
|
18
|
+
};
|
|
14
19
|
accountingReport: AccountingReportRepo;
|
|
15
20
|
product: ProductRepo;
|
|
16
21
|
task: TaskRepo;
|
|
17
22
|
}) => Promise<void>;
|
|
18
23
|
declare function refundFaceToFace(params: factory.task.refund.IData): (repos: {
|
|
19
|
-
action
|
|
24
|
+
action?: never;
|
|
25
|
+
actions: {
|
|
26
|
+
pay: PayActionRepo;
|
|
27
|
+
refund: RefundActionRepo;
|
|
28
|
+
};
|
|
20
29
|
accountingReport: AccountingReportRepo;
|
|
21
30
|
product: ProductRepo;
|
|
22
31
|
task: TaskRepo;
|
|
@@ -39,13 +39,13 @@ function voidTransaction(__) {
|
|
|
39
39
|
}
|
|
40
40
|
function payFaceToFace(params) {
|
|
41
41
|
return async (repos) => {
|
|
42
|
-
const action = await repos.
|
|
42
|
+
const action = await repos.actions.pay.start(params);
|
|
43
43
|
try {
|
|
44
44
|
// no op
|
|
45
45
|
}
|
|
46
46
|
catch (error) {
|
|
47
47
|
try {
|
|
48
|
-
await repos.
|
|
48
|
+
await repos.actions.pay.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
49
49
|
}
|
|
50
50
|
catch (__) {
|
|
51
51
|
// 失敗したら仕方ない
|
|
@@ -53,7 +53,7 @@ function payFaceToFace(params) {
|
|
|
53
53
|
throw error;
|
|
54
54
|
}
|
|
55
55
|
const actionResult = {};
|
|
56
|
-
await repos.
|
|
56
|
+
await repos.actions.pay.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
57
57
|
await (0, onPayActionCompleted_1.onPayActionCompleted)({
|
|
58
58
|
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
59
59
|
id: action.id,
|
|
@@ -62,19 +62,23 @@ function payFaceToFace(params) {
|
|
|
62
62
|
project: params.project,
|
|
63
63
|
purpose: params.purpose,
|
|
64
64
|
typeOf: action.typeOf
|
|
65
|
-
})(
|
|
65
|
+
})({
|
|
66
|
+
actions: repos.actions,
|
|
67
|
+
accountingReport: repos.accountingReport,
|
|
68
|
+
task: repos.task
|
|
69
|
+
});
|
|
66
70
|
// return action;
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
function refundFaceToFace(params) {
|
|
70
74
|
return async (repos) => {
|
|
71
|
-
const action = await repos.
|
|
75
|
+
const action = await repos.actions.refund.start(params);
|
|
72
76
|
try {
|
|
73
77
|
// no op
|
|
74
78
|
}
|
|
75
79
|
catch (error) {
|
|
76
80
|
try {
|
|
77
|
-
await repos.
|
|
81
|
+
await repos.actions.refund.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
78
82
|
}
|
|
79
83
|
catch (__) {
|
|
80
84
|
// no op
|
|
@@ -82,7 +86,7 @@ function refundFaceToFace(params) {
|
|
|
82
86
|
throw error;
|
|
83
87
|
}
|
|
84
88
|
const actionResult = {};
|
|
85
|
-
await repos.
|
|
89
|
+
await repos.actions.refund.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
86
90
|
await (0, onRefundActionCompletedOrFailed_1.onRefundActionCompletedOrFailed)({
|
|
87
91
|
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
88
92
|
id: action.id,
|
|
@@ -91,7 +95,11 @@ function refundFaceToFace(params) {
|
|
|
91
95
|
project: params.project,
|
|
92
96
|
purpose: params.purpose,
|
|
93
97
|
typeOf: action.typeOf
|
|
94
|
-
})(
|
|
98
|
+
})({
|
|
99
|
+
actions: repos.actions,
|
|
100
|
+
accountingReport: repos.accountingReport,
|
|
101
|
+
task: repos.task
|
|
102
|
+
});
|
|
95
103
|
// return action;
|
|
96
104
|
};
|
|
97
105
|
}
|
|
@@ -39,7 +39,7 @@ function createPayObjectServiceOutput(params) {
|
|
|
39
39
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
40
40
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
41
41
|
break;
|
|
42
|
-
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
42
|
+
case factory.service.paymentService.PaymentServiceType.MovieTicket: {
|
|
43
43
|
const paymentMethodType = paymentMethod?.identifier;
|
|
44
44
|
const movieTickets = paymentMethod?.movieTickets;
|
|
45
45
|
if (Array.isArray(movieTickets)) {
|
|
@@ -58,6 +58,7 @@ function createPayObjectServiceOutput(params) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
break;
|
|
61
|
+
}
|
|
61
62
|
default:
|
|
62
63
|
throw new factory.errors.NotImplemented(`Payment service "${transaction.object.typeOf}" not implemented.`);
|
|
63
64
|
}
|
|
@@ -82,7 +82,7 @@ function createPayObject(params) {
|
|
|
82
82
|
const paymentServiceOutput = (0, createPayObjectServiceOutput_1.createPayObjectServiceOutput)(params);
|
|
83
83
|
let payObject;
|
|
84
84
|
switch (transaction.object.typeOf) {
|
|
85
|
-
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
85
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace: {
|
|
86
86
|
// 対面決済ではとりあえず問答無用にJPY
|
|
87
87
|
const totalPaymentDue4faceToFace = {
|
|
88
88
|
typeOf: 'MonetaryAmount',
|
|
@@ -102,7 +102,8 @@ function createPayObject(params) {
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
break;
|
|
105
|
-
|
|
105
|
+
}
|
|
106
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard: {
|
|
106
107
|
const totalPaymentDue = (typeof paymentMethod?.totalPaymentDue?.typeOf === 'string')
|
|
107
108
|
? paymentMethod.totalPaymentDue
|
|
108
109
|
: {
|
|
@@ -124,6 +125,7 @@ function createPayObject(params) {
|
|
|
124
125
|
pendingTransaction: transaction.object.pendingTransaction
|
|
125
126
|
};
|
|
126
127
|
break;
|
|
128
|
+
}
|
|
127
129
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
128
130
|
payObject = {
|
|
129
131
|
typeOf: transaction.object.typeOf,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
3
|
+
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
3
4
|
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
4
5
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
5
6
|
import type { EventRepo } from '../../../repo/event';
|
|
@@ -38,7 +39,11 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
|
|
|
38
39
|
id: string;
|
|
39
40
|
};
|
|
40
41
|
}): (repos: {
|
|
41
|
-
action
|
|
42
|
+
action?: never;
|
|
43
|
+
actions: {
|
|
44
|
+
pay: PayActionRepo;
|
|
45
|
+
refund: RefundActionRepo;
|
|
46
|
+
};
|
|
42
47
|
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
43
48
|
accountingReport: AccountingReportRepo;
|
|
44
49
|
credentials: CredentialsRepo;
|
|
@@ -38,7 +38,7 @@ function authorize(params, transaction, paymentServiceId, options) {
|
|
|
38
38
|
let accountsReceivablesByServiceType;
|
|
39
39
|
try {
|
|
40
40
|
// MovieTicket決済の場合、認証
|
|
41
|
-
const validateMovieTicketResult = await (0, validation_1.validateMovieTicket)(params, paymentServiceId, options.checkedAction, options.purpose)(repos
|
|
41
|
+
const validateMovieTicketResult = await (0, validation_1.validateMovieTicket)(params, paymentServiceId, options.checkedAction, options.purpose)(repos);
|
|
42
42
|
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
43
43
|
const paymentMethod = transaction.object.paymentMethod;
|
|
44
44
|
const paymentMethodType = String(paymentMethod?.identifier);
|
package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as surfrock from '@surfrock/sdk';
|
|
2
|
+
import type { EventRepo } from '../../../../repo/event';
|
|
3
|
+
import type { PaymentServiceProviderRepo } from '../../../../repo/paymentServiceProvider';
|
|
4
|
+
import type { SellerPaymentAcceptedRepo } from '../../../../repo/sellerPaymentAccepted';
|
|
5
|
+
import * as factory from '../../../../factory';
|
|
6
|
+
export declare function payActionParams2seatInfoSyncIn(params: Omit<factory.action.trade.pay.IAttributes, 'purpose'> & {
|
|
7
|
+
purpose: factory.action.trade.pay.IOrderAsPayPurpose;
|
|
8
|
+
}): (repos: {
|
|
9
|
+
event: EventRepo;
|
|
10
|
+
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
11
|
+
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
12
|
+
}) => Promise<surfrock.factory.service.seat.seatInfoSync.ISeatInfoSyncIn>;
|
package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.payActionParams2seatInfoSyncIn = payActionParams2seatInfoSyncIn;
|
|
27
|
+
const factory = __importStar(require("../../../../factory"));
|
|
28
|
+
const factory_1 = require("../factory");
|
|
29
|
+
const getCredentials_1 = require("../getCredentials");
|
|
30
|
+
function payActionParams2seatInfoSyncIn(params) {
|
|
31
|
+
return async (repos) => {
|
|
32
|
+
const paymentMethodType = params.object[0]?.paymentMethod.typeOf;
|
|
33
|
+
const paymentMethodId = params.object[0]?.paymentMethod.paymentMethodId;
|
|
34
|
+
const paymentServiceId = params.object[0]?.id;
|
|
35
|
+
// イベントがひとつに特定されているかどうか確認
|
|
36
|
+
const eventIds = [...new Set(params.object.reduce((a, b) => [
|
|
37
|
+
...a,
|
|
38
|
+
...(Array.isArray(b.movieTickets)) ? b.movieTickets.map((ticket) => ticket.serviceOutput.reservationFor.id) : []
|
|
39
|
+
], []))];
|
|
40
|
+
if (eventIds.length !== 1) {
|
|
41
|
+
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
42
|
+
}
|
|
43
|
+
const event = await repos.event.projectEventFieldsById({ id: eventIds[0] },
|
|
44
|
+
// optimize projection(2024-07-19~)
|
|
45
|
+
[
|
|
46
|
+
'coaInfo', 'startDate', 'project',
|
|
47
|
+
'offers.offeredThrough', 'location.branchCode', 'superEvent.workPerformed.identifier'
|
|
48
|
+
]);
|
|
49
|
+
const sellerId = String(params.recipient?.id);
|
|
50
|
+
// 全購入管理番号のMovieTicketをマージ
|
|
51
|
+
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
52
|
+
const sellerCredentials = await (0, getCredentials_1.getCredentials)({
|
|
53
|
+
seller: { id: sellerId, project: { id: event.project.id } },
|
|
54
|
+
paymentServiceId
|
|
55
|
+
})(repos);
|
|
56
|
+
const paymentAccepted = await repos.paymentAccepted.isAcceptedBySeller({
|
|
57
|
+
seller: { id: sellerId },
|
|
58
|
+
codeValue: paymentMethodType
|
|
59
|
+
});
|
|
60
|
+
if (paymentAccepted !== true) {
|
|
61
|
+
throw new factory.errors.Argument('transactionId', `payment not accepted [${paymentMethodType}]`);
|
|
62
|
+
}
|
|
63
|
+
return (0, factory_1.createSeatInfoSyncIn)({
|
|
64
|
+
paymentMethodType: paymentMethodType,
|
|
65
|
+
paymentMethodId: paymentMethodId,
|
|
66
|
+
movieTickets: movieTickets,
|
|
67
|
+
event: event,
|
|
68
|
+
purpose: params.purpose,
|
|
69
|
+
credentials: sellerCredentials
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as surfrock from '@surfrock/sdk';
|
|
2
|
+
import * as factory from '../../../../factory';
|
|
3
|
+
import { IProcessSeatInfoSyncResult } from '../factory';
|
|
4
|
+
export declare function processSeatInfoSync(params: {
|
|
5
|
+
seatInfoSyncIn: factory.action.trade.refund.ISeatInfoSyncIn;
|
|
6
|
+
}): (repos: {
|
|
7
|
+
seatService: surfrock.service.seat.SeatService;
|
|
8
|
+
}) => Promise<IProcessSeatInfoSyncResult>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processSeatInfoSync = processSeatInfoSync;
|
|
4
|
+
const http_status_1 = require("http-status");
|
|
5
|
+
const errorHandler_1 = require("../../../../errorHandler");
|
|
6
|
+
const factory_1 = require("../factory");
|
|
7
|
+
function processSeatInfoSync(params) {
|
|
8
|
+
return async (repos) => {
|
|
9
|
+
let seatInfoSyncResult;
|
|
10
|
+
const { seatInfoSyncIn } = params;
|
|
11
|
+
try {
|
|
12
|
+
seatInfoSyncResult = await repos.seatService.seatInfoSync(seatInfoSyncIn);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
let throwsError = true;
|
|
16
|
+
// 「既に存在する興行システム座席予約番号が入力されました」の場合、着券済なのでok
|
|
17
|
+
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
18
|
+
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.AlreadyPaid) {
|
|
19
|
+
seatInfoSyncResult = error;
|
|
20
|
+
throwsError = false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (throwsError) {
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { seatInfoSyncIn, seatInfoSyncResult };
|
|
28
|
+
};
|
|
29
|
+
}
|