@chevre/domain 20.2.0-alpha.2 → 20.2.0-alpha.21
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/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +82 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +90 -0
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -5
- package/example/src/chevre/migratePaymentServicePaymentUrlExpiresInSeconds.ts +77 -0
- package/lib/chevre/repo/action.d.ts +58 -0
- package/lib/chevre/repo/action.js +187 -0
- package/lib/chevre/repo/aggregation.d.ts +34 -0
- package/lib/chevre/repo/aggregation.js +64 -0
- package/lib/chevre/repo/event.d.ts +0 -1
- package/lib/chevre/repo/event.js +124 -105
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
- package/lib/chevre/repo/mongoose/model/event.js +2 -2
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/order.d.ts +9 -0
- package/lib/chevre/repo/order.js +49 -0
- package/lib/chevre/repo/place.d.ts +15 -1
- package/lib/chevre/repo/place.js +205 -52
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/reservation.d.ts +0 -6
- package/lib/chevre/repo/reservation.js +106 -66
- package/lib/chevre/repo/transaction.d.ts +29 -0
- package/lib/chevre/repo/transaction.js +133 -0
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +34 -13
- package/lib/chevre/service/aggregation/system.d.ts +74 -0
- package/lib/chevre/service/aggregation/system.js +266 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
- package/lib/chevre/service/assetTransaction/reserve.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve.js +33 -51
- package/lib/chevre/service/delivery/factory.js +1 -0
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +21 -10
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.js +25 -5
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +116 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer.js +28 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/payment/any.d.ts +5 -0
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/useReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +7 -2
- package/package.json +3 -3
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migrateEventProjectAttributes.ts +0 -57
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPotentialActions = exports.createReservation = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
|
|
3
|
+
exports.createPendingReservationAction = exports.createPotentialActions = exports.createReservation = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 予約取引ファクトリー
|
|
6
6
|
*/
|
|
@@ -468,7 +468,10 @@ function createPotentialActions(params) {
|
|
|
468
468
|
underName
|
|
469
469
|
}));
|
|
470
470
|
});
|
|
471
|
-
const reservationPackage = Object.assign({ reservationFor, reservationNumber: pendingReservations[0].reservationNumber, reservationStatus: pendingReservations[0].reservationStatus,
|
|
471
|
+
const reservationPackage = Object.assign({ reservationFor, reservationNumber: pendingReservations[0].reservationNumber, reservationStatus: pendingReservations[0].reservationStatus,
|
|
472
|
+
// 不要なので廃止(2023-01-19~)
|
|
473
|
+
// subReservation: pendingReservations,
|
|
474
|
+
typeOf: factory.reservationType.ReservationPackage }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string') ? { underName } : undefined);
|
|
472
475
|
reserveActionAttributes = [{
|
|
473
476
|
project: transaction.project,
|
|
474
477
|
typeOf: factory.actionType.ReserveAction,
|
|
@@ -550,3 +553,31 @@ function createMoneyTransferActions(params) {
|
|
|
550
553
|
}
|
|
551
554
|
return moneyTransfer;
|
|
552
555
|
}
|
|
556
|
+
function createPendingReservationAction(params) {
|
|
557
|
+
const transaction = params.transaction;
|
|
558
|
+
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
559
|
+
let cancelActionAttributes = [];
|
|
560
|
+
if (pendingReservations.length > 0) {
|
|
561
|
+
const reservationFor = transaction.object.reservationFor;
|
|
562
|
+
if (reservationFor === undefined) {
|
|
563
|
+
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
564
|
+
}
|
|
565
|
+
// ReservationPackageに対応(2022-12-23~)
|
|
566
|
+
const reservationPackage = {
|
|
567
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
568
|
+
reservationNumber: transaction.transactionNumber,
|
|
569
|
+
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
570
|
+
reservationStatus: pendingReservations[0].reservationStatus
|
|
571
|
+
};
|
|
572
|
+
cancelActionAttributes = [{
|
|
573
|
+
project: transaction.project,
|
|
574
|
+
typeOf: factory.actionType.CancelAction,
|
|
575
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
576
|
+
agent: transaction.project,
|
|
577
|
+
object: reservationPackage,
|
|
578
|
+
potentialActions: {}
|
|
579
|
+
}];
|
|
580
|
+
}
|
|
581
|
+
return cancelActionAttributes;
|
|
582
|
+
}
|
|
583
|
+
exports.createPendingReservationAction = createPendingReservationAction;
|
|
@@ -54,10 +54,14 @@ export declare type ITaskAndTransactionOperation<T> = (repos: {
|
|
|
54
54
|
task: TaskRepo;
|
|
55
55
|
assetTransaction: AssetTransactionRepo;
|
|
56
56
|
}) => Promise<T>;
|
|
57
|
-
|
|
57
|
+
interface IConfirmRepo {
|
|
58
|
+
action: ActionRepo;
|
|
58
59
|
assetTransaction: AssetTransactionRepo;
|
|
59
60
|
order: OrderRepo;
|
|
60
|
-
|
|
61
|
+
reservation: ReservationRepo;
|
|
62
|
+
task: TaskRepo;
|
|
63
|
+
}
|
|
64
|
+
export declare type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
|
|
61
65
|
/**
|
|
62
66
|
* 取引開始
|
|
63
67
|
*/
|
|
@@ -81,3 +85,4 @@ export declare function cancel(params: {
|
|
|
81
85
|
export declare function exportTasksById(params: {
|
|
82
86
|
id: string;
|
|
83
87
|
}): ITaskAndTransactionOperation<factory.task.ITask<factory.taskName>[]>;
|
|
88
|
+
export {};
|
|
@@ -18,6 +18,7 @@ const pecorinoapi = require("../../pecorinoapi");
|
|
|
18
18
|
const factory = require("../../factory");
|
|
19
19
|
const OfferService = require("../offer");
|
|
20
20
|
const cancelReservation_1 = require("../reserve/cancelReservation");
|
|
21
|
+
const confirmReservation_1 = require("../reserve/confirmReservation");
|
|
21
22
|
const settings_1 = require("../../settings");
|
|
22
23
|
const factory_1 = require("./reserve/factory");
|
|
23
24
|
/**
|
|
@@ -571,8 +572,14 @@ function confirm(params) {
|
|
|
571
572
|
typeOf: factory.assetTransactionType.Reserve,
|
|
572
573
|
id: transaction.id,
|
|
573
574
|
result: result,
|
|
574
|
-
potentialActions:
|
|
575
|
+
potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
576
|
+
? { reserve: [] }
|
|
577
|
+
: potentialActions
|
|
575
578
|
});
|
|
579
|
+
if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
580
|
+
// sync対応(2023-01-13~)
|
|
581
|
+
yield (0, confirmReservation_1.confirmReservation)(potentialActions.reserve)(repos);
|
|
582
|
+
}
|
|
576
583
|
});
|
|
577
584
|
}
|
|
578
585
|
exports.confirm = confirm;
|
|
@@ -614,34 +621,9 @@ function cancel(params) {
|
|
|
614
621
|
});
|
|
615
622
|
// 本来非同期でタスクが実行されるが、同期的に仮予約取消が実行されていないと、サービス利用側が困る可能性があるので、
|
|
616
623
|
// 同期的にもcancelPendingReservationを実行しておく
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
if (pendingReservations.length > 0) {
|
|
621
|
-
const reservationFor = transaction.object.reservationFor;
|
|
622
|
-
if (reservationFor === undefined) {
|
|
623
|
-
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
624
|
-
}
|
|
625
|
-
// ReservationPackageに対応(2022-12-23~)
|
|
626
|
-
const reservationPackage = {
|
|
627
|
-
typeOf: factory.reservationType.ReservationPackage,
|
|
628
|
-
reservationNumber: transaction.transactionNumber,
|
|
629
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
630
|
-
reservationStatus: pendingReservations[0].reservationStatus
|
|
631
|
-
};
|
|
632
|
-
cancelActionAttributes = [{
|
|
633
|
-
project: transaction.project,
|
|
634
|
-
typeOf: factory.actionType.CancelAction,
|
|
635
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
636
|
-
agent: transaction.project,
|
|
637
|
-
object: reservationPackage,
|
|
638
|
-
potentialActions: {}
|
|
639
|
-
}];
|
|
640
|
-
yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
catch (error) {
|
|
644
|
-
// no op
|
|
624
|
+
const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
|
|
625
|
+
if (cancelActionAttributes.length > 0) {
|
|
626
|
+
yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
|
|
645
627
|
}
|
|
646
628
|
});
|
|
647
629
|
}
|
|
@@ -704,29 +686,29 @@ function exportTasksById(params) {
|
|
|
704
686
|
}
|
|
705
687
|
break;
|
|
706
688
|
case factory.transactionStatusType.Canceled:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
if (reservationFor === undefined) {
|
|
713
|
-
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
714
|
-
}
|
|
715
|
-
// ReservationPackageに対応(2022-12-23~)
|
|
716
|
-
const reservationPackage = {
|
|
717
|
-
typeOf: factory.reservationType.ReservationPackage,
|
|
718
|
-
reservationNumber: transaction.transactionNumber,
|
|
719
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
720
|
-
reservationStatus: pendingReservations[0].reservationStatus
|
|
721
|
-
};
|
|
722
|
-
cancelActionAttributes = [{
|
|
689
|
+
// sync対応(2023-01-13~)
|
|
690
|
+
if (!settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
691
|
+
const cancelActionAttributes4canceled = (0, factory_1.createPendingReservationAction)({ transaction });
|
|
692
|
+
if (cancelActionAttributes4canceled.length > 0) {
|
|
693
|
+
const cancelPendingReservationTask = {
|
|
723
694
|
project: transaction.project,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
695
|
+
name: factory.taskName.CancelPendingReservation,
|
|
696
|
+
status: factory.taskStatus.Ready,
|
|
697
|
+
runsAt: new Date(),
|
|
698
|
+
remainingNumberOfTries: 10,
|
|
699
|
+
numberOfTried: 0,
|
|
700
|
+
executionResults: [],
|
|
701
|
+
data: {
|
|
702
|
+
actionAttributes: cancelActionAttributes4canceled
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
taskAttributes.push(cancelPendingReservationTask);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
break;
|
|
709
|
+
case factory.transactionStatusType.Expired:
|
|
710
|
+
const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
|
|
711
|
+
if (cancelActionAttributes.length > 0) {
|
|
730
712
|
const cancelPendingReservationTask = {
|
|
731
713
|
project: transaction.project,
|
|
732
714
|
name: factory.taskName.CancelPendingReservation,
|
|
@@ -22,6 +22,7 @@ function createOwnershipInfosFromOrder(params) {
|
|
|
22
22
|
const ownedBy = createOwnedby(params);
|
|
23
23
|
const itemOfferedType = itemOffered.typeOf;
|
|
24
24
|
switch (itemOfferedType) {
|
|
25
|
+
case factory.reservationType.BusReservation:
|
|
25
26
|
case factory.reservationType.EventReservation:
|
|
26
27
|
ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
|
|
27
28
|
project: params.order.project,
|
|
@@ -3,6 +3,7 @@ import { MongoRepository as CategoryCodeRepo } from '../repo/categoryCode';
|
|
|
3
3
|
import { MongoRepository as EventRepo } from '../repo/event';
|
|
4
4
|
import { MongoRepository as PlaceRepo } from '../repo/place';
|
|
5
5
|
import { MongoRepository as ProjectRepo } from '../repo/project';
|
|
6
|
+
import { MongoRepository as SellerRepo } from '../repo/seller';
|
|
6
7
|
import { MongoRepository as TaskRepo } from '../repo/task';
|
|
7
8
|
import * as factory from '../factory';
|
|
8
9
|
/**
|
|
@@ -32,6 +33,7 @@ export declare function importFromCOA(params: {
|
|
|
32
33
|
categoryCode: CategoryCodeRepo;
|
|
33
34
|
event: EventRepo;
|
|
34
35
|
place: PlaceRepo;
|
|
36
|
+
seller: SellerRepo;
|
|
35
37
|
}) => Promise<void>;
|
|
36
38
|
/**
|
|
37
39
|
* COA情報からイベントIDを作成する
|
|
@@ -49,10 +51,6 @@ export declare function updateEvent4ttts(params: {
|
|
|
49
51
|
* 旧イベントID
|
|
50
52
|
*/
|
|
51
53
|
oldEventId: string;
|
|
52
|
-
/**
|
|
53
|
-
* 旧IDを使用しない場合、IDは自動発行される
|
|
54
|
-
*/
|
|
55
|
-
useOldEventId: boolean;
|
|
56
54
|
/**
|
|
57
55
|
* イベント属性
|
|
58
56
|
*/
|
|
@@ -89,8 +89,18 @@ function importFromCOA(params) {
|
|
|
89
89
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
90
90
|
auth: coaAuthClient
|
|
91
91
|
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
92
|
+
// 同ブランチコードの販売者を検索する
|
|
93
|
+
const sellersWithSameBranchCode = yield repos.seller.search({
|
|
94
|
+
limit: 1,
|
|
95
|
+
page: 1,
|
|
96
|
+
branchCode: { $eq: params.locationBranchCode }
|
|
97
|
+
});
|
|
98
|
+
const seller = sellersWithSameBranchCode.shift();
|
|
99
|
+
if (typeof (seller === null || seller === void 0 ? void 0 : seller.id) !== 'string') {
|
|
100
|
+
throw new factory.errors.NotFound('Seller', `Seller with branchCod '${params.locationBranchCode}' not found`);
|
|
101
|
+
}
|
|
92
102
|
// 施設取得
|
|
93
|
-
let movieTheater = createMovieTheaterFromCOA(project, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
|
|
103
|
+
let movieTheater = createMovieTheaterFromCOA(project, { id: seller.id }, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
|
|
94
104
|
// saveMovieTheater:trueの場合のみ、施設保管(2022-10-10~)
|
|
95
105
|
if (params.saveMovieTheater === true) {
|
|
96
106
|
movieTheater = yield repos.place.saveMovieTheaterByBranchCode4coa(movieTheater);
|
|
@@ -539,11 +549,12 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
539
549
|
kanaName: params.movieTheater.kanaName,
|
|
540
550
|
typeOf: params.movieTheater.typeOf
|
|
541
551
|
},
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
552
|
+
// 不要なので廃止(2023-01-12~)
|
|
553
|
+
// organizer: {
|
|
554
|
+
// typeOf: factory.organizationType.Corporation,
|
|
555
|
+
// identifier: params.movieTheater.id,
|
|
556
|
+
// name: params.movieTheater.name
|
|
557
|
+
// },
|
|
547
558
|
videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
|
|
548
559
|
soundFormat: [],
|
|
549
560
|
workPerformed: {
|
|
@@ -617,7 +628,7 @@ function createScreeningEventSeriesId(params) {
|
|
|
617
628
|
*/
|
|
618
629
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
619
630
|
/* istanbul ignore next */
|
|
620
|
-
function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
|
|
631
|
+
function createMovieTheaterFromCOA(project, seller, theaterFromCOA, screensFromCOA) {
|
|
621
632
|
const id = `MovieTheater-${theaterFromCOA.theaterCode}`;
|
|
622
633
|
return {
|
|
623
634
|
project: { typeOf: project.typeOf, id: project.id },
|
|
@@ -663,7 +674,8 @@ function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
|
|
|
663
674
|
value: 2678400,
|
|
664
675
|
unitCode: factory.unitCode.Sec
|
|
665
676
|
}
|
|
666
|
-
}
|
|
677
|
+
},
|
|
678
|
+
parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
|
|
667
679
|
};
|
|
668
680
|
}
|
|
669
681
|
/**
|
|
@@ -731,8 +743,7 @@ function updateEvent4ttts(params) {
|
|
|
731
743
|
try {
|
|
732
744
|
event = yield repos.event.save4ttts({
|
|
733
745
|
oldEventId: params.oldEventId,
|
|
734
|
-
attributes: params.attributes
|
|
735
|
-
useOldEventId: params.useOldEventId
|
|
746
|
+
attributes: params.attributes
|
|
736
747
|
});
|
|
737
748
|
}
|
|
738
749
|
catch (error) {
|
|
@@ -37,7 +37,6 @@ function cancel(params) {
|
|
|
37
37
|
const transactionNumber = (_a = action.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.transactionNumber;
|
|
38
38
|
if (typeof transactionNumber === 'string') {
|
|
39
39
|
// すでに取消済であったとしても、すべて取消処理(actionStatusに関係なく)
|
|
40
|
-
// await repos.reserveTransaction.cancel({ transactionNumber: action.object.pendingTransaction?.transactionNumber });
|
|
41
40
|
yield ReserveTransactionService.cancel({ transactionNumber })(repos);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -211,7 +211,7 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
|
|
|
211
211
|
*/
|
|
212
212
|
// tslint:disable-next-line:max-func-body-length
|
|
213
213
|
function createReservation(params) {
|
|
214
|
-
var _a;
|
|
214
|
+
var _a, _b, _c, _d;
|
|
215
215
|
const itemOffered = params.itemOffered;
|
|
216
216
|
const event = params.event;
|
|
217
217
|
let reservationItem;
|
|
@@ -243,16 +243,36 @@ function createReservation(params) {
|
|
|
243
243
|
.toDate(),
|
|
244
244
|
// 最適化(2022-05-31~)
|
|
245
245
|
superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, kanaName: event.superEvent.kanaName, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
|
|
246
|
-
// 廃止(superEvent.workPerformedへ完全移行)
|
|
247
|
-
// workPerformed: {},
|
|
248
246
|
};
|
|
249
|
-
reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor
|
|
247
|
+
reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
|
|
248
|
+
reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
250
249
|
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
251
250
|
: undefined);
|
|
252
251
|
}
|
|
253
252
|
else if (itemOffered.typeOf === factory.reservationType.BusReservation
|
|
254
253
|
&& event.typeOf === factory.eventType.Event) {
|
|
255
|
-
|
|
254
|
+
const tripByEvent = (_c = (_b = event.offers) === null || _b === void 0 ? void 0 : _b.itemOffered.serviceOutput) === null || _c === void 0 ? void 0 : _c.reservationFor;
|
|
255
|
+
if (typeof (tripByEvent === null || tripByEvent === void 0 ? void 0 : tripByEvent.typeOf) !== 'string') {
|
|
256
|
+
throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput.reservationFor');
|
|
257
|
+
}
|
|
258
|
+
const reservationFor = {
|
|
259
|
+
typeOf: tripByEvent.typeOf,
|
|
260
|
+
id: event.id,
|
|
261
|
+
arrivalBusStop: tripByEvent.arrivalBusStop,
|
|
262
|
+
departureBusStop: tripByEvent.departureBusStop,
|
|
263
|
+
name: event.name,
|
|
264
|
+
departureTime: moment(tripByEvent.departureTime)
|
|
265
|
+
.toDate(),
|
|
266
|
+
arrivalTime: moment(tripByEvent.arrivalTime)
|
|
267
|
+
.toDate(),
|
|
268
|
+
busName: tripByEvent.busName,
|
|
269
|
+
busNumber: tripByEvent.busNumber,
|
|
270
|
+
identifier: tripByEvent.identifier
|
|
271
|
+
};
|
|
272
|
+
reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
|
|
273
|
+
reservedTicket }, (typeof ((_d = itemOffered.programMembershipUsed) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
274
|
+
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
275
|
+
: undefined);
|
|
256
276
|
}
|
|
257
277
|
else {
|
|
258
278
|
throw new factory.errors.Argument('itemOffered');
|
|
@@ -13,6 +13,112 @@ exports.searchEventTicketOffers = void 0;
|
|
|
13
13
|
const moment = require("moment-timezone");
|
|
14
14
|
const factory = require("../../../factory");
|
|
15
15
|
const factory_1 = require("../factory");
|
|
16
|
+
/**
|
|
17
|
+
* 旅客オファー検索
|
|
18
|
+
*/
|
|
19
|
+
function searchTransportationEventTicketOffers(params) {
|
|
20
|
+
// tslint:disable-next-line:max-func-body-length
|
|
21
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
const screeningEvent = yield repos.event.findById({ id: params.eventId });
|
|
24
|
+
const soundFormatTypes = [];
|
|
25
|
+
const videoFormatTypes = [];
|
|
26
|
+
let availableOffers = [];
|
|
27
|
+
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
28
|
+
const eventOffers = screeningEvent.offers;
|
|
29
|
+
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
30
|
+
const transportation = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
31
|
+
if (typeof ((_b = transportation.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
32
|
+
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
33
|
+
offerCatalog: { id: transportation.hasOfferCatalog.id }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// hasOfferCatalog参照廃止(2022-09-02~)
|
|
39
|
+
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
40
|
+
}
|
|
41
|
+
const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
|
|
42
|
+
const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
|
|
43
|
+
// 不許可決済方法があれば、該当オファーを除外
|
|
44
|
+
if (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length > 0) {
|
|
45
|
+
availableOffers = availableOffers.filter((o) => {
|
|
46
|
+
var _a;
|
|
47
|
+
// 複数決済カード対応(2022-07-11~)
|
|
48
|
+
const priceSpecificationAppliesToMovieTicket = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
49
|
+
if (Array.isArray(priceSpecificationAppliesToMovieTicket)) {
|
|
50
|
+
return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
|
|
51
|
+
return !unacceptedPaymentMethod.includes(appliesToMovieTicket.serviceOutput.typeOf);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Arrayでないケースは廃止(2022-09-10~)
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// 適用決済カード条件がある場合、決済カード加算料金が存在しないオファーは除外する
|
|
61
|
+
availableOffers = availableOffers.filter((o) => {
|
|
62
|
+
var _a;
|
|
63
|
+
// 複数決済カード対応(2022-07-26~)
|
|
64
|
+
const priceSpecificationAppliesToMovieTicket = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
65
|
+
if (Array.isArray(priceSpecificationAppliesToMovieTicket)) {
|
|
66
|
+
// 適用決済カード数が0であれば除外
|
|
67
|
+
if (priceSpecificationAppliesToMovieTicket.length === 0) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
// 上映方式がなければ除外(2022-11-03~)
|
|
71
|
+
if (videoFormatTypes.length === 0) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
|
|
75
|
+
// すべての上映方式について検証する(2022-10-29~)
|
|
76
|
+
return videoFormatTypes.every((videoFormat) => {
|
|
77
|
+
return movieTicketTypeChargeSpecs.some((s) => {
|
|
78
|
+
var _a, _b, _c, _d;
|
|
79
|
+
return ((_b = (_a = s.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.typeOf) === ((_c = appliesToMovieTicket.serviceOutput) === null || _c === void 0 ? void 0 : _c.typeOf)
|
|
80
|
+
&& ((_d = s.appliesToMovieTicket) === null || _d === void 0 ? void 0 : _d.serviceType) === appliesToMovieTicket.serviceType
|
|
81
|
+
&& s.appliesToVideoFormat === videoFormat;
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Arrayでないケースは廃止(2022-09-10~)
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
let offers4event = availableOffers.map((availableOffer) => {
|
|
92
|
+
return (0, factory_1.createCompoundPriceSpec4event)({
|
|
93
|
+
eligibleQuantity: eventOffers.eligibleQuantity,
|
|
94
|
+
offer: availableOffer,
|
|
95
|
+
videoFormatChargeSpecifications,
|
|
96
|
+
soundFormatChargeSpecifications,
|
|
97
|
+
movieTicketTypeChargeSpecs,
|
|
98
|
+
videoFormatTypes
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
// レート制限を確認
|
|
102
|
+
offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
return checkAvailability({ event: screeningEvent, offer })(repos);
|
|
104
|
+
})));
|
|
105
|
+
// アドオン設定があれば、プロダクトオファーを検索
|
|
106
|
+
for (const offer of offers4event) {
|
|
107
|
+
const offerAddOn = [];
|
|
108
|
+
if (Array.isArray(offer.addOn)) {
|
|
109
|
+
for (const addOn of offer.addOn) {
|
|
110
|
+
const productId = (_c = addOn.itemOffered) === null || _c === void 0 ? void 0 : _c.id;
|
|
111
|
+
if (typeof productId === 'string') {
|
|
112
|
+
const productOffers = yield searchAddOns({ product: { id: productId } })(repos);
|
|
113
|
+
offerAddOn.push(...productOffers);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
offer.addOn = offerAddOn;
|
|
118
|
+
}
|
|
119
|
+
return offers4event;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
16
122
|
/**
|
|
17
123
|
* 興行オファー全検索
|
|
18
124
|
*/
|
|
@@ -243,9 +349,7 @@ function searchEventTicketOffers(params) {
|
|
|
243
349
|
var _a;
|
|
244
350
|
const now = moment();
|
|
245
351
|
let event;
|
|
246
|
-
event = yield repos.event.findById({
|
|
247
|
-
id: params.event.id
|
|
248
|
-
});
|
|
352
|
+
event = yield repos.event.findById({ id: params.event.id });
|
|
249
353
|
let offers;
|
|
250
354
|
const eventOffers = event.offers;
|
|
251
355
|
if (eventOffers === undefined) {
|
|
@@ -259,7 +363,15 @@ function searchEventTicketOffers(params) {
|
|
|
259
363
|
throw new factory.errors.NotImplemented(`booking service '${eventOffers.offeredThrough.identifier}' not implemented`);
|
|
260
364
|
default:
|
|
261
365
|
// Chevreで券種オファーを検索
|
|
262
|
-
|
|
366
|
+
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
367
|
+
offers = yield searchScreeningEventTicketOffers({ eventId: params.event.id })(repos);
|
|
368
|
+
}
|
|
369
|
+
else if (event.typeOf === factory.eventType.Event) {
|
|
370
|
+
offers = yield searchTransportationEventTicketOffers({ eventId: params.event.id })(repos);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
throw new factory.errors.NotImplemented(`'${event.typeOf}' not implemented`);
|
|
374
|
+
}
|
|
263
375
|
const specifiedStoreId = (_a = params.store) === null || _a === void 0 ? void 0 : _a.id;
|
|
264
376
|
if (typeof specifiedStoreId === 'string') {
|
|
265
377
|
// アプリケーションが利用可能なオファーに絞る
|
|
@@ -114,8 +114,6 @@ function processVoidTransaction4chevre(params) {
|
|
|
114
114
|
transactionNumber: { $eq: transactionNumber }
|
|
115
115
|
});
|
|
116
116
|
if (assetTransactions.length > 0) {
|
|
117
|
-
// 予約取引サービスで中止
|
|
118
|
-
// await repos.reserveTransaction.cancel({ transactionNumber });
|
|
119
117
|
yield ReserveTransactionService.cancel({ transactionNumber })(repos);
|
|
120
118
|
}
|
|
121
119
|
}
|
|
@@ -67,34 +67,38 @@ function addOffers2Seat(params) {
|
|
|
67
67
|
*/
|
|
68
68
|
function searchEventSeatOffers(params) {
|
|
69
69
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
var _a, _b, _c, _d, _e;
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
71
71
|
let offers = [];
|
|
72
|
-
const
|
|
72
|
+
const event = yield repos.event.findById({
|
|
73
73
|
id: params.event.id
|
|
74
74
|
});
|
|
75
75
|
// 座席指定利用可能かどうか
|
|
76
|
-
const eventOffers =
|
|
76
|
+
const eventOffers = event.offers;
|
|
77
77
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
78
78
|
if (reservedSeatsAvailable) {
|
|
79
79
|
// 座席タイプ価格仕様を検索
|
|
80
80
|
const priceSpecs = yield repos.priceSpecification.search({
|
|
81
|
-
project: { id: { $eq:
|
|
81
|
+
project: { id: { $eq: event.project.id } },
|
|
82
82
|
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
83
83
|
appliesToCategoryCode: {
|
|
84
84
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
|
+
// const roomBranchCode = event.location.branchCode;
|
|
88
|
+
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
89
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
90
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
87
91
|
const seats = yield repos.place.searchSeats({
|
|
88
|
-
project: { id: { $eq:
|
|
89
|
-
branchCode: { $in: (
|
|
92
|
+
project: { id: { $eq: event.project.id } },
|
|
93
|
+
branchCode: { $in: (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in },
|
|
90
94
|
containedInPlace: {
|
|
91
95
|
branchCode: {
|
|
92
|
-
$in: (
|
|
96
|
+
$in: (_j = (_h = params.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$in
|
|
93
97
|
},
|
|
94
98
|
containedInPlace: {
|
|
95
|
-
branchCode: { $eq:
|
|
99
|
+
branchCode: { $eq: roomBranchCode },
|
|
96
100
|
containedInPlace: {
|
|
97
|
-
branchCode: { $eq:
|
|
101
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
},
|
|
@@ -114,7 +118,7 @@ function searchEventSeatOffers(params) {
|
|
|
114
118
|
offers = seats.map((seat, index) => {
|
|
115
119
|
var _a;
|
|
116
120
|
return addOffers2Seat({
|
|
117
|
-
project:
|
|
121
|
+
project: event.project,
|
|
118
122
|
seat: seat,
|
|
119
123
|
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
120
124
|
unavailableOffers: [],
|
|
@@ -133,33 +137,37 @@ exports.searchEventSeatOffers = searchEventSeatOffers;
|
|
|
133
137
|
*/
|
|
134
138
|
function searchEventSeatOffersWithPaging(params) {
|
|
135
139
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
var _a, _b, _c, _d, _e, _f;
|
|
140
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
137
141
|
let offers = [];
|
|
138
|
-
const
|
|
142
|
+
const event = yield repos.event.findById({
|
|
139
143
|
id: params.event.id
|
|
140
144
|
});
|
|
141
145
|
// 座席指定利用可能かどうか
|
|
142
|
-
const eventOffers =
|
|
146
|
+
const eventOffers = event.offers;
|
|
143
147
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
144
148
|
if (reservedSeatsAvailable) {
|
|
145
149
|
// 座席タイプ価格仕様を検索
|
|
146
150
|
const priceSpecs = yield repos.priceSpecification.search({
|
|
147
|
-
project: { id: { $eq:
|
|
151
|
+
project: { id: { $eq: event.project.id } },
|
|
148
152
|
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
149
153
|
appliesToCategoryCode: {
|
|
150
154
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
151
155
|
}
|
|
152
156
|
});
|
|
153
|
-
const
|
|
157
|
+
// const roomBranchCode = event.location.branchCode;
|
|
158
|
+
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
159
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
160
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
161
|
+
const seats = yield repos.place.searchSeats(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
|
|
154
162
|
branchCode: {
|
|
155
|
-
$eq: (typeof ((
|
|
156
|
-
? (
|
|
163
|
+
$eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
|
|
164
|
+
? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
|
|
157
165
|
: undefined
|
|
158
166
|
},
|
|
159
167
|
containedInPlace: {
|
|
160
|
-
branchCode: { $eq:
|
|
168
|
+
branchCode: { $eq: roomBranchCode },
|
|
161
169
|
containedInPlace: {
|
|
162
|
-
branchCode: { $eq:
|
|
170
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
163
171
|
}
|
|
164
172
|
}
|
|
165
173
|
} }));
|
|
@@ -177,7 +185,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
177
185
|
offers = seats.map((seat, index) => {
|
|
178
186
|
var _a;
|
|
179
187
|
return addOffers2Seat({
|
|
180
|
-
project:
|
|
188
|
+
project: event.project,
|
|
181
189
|
seat: seat,
|
|
182
190
|
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
183
191
|
unavailableOffers: [],
|
|
@@ -184,7 +184,8 @@ function createConfirmReservationActionObject4ChevreByOrder(params) {
|
|
|
184
184
|
const chevreReservationNumbers = (Array.isArray(params.order.acceptedOffers))
|
|
185
185
|
? params.order.acceptedOffers.filter((o) => {
|
|
186
186
|
var _a;
|
|
187
|
-
return o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
187
|
+
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
188
|
+
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
188
189
|
&& ((_a = o.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.Chevre;
|
|
189
190
|
})
|
|
190
191
|
.map((o) => {
|
|
@@ -271,7 +271,8 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
271
271
|
// 注文アイテムから返却アクションを作成する
|
|
272
272
|
const acceptedOffers = (Array.isArray(order.acceptedOffers)) ? order.acceptedOffers : [];
|
|
273
273
|
for (const acceptedOffer of acceptedOffers) {
|
|
274
|
-
if (acceptedOffer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
274
|
+
if (acceptedOffer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
275
|
+
|| acceptedOffer.itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
275
276
|
const reservation = acceptedOffer.itemOffered;
|
|
276
277
|
const reservationNumber = reservation.reservationNumber;
|
|
277
278
|
// 予約番号ごとに返却アクションを作成する
|