@chevre/domain 21.8.0-alpha.6 → 21.8.0-alpha.60
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/countOffers.ts +32 -0
- package/example/src/chevre/findItemListElementByCatalogId.ts +23 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateAggregateOffers.ts +89 -0
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/searchAggregateOffers.ts +48 -0
- package/example/src/chevre/searchEventTicketOffers.ts +3 -1
- package/example/src/chevre/searchEvents.ts +9 -7
- package/example/src/chevre/searchOffersByCatalog.ts +9 -5
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
- package/example/src/chevre/searchOrders.ts +9 -7
- package/example/src/chevre/sync2aggregateOffer.ts +27 -0
- package/example/src/chevre/syncAggregateOffer.ts +25 -0
- package/lib/chevre/emailMessageBuilder.js +6 -5
- package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
- package/lib/chevre/repo/aggregateOffer.js +534 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +177 -0
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +24 -33
- package/lib/chevre/repo/mongoose/schemas/offer.js +4 -3
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
- package/lib/chevre/repo/offer.d.ts +82 -47
- package/lib/chevre/repo/offer.js +1279 -289
- package/lib/chevre/repo/offerCatalog.d.ts +6 -0
- package/lib/chevre/repo/offerCatalog.js +13 -0
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +58 -26
- package/lib/chevre/repo/task.d.ts +7 -1
- package/lib/chevre/repo/task.js +100 -0
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
- package/lib/chevre/service/assetTransaction/registerService.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +111 -35
- package/lib/chevre/service/delivery.js +17 -0
- package/lib/chevre/service/offer/event/authorize.js +39 -35
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +8 -8
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +6 -3
- package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
- package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
- package/lib/chevre/service/offer/factory.d.ts +12 -4
- package/lib/chevre/service/offer/factory.js +9 -11
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +8 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +10 -3
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +3 -2
- package/lib/chevre/service/offer.d.ts +1 -0
- package/lib/chevre/service/offer.js +7 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +29 -40
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
- package/lib/chevre/service/order/onOrderStatusChanged.js +81 -54
- package/lib/chevre/service/order/payOrder.d.ts +2 -10
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -13
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +33 -8
- package/lib/chevre/service/payment/any.js +30 -21
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.d.ts +8 -0
- package/lib/chevre/service/reserve/checkInReservation.js +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +5 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +6 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +60 -0
- package/lib/chevre/service/task/onResourceUpdated.js +12 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/task/syncAggregateOffer.d.ts +7 -0
- package/lib/chevre/service/task/syncAggregateOffer.js +23 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +5 -3
- package/lib/chevre/settings.js +6 -6
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
|
@@ -299,6 +299,7 @@ function createReservation(params) {
|
|
|
299
299
|
}
|
|
300
300
|
return reservationItem;
|
|
301
301
|
}
|
|
302
|
+
// tslint:disable-next-line:max-func-body-length
|
|
302
303
|
function coaTicket2offer(params) {
|
|
303
304
|
var _a, _b;
|
|
304
305
|
// 適用通貨区分
|
|
@@ -322,7 +323,6 @@ function coaTicket2offer(params) {
|
|
|
322
323
|
}]
|
|
323
324
|
: undefined;
|
|
324
325
|
const unitPriceSpec = {
|
|
325
|
-
// project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
326
326
|
typeOf: factory.priceSpecificationType.UnitPriceSpecification,
|
|
327
327
|
price: 0,
|
|
328
328
|
priceCurrency: factory.priceCurrency.JPY,
|
|
@@ -332,15 +332,15 @@ function coaTicket2offer(params) {
|
|
|
332
332
|
unitCode: factory.unitCode.C62,
|
|
333
333
|
value: 1
|
|
334
334
|
}
|
|
335
|
-
// appliesToMovieTicket?: {};
|
|
336
335
|
};
|
|
337
336
|
const identifier = (0, util_1.format)('%s-%s-%s', factory.service.webAPI.Identifier.COA, params.theaterCode, params.ticketResult.ticketCode);
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
337
|
+
const offerName = {
|
|
338
|
+
ja: params.ticketResult.ticketName,
|
|
339
|
+
en: (typeof params.ticketResult.ticketNameEng === 'string')
|
|
340
|
+
? params.ticketResult.ticketNameEng
|
|
341
|
+
: ''
|
|
342
|
+
};
|
|
343
|
+
return Object.assign(Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY, id: '', identifier: identifier, name: offerName, description: {
|
|
344
344
|
ja: '',
|
|
345
345
|
en: ''
|
|
346
346
|
}, alternateName: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as COA from '@motionpicture/coa-service';
|
|
2
2
|
import { MongoRepository as CategoryCodeRepo } from '../../../repo/categoryCode';
|
|
3
3
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
4
|
+
import { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
4
5
|
export declare function importFromCOA(params: {
|
|
5
6
|
project: {
|
|
6
7
|
id: string;
|
|
@@ -9,6 +10,7 @@ export declare function importFromCOA(params: {
|
|
|
9
10
|
}): (repos: {
|
|
10
11
|
categoryCode: CategoryCodeRepo;
|
|
11
12
|
offer: OfferRepo;
|
|
13
|
+
task: TaskRepo;
|
|
12
14
|
masterService: COA.service.Master;
|
|
13
15
|
}) => Promise<void>;
|
|
14
16
|
/**
|
|
@@ -47,6 +47,7 @@ declare function searchEventTicketOffers(params: {
|
|
|
47
47
|
page?: number;
|
|
48
48
|
addSortIndex: boolean;
|
|
49
49
|
validateOfferRateLimit: boolean;
|
|
50
|
+
useOffersAsPrimaryForcible: boolean;
|
|
50
51
|
}): ISearchEventTicketOffersOperation<{
|
|
51
52
|
ticketOffers: ITicketOfferWithSortIndex[];
|
|
52
53
|
unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
@@ -36,7 +36,8 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
36
36
|
// Mongoのpagingを利用するオプション(2023-02-21~)
|
|
37
37
|
limit: params.limit,
|
|
38
38
|
page: params.page,
|
|
39
|
-
|
|
39
|
+
useOffersAsPrimaryForcible: params.useOffersAsPrimaryForcible
|
|
40
|
+
// sort: false // 完全廃止(2023-09-04~)
|
|
40
41
|
});
|
|
41
42
|
return { availableOffers: offers, sortedOfferIds };
|
|
42
43
|
});
|
|
@@ -84,7 +85,8 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
84
85
|
page: params.page,
|
|
85
86
|
onlyValid: params.onlyValid,
|
|
86
87
|
unacceptedPaymentMethod,
|
|
87
|
-
excludeAppliesToMovieTicket
|
|
88
|
+
excludeAppliesToMovieTicket,
|
|
89
|
+
useOffersAsPrimaryForcible: params.useOffersAsPrimaryForcible
|
|
88
90
|
})(repos);
|
|
89
91
|
// 冗長な検索について最適化(2023-03-03~)
|
|
90
92
|
const { soundFormatChargeSpecs, videoFormatChargeSpecs, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({
|
|
@@ -248,7 +250,8 @@ function searchEventTicketOffers(params) {
|
|
|
248
250
|
page: params.page,
|
|
249
251
|
addSortIndex: params.addSortIndex,
|
|
250
252
|
validateOfferRateLimit: params.validateOfferRateLimit,
|
|
251
|
-
onlyValid: params.onlyValid === true
|
|
253
|
+
onlyValid: params.onlyValid === true,
|
|
254
|
+
useOffersAsPrimaryForcible: params.useOffersAsPrimaryForcible
|
|
252
255
|
})(repos);
|
|
253
256
|
offers = searchOffersResult.ticketOffers;
|
|
254
257
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
@@ -26,6 +26,7 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
26
26
|
*/
|
|
27
27
|
function voidTransaction(params) {
|
|
28
28
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
var _a, _b;
|
|
29
30
|
const transaction = yield repos.transaction.findById({
|
|
30
31
|
typeOf: params.purpose.typeOf,
|
|
31
32
|
id: params.purpose.id,
|
|
@@ -46,8 +47,12 @@ function voidTransaction(params) {
|
|
|
46
47
|
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
47
48
|
// 確定取引に対応(2023-05-07~)
|
|
48
49
|
case factory.transactionStatusType.Confirmed:
|
|
49
|
-
//
|
|
50
|
-
|
|
50
|
+
// OrderCancelledを考慮(2023-08-30~)
|
|
51
|
+
const orderCancelled = ((_b = (_a = params.purpose.result) === null || _a === void 0 ? void 0 : _a.order) === null || _b === void 0 ? void 0 : _b.orderStatus) === factory.orderStatus.OrderCancelled;
|
|
52
|
+
if (!orderCancelled) {
|
|
53
|
+
// 取り消すべきアクションに絞る
|
|
54
|
+
authorizeActions = authorizeActions.filter((a) => a.actionStatus !== factory.actionStatusType.CompletedActionStatus);
|
|
55
|
+
}
|
|
51
56
|
break;
|
|
52
57
|
default:
|
|
53
58
|
// no op
|
|
@@ -71,44 +76,60 @@ function voidTransaction(params) {
|
|
|
71
76
|
}
|
|
72
77
|
exports.voidTransaction = voidTransaction;
|
|
73
78
|
function processVoidTransaction4coa(params) {
|
|
79
|
+
var _a, _b;
|
|
74
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
// COAの場合、objectあるいはresultに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
|
|
82
|
+
let delTmpReserveParams;
|
|
83
|
+
// objectに進行中取引情報があれば利用する(2023-09-11~)
|
|
84
|
+
const pendingTransaction = params.action.object.pendingTransaction;
|
|
85
|
+
if (typeof (pendingTransaction === null || pendingTransaction === void 0 ? void 0 : pendingTransaction.typeOf) === 'string') {
|
|
86
|
+
delTmpReserveParams = {
|
|
87
|
+
theaterCode: pendingTransaction.theaterCode,
|
|
88
|
+
dateJouei: pendingTransaction.dateJouei,
|
|
89
|
+
titleCode: pendingTransaction.titleCode,
|
|
90
|
+
titleBranchNum: pendingTransaction.titleBranchNum,
|
|
91
|
+
timeBegin: pendingTransaction.timeBegin,
|
|
92
|
+
tmpReserveNum: pendingTransaction.tmpReserveNum
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const coaRequestBody = (_a = params.action.result) === null || _a === void 0 ? void 0 : _a.requestBody;
|
|
97
|
+
const coaResponseBody = (_b = params.action.result) === null || _b === void 0 ? void 0 : _b.responseBody;
|
|
80
98
|
if (coaRequestBody !== undefined && coaResponseBody !== undefined) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
delTmpReserveParams = {
|
|
100
|
+
theaterCode: coaRequestBody.theaterCode,
|
|
101
|
+
dateJouei: coaRequestBody.dateJouei,
|
|
102
|
+
titleCode: coaRequestBody.titleCode,
|
|
103
|
+
titleBranchNum: coaRequestBody.titleBranchNum,
|
|
104
|
+
timeBegin: coaRequestBody.timeBegin,
|
|
105
|
+
tmpReserveNum: coaResponseBody.tmpReserveNum
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (delTmpReserveParams !== undefined) {
|
|
110
|
+
// COAで仮予約取消
|
|
111
|
+
try {
|
|
112
|
+
const reserveService = new COA.service.Reserve({
|
|
113
|
+
endpoint: credentials_1.credentials.coa.endpoint,
|
|
114
|
+
auth: coaAuthClient
|
|
115
|
+
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
116
|
+
yield reserveService.delTmpReserve(delTmpReserveParams);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
let deleted = false;
|
|
120
|
+
// COAサービスエラーの場合ハンドリング
|
|
121
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
122
|
+
/* istanbul ignore if */
|
|
123
|
+
if (error.name === 'COAServiceError') {
|
|
124
|
+
if (Number.isInteger(error.code) && error.code < http_status_1.INTERNAL_SERVER_ERROR) {
|
|
125
|
+
// すでに取消済の場合こうなるので、okとする
|
|
126
|
+
if (error.message === '座席取消失敗') {
|
|
127
|
+
deleted = true;
|
|
107
128
|
}
|
|
108
129
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
}
|
|
131
|
+
if (!deleted) {
|
|
132
|
+
throw error;
|
|
112
133
|
}
|
|
113
134
|
}
|
|
114
135
|
}
|
|
@@ -4,8 +4,9 @@ export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
4
4
|
export type IAcceptedOffer4COA = factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>;
|
|
5
5
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
6
6
|
acceptedOffers: factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>[];
|
|
7
|
-
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
7
|
+
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'typeOf'>;
|
|
8
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
9
|
+
pendingTransaction: factory.action.authorize.offer.seatReservation.ICOAPendingTransaction;
|
|
9
10
|
}): factory.action.authorize.offer.seatReservation.IAttributes<WebAPIIdentifier.COA>;
|
|
10
11
|
/**
|
|
11
12
|
* 供給情報から承認アクションの価格を導き出す
|
|
@@ -17,20 +17,18 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
17
17
|
typeOf: 'WebAPI'
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
// ↓不要なので廃止(少なくともapiレスポンスにはevent自体含んでいない)(2022-08-19~)
|
|
21
|
-
// superEvent: params.event.superEvent,
|
|
22
20
|
typeOf: params.event.typeOf
|
|
23
21
|
};
|
|
22
|
+
const authorizeObject = {
|
|
23
|
+
typeOf: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation,
|
|
24
|
+
acceptedOffer: params.acceptedOffers,
|
|
25
|
+
event: authorizeObjectEvent,
|
|
26
|
+
pendingTransaction: params.pendingTransaction
|
|
27
|
+
};
|
|
24
28
|
return {
|
|
25
29
|
project: transaction.project,
|
|
26
30
|
typeOf: factory.actionType.AuthorizeAction,
|
|
27
|
-
object:
|
|
28
|
-
typeOf: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation,
|
|
29
|
-
acceptedOffer: params.acceptedOffers,
|
|
30
|
-
event: authorizeObjectEvent
|
|
31
|
-
// 不要なので廃止(2022-07-29~)
|
|
32
|
-
// ...{ offers: params.acceptedOffers } // 互換性維持のため
|
|
33
|
-
},
|
|
31
|
+
object: authorizeObject,
|
|
34
32
|
agent: {
|
|
35
33
|
id: transaction.seller.id,
|
|
36
34
|
typeOf: transaction.seller.typeOf,
|
|
@@ -41,8 +39,6 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
41
39
|
recipient: {
|
|
42
40
|
typeOf: transaction.agent.typeOf,
|
|
43
41
|
id: transaction.agent.id
|
|
44
|
-
// ↓不要なので廃止(2022-08-19~)
|
|
45
|
-
// ...(transaction.agent.identifier !== undefined) ? { identifier: transaction.agent.identifier } : undefined
|
|
46
42
|
},
|
|
47
43
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
48
44
|
instrument: { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.COA }
|
|
@@ -18,8 +18,8 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
18
18
|
/**
|
|
19
19
|
* COA興行オファー承認
|
|
20
20
|
*/
|
|
21
|
-
// tslint:disable-next-line:max-func-body-length
|
|
22
21
|
function authorize(params) {
|
|
22
|
+
// tslint:disable-next-line:max-func-body-length
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
const transaction = yield repos.transaction.findInProgressById({
|
|
25
25
|
typeOf: factory.transactionType.PlaceOrder,
|
|
@@ -28,34 +28,64 @@ function authorize(params) {
|
|
|
28
28
|
if (transaction.agent.id !== params.agent.id) {
|
|
29
29
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
seatingTypes
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
let screeningEvent;
|
|
32
|
+
let acceptedOffers;
|
|
33
|
+
const pendingTransaction = {
|
|
34
|
+
theaterCode: params.result.requestBody.theaterCode,
|
|
35
|
+
dateJouei: params.result.requestBody.dateJouei,
|
|
36
|
+
titleCode: params.result.requestBody.titleCode,
|
|
37
|
+
titleBranchNum: params.result.requestBody.titleBranchNum,
|
|
38
|
+
timeBegin: params.result.requestBody.timeBegin,
|
|
39
|
+
tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
40
|
+
transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
41
|
+
typeOf: 'COAReserveTransaction'
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
45
|
+
screeningEvent =
|
|
46
|
+
yield repos.event.findMinimizedIndividualEventById({ id: params.object.event.id });
|
|
47
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
48
|
+
project: { id: { $eq: transaction.project.id } },
|
|
49
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
50
|
+
}, [], []);
|
|
51
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
52
|
+
project: { id: { $eq: transaction.project.id } },
|
|
53
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
54
|
+
}, [], []);
|
|
55
|
+
const videoFormatTypes = yield repos.categoryCode.search({
|
|
56
|
+
project: { id: { $eq: transaction.project.id } },
|
|
57
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
58
|
+
}, [], []);
|
|
59
|
+
// COA仮予約後にリクエストが来る前提
|
|
60
|
+
const validateAcceptedOffersResult = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
61
|
+
object: params.object,
|
|
62
|
+
project: { id: transaction.project.id },
|
|
63
|
+
screeningEvent,
|
|
64
|
+
availablePaymentMethodTypes,
|
|
65
|
+
seatingTypes,
|
|
66
|
+
videoFormatTypes
|
|
67
|
+
})(repos);
|
|
68
|
+
acceptedOffers = validateAcceptedOffersResult.acceptedOffers;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
// アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
|
|
72
|
+
const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
73
|
+
acceptedOffers: [],
|
|
74
|
+
event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
|
|
75
|
+
transaction,
|
|
76
|
+
pendingTransaction
|
|
77
|
+
});
|
|
78
|
+
const failedAction = yield repos.action.start(failedActionAttributes);
|
|
79
|
+
const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
|
|
80
|
+
yield repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error: actionError });
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
54
83
|
// 承認アクションを開始
|
|
55
84
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
56
85
|
acceptedOffers,
|
|
57
86
|
event: screeningEvent,
|
|
58
|
-
transaction
|
|
87
|
+
transaction,
|
|
88
|
+
pendingTransaction
|
|
59
89
|
});
|
|
60
90
|
const action = yield repos.action.start(actionAttributes);
|
|
61
91
|
try {
|
|
@@ -97,8 +127,6 @@ function authorize(params) {
|
|
|
97
127
|
requestBody: params.result.requestBody,
|
|
98
128
|
responseBody: params.result.responseBody,
|
|
99
129
|
acceptedOffers: acceptedOffers4result
|
|
100
|
-
// 不要なので廃止(2023-03-27~)
|
|
101
|
-
// ...{ updTmpReserveSeatArgs, updTmpReserveSeatResult } // 互換性維持のため
|
|
102
130
|
};
|
|
103
131
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
104
132
|
});
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
type IMovieTicketTypeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.MovieTicketTypeChargeSpecification>;
|
|
3
3
|
type ICategoryCodeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.CategoryCodeChargeSpecification>;
|
|
4
|
+
type ITicketOffer = factory.product.ITicketOffer & {
|
|
5
|
+
parentOffer?: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
4
9
|
declare function createCompoundPriceSpec4event(params: {
|
|
5
10
|
eligibleQuantity: factory.quantitativeValue.IQuantitativeValue<factory.unitCode.C62>;
|
|
6
|
-
offer: factory.unitPriceOffer.IUnitPriceOffer
|
|
11
|
+
offer: factory.unitPriceOffer.IUnitPriceOffer & {
|
|
12
|
+
offerIndex?: number;
|
|
13
|
+
parentOffer?: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
7
17
|
movieTicketTypeChargeSpecs: IMovieTicketTypeChargeSpecification[];
|
|
8
18
|
videoFormatChargeSpecs: ICategoryCodeChargeSpecification[];
|
|
9
19
|
soundFormatChargeSpecs: ICategoryCodeChargeSpecification[];
|
|
@@ -11,7 +21,5 @@ declare function createCompoundPriceSpec4event(params: {
|
|
|
11
21
|
availability?: factory.itemAvailability;
|
|
12
22
|
addOn: factory.product.IMinimizedTicketAddOn[];
|
|
13
23
|
sortIndex?: number;
|
|
14
|
-
}):
|
|
15
|
-
sortIndex?: number;
|
|
16
|
-
};
|
|
24
|
+
}): ITicketOffer;
|
|
17
25
|
export { createCompoundPriceSpec4event };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCompoundPriceSpec4event = void 0;
|
|
4
4
|
const factory = require("../../factory");
|
|
5
|
+
const settings_1 = require("../../settings");
|
|
5
6
|
function categoryCodeChargePriceSpec2component(params) {
|
|
6
7
|
var _a;
|
|
7
8
|
return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
|
|
@@ -69,25 +70,22 @@ function createCompoundPriceSpec4event(params) {
|
|
|
69
70
|
...mvtkPriceComponents
|
|
70
71
|
];
|
|
71
72
|
const compoundPriceSpecification = {
|
|
72
|
-
// 不要な属性を除外(2022-11-02~)
|
|
73
|
-
// project: params.offer.project,
|
|
74
73
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
75
74
|
priceCurrency: factory.priceCurrency.JPY,
|
|
76
75
|
valueAddedTaxIncluded: true,
|
|
77
76
|
priceComponent
|
|
78
77
|
};
|
|
79
78
|
// 必要な属性のみに限定(2023-02-24~)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered } = params.offer;
|
|
84
|
-
return Object.assign(Object.assign({ name, description, alternateName, color, typeOf, id,
|
|
85
|
-
// addOn,
|
|
86
|
-
// availability,
|
|
87
|
-
availableAtOrFrom, category,
|
|
79
|
+
const { name, description, alternateName, color, typeOf, id, availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered, offerIndex, parentOffer } = params.offer;
|
|
80
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ name, description, alternateName, color, typeOf, id,
|
|
81
|
+
category,
|
|
88
82
|
eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation,
|
|
89
83
|
priceCurrency,
|
|
90
84
|
validFrom, validThrough, validRateLimit, additionalProperty,
|
|
91
|
-
identifier, itemOffered, addOn: params.addOn, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (
|
|
85
|
+
identifier, itemOffered, addOn: params.addOn, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (!settings_1.USE_OPTIMIZE_TICKET_OFFER)
|
|
86
|
+
? {
|
|
87
|
+
availableAtOrFrom // 最適化(2023-09-10~)
|
|
88
|
+
}
|
|
89
|
+
: undefined), (typeof params.availability === 'string') ? { availability: params.availability } : { availability }), (typeof params.sortIndex === 'number') ? { sortIndex: params.sortIndex } : undefined), (typeof offerIndex === 'number') ? { offerIndex } : undefined), (typeof (parentOffer === null || parentOffer === void 0 ? void 0 : parentOffer.id) === 'string') ? { parentOffer: { id: parentOffer.id } } : undefined);
|
|
92
90
|
}
|
|
93
91
|
exports.createCompoundPriceSpec4event = createCompoundPriceSpec4event;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
4
|
+
type ITicketOffer = factory.product.ITicketOffer & {
|
|
5
|
+
parentOffer?: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
4
9
|
/**
|
|
5
10
|
* プロダクトオファーを検索する
|
|
6
11
|
*/
|
|
@@ -19,7 +24,9 @@ export declare function searchProductOffers(params: {
|
|
|
19
24
|
addSortIndex: boolean;
|
|
20
25
|
limit?: number;
|
|
21
26
|
page?: number;
|
|
27
|
+
useOffersAsPrimaryForcible: boolean;
|
|
22
28
|
}): (repos: {
|
|
23
29
|
offer: OfferRepo;
|
|
24
30
|
product: ProductRepo;
|
|
25
|
-
}) => Promise<
|
|
31
|
+
}) => Promise<ITicketOffer[]>;
|
|
32
|
+
export {};
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.searchProductOffers = void 0;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
|
+
const settings_1 = require("../../../settings");
|
|
14
15
|
/**
|
|
15
16
|
* プロダクトオファーを検索する
|
|
16
17
|
*/
|
|
@@ -29,11 +30,13 @@ function searchProductOffers(params) {
|
|
|
29
30
|
excludeAppliesToMovieTicket: false,
|
|
30
31
|
limit: params.limit,
|
|
31
32
|
page: params.page,
|
|
32
|
-
sort: false,
|
|
33
|
+
// sort: false, // 完全廃止(2023-09-04~)
|
|
33
34
|
onlyValid: params.onlyValid === true,
|
|
34
|
-
availableAtOrFrom: params.availableAt
|
|
35
|
+
availableAtOrFrom: params.availableAt,
|
|
36
|
+
useOffersAsPrimaryForcible: params.useOffersAsPrimaryForcible
|
|
35
37
|
});
|
|
36
38
|
return offers.map((o) => {
|
|
39
|
+
var _a;
|
|
37
40
|
let sortIndex;
|
|
38
41
|
if (params.addSortIndex) {
|
|
39
42
|
sortIndex = sortedOfferIds.indexOf(String(o.id));
|
|
@@ -47,7 +50,11 @@ function searchProductOffers(params) {
|
|
|
47
50
|
...(unitSpec !== undefined) ? [unitSpec] : []
|
|
48
51
|
]
|
|
49
52
|
};
|
|
50
|
-
return Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray(o.additionalProperty)) ? o.additionalProperty : [], alternateName: o.alternateName, availability: o.availability,
|
|
53
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray(o.additionalProperty)) ? o.additionalProperty : [], alternateName: o.alternateName, availability: o.availability, color: o.color, description: o.description, id: o.id, identifier: o.identifier, itemOffered: o.itemOffered, name: o.name, priceCurrency: o.priceCurrency, typeOf: o.typeOf, priceSpecification: compoundPriceSpecification }, (!settings_1.USE_OPTIMIZE_TICKET_OFFER)
|
|
54
|
+
? {
|
|
55
|
+
availableAtOrFrom: o.availableAtOrFrom // 最適化(2023-09-10~)
|
|
56
|
+
}
|
|
57
|
+
: undefined), (o.validFrom instanceof Date) ? { validFrom: o.validFrom } : undefined), (o.validThrough instanceof Date) ? { validThrough: o.validThrough } : undefined), (typeof sortIndex === 'number') ? { sortIndex } : undefined), (typeof o.offerIndex === 'number') ? { offerIndex: o.offerIndex } : undefined), (typeof ((_a = o.parentOffer) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { parentOffer: { id: o.parentOffer.id } } : undefined);
|
|
51
58
|
});
|
|
52
59
|
});
|
|
53
60
|
}
|
|
@@ -66,7 +66,8 @@ function search(params) {
|
|
|
66
66
|
itemOffered: { id: params.itemOffered.id },
|
|
67
67
|
availableAt: params.availableAt,
|
|
68
68
|
onlyValid: params.onlyValid,
|
|
69
|
-
addSortIndex: params.addSortIndex
|
|
69
|
+
addSortIndex: params.addSortIndex,
|
|
70
|
+
useOffersAsPrimaryForcible: params.useOffersAsPrimaryForcible
|
|
70
71
|
})(repos);
|
|
71
72
|
return { offers, product };
|
|
72
73
|
// Mongoへ移行(2023-03-01~)
|
|
@@ -211,7 +212,7 @@ function fixProductAndOffers(params) {
|
|
|
211
212
|
if (product === undefined) {
|
|
212
213
|
throw new factory.errors.NotFound('Product');
|
|
213
214
|
}
|
|
214
|
-
const { offers } = yield search(Object.assign({ ids: params.object.map((o) => String(o.id)), project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true, addSortIndex: false }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined))(repos);
|
|
215
|
+
const { offers } = yield search(Object.assign({ ids: params.object.map((o) => String(o.id)), project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true, addSortIndex: false, useOffersAsPrimaryForcible: false }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined))(repos);
|
|
215
216
|
return { product, availableOffers: offers };
|
|
216
217
|
});
|
|
217
218
|
}
|
|
@@ -135,7 +135,8 @@ function onEventChanged(params) {
|
|
|
135
135
|
return { id };
|
|
136
136
|
}),
|
|
137
137
|
// 新規作成の場合は強制的に集計
|
|
138
|
-
force: params.isNew
|
|
138
|
+
force: params.isNew,
|
|
139
|
+
identifier: `onEventChanged`
|
|
139
140
|
})(repos);
|
|
140
141
|
}
|
|
141
142
|
// 通知タスク作成(2023-06-08~)
|
|
@@ -184,9 +185,12 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
184
185
|
const project = {
|
|
185
186
|
id: params.project.id, typeOf: factory.organizationType.Project
|
|
186
187
|
};
|
|
188
|
+
const nowInMilliseconds = Date.now();
|
|
187
189
|
if (params.force) {
|
|
188
190
|
aggregateTasks = params.reservationFor.map((reservationFor) => {
|
|
191
|
+
const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
|
|
189
192
|
return {
|
|
193
|
+
identifier: taskIdentifier,
|
|
190
194
|
project,
|
|
191
195
|
name: factory.taskName.AggregateScreeningEvent,
|
|
192
196
|
status: factory.taskStatus.Ready,
|
|
@@ -209,7 +213,9 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
209
213
|
}, { _id: 1 })
|
|
210
214
|
.exec();
|
|
211
215
|
if (readyAggregateScreeningEventTaskDoc === null) {
|
|
216
|
+
const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
|
|
212
217
|
aggregateTasks.push({
|
|
218
|
+
identifier: taskIdentifier,
|
|
213
219
|
project,
|
|
214
220
|
name: factory.taskName.AggregateScreeningEvent,
|
|
215
221
|
status: factory.taskStatus.Ready,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
3
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
|
-
import { RedisRepository as RegisterServiceInProgressRepo } from '../../repo/action/registerServiceInProgress';
|
|
5
4
|
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
5
|
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
7
6
|
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
@@ -21,6 +20,5 @@ declare function confirmPayTransaction(data: factory.task.IData<factory.taskName
|
|
|
21
20
|
seller: SellerRepo;
|
|
22
21
|
task: TaskRepo;
|
|
23
22
|
transaction: TransactionRepo;
|
|
24
|
-
registerServiceInProgress: RegisterServiceInProgressRepo;
|
|
25
23
|
}) => Promise<void>;
|
|
26
24
|
export { confirmPayTransaction };
|