@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
|
@@ -15,9 +15,11 @@ const http_status_1 = require("http-status");
|
|
|
15
15
|
const credentials_1 = require("../../../credentials");
|
|
16
16
|
const factory = require("../../../factory");
|
|
17
17
|
const ReserveTransactionService = require("../../assetTransaction/reserve");
|
|
18
|
+
const any_1 = require("../any");
|
|
18
19
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
19
20
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
20
|
-
refreshToken: credentials_1.credentials.coa.refreshToken
|
|
21
|
+
refreshToken: credentials_1.credentials.coa.refreshToken,
|
|
22
|
+
useFetch: credentials_1.credentials.coa.useFetch
|
|
21
23
|
});
|
|
22
24
|
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
23
25
|
/**
|
|
@@ -30,7 +32,7 @@ function voidTransaction(params) {
|
|
|
30
32
|
const transaction = yield repos.transaction.findById({
|
|
31
33
|
typeOf: params.purpose.typeOf,
|
|
32
34
|
id: params.purpose.id,
|
|
33
|
-
inclusion: ['_id', 'typeOf', 'status']
|
|
35
|
+
inclusion: ['_id', 'typeOf', 'status', 'object.orderNumber']
|
|
34
36
|
});
|
|
35
37
|
// 興行オファー承認アクション検索
|
|
36
38
|
let authorizeActions = yield repos.action.searchByPurpose({
|
|
@@ -41,9 +43,6 @@ function voidTransaction(params) {
|
|
|
41
43
|
},
|
|
42
44
|
object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
|
|
43
45
|
});
|
|
44
|
-
// .then((actions) => actions
|
|
45
|
-
// .filter((a) => a.object.typeOf === factory.action.authorize.offer.eventService.ObjectType.SeatReservation)
|
|
46
|
-
// );
|
|
47
46
|
switch (transaction.status) {
|
|
48
47
|
case factory.transactionStatusType.InProgress:
|
|
49
48
|
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
@@ -59,8 +58,26 @@ function voidTransaction(params) {
|
|
|
59
58
|
default:
|
|
60
59
|
// no op
|
|
61
60
|
}
|
|
61
|
+
// add orderInTransaction(2024-01-15~)
|
|
62
|
+
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
63
|
+
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
64
|
+
if (typeof orderNumberByTransaction === 'string') {
|
|
65
|
+
switch (transaction.status) {
|
|
66
|
+
case factory.transactionStatusType.Confirmed:
|
|
67
|
+
// 確定取引の場合、不要なオファーのみ除外
|
|
68
|
+
yield (0, any_1.voidAcceptedOffer)({
|
|
69
|
+
// authorizeActions,
|
|
70
|
+
authorizeActionsWithInstrument: authorizeActions,
|
|
71
|
+
orderNumber: orderNumberByTransaction
|
|
72
|
+
})(repos);
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
// orderInTransaction自体を削除
|
|
76
|
+
yield repos.orderInTransaction.deleteByOrderNumber({ orderNumber: orderNumberByTransaction });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
62
79
|
yield Promise.all(authorizeActions.map((action) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
yield repos.action.
|
|
80
|
+
yield repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
|
|
64
81
|
switch (action.instrument.identifier) {
|
|
65
82
|
case exports.WebAPIIdentifier.COA:
|
|
66
83
|
yield processVoidTransaction4coa({
|
|
@@ -123,7 +140,7 @@ function processVoidTransaction4coa(params) {
|
|
|
123
140
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
124
141
|
/* istanbul ignore if */
|
|
125
142
|
if (error.name === 'COAServiceError') {
|
|
126
|
-
if (
|
|
143
|
+
if (typeof error.code === 'number' && error.code < http_status_1.INTERNAL_SERVER_ERROR) {
|
|
127
144
|
// すでに取消済の場合こうなるので、okとする
|
|
128
145
|
if (error.message === '座席取消失敗') {
|
|
129
146
|
deleted = true;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
2
|
+
import type { MongoRepository as CategoryCodeRepo } from '../../../repo/categoryCode';
|
|
3
|
+
import type { MongoRepository as EventRepo } from '../../../repo/event';
|
|
4
|
+
import type { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
5
|
+
import type { MongoRepository as OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
6
|
+
import type { RedisRepository as OrderNumberRepo } from '../../../repo/orderNumber';
|
|
7
|
+
import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
8
|
+
import type { MongoRepository as TransactionRepo } from '../../../repo/transaction';
|
|
9
|
+
import { IAcceptedOfferBeforeAuthorize4COA } from './validateAcceptedOffers';
|
|
10
|
+
import * as factory from '../../../factory';
|
|
11
|
+
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
12
|
+
export type IAuthorizeActionResult = factory.action.authorize.offer.eventService.IResult<WebAPIIdentifier.COA>;
|
|
13
|
+
export interface IAuthorizeRepos {
|
|
14
|
+
action: ActionRepo;
|
|
15
|
+
categoryCode: CategoryCodeRepo;
|
|
16
|
+
event: EventRepo;
|
|
17
|
+
offer: OfferRepo;
|
|
18
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
19
|
+
orderNumber: OrderNumberRepo;
|
|
20
|
+
project: ProjectRepo;
|
|
21
|
+
transaction: TransactionRepo;
|
|
22
|
+
}
|
|
23
|
+
export type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
24
|
+
export type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<WebAPIIdentifier.COA>;
|
|
25
|
+
/**
|
|
26
|
+
* COA興行オファー承認
|
|
27
|
+
*/
|
|
28
|
+
export declare function authorize(params: {
|
|
29
|
+
object: {
|
|
30
|
+
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
31
|
+
event: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
agent: {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
transaction: {
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
store: {
|
|
42
|
+
/**
|
|
43
|
+
* 販売アプリケーションID
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
result: {
|
|
48
|
+
requestBody: factory.action.authorize.offer.eventService.IRequestBody<WebAPIIdentifier.COA>;
|
|
49
|
+
responseBody: factory.action.authorize.offer.eventService.IResponseBody<WebAPIIdentifier.COA>;
|
|
50
|
+
};
|
|
51
|
+
options: {
|
|
52
|
+
useCreateOrderOnOfferAccepted: boolean;
|
|
53
|
+
};
|
|
54
|
+
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
@@ -0,0 +1,138 @@
|
|
|
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.authorize = exports.WebAPIIdentifier = void 0;
|
|
13
|
+
const moment = require("moment");
|
|
14
|
+
const any_1 = require("../any");
|
|
15
|
+
const factory_1 = require("./factory");
|
|
16
|
+
const validateAcceptedOffers_1 = require("./validateAcceptedOffers");
|
|
17
|
+
const factory = require("../../../factory");
|
|
18
|
+
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
19
|
+
/**
|
|
20
|
+
* COA興行オファー承認
|
|
21
|
+
*/
|
|
22
|
+
function authorize(params) {
|
|
23
|
+
// tslint:disable-next-line:max-func-body-length
|
|
24
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
26
|
+
const transaction = yield repos.transaction.findInProgressById({
|
|
27
|
+
typeOf: factory.transactionType.PlaceOrder,
|
|
28
|
+
id: params.transaction.id
|
|
29
|
+
});
|
|
30
|
+
if (transaction.agent.id !== params.agent.id) {
|
|
31
|
+
throw new factory.errors.Forbidden('Transaction not yours');
|
|
32
|
+
}
|
|
33
|
+
// クライアント検証(2024-02-07~)
|
|
34
|
+
if (((_a = transaction.object.clientUser) === null || _a === void 0 ? void 0 : _a.client_id) !== params.store.id) {
|
|
35
|
+
throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
36
|
+
}
|
|
37
|
+
let screeningEvent;
|
|
38
|
+
let acceptedOffers;
|
|
39
|
+
const pendingTransaction = {
|
|
40
|
+
theaterCode: params.result.requestBody.theaterCode,
|
|
41
|
+
dateJouei: params.result.requestBody.dateJouei,
|
|
42
|
+
titleCode: params.result.requestBody.titleCode,
|
|
43
|
+
titleBranchNum: params.result.requestBody.titleBranchNum,
|
|
44
|
+
timeBegin: params.result.requestBody.timeBegin,
|
|
45
|
+
tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
46
|
+
transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
47
|
+
typeOf: 'COAReserveTransaction'
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
51
|
+
screeningEvent =
|
|
52
|
+
yield repos.event.findMinimizedIndividualEventById({ id: params.object.event.id });
|
|
53
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
54
|
+
project: { id: { $eq: transaction.project.id } },
|
|
55
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
56
|
+
}, [], []);
|
|
57
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
58
|
+
project: { id: { $eq: transaction.project.id } },
|
|
59
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
60
|
+
}, [], []);
|
|
61
|
+
const videoFormatTypes = yield repos.categoryCode.search({
|
|
62
|
+
project: { id: { $eq: transaction.project.id } },
|
|
63
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
64
|
+
}, [], []);
|
|
65
|
+
// COA仮予約後にリクエストが来る前提
|
|
66
|
+
const validateAcceptedOffersResult = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
67
|
+
object: params.object,
|
|
68
|
+
project: { id: transaction.project.id },
|
|
69
|
+
screeningEvent,
|
|
70
|
+
availablePaymentMethodTypes,
|
|
71
|
+
seatingTypes,
|
|
72
|
+
videoFormatTypes
|
|
73
|
+
})(repos);
|
|
74
|
+
acceptedOffers = validateAcceptedOffersResult.acceptedOffers;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
// アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
|
|
78
|
+
const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
79
|
+
acceptedOffers: [],
|
|
80
|
+
event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
|
|
81
|
+
transaction,
|
|
82
|
+
pendingTransaction
|
|
83
|
+
});
|
|
84
|
+
const failedAction = yield repos.action.start(failedActionAttributes);
|
|
85
|
+
yield repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
let result;
|
|
89
|
+
// 承認アクションを開始
|
|
90
|
+
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
91
|
+
acceptedOffers,
|
|
92
|
+
event: screeningEvent,
|
|
93
|
+
transaction,
|
|
94
|
+
pendingTransaction
|
|
95
|
+
});
|
|
96
|
+
const action = yield repos.action.start(actionAttributes);
|
|
97
|
+
try {
|
|
98
|
+
// 座席仮予約からオファー情報を生成する
|
|
99
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
100
|
+
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
101
|
+
responseBody: params.result.responseBody,
|
|
102
|
+
object: action.object,
|
|
103
|
+
event: screeningEvent,
|
|
104
|
+
seller: transaction.seller,
|
|
105
|
+
bookingTime: moment(action.startDate)
|
|
106
|
+
.toDate(),
|
|
107
|
+
totalPrice: price
|
|
108
|
+
});
|
|
109
|
+
result = {
|
|
110
|
+
price: price,
|
|
111
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
112
|
+
amount: eligibleMonetaryAmount,
|
|
113
|
+
requestBody: params.result.requestBody,
|
|
114
|
+
responseBody: params.result.responseBody,
|
|
115
|
+
acceptedOffers: acceptedOffers4result
|
|
116
|
+
};
|
|
117
|
+
// add orderInTransaction(2024-01-15~)
|
|
118
|
+
if (params.options.useCreateOrderOnOfferAccepted) {
|
|
119
|
+
yield (0, any_1.acceptOffer)({
|
|
120
|
+
project: transaction.project,
|
|
121
|
+
purpose: { id: transaction.id },
|
|
122
|
+
acceptedOffers: acceptedOffers4result
|
|
123
|
+
})(repos);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
try {
|
|
128
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
129
|
+
}
|
|
130
|
+
catch (__) {
|
|
131
|
+
// no op
|
|
132
|
+
}
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result });
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
exports.authorize = authorize;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
2
|
+
import type { MongoRepository as OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
3
|
+
import type { MongoRepository as TransactionRepo } from '../../../repo/transaction';
|
|
4
|
+
import * as factory from '../../../factory';
|
|
5
|
+
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
6
|
+
interface ICancelResult {
|
|
7
|
+
theaterCode: string;
|
|
8
|
+
dateJouei: string;
|
|
9
|
+
titleCode: string;
|
|
10
|
+
titleBranchNum: string;
|
|
11
|
+
timeBegin: string;
|
|
12
|
+
tmpReserveNum: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* COA興行オファー承認取消
|
|
16
|
+
*/
|
|
17
|
+
export declare function cancel(params: {
|
|
18
|
+
/**
|
|
19
|
+
* 承認アクションID
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* 取引進行者
|
|
24
|
+
*/
|
|
25
|
+
agent: {
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 取引
|
|
30
|
+
*/
|
|
31
|
+
transaction: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}): (repos: {
|
|
35
|
+
action: ActionRepo;
|
|
36
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
37
|
+
transaction: TransactionRepo;
|
|
38
|
+
}) => Promise<ICancelResult | undefined>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
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.cancel = exports.WebAPIIdentifier = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
const any_1 = require("../any");
|
|
15
|
+
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
16
|
+
/**
|
|
17
|
+
* COA興行オファー承認取消
|
|
18
|
+
*/
|
|
19
|
+
function cancel(params) {
|
|
20
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const transaction = yield repos.transaction.findInProgressById({
|
|
22
|
+
typeOf: factory.transactionType.PlaceOrder,
|
|
23
|
+
id: params.transaction.id
|
|
24
|
+
});
|
|
25
|
+
if (transaction.agent.id !== params.agent.id) {
|
|
26
|
+
throw new factory.errors.Forbidden('Transaction not yours');
|
|
27
|
+
}
|
|
28
|
+
// 取引内のアクションかどうか確認
|
|
29
|
+
const action = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
30
|
+
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
31
|
+
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
32
|
+
}
|
|
33
|
+
yield repos.action.cancelWithVoid({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
34
|
+
// add orderInTransaction(2024-01-15~)
|
|
35
|
+
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
36
|
+
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
37
|
+
if (typeof orderNumberByTransaction === 'string') {
|
|
38
|
+
yield (0, any_1.voidAcceptedOffer)({
|
|
39
|
+
// authorizeActions: [action],
|
|
40
|
+
authorizeActionsWithInstrument: [action],
|
|
41
|
+
orderNumber: orderNumberByTransaction
|
|
42
|
+
})(repos);
|
|
43
|
+
}
|
|
44
|
+
let cancelResult;
|
|
45
|
+
const actionResult = action.result;
|
|
46
|
+
if ((actionResult === null || actionResult === void 0 ? void 0 : actionResult.requestBody) !== undefined && actionResult.responseBody !== undefined) {
|
|
47
|
+
cancelResult = {
|
|
48
|
+
theaterCode: actionResult.requestBody.theaterCode,
|
|
49
|
+
dateJouei: actionResult.requestBody.dateJouei,
|
|
50
|
+
titleCode: actionResult.requestBody.titleCode,
|
|
51
|
+
titleBranchNum: actionResult.requestBody.titleBranchNum,
|
|
52
|
+
timeBegin: actionResult.requestBody.timeBegin,
|
|
53
|
+
tmpReserveNum: actionResult.responseBody.tmpReserveNum
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return cancelResult;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.cancel = cancel;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IAuthorizeOfferAction, IAuthorizeOperation } from './authorize';
|
|
2
|
+
import { IAcceptedOfferBeforeAuthorize4COA } from './validateAcceptedOffers';
|
|
3
|
+
import * as factory from '../../../factory';
|
|
4
|
+
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
5
|
+
/**
|
|
6
|
+
* COA興行オファー承認のオファーを変更
|
|
7
|
+
*/
|
|
8
|
+
export declare function changeOffers(params: {
|
|
9
|
+
id: string;
|
|
10
|
+
object: {
|
|
11
|
+
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
12
|
+
event: {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
agent: {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
transaction: {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
options: {
|
|
23
|
+
useCreateOrderOnOfferAccepted: boolean;
|
|
24
|
+
};
|
|
25
|
+
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
@@ -0,0 +1,165 @@
|
|
|
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.changeOffers = exports.WebAPIIdentifier = void 0;
|
|
13
|
+
const moment = require("moment");
|
|
14
|
+
const any_1 = require("../any");
|
|
15
|
+
const factory_1 = require("./factory");
|
|
16
|
+
const validateAcceptedOffers_1 = require("./validateAcceptedOffers");
|
|
17
|
+
const factory = require("../../../factory");
|
|
18
|
+
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
19
|
+
/**
|
|
20
|
+
* COA興行オファー承認のオファーを変更
|
|
21
|
+
*/
|
|
22
|
+
function changeOffers(params) {
|
|
23
|
+
// tslint:disable-next-line:max-func-body-length
|
|
24
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
26
|
+
const transaction = yield repos.transaction.findInProgressById({
|
|
27
|
+
typeOf: factory.transactionType.PlaceOrder,
|
|
28
|
+
id: params.transaction.id
|
|
29
|
+
});
|
|
30
|
+
if (transaction.agent.id !== params.agent.id) {
|
|
31
|
+
throw new factory.errors.Forbidden('Transaction not yours');
|
|
32
|
+
}
|
|
33
|
+
// 取引内のアクションかどうか確認
|
|
34
|
+
const authorizeAction = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
35
|
+
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
36
|
+
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
37
|
+
}
|
|
38
|
+
validate4changeOffer({ action: authorizeAction, object: params.object });
|
|
39
|
+
// 座席情報に関しては元のacceptedOffersで自動補完する(リクエストでは正しく指定されないので注意)(2023-03-20~)
|
|
40
|
+
params.object.acceptedOffer = params.object.acceptedOffer.map((offer) => {
|
|
41
|
+
const originalAcceptedOfferBySeatNumber = authorizeAction.object.acceptedOffer.find((originalOffer) => {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
43
|
+
return ((_d = (_c = (_b = (_a = originalOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection)
|
|
44
|
+
=== ((_g = (_f = (_e = offer.itemOffered.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket) === null || _f === void 0 ? void 0 : _f.ticketedSeat) === null || _g === void 0 ? void 0 : _g.seatSection)
|
|
45
|
+
&& ((_k = (_j = (_h = originalOffer.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatNumber)
|
|
46
|
+
=== ((_o = (_m = (_l = offer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber);
|
|
47
|
+
});
|
|
48
|
+
if (originalAcceptedOfferBySeatNumber === undefined) {
|
|
49
|
+
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
50
|
+
}
|
|
51
|
+
return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd1, spseatAdd2: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd2, spseatKbn: originalAcceptedOfferBySeatNumber.ticketInfo.spseatKbn }) });
|
|
52
|
+
});
|
|
53
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
54
|
+
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
55
|
+
id: params.object.event.id
|
|
56
|
+
});
|
|
57
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
58
|
+
project: { id: { $eq: transaction.project.id } },
|
|
59
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
60
|
+
}, [], []);
|
|
61
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
62
|
+
project: { id: { $eq: transaction.project.id } },
|
|
63
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
64
|
+
}, [], []);
|
|
65
|
+
const videoFormatTypes = yield repos.categoryCode.search({
|
|
66
|
+
project: { id: { $eq: transaction.project.id } },
|
|
67
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
68
|
+
}, [], []);
|
|
69
|
+
// COA仮予約後にリクエストが来る前提
|
|
70
|
+
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
71
|
+
object: params.object,
|
|
72
|
+
project: { id: transaction.project.id },
|
|
73
|
+
screeningEvent,
|
|
74
|
+
availablePaymentMethodTypes,
|
|
75
|
+
seatingTypes,
|
|
76
|
+
videoFormatTypes
|
|
77
|
+
})(repos);
|
|
78
|
+
// 供給情報と価格を変更してからDB更新
|
|
79
|
+
authorizeAction.object.acceptedOffer = acceptedOffers;
|
|
80
|
+
const updTmpReserveSeatResult = (_a = authorizeAction.result) === null || _a === void 0 ? void 0 : _a.responseBody;
|
|
81
|
+
if (updTmpReserveSeatResult === undefined) {
|
|
82
|
+
throw new factory.errors.NotFound('action.result.responseBody');
|
|
83
|
+
}
|
|
84
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
85
|
+
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
86
|
+
responseBody: updTmpReserveSeatResult,
|
|
87
|
+
object: authorizeAction.object,
|
|
88
|
+
event: screeningEvent,
|
|
89
|
+
seller: transaction.seller,
|
|
90
|
+
bookingTime: moment(authorizeAction.startDate)
|
|
91
|
+
.toDate(),
|
|
92
|
+
totalPrice: price
|
|
93
|
+
});
|
|
94
|
+
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price, amount: eligibleMonetaryAmount, acceptedOffers: acceptedOffers4result });
|
|
95
|
+
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
96
|
+
yield repos.action.reStart({ id: authorizeAction.id });
|
|
97
|
+
try {
|
|
98
|
+
// まずvoidAcceptedOffer
|
|
99
|
+
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
100
|
+
if (typeof orderNumberByTransaction === 'string') {
|
|
101
|
+
yield (0, any_1.voidAcceptedOffer)({
|
|
102
|
+
// authorizeActions: [authorizeAction],
|
|
103
|
+
authorizeActionsWithInstrument: [authorizeAction],
|
|
104
|
+
orderNumber: orderNumberByTransaction
|
|
105
|
+
})(repos);
|
|
106
|
+
}
|
|
107
|
+
// add orderInTransaction(2024-01-15~)
|
|
108
|
+
if (params.options.useCreateOrderOnOfferAccepted) {
|
|
109
|
+
yield (0, any_1.acceptOffer)({
|
|
110
|
+
project: transaction.project,
|
|
111
|
+
purpose: { id: transaction.id },
|
|
112
|
+
acceptedOffers: acceptedOffers4result
|
|
113
|
+
})(repos);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
try {
|
|
118
|
+
yield repos.action.giveUp({ typeOf: authorizeAction.typeOf, id: authorizeAction.id, error });
|
|
119
|
+
}
|
|
120
|
+
catch (__) {
|
|
121
|
+
// no op
|
|
122
|
+
}
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
// 座席予約承認アクションの供給情報を変更する
|
|
126
|
+
return repos.action.updateAuthorizeEventOfferAction({
|
|
127
|
+
id: params.id,
|
|
128
|
+
object: authorizeAction.object,
|
|
129
|
+
result: actionResult
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
exports.changeOffers = changeOffers;
|
|
134
|
+
function validate4changeOffer(params) {
|
|
135
|
+
// アクション中のイベント識別子と座席リストが合っているかどうか確認
|
|
136
|
+
const authorizeAction = params.action;
|
|
137
|
+
// 完了ステータスのアクションのみ更新可能
|
|
138
|
+
if (authorizeAction.actionStatus !== factory.actionStatusType.CompletedActionStatus) {
|
|
139
|
+
throw new factory.errors.NotFound('authorizeAction');
|
|
140
|
+
}
|
|
141
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
142
|
+
/* istanbul ignore if */
|
|
143
|
+
if (authorizeAction.object.event === undefined) {
|
|
144
|
+
throw new factory.errors.NotFound('authorizeAction.object.event');
|
|
145
|
+
}
|
|
146
|
+
// イベントが一致しているかどうか
|
|
147
|
+
if (authorizeAction.object.event.id !== params.object.event.id) {
|
|
148
|
+
throw new factory.errors.Argument('Event', 'Event ID not matched.');
|
|
149
|
+
}
|
|
150
|
+
// 座席セクションと座席番号が一致しているかどうか
|
|
151
|
+
const acceptedOfferParams = (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer : [];
|
|
152
|
+
const allSeatsExisted = authorizeAction.object.acceptedOffer.every((originalAcceptedOffer) => {
|
|
153
|
+
return acceptedOfferParams.some((o) => {
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
155
|
+
const newSeatSection = (_c = (_b = (_a = o.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) === null || _c === void 0 ? void 0 : _c.seatSection;
|
|
156
|
+
const newSeatNumber = (_f = (_e = (_d = o.itemOffered.serviceOutput) === null || _d === void 0 ? void 0 : _d.reservedTicket) === null || _e === void 0 ? void 0 : _e.ticketedSeat) === null || _f === void 0 ? void 0 : _f.seatNumber;
|
|
157
|
+
return ((_k = (_j = (_h = (_g = originalAcceptedOffer.itemOffered) === null || _g === void 0 ? void 0 : _g.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatSection) === newSeatSection
|
|
158
|
+
&& ((_o = (_m = (_l = originalAcceptedOffer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber) === newSeatNumber;
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
const allSeatsMatched = (acceptedOfferParams.length === authorizeAction.object.acceptedOffer.length) && allSeatsExisted;
|
|
162
|
+
if (!allSeatsMatched) {
|
|
163
|
+
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.responseBody2acceptedOffers4result = exports.offers2resultPrice = exports.createAuthorizeSeatReservationActionAttributes = exports.WebAPIIdentifier = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("../../../factory");
|
|
6
|
+
const settings_1 = require("../../../settings");
|
|
6
7
|
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
7
8
|
function createAuthorizeSeatReservationActionAttributes(params) {
|
|
8
9
|
var _a;
|
|
@@ -41,7 +42,11 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
41
42
|
id: transaction.agent.id
|
|
42
43
|
},
|
|
43
44
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
44
|
-
instrument: {
|
|
45
|
+
instrument: {
|
|
46
|
+
typeOf: 'WebAPI',
|
|
47
|
+
identifier: factory.service.webAPI.Identifier.COA,
|
|
48
|
+
transactionNumber: params.pendingTransaction.transactionNumber
|
|
49
|
+
}
|
|
45
50
|
};
|
|
46
51
|
}
|
|
47
52
|
exports.createAuthorizeSeatReservationActionAttributes = createAuthorizeSeatReservationActionAttributes;
|
|
@@ -112,20 +117,8 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
112
117
|
branchCode: event.location.branchCode,
|
|
113
118
|
name: event.location.name
|
|
114
119
|
}, name: event.name, startDate: moment(event.startDate)
|
|
115
|
-
.toDate(), superEvent: {
|
|
116
|
-
|
|
117
|
-
id: event.superEvent.id,
|
|
118
|
-
identifier: event.superEvent.identifier,
|
|
119
|
-
name: event.superEvent.name,
|
|
120
|
-
kanaName: event.superEvent.kanaName,
|
|
121
|
-
alternativeHeadline: event.superEvent.alternativeHeadline,
|
|
122
|
-
location: event.superEvent.location,
|
|
123
|
-
videoFormat: event.superEvent.videoFormat,
|
|
124
|
-
soundFormat: event.superEvent.soundFormat,
|
|
125
|
-
workPerformed: workPerformed,
|
|
126
|
-
duration: event.superEvent.duration,
|
|
127
|
-
coaInfo: event.superEvent.coaInfo
|
|
128
|
-
}, id: event.id });
|
|
120
|
+
.toDate(), superEvent: Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, identifier: event.superEvent.identifier, name: event.superEvent.name, alternativeHeadline: event.superEvent.alternativeHeadline, location: event.superEvent.location, videoFormat: event.superEvent.videoFormat, soundFormat: event.superEvent.soundFormat, workPerformed: workPerformed, duration: event.superEvent.duration, coaInfo: event.superEvent.coaInfo }, (settings_1.USE_KANA_NAME_IN_ACCEPTED_OFFER) ? { kanaName: event.superEvent.kanaName } : undefined // オプション化
|
|
121
|
+
), id: event.id });
|
|
129
122
|
const reservedTicket = {
|
|
130
123
|
typeOf: 'Ticket',
|
|
131
124
|
coaTicketInfo: requestedOffer.ticketInfo,
|
|
@@ -189,14 +182,8 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
189
182
|
name: requestedOffer.name,
|
|
190
183
|
itemOffered: reservation,
|
|
191
184
|
offeredThrough: { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.COA },
|
|
192
|
-
priceSpecification
|
|
193
|
-
|
|
194
|
-
// priceCurrency: factory.priceCurrency.JPY,
|
|
195
|
-
// 不要なので廃止(2023-07-01~)
|
|
196
|
-
// seller: {
|
|
197
|
-
// typeOf: params.seller.typeOf,
|
|
198
|
-
// name: params.seller.name
|
|
199
|
-
// }
|
|
185
|
+
priceSpecification,
|
|
186
|
+
serialNumber: reservationNumber
|
|
200
187
|
};
|
|
201
188
|
return resultAcceptedOffer;
|
|
202
189
|
}));
|