@chevre/domain 20.1.0-alpha.47 → 20.1.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +32 -5
- package/lib/chevre/service/assetTransaction/reserve.js +40 -104
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
- package/lib/chevre/service/reserve/cancelReservation.js +119 -73
- package/lib/chevre/service/reserve/factory.js +12 -9
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +14 -1
- package/package.json +2 -2
|
@@ -6,11 +6,38 @@ const factory = require("../../../factory");
|
|
|
6
6
|
* 取引開始パラメータ作成
|
|
7
7
|
*/
|
|
8
8
|
function createStartParams(params) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
let reserveTransactionAsObject;
|
|
11
|
+
let eventReservationsAsObject;
|
|
12
|
+
if (typeof ((_a = params.transaction) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
|
|
13
|
+
const reservationFor = params.transaction.object.reservationFor;
|
|
14
|
+
if (typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.typeOf) !== 'string') {
|
|
15
|
+
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
16
|
+
}
|
|
17
|
+
reserveTransactionAsObject = {
|
|
18
|
+
id: params.transaction.id,
|
|
19
|
+
transactionNumber: params.transaction.transactionNumber,
|
|
20
|
+
typeOf: params.transaction.typeOf,
|
|
21
|
+
object: {
|
|
22
|
+
reservationFor: {
|
|
23
|
+
id: reservationFor.id,
|
|
24
|
+
typeOf: reservationFor.typeOf
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(params.reservations)) {
|
|
30
|
+
eventReservationsAsObject = params.reservations.map((r) => {
|
|
31
|
+
return {
|
|
32
|
+
id: r.id,
|
|
33
|
+
issuedThrough: r.issuedThrough,
|
|
34
|
+
reservationFor: { id: r.reservationFor.id, typeOf: r.reservationFor.typeOf },
|
|
35
|
+
reservationNumber: r.reservationNumber,
|
|
36
|
+
typeOf: r.typeOf
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const cancelReservationObject = Object.assign(Object.assign({ clientUser: params.paramsWithoutDetail.object.clientUser }, (typeof (reserveTransactionAsObject === null || reserveTransactionAsObject === void 0 ? void 0 : reserveTransactionAsObject.typeOf) === 'string') ? { transaction: reserveTransactionAsObject } : undefined), (Array.isArray(eventReservationsAsObject)) ? { reservations: eventReservationsAsObject } : undefined);
|
|
14
41
|
return {
|
|
15
42
|
project: { id: params.project.id, typeOf: params.project.typeOf },
|
|
16
43
|
transactionNumber: params.transactionNumber,
|
|
@@ -20,7 +20,6 @@ const OfferService = require("../offer");
|
|
|
20
20
|
const cancelReservation_1 = require("../reserve/cancelReservation");
|
|
21
21
|
const settings_1 = require("../../settings");
|
|
22
22
|
const factory_1 = require("./reserve/factory");
|
|
23
|
-
const USE_RESERVATION_PACKAGE_AS_OBJECT = process.env.USE_RESERVATION_PACKAGE_AS_OBJECT === '1';
|
|
24
23
|
/**
|
|
25
24
|
* 取引開始
|
|
26
25
|
*/
|
|
@@ -620,44 +619,20 @@ function cancel(params) {
|
|
|
620
619
|
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
621
620
|
}
|
|
622
621
|
// ReservationPackageに対応(2022-12-23~)
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}];
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
cancelActionAttributes = pendingReservations.map((reservation) => {
|
|
641
|
-
var _a;
|
|
642
|
-
return {
|
|
643
|
-
project: transaction.project,
|
|
644
|
-
typeOf: factory.actionType.CancelAction,
|
|
645
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
646
|
-
agent: transaction.project,
|
|
647
|
-
object: {
|
|
648
|
-
typeOf: reservation.typeOf,
|
|
649
|
-
id: reservation.id,
|
|
650
|
-
issuedThrough: {
|
|
651
|
-
typeOf: (_a = reservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
|
|
652
|
-
},
|
|
653
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
|
|
654
|
-
reservationNumber: reservation.reservationNumber,
|
|
655
|
-
reservationStatus: reservation.reservationStatus
|
|
656
|
-
},
|
|
657
|
-
potentialActions: {}
|
|
658
|
-
};
|
|
659
|
-
});
|
|
660
|
-
}
|
|
622
|
+
const reservationPackage = {
|
|
623
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
624
|
+
reservationNumber: transaction.transactionNumber,
|
|
625
|
+
reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
|
|
626
|
+
reservationStatus: pendingReservations[0].reservationStatus
|
|
627
|
+
};
|
|
628
|
+
cancelActionAttributes = [{
|
|
629
|
+
project: transaction.project,
|
|
630
|
+
typeOf: factory.actionType.CancelAction,
|
|
631
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
632
|
+
agent: transaction.project,
|
|
633
|
+
object: reservationPackage,
|
|
634
|
+
potentialActions: {}
|
|
635
|
+
}];
|
|
661
636
|
yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
|
|
662
637
|
}
|
|
663
638
|
}
|
|
@@ -734,72 +709,33 @@ function exportTasksById(params) {
|
|
|
734
709
|
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
735
710
|
}
|
|
736
711
|
// ReservationPackageに対応(2022-12-23~)
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
cancelActionAttributes = [{
|
|
745
|
-
project: transaction.project,
|
|
746
|
-
typeOf: factory.actionType.CancelAction,
|
|
747
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
748
|
-
agent: transaction.project,
|
|
749
|
-
object: reservationPackage,
|
|
750
|
-
potentialActions: {}
|
|
751
|
-
}];
|
|
752
|
-
const cancelPendingReservationTask = {
|
|
712
|
+
const reservationPackage = {
|
|
713
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
714
|
+
reservationNumber: transaction.transactionNumber,
|
|
715
|
+
reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
|
|
716
|
+
reservationStatus: pendingReservations[0].reservationStatus
|
|
717
|
+
};
|
|
718
|
+
cancelActionAttributes = [{
|
|
753
719
|
project: transaction.project,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
agent: transaction.project,
|
|
774
|
-
object: {
|
|
775
|
-
typeOf: reservation.typeOf,
|
|
776
|
-
id: reservation.id,
|
|
777
|
-
issuedThrough: {
|
|
778
|
-
typeOf: (_a = reservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
|
|
779
|
-
},
|
|
780
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
|
|
781
|
-
reservationNumber: reservation.reservationNumber,
|
|
782
|
-
reservationStatus: reservation.reservationStatus
|
|
783
|
-
},
|
|
784
|
-
potentialActions: {}
|
|
785
|
-
};
|
|
786
|
-
});
|
|
787
|
-
const cancelPendingReservationTasks = cancelActionAttributes.map((a) => {
|
|
788
|
-
return {
|
|
789
|
-
project: transaction.project,
|
|
790
|
-
name: factory.taskName.CancelPendingReservation,
|
|
791
|
-
status: factory.taskStatus.Ready,
|
|
792
|
-
runsAt: new Date(),
|
|
793
|
-
remainingNumberOfTries: 10,
|
|
794
|
-
numberOfTried: 0,
|
|
795
|
-
executionResults: [],
|
|
796
|
-
data: {
|
|
797
|
-
actionAttributes: [a]
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
});
|
|
801
|
-
taskAttributes.push(...cancelPendingReservationTasks);
|
|
802
|
-
}
|
|
720
|
+
typeOf: factory.actionType.CancelAction,
|
|
721
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
722
|
+
agent: transaction.project,
|
|
723
|
+
object: reservationPackage,
|
|
724
|
+
potentialActions: {}
|
|
725
|
+
}];
|
|
726
|
+
const cancelPendingReservationTask = {
|
|
727
|
+
project: transaction.project,
|
|
728
|
+
name: factory.taskName.CancelPendingReservation,
|
|
729
|
+
status: factory.taskStatus.Ready,
|
|
730
|
+
runsAt: new Date(),
|
|
731
|
+
remainingNumberOfTries: 10,
|
|
732
|
+
numberOfTried: 0,
|
|
733
|
+
executionResults: [],
|
|
734
|
+
data: {
|
|
735
|
+
actionAttributes: cancelActionAttributes
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
taskAttributes.push(cancelPendingReservationTask);
|
|
803
739
|
}
|
|
804
740
|
break;
|
|
805
741
|
default:
|
|
@@ -9,7 +9,7 @@ declare type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSub
|
|
|
9
9
|
/**
|
|
10
10
|
* 進行中の予約をキャンセルする
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
declare function cancelPendingReservation(actionAttributesList: factory.action.cancel.reservation.IAttributes[]): (repos: {
|
|
13
13
|
action: ActionRepo;
|
|
14
14
|
assetTransaction: AssetTransactionRepo;
|
|
15
15
|
eventAvailability: ScreeningEventAvailabilityRepo;
|
|
@@ -20,7 +20,7 @@ export declare function cancelPendingReservation(actionAttributesList: factory.a
|
|
|
20
20
|
/**
|
|
21
21
|
* 予約をキャンセルする
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
declare function cancelReservation(actionAttributesList: factory.action.cancel.reservation.IAttributes[]): (repos: {
|
|
24
24
|
action: ActionRepo;
|
|
25
25
|
eventAvailability: ScreeningEventAvailabilityRepo;
|
|
26
26
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -28,10 +28,10 @@ export declare function cancelReservation(actionAttributesList: factory.action.c
|
|
|
28
28
|
task: TaskRepo;
|
|
29
29
|
assetTransaction: AssetTransactionRepo;
|
|
30
30
|
}) => Promise<void>;
|
|
31
|
-
|
|
32
|
-
reservation: IObjectSubReservation
|
|
31
|
+
declare function processUnlockOfferRateLimit(params: {
|
|
32
|
+
reservation: Pick<IObjectSubReservation, 'reservationNumber' | 'reservedTicket'>;
|
|
33
33
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
34
34
|
}): (repos: {
|
|
35
35
|
offerRateLimit: OfferRateLimitRepo;
|
|
36
36
|
}) => Promise<void>;
|
|
37
|
-
export {};
|
|
37
|
+
export { cancelPendingReservation, cancelReservation, processUnlockOfferRateLimit };
|
|
@@ -28,11 +28,11 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
28
28
|
if (actionAttributesList.length > 0) {
|
|
29
29
|
// tslint:disable-next-line:max-func-body-length
|
|
30
30
|
yield Promise.all(actionAttributesList.map((actionAttributes) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var _a;
|
|
32
31
|
// let canceledReservation: factory.reservation.eventReservation.IReservation | undefined;
|
|
33
32
|
const reserveTransactionId = actionAttributes.purpose.id;
|
|
34
33
|
// アクション開始
|
|
35
34
|
const action = yield repos.action.start(actionAttributes);
|
|
35
|
+
const actionObject = actionAttributes.object;
|
|
36
36
|
let cancelResult;
|
|
37
37
|
try {
|
|
38
38
|
// 予約取引を検索
|
|
@@ -43,7 +43,6 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
43
43
|
ids: [reserveTransactionId]
|
|
44
44
|
});
|
|
45
45
|
const reserveTransaction = reserveTransactions.shift();
|
|
46
|
-
const actionObject = actionAttributes.object;
|
|
47
46
|
if (reserveTransaction !== undefined) {
|
|
48
47
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
49
48
|
if (reservationFor === undefined) {
|
|
@@ -54,12 +53,26 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
54
53
|
const subReservation = reserveTransaction.object.subReservation;
|
|
55
54
|
if (Array.isArray(subReservation) && subReservation.length > 0) {
|
|
56
55
|
yield Promise.all(subReservation.map((cancelingSubReservation) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
const cancelingReservation
|
|
56
|
+
// const cancelingReservation: factory.reservation.eventReservation.IReservation = {
|
|
57
|
+
// ...cancelingSubReservation,
|
|
58
|
+
// reservationFor
|
|
59
|
+
// };
|
|
58
60
|
yield processUnlockSeat({
|
|
59
|
-
reservation:
|
|
61
|
+
reservation: {
|
|
62
|
+
id: cancelingSubReservation.id,
|
|
63
|
+
reservedTicket: cancelingSubReservation.reservedTicket,
|
|
64
|
+
subReservation: cancelingSubReservation.subReservation,
|
|
65
|
+
reservationFor: { id: reservationFor.id }
|
|
66
|
+
},
|
|
60
67
|
expectedHolder: reserveTransactionId
|
|
61
68
|
})(repos);
|
|
62
|
-
yield processUnlockOfferRateLimit({
|
|
69
|
+
yield processUnlockOfferRateLimit({
|
|
70
|
+
reservation: {
|
|
71
|
+
reservationNumber: cancelingSubReservation.reservationNumber,
|
|
72
|
+
reservedTicket: cancelingSubReservation.reservedTicket
|
|
73
|
+
},
|
|
74
|
+
reservationFor
|
|
75
|
+
})(repos);
|
|
63
76
|
})));
|
|
64
77
|
}
|
|
65
78
|
// 予約番号単位でキャンセル状態に変更する
|
|
@@ -70,31 +83,35 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
70
83
|
});
|
|
71
84
|
}
|
|
72
85
|
else {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
// 廃止(2022-12-27~)
|
|
87
|
+
throw new factory.errors.NotImplemented(`object.typeOf '${actionObject.typeOf}' not implemented`);
|
|
88
|
+
// const cancelingSubReservation = reserveTransaction.object.subReservation?.find((r) => {
|
|
89
|
+
// return r.id === actionObject.id;
|
|
90
|
+
// });
|
|
91
|
+
// // 取消対象予約が取引に存在すれば、適宜unlock
|
|
92
|
+
// if (cancelingSubReservation !== undefined) {
|
|
93
|
+
// const cancelingReservation: factory.reservation.eventReservation.IReservation = {
|
|
94
|
+
// ...cancelingSubReservation,
|
|
95
|
+
// reservationFor
|
|
96
|
+
// };
|
|
97
|
+
// await processUnlockSeat({
|
|
98
|
+
// reservation: cancelingReservation,
|
|
99
|
+
// expectedHolder: reserveTransactionId
|
|
100
|
+
// })(repos);
|
|
101
|
+
// await processUnlockOfferRateLimit({ reservation: cancelingReservation, reservationFor })(repos);
|
|
102
|
+
// // 予約が存在すればキャンセル状態に変更する
|
|
103
|
+
// const reservationCount = await repos.reservation.count({
|
|
104
|
+
// typeOf: cancelingSubReservation.typeOf,
|
|
105
|
+
// ids: [cancelingSubReservation.id]
|
|
106
|
+
// });
|
|
107
|
+
// if (reservationCount > 0) {
|
|
108
|
+
// await repos.reservation.cancel<factory.reservationType.EventReservation>({
|
|
109
|
+
// id: cancelingSubReservation.id,
|
|
110
|
+
// previousReservationStatus: actionObject.reservationStatus,
|
|
111
|
+
// modifiedTime: now
|
|
112
|
+
// });
|
|
113
|
+
// }
|
|
114
|
+
// }
|
|
98
115
|
}
|
|
99
116
|
}
|
|
100
117
|
}
|
|
@@ -120,22 +137,21 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
120
137
|
// canceledReservationId: canceledReservation?.id
|
|
121
138
|
);
|
|
122
139
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
123
|
-
|
|
140
|
+
// await onReservationCanceledByAction(actionAttributes)({ task: repos.task });
|
|
141
|
+
if (actionObject.typeOf === factory.reservationType.ReservationPackage) {
|
|
142
|
+
// 最新のconfirmedReservationsを検索
|
|
143
|
+
canceledReservations = yield repos.reservation.search({
|
|
144
|
+
reservationNumber: { $eq: actionObject.reservationNumber },
|
|
145
|
+
typeOf: factory.reservationType.EventReservation
|
|
146
|
+
});
|
|
147
|
+
canceledReservations = canceledReservations.map((r) => {
|
|
148
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
149
|
+
delete r._id;
|
|
150
|
+
return r;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
yield (0, onReservationCanceled_1.onReservationCanceled)(canceledReservations, false)({ task: repos.task });
|
|
124
154
|
})));
|
|
125
|
-
const reservationNumber = actionAttributesList[0].object.reservationNumber;
|
|
126
|
-
if (typeof reservationNumber === 'string' && reservationNumber.length > 0) {
|
|
127
|
-
// 最新のconfirmedReservationsを検索
|
|
128
|
-
canceledReservations = yield repos.reservation.search({
|
|
129
|
-
reservationNumber: { $eq: reservationNumber },
|
|
130
|
-
typeOf: factory.reservationType.EventReservation
|
|
131
|
-
});
|
|
132
|
-
canceledReservations = canceledReservations.map((r) => {
|
|
133
|
-
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
134
|
-
delete r._id;
|
|
135
|
-
return r;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
yield (0, onReservationCanceled_1.onReservationCanceled)(canceledReservations, false)({ task: repos.task });
|
|
139
155
|
}
|
|
140
156
|
});
|
|
141
157
|
}
|
|
@@ -147,7 +163,6 @@ function cancelReservation(actionAttributesList) {
|
|
|
147
163
|
// tslint:disable-next-line:max-func-body-length
|
|
148
164
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
149
165
|
const now = new Date();
|
|
150
|
-
let canceledReservations = [];
|
|
151
166
|
if (actionAttributesList.length > 0) {
|
|
152
167
|
// tslint:disable-next-line:max-func-body-length
|
|
153
168
|
yield Promise.all(actionAttributesList.map((actionAttributes) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -173,12 +188,26 @@ function cancelReservation(actionAttributesList) {
|
|
|
173
188
|
const subReservation = reserveTransaction.object.subReservation;
|
|
174
189
|
if (Array.isArray(subReservation) && subReservation.length > 0) {
|
|
175
190
|
yield Promise.all(subReservation.map((cancelingSubReservation) => __awaiter(this, void 0, void 0, function* () {
|
|
176
|
-
const cancelingReservation
|
|
191
|
+
// const cancelingReservation: factory.reservation.eventReservation.IReservation = {
|
|
192
|
+
// ...cancelingSubReservation,
|
|
193
|
+
// reservationFor
|
|
194
|
+
// };
|
|
177
195
|
yield processUnlockSeat({
|
|
178
|
-
reservation:
|
|
196
|
+
reservation: {
|
|
197
|
+
id: cancelingSubReservation.id,
|
|
198
|
+
reservedTicket: cancelingSubReservation.reservedTicket,
|
|
199
|
+
subReservation: cancelingSubReservation.subReservation,
|
|
200
|
+
reservationFor: { id: reservationFor.id }
|
|
201
|
+
},
|
|
179
202
|
expectedHolder: reserveTransaction.id
|
|
180
203
|
})(repos);
|
|
181
|
-
yield processUnlockOfferRateLimit({
|
|
204
|
+
yield processUnlockOfferRateLimit({
|
|
205
|
+
reservation: {
|
|
206
|
+
reservationNumber: cancelingSubReservation.reservationNumber,
|
|
207
|
+
reservedTicket: cancelingSubReservation.reservedTicket
|
|
208
|
+
},
|
|
209
|
+
reservationFor
|
|
210
|
+
})(repos);
|
|
182
211
|
})));
|
|
183
212
|
}
|
|
184
213
|
// 予約番号単位でキャンセル状態に変更する
|
|
@@ -200,24 +229,34 @@ function cancelReservation(actionAttributesList) {
|
|
|
200
229
|
object: { reservations: { id: { $in: [reservation.id] } } }
|
|
201
230
|
});
|
|
202
231
|
const reserveTransaction = reserveTransactions.shift();
|
|
203
|
-
let
|
|
232
|
+
let expectedHolder;
|
|
204
233
|
if (reserveTransaction !== undefined) {
|
|
205
|
-
|
|
234
|
+
expectedHolder = reserveTransaction.id;
|
|
206
235
|
}
|
|
207
|
-
if (typeof
|
|
236
|
+
if (typeof expectedHolder === 'string') {
|
|
208
237
|
yield processUnlockSeat({
|
|
209
|
-
reservation:
|
|
210
|
-
|
|
238
|
+
reservation: {
|
|
239
|
+
id: reservation.id,
|
|
240
|
+
reservedTicket: reservation.reservedTicket,
|
|
241
|
+
subReservation: reservation.subReservation,
|
|
242
|
+
reservationFor: { id: reservation.reservationFor.id }
|
|
243
|
+
},
|
|
244
|
+
expectedHolder
|
|
211
245
|
})(repos);
|
|
212
246
|
}
|
|
213
|
-
yield processUnlockOfferRateLimit({
|
|
247
|
+
yield processUnlockOfferRateLimit({
|
|
248
|
+
reservation: {
|
|
249
|
+
reservationNumber: reservation.reservationNumber,
|
|
250
|
+
reservedTicket: reservation.reservedTicket
|
|
251
|
+
},
|
|
252
|
+
reservationFor: reservation.reservationFor
|
|
253
|
+
})(repos);
|
|
214
254
|
// 予約をキャンセル状態に変更する
|
|
215
|
-
|
|
255
|
+
yield repos.reservation.cancel({
|
|
216
256
|
id: reservation.id,
|
|
217
257
|
previousReservationStatus: actionAttributes.object.reservationStatus,
|
|
218
258
|
modifiedTime: now
|
|
219
259
|
});
|
|
220
|
-
canceledReservations.push(canceledReservation);
|
|
221
260
|
}
|
|
222
261
|
}
|
|
223
262
|
catch (error) {
|
|
@@ -241,24 +280,31 @@ function cancelReservation(actionAttributesList) {
|
|
|
241
280
|
// canceledReservationId: canceledReservation?.id
|
|
242
281
|
);
|
|
243
282
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
283
|
+
// await onReservationCanceledByAction(actionAttributes)({ task: repos.task });
|
|
284
|
+
let canceledReservations = [];
|
|
285
|
+
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
286
|
+
const reservationNumber = actionAttributes.object.reservationNumber;
|
|
287
|
+
if (typeof reservationNumber === 'string' && reservationNumber.length > 0) {
|
|
288
|
+
// 最新のconfirmedReservationsを検索
|
|
289
|
+
canceledReservations = yield repos.reservation.search({
|
|
290
|
+
reservationNumber: { $eq: reservationNumber },
|
|
291
|
+
typeOf: factory.reservationType.EventReservation
|
|
292
|
+
});
|
|
293
|
+
canceledReservations = canceledReservations.map((r) => {
|
|
294
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
295
|
+
delete r._id;
|
|
296
|
+
return r;
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
const canceledReservation = yield repos.reservation.findById({
|
|
302
|
+
id: actionAttributes.object.id
|
|
258
303
|
});
|
|
304
|
+
canceledReservations = [canceledReservation];
|
|
259
305
|
}
|
|
260
|
-
|
|
261
|
-
|
|
306
|
+
yield (0, onReservationCanceled_1.onReservationCanceled)(canceledReservations, true)({ task: repos.task });
|
|
307
|
+
})));
|
|
262
308
|
}
|
|
263
309
|
});
|
|
264
310
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NUM_TRY_INFORM_RESERVATION = exports.maskUnderName = void 0;
|
|
4
|
-
const reservedAgentIdentifireNames_1 = require("../../factory/reservedAgentIdentifireNames");
|
|
5
4
|
const MASKED_PROFILE = '****';
|
|
6
5
|
function maskUnderName(reservation) {
|
|
7
|
-
var _a, _b, _c;
|
|
8
6
|
// 予約後を隠蔽(2022-12-24~)
|
|
9
|
-
const underNameIdentifiers
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
// const underNameIdentifiers: factory.propertyValue.IPropertyValue<string>[] | undefined =
|
|
8
|
+
// (Array.isArray(reservation.underName?.identifier))
|
|
9
|
+
// ? reservation.underName?.identifier.filter((p) => {
|
|
10
|
+
// return !RESERVED_AGENT_IDENTIFIER_NAMES.includes(p.name);
|
|
11
|
+
// })
|
|
12
|
+
// : undefined;
|
|
13
|
+
var _a;
|
|
14
|
+
const underName = (typeof ((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
15
|
+
? Object.assign(Object.assign({}, reservation.underName), { email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE,
|
|
16
|
+
// ... (Array.isArray(underNameIdentifiers)) ? { identifier: underNameIdentifiers } : undefined,
|
|
17
|
+
// identifierも隠蔽(2022-12-27~)
|
|
18
|
+
identifier: [] }) : undefined;
|
|
16
19
|
return Object.assign(Object.assign({}, reservation), (underName !== undefined) ? { underName } : undefined);
|
|
17
20
|
}
|
|
18
21
|
exports.maskUnderName = maskUnderName;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
+
export declare type IPlaceOrderTransactionAsInformObject = Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'id' | 'typeOf' | 'agent' | 'endDate' | 'expires' | 'project' | 'seller' | 'result' | 'startDate' | 'status'>;
|
|
2
3
|
/**
|
|
3
4
|
* 取引のタスクを作成する
|
|
4
5
|
*/
|
|
@@ -15,6 +15,18 @@ function createTasks(params) {
|
|
|
15
15
|
const taskRunsAt = params.runsAt;
|
|
16
16
|
const transactionWebhookUrls = (Array.isArray(settings_1.settings.transactionWebhookUrls)) ? settings_1.settings.transactionWebhookUrls : [];
|
|
17
17
|
const triggerWebhookTaskAttributes = transactionWebhookUrls.map((webhookUrl) => {
|
|
18
|
+
const informObject = {
|
|
19
|
+
id: transaction.id,
|
|
20
|
+
typeOf: transaction.typeOf,
|
|
21
|
+
agent: transaction.agent,
|
|
22
|
+
endDate: transaction.endDate,
|
|
23
|
+
expires: transaction.expires,
|
|
24
|
+
project: transaction.project,
|
|
25
|
+
seller: transaction.seller,
|
|
26
|
+
result: transaction.result,
|
|
27
|
+
startDate: transaction.startDate,
|
|
28
|
+
status: transaction.status
|
|
29
|
+
};
|
|
18
30
|
return {
|
|
19
31
|
project: transaction.project,
|
|
20
32
|
name: factory.taskName.TriggerWebhook,
|
|
@@ -25,7 +37,8 @@ function createTasks(params) {
|
|
|
25
37
|
executionResults: [],
|
|
26
38
|
data: {
|
|
27
39
|
agent: transaction.project,
|
|
28
|
-
|
|
40
|
+
// 通知内容最適化(2022-12-28~)
|
|
41
|
+
object: informObject,
|
|
29
42
|
project: transaction.project,
|
|
30
43
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
31
44
|
recipient: {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.280.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.280.0-alpha.12",
|
|
13
13
|
"@cinerino/sdk": "3.135.0-alpha.6",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.1.0-alpha.
|
|
123
|
+
"version": "20.1.0-alpha.49"
|
|
124
124
|
}
|