@chevre/domain 21.20.0-alpha.9 → 21.20.1
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/findTransactionById.ts +21 -0
- package/example/src/chevre/importCategoryCodesFromCOA.ts +2 -1
- package/example/src/chevre/importOffersFromCOA.ts +2 -1
- package/example/src/chevre/migrateActionInstrumentTransactionNumber.ts +93 -0
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +119 -0
- package/example/src/chevre/migrateEventMakesOfferAvailableAtOrFrom.ts +87 -0
- package/example/src/chevre/migrateIAMMemberPOSRoles.ts +3 -2
- package/example/src/chevre/migrateOfferAvailableAtOrFrom.ts +63 -0
- package/example/src/chevre/{migrateOrderPaymentMethodIdentifier.ts → migrateOrderAcceptedOfferSerialNumber.ts} +18 -19
- package/example/src/chevre/onAssetTransactionStatusChanged.ts +36 -0
- package/example/src/chevre/retryTasks.ts +39 -0
- package/example/src/chevre/searchActions.ts +13 -7
- package/example/src/chevre/searchOrderAcceptedOffers.ts +13 -3
- package/example/src/chevre/searchOrders.ts +13 -15
- package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +28 -0
- package/example/src/chevre/sendOrder.ts +37 -0
- package/example/src/chevre/transaction/processPlaceOrder.ts +2 -3
- package/example/src/verifyToken.ts +44 -0
- package/lib/chevre/credentials.d.ts +2 -0
- package/lib/chevre/credentials.js +4 -2
- package/lib/chevre/errorHandler.js +3 -0
- package/lib/chevre/factory/order.d.ts +1 -0
- package/lib/chevre/factory/order.js +2 -1
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
- package/lib/chevre/factory/transaction.d.ts +10 -1
- package/lib/chevre/repo/acceptedOffer.d.ts +58 -2
- package/lib/chevre/repo/acceptedOffer.js +100 -4
- package/lib/chevre/repo/accountingReport.d.ts +33 -7
- package/lib/chevre/repo/accountingReport.js +157 -5
- package/lib/chevre/repo/action.d.ts +32 -8
- package/lib/chevre/repo/action.js +114 -54
- package/lib/chevre/repo/event.d.ts +20 -0
- package/lib/chevre/repo/event.js +22 -0
- package/lib/chevre/repo/member.d.ts +8 -1
- package/lib/chevre/repo/member.js +7 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +25 -11
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.js +38 -11
- package/lib/chevre/repo/offer.d.ts +42 -0
- package/lib/chevre/repo/offer.js +35 -0
- package/lib/chevre/repo/order.js +43 -20
- package/lib/chevre/repo/orderInTransaction.d.ts +44 -0
- package/lib/chevre/repo/orderInTransaction.js +164 -0
- package/lib/chevre/repo/paymentServiceProvider.js +2 -1
- package/lib/chevre/repo/person.js +1 -4
- package/lib/chevre/repo/task.d.ts +26 -3
- package/lib/chevre/repo/task.js +61 -46
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/repo/transaction.js +13 -36
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/aggregation/event/importFromCOA.js +5 -5
- package/lib/chevre/service/assetTransaction/pay/factory.js +1 -6
- package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.d.ts +9 -0
- package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.js +143 -0
- package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +11 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +4 -165
- package/lib/chevre/service/assetTransaction/pay.d.ts +21 -4
- package/lib/chevre/service/assetTransaction/pay.js +64 -23
- package/lib/chevre/service/assetTransaction/reserve/factory.js +11 -14
- package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +19 -0
- package/lib/chevre/service/assetTransaction/reserveCOA.js +46 -0
- package/lib/chevre/service/code.js +1 -1
- package/lib/chevre/service/delivery.js +2 -2
- package/lib/chevre/service/event/createEvent.js +1 -1
- package/lib/chevre/service/event.js +16 -24
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/notification.js +71 -66
- package/lib/chevre/service/offer/any.d.ts +35 -0
- package/lib/chevre/service/offer/any.js +67 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +7 -0
- package/lib/chevre/service/offer/event/authorize.js +27 -17
- package/lib/chevre/service/offer/event/cancel.d.ts +2 -0
- package/lib/chevre/service/offer/event/cancel.js +13 -1
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +11 -22
- package/lib/chevre/service/offer/event/importFromCOA.js +6 -8
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +24 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +54 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +138 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.d.ts +39 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +59 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +25 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +165 -0
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +10 -23
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +4 -89
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -292
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +10 -1
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +49 -3
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +47 -2
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/product/factory.js +2 -5
- package/lib/chevre/service/offer/product.d.ts +2 -0
- package/lib/chevre/service/offer/product.js +11 -23
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +3 -1
- package/lib/chevre/service/order/confirmPayTransaction.js +4 -4
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +12 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +206 -7
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +51 -53
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +10 -25
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +16 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +91 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +8 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +37 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +115 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +19 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +8 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +41 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +6 -10
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +116 -92
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +81 -84
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +62 -1
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +3 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -1
- package/lib/chevre/service/order/placeOrder.d.ts +3 -1
- package/lib/chevre/service/order/placeOrder.js +157 -50
- package/lib/chevre/service/order/returnOrder.js +25 -16
- package/lib/chevre/service/order/sendOrder.d.ts +5 -0
- package/lib/chevre/service/order/sendOrder.js +67 -33
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +3 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.js +15 -9
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +3 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.js +8 -5
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +6 -5
- package/lib/chevre/service/payment/any.js +3 -2
- package/lib/chevre/service/payment/creditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +62 -74
- package/lib/chevre/service/payment/faceToFace.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
- package/lib/chevre/service/payment.d.ts +5 -0
- package/lib/chevre/service/payment.js +40 -5
- package/lib/chevre/service/product.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +2 -2
- package/lib/chevre/service/reserve/checkInReservation.d.ts +1 -3
- package/lib/chevre/service/reserve/checkInReservation.js +6 -5
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/factory.js +0 -8
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +4 -4
- package/lib/chevre/service/reserve/searchByOrder.js +2 -1
- package/lib/chevre/service/reserve/useReservation.d.ts +1 -3
- package/lib/chevre/service/reserve/useReservation.js +10 -9
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -0
- package/lib/chevre/service/task/confirmMoneyTransfer.js +4 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +30 -8
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +176 -29
- package/lib/chevre/service/task/createAccountingReport.d.ts +6 -0
- package/lib/chevre/service/task/createAccountingReport.js +80 -0
- package/lib/chevre/service/task/importOffersFromCOA.js +2 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -7
- package/lib/chevre/service/task/pay.js +6 -0
- package/lib/chevre/service/task/placeOrder.js +9 -10
- package/lib/chevre/service/task/returnOrder.js +0 -3
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +3 -2
- package/lib/chevre/service/task/sendOrder.js +8 -4
- package/lib/chevre/service/task/useReservation.js +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +8 -12
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +2 -18
- package/lib/chevre/service/transaction/moneyTransfer.js +7 -6
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +17 -20
- package/lib/chevre/service/transaction/placeOrder.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.d.ts +51 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +268 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +22 -44
- package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.d.ts +14 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.js +41 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.d.ts +18 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.js +42 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.d.ts +23 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.js +46 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +34 -37
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +13 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +19 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/start.js +46 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.d.ts +26 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js +109 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +10 -23
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +20 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +11 -73
- package/lib/chevre/service/transaction/placeOrderInProgress.js +13 -286
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +1 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +8 -3
- package/lib/chevre/service/transaction/returnOrder/preStart.js +78 -50
- package/lib/chevre/service/transaction/returnOrder.js +3 -10
- package/lib/chevre/service.js +0 -10
- package/lib/chevre/settings.d.ts +7 -3
- package/lib/chevre/settings.js +13 -4
- package/package.json +5 -9
- package/example/src/chevre/cleanAccountingReports.ts +0 -57
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +0 -78
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +0 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +0 -30
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +0 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +0 -82
- package/lib/chevre/service/util.d.ts +0 -19
- package/lib/chevre/service/util.js +0 -126
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPotentialActions = void 0;
|
|
3
|
+
exports.createPotentialActions = exports.createPayActions = void 0;
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
|
-
|
|
5
|
+
const createPayObjectServiceOutput_1 = require("./potentialActions/createPayObjectServiceOutput");
|
|
6
6
|
function createPayActions(params) {
|
|
7
7
|
var _a;
|
|
8
8
|
const payActions = [];
|
|
@@ -28,6 +28,7 @@ function createPayActions(params) {
|
|
|
28
28
|
}
|
|
29
29
|
return payActions;
|
|
30
30
|
}
|
|
31
|
+
exports.createPayActions = createPayActions;
|
|
31
32
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
32
33
|
function createPayObject(params) {
|
|
33
34
|
var _a;
|
|
@@ -41,7 +42,7 @@ function createPayObject(params) {
|
|
|
41
42
|
const paymentMethodAmountValue = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount) === 'number')
|
|
42
43
|
? paymentMethod.amount
|
|
43
44
|
: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount.value;
|
|
44
|
-
const paymentServiceOutput = createPayObjectServiceOutput(params);
|
|
45
|
+
const paymentServiceOutput = (0, createPayObjectServiceOutput_1.createPayObjectServiceOutput)(params);
|
|
45
46
|
let payObject;
|
|
46
47
|
switch (transaction.object.typeOf) {
|
|
47
48
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
@@ -111,168 +112,6 @@ function createPayObject(params) {
|
|
|
111
112
|
}
|
|
112
113
|
return payObject;
|
|
113
114
|
}
|
|
114
|
-
function createPayObjectServiceOutput(params) {
|
|
115
|
-
const transaction = params.transaction;
|
|
116
|
-
const paymentMethod = transaction.object.paymentMethod;
|
|
117
|
-
const order = params.order;
|
|
118
|
-
let paymentServiceOutput;
|
|
119
|
-
switch (transaction.object.typeOf) {
|
|
120
|
-
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
121
|
-
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
122
|
-
break;
|
|
123
|
-
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
124
|
-
// CreditCardIFのカード通貨区分を追加(2023-08-07~)
|
|
125
|
-
// const creditCardAsPaymentServiceOutput: factory.order.IOrderPaymentMethodIssuedThroughServiceOutput | undefined =
|
|
126
|
-
// (typeof transaction.object.paymentMethod?.amount !== 'number'
|
|
127
|
-
// && typeof transaction.object.paymentMethod?.amount?.currency === 'string')
|
|
128
|
-
// ? {
|
|
129
|
-
// paymentMethod: {
|
|
130
|
-
// amount: {
|
|
131
|
-
// currency: transaction.object.paymentMethod.amount.currency,
|
|
132
|
-
// value: transaction.object.paymentMethod.amount.value
|
|
133
|
-
// }
|
|
134
|
-
// }
|
|
135
|
-
// }
|
|
136
|
-
// : undefined;
|
|
137
|
-
// if (creditCardAsPaymentServiceOutput !== undefined) {
|
|
138
|
-
// paymentServiceOutput = creditCardAsPaymentServiceOutput;
|
|
139
|
-
// }
|
|
140
|
-
break;
|
|
141
|
-
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
142
|
-
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier;
|
|
143
|
-
const movieTickets = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets;
|
|
144
|
-
if (Array.isArray(movieTickets)) {
|
|
145
|
-
paymentServiceOutput = movieTickets.map((movieTicket) => {
|
|
146
|
-
var _a;
|
|
147
|
-
const amount = movieTicket2amount(transaction, movieTicket);
|
|
148
|
-
const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
|
|
149
|
-
return Object.assign(Object.assign({ identifier: movieTicket.identifier }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
150
|
-
? { serviceOutput: reservation4invoice }
|
|
151
|
-
: undefined);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
break;
|
|
155
|
-
default:
|
|
156
|
-
throw new factory.errors.NotImplemented(`Payment service "${transaction.object.typeOf}" not implemented.`);
|
|
157
|
-
}
|
|
158
|
-
return paymentServiceOutput;
|
|
159
|
-
}
|
|
160
|
-
function movieTicket2amount(transaction, movieTicket) {
|
|
161
|
-
var _a;
|
|
162
|
-
let amount;
|
|
163
|
-
const accountsReceivables = transaction.object.accountsReceivablesByServiceType;
|
|
164
|
-
if (Array.isArray(accountsReceivables)) {
|
|
165
|
-
const accountsReceivable = (_a = accountsReceivables.find((a) => a.serviceType === movieTicket.serviceType)) === null || _a === void 0 ? void 0 : _a.accountsReceivable;
|
|
166
|
-
if (typeof accountsReceivable === 'number') {
|
|
167
|
-
amount = {
|
|
168
|
-
typeOf: 'MonetaryAmount',
|
|
169
|
-
value: accountsReceivable
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return amount;
|
|
174
|
-
}
|
|
175
|
-
function reservationPriceComponent2invoicePriceComponent(component) {
|
|
176
|
-
var _a;
|
|
177
|
-
const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
|
|
178
|
-
? { accountsReceivable: component.accounting.accountsReceivable }
|
|
179
|
-
: undefined;
|
|
180
|
-
let minimizedUnitPriceSpec;
|
|
181
|
-
let minimizedMovieTicketTypeChargeSpec;
|
|
182
|
-
let minimizedCategoryCodeChargeSpec;
|
|
183
|
-
if (component.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
|
|
184
|
-
const appliesToAddOn = (Array.isArray(component.appliesToAddOn))
|
|
185
|
-
? component.appliesToAddOn.map((addOn) => {
|
|
186
|
-
return { typeOf: addOn.typeOf };
|
|
187
|
-
})
|
|
188
|
-
: undefined;
|
|
189
|
-
minimizedUnitPriceSpec = Object.assign(Object.assign({ typeOf: component.typeOf, price: component.price, referenceQuantity: component.referenceQuantity }, (Array.isArray(appliesToAddOn)) ? { appliesToAddOn } : undefined), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
|
|
190
|
-
}
|
|
191
|
-
else if (component.typeOf === factory.priceSpecificationType.MovieTicketTypeChargeSpecification) {
|
|
192
|
-
minimizedMovieTicketTypeChargeSpec = Object.assign({ typeOf: component.typeOf, price: component.price,
|
|
193
|
-
// 適用決済方法区分を追加(2023-03-29~)
|
|
194
|
-
appliesToMovieTicket: {
|
|
195
|
-
serviceOutput: {
|
|
196
|
-
typeOf: component.appliesToMovieTicket.serviceOutput.typeOf
|
|
197
|
-
}
|
|
198
|
-
} }, (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
minimizedCategoryCodeChargeSpec = Object.assign({ typeOf: component.typeOf, price: component.price }, (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
|
|
202
|
-
}
|
|
203
|
-
if (minimizedUnitPriceSpec !== undefined) {
|
|
204
|
-
return minimizedUnitPriceSpec;
|
|
205
|
-
}
|
|
206
|
-
else if (minimizedMovieTicketTypeChargeSpec !== undefined) {
|
|
207
|
-
return minimizedMovieTicketTypeChargeSpec;
|
|
208
|
-
}
|
|
209
|
-
else if (minimizedCategoryCodeChargeSpec !== undefined) {
|
|
210
|
-
return minimizedCategoryCodeChargeSpec;
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
throw new factory.errors.NotImplemented(`unexpected priceComponent: ${component.typeOf}`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType) {
|
|
217
|
-
var _a;
|
|
218
|
-
let ticketToken;
|
|
219
|
-
let reservationNumber = '';
|
|
220
|
-
let priceComponents4invoice = [];
|
|
221
|
-
// Orderから対象予約を取得
|
|
222
|
-
const reservationOffer = order.acceptedOffers.find((o) => {
|
|
223
|
-
var _a, _b, _c, _d;
|
|
224
|
-
let mvtkUnitPriceSpec;
|
|
225
|
-
// MovieTicket適用単価オファーからidentifierを取り出す
|
|
226
|
-
if (((_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.priceSpecificationType.CompoundPriceSpecification) {
|
|
227
|
-
// 適用購入管理番号が一致、かつ、決済方法区分が一致、の単価仕様を検索
|
|
228
|
-
mvtkUnitPriceSpec = (_c = (_b = o.priceSpecification) === null || _b === void 0 ? void 0 : _b.priceComponent) === null || _c === void 0 ? void 0 : _c.find((p) => {
|
|
229
|
-
if (p.typeOf !== factory.priceSpecificationType.UnitPriceSpecification) {
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
// 複数決済カード対応(2022-07-11~)
|
|
233
|
-
if (Array.isArray(p.appliesToMovieTicket)) {
|
|
234
|
-
return p.appliesToMovieTicket.length > 0
|
|
235
|
-
&& p.appliesToMovieTicket.some((appliesToMovieTicket) => {
|
|
236
|
-
return appliesToMovieTicket.identifier === movieTicket.identifier
|
|
237
|
-
&& appliesToMovieTicket.serviceOutput.typeOf === paymentMethodType;
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
246
|
-
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
247
|
-
&& mvtkUnitPriceSpec !== undefined
|
|
248
|
-
&& o.itemOffered.reservationFor.id === movieTicket.serviceOutput.reservationFor.id
|
|
249
|
-
&& ((_d = o.itemOffered.reservedTicket.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatNumber) === movieTicket.serviceOutput.reservedTicket.ticketedSeat.seatNumber
|
|
250
|
-
&& o.itemOffered.reservedTicket.ticketedSeat.seatSection === movieTicket.serviceOutput.reservedTicket.ticketedSeat.seatSection;
|
|
251
|
-
});
|
|
252
|
-
if (reservationOffer !== undefined) {
|
|
253
|
-
if (reservationOffer.itemOffered.typeOf !== factory.reservationType.EventReservation
|
|
254
|
-
&& reservationOffer.itemOffered.typeOf !== factory.reservationType.BusReservation) {
|
|
255
|
-
throw new factory.errors.NotImplemented(`itemOffered.typeOf: ${reservationOffer.itemOffered.typeOf} not implemented`);
|
|
256
|
-
}
|
|
257
|
-
const ticketTokenByReservationOffer = reservationOffer.itemOffered.reservedTicket.ticketToken;
|
|
258
|
-
if (typeof ticketTokenByReservationOffer === 'string' && ticketTokenByReservationOffer.length > 0) {
|
|
259
|
-
ticketToken = ticketTokenByReservationOffer;
|
|
260
|
-
}
|
|
261
|
-
reservationNumber = reservationOffer.itemOffered.reservationNumber;
|
|
262
|
-
const priceComponent = (_a = reservationOffer.priceSpecification) === null || _a === void 0 ? void 0 : _a.priceComponent;
|
|
263
|
-
if (Array.isArray(priceComponent)) {
|
|
264
|
-
priceComponents4invoice = priceComponent.map(reservationPriceComponent2invoicePriceComponent);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return Object.assign({ priceSpecification: {
|
|
268
|
-
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
269
|
-
priceComponent: priceComponents4invoice
|
|
270
|
-
},
|
|
271
|
-
// add reservationNumber(2023-03-20~)
|
|
272
|
-
reservationNumber }, (typeof ticketToken === 'string')
|
|
273
|
-
? { reservedTicket: { ticketToken } }
|
|
274
|
-
: undefined);
|
|
275
|
-
}
|
|
276
115
|
function createInformPaymentActions(params) {
|
|
277
116
|
var _a;
|
|
278
117
|
const transaction = params.transaction;
|
|
@@ -11,12 +11,12 @@ import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
|
11
11
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
12
12
|
import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentService';
|
|
13
13
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
14
|
-
import type { CognitoRepository as PersonRepo } from '../../repo/person';
|
|
15
14
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
16
15
|
import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
17
16
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
18
17
|
import * as CreditCardPayment from '../payment/creditCard';
|
|
19
18
|
import * as MovieTicketPayment from '../payment/movieTicket';
|
|
19
|
+
import { IAcceptedOfferMovieTicketUsed } from './pay/potentialActions';
|
|
20
20
|
export interface IStartOperationRepos {
|
|
21
21
|
accountingReport: AccountingReportRepo;
|
|
22
22
|
action: ActionRepo;
|
|
@@ -24,7 +24,6 @@ export interface IStartOperationRepos {
|
|
|
24
24
|
paymentAccepted: PaymentAcceptedRepo;
|
|
25
25
|
paymentService: PaymentServiceRepo;
|
|
26
26
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
27
|
-
person: PersonRepo;
|
|
28
27
|
product: ProductRepo;
|
|
29
28
|
assetTransaction: AssetTransactionRepo;
|
|
30
29
|
task: TaskRepo;
|
|
@@ -59,7 +58,6 @@ export type IPublishPaymentUrlOperation<T> = (repos: {
|
|
|
59
58
|
paymentAccepted: PaymentAcceptedRepo;
|
|
60
59
|
paymentService: PaymentServiceRepo;
|
|
61
60
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
62
|
-
person: PersonRepo;
|
|
63
61
|
}) => Promise<T>;
|
|
64
62
|
export type IInvalidatePaymentUrlOperation<T> = (repos: {
|
|
65
63
|
accountingReport: AccountingReportRepo;
|
|
@@ -102,7 +100,26 @@ export declare function start(params: factory.assetTransaction.pay.IStartParamsW
|
|
|
102
100
|
/**
|
|
103
101
|
* 取引確定
|
|
104
102
|
*/
|
|
105
|
-
export declare function confirm(params: factory.assetTransaction.pay.IConfirmParams
|
|
103
|
+
export declare function confirm(params: factory.assetTransaction.pay.IConfirmParams & {
|
|
104
|
+
options: {
|
|
105
|
+
minimizePotentialActions: boolean;
|
|
106
|
+
};
|
|
107
|
+
}): IConfirmOperation<void>;
|
|
108
|
+
export declare function fixOrderAsPurpose(params: {
|
|
109
|
+
potentialActions: {
|
|
110
|
+
pay: {
|
|
111
|
+
purpose: {
|
|
112
|
+
confirmationNumber: string;
|
|
113
|
+
orderNumber: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}, transaction: factory.assetTransaction.pay.ITransaction): (repos: {
|
|
118
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
119
|
+
order: OrderRepo;
|
|
120
|
+
}) => Promise<Pick<factory.order.IOrder, "typeOf" | "confirmationNumber" | "orderNumber"> & {
|
|
121
|
+
acceptedOffersMovieTicketUsed: IAcceptedOfferMovieTicketUsed[];
|
|
122
|
+
}>;
|
|
106
123
|
/**
|
|
107
124
|
* 取引中止
|
|
108
125
|
*/
|
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.searchGMOTrade = exports.exportTasksById = exports.cancel = exports.confirm = exports.start = exports.check = exports.invalidatePaymentUrl = exports.publishPaymentUrl = void 0;
|
|
12
|
+
exports.searchGMOTrade = exports.exportTasksById = exports.cancel = exports.fixOrderAsPurpose = exports.confirm = exports.start = exports.check = exports.invalidatePaymentUrl = exports.publishPaymentUrl = void 0;
|
|
13
|
+
const createDebug = require("debug");
|
|
13
14
|
const moment = require("moment");
|
|
14
15
|
const factory = require("../../factory");
|
|
15
16
|
const CreditCardPayment = require("../payment/creditCard");
|
|
@@ -18,6 +19,7 @@ const PaymentCardPayment = require("../payment/paymentCard");
|
|
|
18
19
|
const validation_1 = require("./pay/account/validation");
|
|
19
20
|
const factory_1 = require("./pay/factory");
|
|
20
21
|
const potentialActions_1 = require("./pay/potentialActions");
|
|
22
|
+
const debug = createDebug('chevre-domain:service:assetTransaction');
|
|
21
23
|
/**
|
|
22
24
|
* 外部決済ロケーション発行
|
|
23
25
|
*/
|
|
@@ -340,7 +342,7 @@ function saveAuthorizeResult(params) {
|
|
|
340
342
|
*/
|
|
341
343
|
function confirm(params) {
|
|
342
344
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
343
|
-
var _a, _b;
|
|
345
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
344
346
|
let transaction;
|
|
345
347
|
// 取引存在確認
|
|
346
348
|
if (typeof params.id === 'string') {
|
|
@@ -364,15 +366,41 @@ function confirm(params) {
|
|
|
364
366
|
if (typeof specifiedPaymentMethodIdentifire === 'string' && specifiedPaymentMethodIdentifire.length > 0) {
|
|
365
367
|
overwritingPaymentMethodIdentifier = specifiedPaymentMethodIdentifire;
|
|
366
368
|
transaction.object.paymentMethod.identifier = overwritingPaymentMethodIdentifier;
|
|
367
|
-
// transaction.object.paymentMethod.typeOf = overwritingPaymentMethodIdentifier;
|
|
368
369
|
}
|
|
369
370
|
}
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
371
|
+
const confirmationNumber = (_e = (_d = (_c = params.potentialActions) === null || _c === void 0 ? void 0 : _c.pay) === null || _d === void 0 ? void 0 : _d.purpose) === null || _e === void 0 ? void 0 : _e.confirmationNumber;
|
|
372
|
+
const orderNumber = (_h = (_g = (_f = params.potentialActions) === null || _f === void 0 ? void 0 : _f.pay) === null || _g === void 0 ? void 0 : _g.purpose) === null || _h === void 0 ? void 0 : _h.orderNumber;
|
|
373
|
+
if (typeof confirmationNumber !== 'string' || confirmationNumber.length === 0
|
|
374
|
+
|| typeof orderNumber !== 'string' || orderNumber.length === 0) {
|
|
375
|
+
throw new factory.errors.ArgumentNull('potentialActions.pay.purpose');
|
|
376
|
+
}
|
|
377
|
+
let potentialActions;
|
|
378
|
+
if (params.options.minimizePotentialActions) {
|
|
379
|
+
// 注文検証
|
|
380
|
+
const existingOrders = yield repos.order.search({
|
|
381
|
+
limit: 1,
|
|
382
|
+
page: 1,
|
|
383
|
+
project: { id: { $eq: transaction.project.id } },
|
|
384
|
+
confirmationNumbers: [confirmationNumber],
|
|
385
|
+
orderNumbers: [orderNumber]
|
|
386
|
+
}, { orderNumber: 1 });
|
|
387
|
+
if (existingOrders.length === 0) {
|
|
388
|
+
throw new factory.errors.NotFound(factory.order.OrderType.Order);
|
|
389
|
+
}
|
|
390
|
+
const payActionData4order = {
|
|
391
|
+
object: { paymentMethod: { paymentMethodId: transaction.transactionNumber } },
|
|
392
|
+
purpose: { confirmationNumber, orderNumber, typeOf: factory.order.OrderType.Order }
|
|
393
|
+
};
|
|
394
|
+
potentialActions = { pay: [payActionData4order] };
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
const order = yield fixOrderAsPurpose({ potentialActions: { pay: { purpose: { confirmationNumber, orderNumber } } } }, transaction)(repos);
|
|
398
|
+
potentialActions = (0, potentialActions_1.createPotentialActions)({
|
|
399
|
+
transaction: transaction,
|
|
400
|
+
potentialActions: params.potentialActions,
|
|
401
|
+
order
|
|
402
|
+
});
|
|
403
|
+
}
|
|
376
404
|
yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Pay, id: transaction.id, result: {}, potentialActions: potentialActions }, (typeof overwritingPaymentMethodIdentifier === 'string')
|
|
377
405
|
? { object: { paymentMethod: { identifier: overwritingPaymentMethodIdentifier } } }
|
|
378
406
|
: undefined));
|
|
@@ -381,13 +409,9 @@ function confirm(params) {
|
|
|
381
409
|
exports.confirm = confirm;
|
|
382
410
|
function fixOrderAsPurpose(params, transaction) {
|
|
383
411
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
384
|
-
var _a
|
|
385
|
-
const payPurposeConfirmationNumber =
|
|
386
|
-
const payPurposeOrderNumber = (
|
|
387
|
-
if (typeof payPurposeConfirmationNumber !== 'string' || payPurposeConfirmationNumber.length === 0
|
|
388
|
-
|| typeof payPurposeOrderNumber !== 'string' || payPurposeOrderNumber.length === 0) {
|
|
389
|
-
throw new factory.errors.ArgumentNull('potentialActions.pay.purpose');
|
|
390
|
-
}
|
|
412
|
+
var _a;
|
|
413
|
+
const payPurposeConfirmationNumber = params.potentialActions.pay.purpose.confirmationNumber;
|
|
414
|
+
const payPurposeOrderNumber = (_a = params.potentialActions.pay.purpose) === null || _a === void 0 ? void 0 : _a.orderNumber;
|
|
391
415
|
const ordersWithoutAcceptedOffers = yield repos.order.search({
|
|
392
416
|
limit: 1,
|
|
393
417
|
page: 1,
|
|
@@ -399,14 +423,31 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
399
423
|
if (orderWithoutAcceptedOffers === undefined) {
|
|
400
424
|
throw new factory.errors.NotFound('Order as purpose');
|
|
401
425
|
}
|
|
402
|
-
//
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
426
|
+
// 必要なオファー検索のみ実行する(2024-01-18~)
|
|
427
|
+
let acceptedOffersMovieTicketUsed = [];
|
|
428
|
+
const movieTickets = transaction.object.paymentMethod.movieTickets;
|
|
429
|
+
if (Array.isArray(movieTickets) && movieTickets.length > 0) {
|
|
430
|
+
const reservationForId = movieTickets[0].serviceOutput.reservationFor.id; // イベントIDは決済取引ごとにひとつのみ許可なので、これで問題ない
|
|
431
|
+
const seatNumbers = movieTickets.map(({ serviceOutput }) => serviceOutput.reservedTicket.ticketedSeat.seatNumber);
|
|
432
|
+
debug('fixOrderAsPurpose at confirming payTransaction: searching acceptedOffersMovieTicketUsed...', reservationForId, seatNumbers);
|
|
433
|
+
acceptedOffersMovieTicketUsed = (yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
434
|
+
orderNumber: { $eq: orderWithoutAcceptedOffers.orderNumber },
|
|
435
|
+
project: { id: { $eq: transaction.project.id } },
|
|
436
|
+
acceptedOffers: {
|
|
437
|
+
itemOffered: {
|
|
438
|
+
typeOf: { $in: [factory.reservationType.EventReservation] },
|
|
439
|
+
// movieTicketsに結合されたイベントID,座席コードで絞る
|
|
440
|
+
reservationFor: { id: { $in: [reservationForId] } },
|
|
441
|
+
reservedTicket: { ticketedSeat: { seatNumber: { $in: seatNumbers } } }
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}, ['itemOffered', 'priceSpecification']));
|
|
445
|
+
debug('fixOrderAsPurpose at confirming payTransaction:', acceptedOffersMovieTicketUsed.length, 'acceptedOffersMovieTicketUsed found', acceptedOffersMovieTicketUsed);
|
|
446
|
+
}
|
|
447
|
+
return Object.assign(Object.assign({}, orderWithoutAcceptedOffers), { acceptedOffersMovieTicketUsed });
|
|
408
448
|
});
|
|
409
449
|
}
|
|
450
|
+
exports.fixOrderAsPurpose = fixOrderAsPurpose;
|
|
410
451
|
/**
|
|
411
452
|
* 取引中止
|
|
412
453
|
*/
|
|
@@ -471,7 +512,7 @@ function exportTasksById(params) {
|
|
|
471
512
|
purpose: {
|
|
472
513
|
confirmationNumber: '',
|
|
473
514
|
orderNumber: '',
|
|
474
|
-
typeOf:
|
|
515
|
+
typeOf: factory.order.OrderType.Order
|
|
475
516
|
},
|
|
476
517
|
useOnOrderStatusChanged: true
|
|
477
518
|
};
|
|
@@ -331,9 +331,7 @@ function createAdditionalTicketText(params) {
|
|
|
331
331
|
return (_b = (_a = params.acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.additionalTicketText;
|
|
332
332
|
}
|
|
333
333
|
exports.createAdditionalTicketText = createAdditionalTicketText;
|
|
334
|
-
function createReservationFor(
|
|
335
|
-
// params: factory.event.screeningEvent.IEvent | factory.event.event.IEvent
|
|
336
|
-
params) {
|
|
334
|
+
function createReservationFor(params) {
|
|
337
335
|
var _a, _b;
|
|
338
336
|
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
339
337
|
return Object.assign({ endDate: params.endDate, id: params.id, location: params.location, name: params.name, startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params), typeOf: params.typeOf }, (params.doorTime instanceof Date)
|
|
@@ -349,18 +347,13 @@ params) {
|
|
|
349
347
|
}
|
|
350
348
|
}
|
|
351
349
|
exports.createReservationFor = createReservationFor;
|
|
352
|
-
function optimizeReservationSuperEvent(
|
|
353
|
-
// params: factory.event.screeningEvent.IEvent
|
|
354
|
-
params) {
|
|
350
|
+
function optimizeReservationSuperEvent(params) {
|
|
355
351
|
const superEvent = params.superEvent;
|
|
356
|
-
return Object.assign(
|
|
352
|
+
return Object.assign({ additionalProperty: (Array.isArray(superEvent.additionalProperty))
|
|
357
353
|
? superEvent.additionalProperty
|
|
358
|
-
: [], id: superEvent.id,
|
|
359
|
-
//
|
|
360
|
-
|
|
361
|
-
soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.description !== undefined)
|
|
362
|
-
? { description: superEvent.description }
|
|
363
|
-
: undefined), (superEvent.headline !== undefined)
|
|
354
|
+
: [], id: superEvent.id,
|
|
355
|
+
// kanaName: superEvent.kanaName, // 廃止(2024-01-26~)
|
|
356
|
+
location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
|
|
364
357
|
? { headline: superEvent.headline }
|
|
365
358
|
: undefined);
|
|
366
359
|
}
|
|
@@ -503,7 +496,11 @@ function createPotentialActions(params) {
|
|
|
503
496
|
}));
|
|
504
497
|
});
|
|
505
498
|
reservationPackage = {
|
|
506
|
-
reservationFor
|
|
499
|
+
reservationFor: {
|
|
500
|
+
id: String(reservationFor.id),
|
|
501
|
+
typeOf: reservationFor.typeOf,
|
|
502
|
+
optimized: true
|
|
503
|
+
},
|
|
507
504
|
reservationNumber: transaction.object.reservationNumber,
|
|
508
505
|
reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
|
|
509
506
|
? params.transaction.object.reservationStatus
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COA予約取引サービス
|
|
3
|
+
*/
|
|
4
|
+
import * as COA from '@motionpicture/coa-service';
|
|
5
|
+
import * as factory from '../../factory';
|
|
6
|
+
interface IConfirmRepo {
|
|
7
|
+
}
|
|
8
|
+
type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* 取引確定
|
|
11
|
+
*/
|
|
12
|
+
declare function confirm(params: {
|
|
13
|
+
project: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
object: factory.action.interact.confirm.reservation.IObject4COA;
|
|
17
|
+
purpose: factory.action.interact.confirm.reservation.IPurpose;
|
|
18
|
+
}): IConfirmOperation<COA.factory.reserve.IUpdReserveResult | undefined>;
|
|
19
|
+
export { confirm };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.confirm = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* COA予約取引サービス
|
|
15
|
+
*/
|
|
16
|
+
const COA = require("@motionpicture/coa-service");
|
|
17
|
+
const credentials_1 = require("../../credentials");
|
|
18
|
+
const coaAuthClient = new COA.auth.RefreshToken({
|
|
19
|
+
endpoint: credentials_1.credentials.coa.endpoint,
|
|
20
|
+
refreshToken: credentials_1.credentials.coa.refreshToken,
|
|
21
|
+
useFetch: credentials_1.credentials.coa.useFetch
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* 取引確定
|
|
25
|
+
*/
|
|
26
|
+
function confirm(params) {
|
|
27
|
+
return (__) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
// 未本予約であれば実行(COA本予約は一度成功すると成功できない)
|
|
29
|
+
// リトライ可能な前提でつくる必要があるので、要注意
|
|
30
|
+
// すでに本予約済みかどうか確認
|
|
31
|
+
const reserveService = new COA.service.Reserve({
|
|
32
|
+
endpoint: credentials_1.credentials.coa.endpoint,
|
|
33
|
+
auth: coaAuthClient
|
|
34
|
+
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
35
|
+
const stateReserveResult = yield reserveService.stateReserve({
|
|
36
|
+
theaterCode: params.object.theaterCode,
|
|
37
|
+
reserveNum: params.object.tmpReserveNum,
|
|
38
|
+
telNum: params.object.telNum
|
|
39
|
+
});
|
|
40
|
+
if (stateReserveResult === null) {
|
|
41
|
+
return reserveService.updReserve(params.object);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.confirm = confirm;
|
|
@@ -103,7 +103,7 @@ function verifyToken(params) {
|
|
|
103
103
|
throw error;
|
|
104
104
|
}
|
|
105
105
|
if (repos.action !== undefined && action !== undefined) {
|
|
106
|
-
yield repos.action.
|
|
106
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
107
107
|
}
|
|
108
108
|
return result;
|
|
109
109
|
});
|
|
@@ -63,7 +63,7 @@ function givePointAward(params) {
|
|
|
63
63
|
}
|
|
64
64
|
// アクション完了
|
|
65
65
|
const actionResult = {};
|
|
66
|
-
yield repos.action.
|
|
66
|
+
yield repos.action.completeWithVoid({ typeOf: params.typeOf, id: action.id, result: actionResult });
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
exports.givePointAward = givePointAward;
|
|
@@ -140,7 +140,7 @@ function returnPointAward(params) {
|
|
|
140
140
|
const actionResult = {
|
|
141
141
|
moneyTransferTransaction: moneyTransferTransactions
|
|
142
142
|
};
|
|
143
|
-
yield repos.action.
|
|
143
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
exports.returnPointAward = returnPointAward;
|
|
@@ -27,7 +27,8 @@ const offer_1 = require("./offer");
|
|
|
27
27
|
const debug = createDebug('chevre-domain:service:event');
|
|
28
28
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
29
29
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
30
|
-
refreshToken: credentials_1.credentials.coa.refreshToken
|
|
30
|
+
refreshToken: credentials_1.credentials.coa.refreshToken,
|
|
31
|
+
useFetch: credentials_1.credentials.coa.useFetch
|
|
31
32
|
});
|
|
32
33
|
/**
|
|
33
34
|
* Googleで作品画像を検索する
|
|
@@ -166,10 +167,11 @@ function importFromCOA(params) {
|
|
|
166
167
|
}
|
|
167
168
|
catch (error) {
|
|
168
169
|
let throwsError = true;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
if (error.name === 'AbortError') {
|
|
171
|
+
// tslint:disable-next-line:no-console
|
|
172
|
+
console.error('saveScreeningEvents throwed an error', error.name, error.message);
|
|
173
|
+
throwsError = false;
|
|
174
|
+
}
|
|
173
175
|
if (error.name === 'COAServiceError') {
|
|
174
176
|
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
175
177
|
// tslint:disable-next-line:no-console
|
|
@@ -193,7 +195,7 @@ function importFromCOA(params) {
|
|
|
193
195
|
}
|
|
194
196
|
// アクション完了
|
|
195
197
|
const actionResult = { savedScreeningEventsCount, savedScreeningEventSeriesCount };
|
|
196
|
-
yield repos.action.
|
|
198
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
197
199
|
});
|
|
198
200
|
}
|
|
199
201
|
exports.importFromCOA = importFromCOA;
|
|
@@ -581,6 +583,12 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
581
583
|
const unavailablePaymentMethodTypes = params.availablePaymentMethodTypes.filter((categoryCode) => { var _a, _b; return ((_b = (_a = categoryCode.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === 'flgMvtkUse')) === null || _b === void 0 ? void 0 : _b.value) === '1'; });
|
|
582
584
|
unacceptedPaymentMethod.push(...unavailablePaymentMethodTypes.map((c) => c.codeValue));
|
|
583
585
|
}
|
|
586
|
+
const workPerformed = Object.assign({ id: `${params.movieTheater.branchCode}-${params.filmFromCOA.titleCode}`, identifier: params.filmFromCOA.titleCode, name: {
|
|
587
|
+
ja: params.filmFromCOA.titleNameOrig
|
|
588
|
+
}, duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
589
|
+
.toISOString(), contentRating: params.eirinKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEirin)[0], typeOf: factory.creativeWorkType.Movie }, (typeof params.filmFromCOA.titleBranchNum === 'string' && params.filmFromCOA.titleBranchNum.length > 0)
|
|
590
|
+
? { version: params.filmFromCOA.titleBranchNum } // add version(2024-01-31~)
|
|
591
|
+
: undefined);
|
|
584
592
|
return {
|
|
585
593
|
project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
586
594
|
typeOf: factory.eventType.ScreeningEventSeries,
|
|
@@ -594,8 +602,6 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
594
602
|
kanaName: params.filmFromCOA.titleNameKana,
|
|
595
603
|
alternativeHeadline: params.filmFromCOA.titleNameShort,
|
|
596
604
|
location: {
|
|
597
|
-
// 不要なので廃止(2022-12-19~)
|
|
598
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
599
605
|
id: (params.movieTheater.id !== undefined) ? params.movieTheater.id : '',
|
|
600
606
|
branchCode: params.movieTheater.branchCode,
|
|
601
607
|
name: params.movieTheater.name,
|
|
@@ -606,21 +612,7 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
606
612
|
organizer: { id: params.seller.id },
|
|
607
613
|
videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
|
|
608
614
|
soundFormat: [],
|
|
609
|
-
workPerformed
|
|
610
|
-
// 不要なので廃止(2022-12-19~)
|
|
611
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
612
|
-
id: `${params.movieTheater.branchCode}-${params.filmFromCOA.titleCode}`,
|
|
613
|
-
identifier: params.filmFromCOA.titleCode,
|
|
614
|
-
// 多言語化(2022-07-26~)
|
|
615
|
-
// name: params.filmFromCOA.titleNameOrig,
|
|
616
|
-
name: {
|
|
617
|
-
ja: params.filmFromCOA.titleNameOrig
|
|
618
|
-
},
|
|
619
|
-
duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
620
|
-
.toISOString(),
|
|
621
|
-
contentRating: params.eirinKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEirin)[0],
|
|
622
|
-
typeOf: factory.creativeWorkType.Movie
|
|
623
|
-
},
|
|
615
|
+
workPerformed,
|
|
624
616
|
duration: moment.duration(params.filmFromCOA.showTime, 'm')
|
|
625
617
|
.toISOString(),
|
|
626
618
|
endDate: endDate,
|
|
@@ -807,7 +799,7 @@ function updateEvent4ttts(params) {
|
|
|
807
799
|
throw error;
|
|
808
800
|
}
|
|
809
801
|
// アクション完了
|
|
810
|
-
yield repos.action.
|
|
802
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: { id: event.id } });
|
|
811
803
|
yield (0, offer_1.onEventChanged)({
|
|
812
804
|
id: [event.id],
|
|
813
805
|
project: { id: event.project.id },
|
|
@@ -439,7 +439,7 @@ function moneyTransfer(params) {
|
|
|
439
439
|
throw error;
|
|
440
440
|
}
|
|
441
441
|
const actionResult = {};
|
|
442
|
-
yield repos.action.
|
|
442
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
exports.moneyTransfer = moneyTransfer;
|