@chevre/domain 21.4.0-alpha.14 → 21.4.0-alpha.16
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/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/migrateReservationProvider.ts +107 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.js +6 -3
- package/lib/chevre/repo/order.d.ts +3 -0
- package/lib/chevre/repo/order.js +5 -5
- package/lib/chevre/repo/reservation.d.ts +33 -20
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -38
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +6 -21
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +12 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -1
- package/package.json +3 -3
|
@@ -22,18 +22,18 @@ class MongoRepository {
|
|
|
22
22
|
}
|
|
23
23
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
24
24
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
|
|
26
26
|
// MongoDB検索条件
|
|
27
27
|
const andConditions = [
|
|
28
28
|
{ typeOf: params.typeOf }
|
|
29
29
|
];
|
|
30
30
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
31
31
|
if (typeof projectIdEq === 'string') {
|
|
32
|
-
andConditions.push({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
32
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
33
|
+
}
|
|
34
|
+
const providerIdEq = (_d = (_c = params.provider) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
35
|
+
if (typeof providerIdEq === 'string') {
|
|
36
|
+
andConditions.push({ 'provider.id': { $eq: providerIdEq } });
|
|
37
37
|
}
|
|
38
38
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
39
39
|
/* istanbul ignore else */
|
|
@@ -172,24 +172,24 @@ class MongoRepository {
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
const additionalTicketTextRegex = (
|
|
175
|
+
const additionalTicketTextRegex = (_e = params.additionalTicketText) === null || _e === void 0 ? void 0 : _e.$regex;
|
|
176
176
|
if (typeof additionalTicketTextRegex === 'string' && additionalTicketTextRegex.length > 0) {
|
|
177
|
-
const additionalTicketTextOptions = (
|
|
177
|
+
const additionalTicketTextOptions = (_f = params.additionalTicketText) === null || _f === void 0 ? void 0 : _f.$options;
|
|
178
178
|
andConditions.push({
|
|
179
179
|
additionalTicketText: Object.assign({ $exists: true, $regex: new RegExp(additionalTicketTextRegex) }, (typeof additionalTicketTextOptions === 'string') ? { $options: additionalTicketTextOptions } : undefined)
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
const reservationStatusEq = (
|
|
184
|
+
const reservationStatusEq = (_g = params.reservationStatus) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
185
185
|
if (typeof reservationStatusEq === 'string') {
|
|
186
186
|
andConditions.push({ reservationStatus: { $eq: reservationStatusEq } });
|
|
187
187
|
}
|
|
188
|
-
const reservationStatusNe = (
|
|
188
|
+
const reservationStatusNe = (_h = params.reservationStatus) === null || _h === void 0 ? void 0 : _h.$ne;
|
|
189
189
|
if (typeof reservationStatusNe === 'string') {
|
|
190
190
|
andConditions.push({ reservationStatus: { $ne: reservationStatusNe } });
|
|
191
191
|
}
|
|
192
|
-
const reservationStatusIn = (
|
|
192
|
+
const reservationStatusIn = (_j = params.reservationStatus) === null || _j === void 0 ? void 0 : _j.$in;
|
|
193
193
|
if (Array.isArray(reservationStatusIn)) {
|
|
194
194
|
andConditions.push({ reservationStatus: { $in: reservationStatusIn } });
|
|
195
195
|
}
|
|
@@ -234,7 +234,7 @@ class MongoRepository {
|
|
|
234
234
|
}
|
|
235
235
|
switch (params.typeOf) {
|
|
236
236
|
case factory.reservationType.BusReservation:
|
|
237
|
-
const reservationForTypeOfEq = (
|
|
237
|
+
const reservationForTypeOfEq = (_k = params.reservationFor) === null || _k === void 0 ? void 0 : _k.typeOf;
|
|
238
238
|
if (typeof reservationForTypeOfEq === 'string') {
|
|
239
239
|
andConditions.push({
|
|
240
240
|
'reservationFor.typeOf': {
|
|
@@ -243,7 +243,7 @@ class MongoRepository {
|
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
const reservationForIdEq = (
|
|
246
|
+
const reservationForIdEq = (_m = (_l = params.reservationFor) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
247
247
|
if (typeof reservationForIdEq === 'string') {
|
|
248
248
|
andConditions.push({
|
|
249
249
|
'reservationFor.id': {
|
|
@@ -252,7 +252,7 @@ class MongoRepository {
|
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
const reservationForIdIn = (
|
|
255
|
+
const reservationForIdIn = (_p = (_o = params.reservationFor) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$in;
|
|
256
256
|
if (Array.isArray(reservationForIdIn)) {
|
|
257
257
|
andConditions.push({
|
|
258
258
|
'reservationFor.id': {
|
|
@@ -263,7 +263,7 @@ class MongoRepository {
|
|
|
263
263
|
}
|
|
264
264
|
break;
|
|
265
265
|
case factory.reservationType.EventReservation:
|
|
266
|
-
if (typeof ((
|
|
266
|
+
if (typeof ((_q = params.reservationFor) === null || _q === void 0 ? void 0 : _q.id) === 'string') {
|
|
267
267
|
andConditions.push({
|
|
268
268
|
'reservationFor.id': {
|
|
269
269
|
$exists: true,
|
|
@@ -272,7 +272,7 @@ class MongoRepository {
|
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
274
|
else {
|
|
275
|
-
const reservationForIdEq4eventReservation = (
|
|
275
|
+
const reservationForIdEq4eventReservation = (_s = (_r = params.reservationFor) === null || _r === void 0 ? void 0 : _r.id) === null || _s === void 0 ? void 0 : _s.$eq;
|
|
276
276
|
if (typeof reservationForIdEq4eventReservation === 'string') {
|
|
277
277
|
andConditions.push({
|
|
278
278
|
'reservationFor.id': {
|
|
@@ -526,7 +526,7 @@ class MongoRepository {
|
|
|
526
526
|
}
|
|
527
527
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
528
528
|
/* istanbul ignore else */
|
|
529
|
-
const ticketedSeatSeatingTypeIn = (
|
|
529
|
+
const ticketedSeatSeatingTypeIn = (_u = (_t = params.reservedTicket.ticketedSeat) === null || _t === void 0 ? void 0 : _t.seatingType) === null || _u === void 0 ? void 0 : _u.$in;
|
|
530
530
|
if (Array.isArray(ticketedSeatSeatingTypeIn)) {
|
|
531
531
|
andConditions.push({
|
|
532
532
|
'reservedTicket.ticketedSeat.seatingType': {
|
|
@@ -537,7 +537,7 @@ class MongoRepository {
|
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
|
-
const brokerIdRegex = (
|
|
540
|
+
const brokerIdRegex = (_v = params.broker) === null || _v === void 0 ? void 0 : _v.id;
|
|
541
541
|
if (typeof brokerIdRegex === 'string' && brokerIdRegex.length > 0) {
|
|
542
542
|
andConditions.push({
|
|
543
543
|
'broker.id': {
|
|
@@ -546,7 +546,7 @@ class MongoRepository {
|
|
|
546
546
|
}
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
|
-
const brokerIdentifierAll = (
|
|
549
|
+
const brokerIdentifierAll = (_x = (_w = params.broker) === null || _w === void 0 ? void 0 : _w.identifier) === null || _x === void 0 ? void 0 : _x.$all;
|
|
550
550
|
if (Array.isArray(brokerIdentifierAll)) {
|
|
551
551
|
andConditions.push({
|
|
552
552
|
'broker.identifier': {
|
|
@@ -555,7 +555,7 @@ class MongoRepository {
|
|
|
555
555
|
}
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
|
-
const brokerIdentifierIn = (
|
|
558
|
+
const brokerIdentifierIn = (_z = (_y = params.broker) === null || _y === void 0 ? void 0 : _y.identifier) === null || _z === void 0 ? void 0 : _z.$in;
|
|
559
559
|
if (Array.isArray(brokerIdentifierIn)) {
|
|
560
560
|
andConditions.push({
|
|
561
561
|
'broker.identifier': {
|
|
@@ -564,7 +564,7 @@ class MongoRepository {
|
|
|
564
564
|
}
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
|
-
const brokerIdentifierNin = (
|
|
567
|
+
const brokerIdentifierNin = (_1 = (_0 = params.broker) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$nin;
|
|
568
568
|
if (Array.isArray(brokerIdentifierNin)) {
|
|
569
569
|
andConditions.push({
|
|
570
570
|
'broker.identifier': {
|
|
@@ -572,7 +572,7 @@ class MongoRepository {
|
|
|
572
572
|
}
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
const brokerIdentifierElemMatch = (
|
|
575
|
+
const brokerIdentifierElemMatch = (_3 = (_2 = params.broker) === null || _2 === void 0 ? void 0 : _2.identifier) === null || _3 === void 0 ? void 0 : _3.$elemMatch;
|
|
576
576
|
if (brokerIdentifierElemMatch !== undefined && brokerIdentifierElemMatch !== null) {
|
|
577
577
|
andConditions.push({
|
|
578
578
|
'broker.identifier': {
|
|
@@ -607,9 +607,9 @@ class MongoRepository {
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
else {
|
|
610
|
-
const emailRegex = (
|
|
610
|
+
const emailRegex = (_4 = params.underName.email) === null || _4 === void 0 ? void 0 : _4.$regex;
|
|
611
611
|
if (typeof emailRegex === 'string' && emailRegex.length > 0) {
|
|
612
|
-
const emailOptions = (
|
|
612
|
+
const emailOptions = (_5 = params.underName.email) === null || _5 === void 0 ? void 0 : _5.$options;
|
|
613
613
|
andConditions.push({
|
|
614
614
|
'underName.email': Object.assign({ $exists: true, $regex: new RegExp(emailRegex) }, (typeof emailOptions === 'string') ? { $options: emailOptions } : undefined)
|
|
615
615
|
});
|
|
@@ -628,9 +628,9 @@ class MongoRepository {
|
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
else {
|
|
631
|
-
const underNameNameRegex = (
|
|
631
|
+
const underNameNameRegex = (_6 = params.underName.name) === null || _6 === void 0 ? void 0 : _6.$regex;
|
|
632
632
|
if (typeof underNameNameRegex === 'string' && underNameNameRegex.length > 0) {
|
|
633
|
-
const underNameNameOptions = (
|
|
633
|
+
const underNameNameOptions = (_7 = params.underName.name) === null || _7 === void 0 ? void 0 : _7.$options;
|
|
634
634
|
andConditions.push({
|
|
635
635
|
'underName.name': Object.assign({ $exists: true, $regex: new RegExp(underNameNameRegex) }, (typeof underNameNameOptions === 'string') ? { $options: underNameNameOptions } : undefined)
|
|
636
636
|
});
|
|
@@ -659,9 +659,9 @@ class MongoRepository {
|
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
661
|
else {
|
|
662
|
-
const givenNameRegex = (
|
|
662
|
+
const givenNameRegex = (_8 = params.underName.givenName) === null || _8 === void 0 ? void 0 : _8.$regex;
|
|
663
663
|
if (typeof givenNameRegex === 'string' && givenNameRegex.length > 0) {
|
|
664
|
-
const givenNameOptions = (
|
|
664
|
+
const givenNameOptions = (_9 = params.underName.givenName) === null || _9 === void 0 ? void 0 : _9.$options;
|
|
665
665
|
andConditions.push({
|
|
666
666
|
'underName.givenName': Object.assign({ $exists: true, $regex: new RegExp(givenNameRegex) }, (typeof givenNameOptions === 'string') ? { $options: givenNameOptions } : undefined)
|
|
667
667
|
});
|
|
@@ -680,9 +680,9 @@ class MongoRepository {
|
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
else {
|
|
683
|
-
const familyNameRegex = (
|
|
683
|
+
const familyNameRegex = (_10 = params.underName.familyName) === null || _10 === void 0 ? void 0 : _10.$regex;
|
|
684
684
|
if (typeof familyNameRegex === 'string' && familyNameRegex.length > 0) {
|
|
685
|
-
const familyNameOptions = (
|
|
685
|
+
const familyNameOptions = (_11 = params.underName.familyName) === null || _11 === void 0 ? void 0 : _11.$options;
|
|
686
686
|
andConditions.push({
|
|
687
687
|
'underName.familyName': Object.assign({ $exists: true, $regex: new RegExp(familyNameRegex) }, (typeof familyNameOptions === 'string') ? { $options: familyNameOptions } : undefined)
|
|
688
688
|
});
|
|
@@ -783,7 +783,7 @@ class MongoRepository {
|
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
|
-
const programMembershipUsedIdentifierEq = (
|
|
786
|
+
const programMembershipUsedIdentifierEq = (_13 = (_12 = params.programMembershipUsed) === null || _12 === void 0 ? void 0 : _12.identifier) === null || _13 === void 0 ? void 0 : _13.$eq;
|
|
787
787
|
if (typeof programMembershipUsedIdentifierEq === 'string') {
|
|
788
788
|
andConditions.push({
|
|
789
789
|
'programMembershipUsed.identifier': {
|
|
@@ -792,7 +792,7 @@ class MongoRepository {
|
|
|
792
792
|
}
|
|
793
793
|
});
|
|
794
794
|
}
|
|
795
|
-
const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (
|
|
795
|
+
const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_17 = (_16 = (_15 = (_14 = params.programMembershipUsed) === null || _14 === void 0 ? void 0 : _14.issuedThrough) === null || _15 === void 0 ? void 0 : _15.serviceType) === null || _16 === void 0 ? void 0 : _16.codeValue) === null || _17 === void 0 ? void 0 : _17.$eq;
|
|
796
796
|
if (typeof programMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
797
797
|
andConditions.push({
|
|
798
798
|
'programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
@@ -801,7 +801,7 @@ class MongoRepository {
|
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
|
-
const appliesToMovieTicketIdentifierEq = (
|
|
804
|
+
const appliesToMovieTicketIdentifierEq = (_21 = (_20 = (_19 = (_18 = params.price) === null || _18 === void 0 ? void 0 : _18.priceComponent) === null || _19 === void 0 ? void 0 : _19.appliesToMovieTicket) === null || _20 === void 0 ? void 0 : _20.identifier) === null || _21 === void 0 ? void 0 : _21.$eq;
|
|
805
805
|
if (typeof appliesToMovieTicketIdentifierEq === 'string') {
|
|
806
806
|
andConditions.push({
|
|
807
807
|
'price.priceComponent.appliesToMovieTicket.identifier': {
|
|
@@ -812,25 +812,24 @@ class MongoRepository {
|
|
|
812
812
|
}
|
|
813
813
|
return andConditions;
|
|
814
814
|
}
|
|
815
|
-
createMany(params
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
}
|
|
815
|
+
// public async createMany(params: {
|
|
816
|
+
// reservations: factory.assetTransaction.reserve.IObjectSubReservation[];
|
|
817
|
+
// reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
818
|
+
// }): Promise<void> {
|
|
819
|
+
// if (params.reservations.length > 0) {
|
|
820
|
+
// const result = await this.reservationModel.insertMany(
|
|
821
|
+
// params.reservations.map((r) => {
|
|
822
|
+
// return { ...r, _id: r.id, reservationFor: params.reservationFor };
|
|
823
|
+
// }),
|
|
824
|
+
// { ordered: false, rawResult: true }
|
|
825
|
+
// );
|
|
826
|
+
// if (result.insertedCount !== params.reservations.length) {
|
|
827
|
+
// throw new factory.errors.ServiceUnavailable('all reservations not saved');
|
|
828
|
+
// }
|
|
829
|
+
// } else {
|
|
830
|
+
// // no op
|
|
831
|
+
// }
|
|
832
|
+
// }
|
|
834
833
|
/**
|
|
835
834
|
* 汎用予約カウント
|
|
836
835
|
*/
|
|
@@ -899,30 +898,29 @@ class MongoRepository {
|
|
|
899
898
|
return doc.toObject();
|
|
900
899
|
});
|
|
901
900
|
}
|
|
902
|
-
confirmByReservationNumber(params
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}
|
|
901
|
+
// public async confirmByReservationNumber(params: {
|
|
902
|
+
// reservationNumber: string;
|
|
903
|
+
// previousReservationStatus: factory.reservationStatusType;
|
|
904
|
+
// underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
905
|
+
// broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
906
|
+
// issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
907
|
+
// }): Promise<void> {
|
|
908
|
+
// const conditions = {
|
|
909
|
+
// reservationNumber: { $eq: String(params.reservationNumber) },
|
|
910
|
+
// reservationStatus: { $eq: params.previousReservationStatus }
|
|
911
|
+
// };
|
|
912
|
+
// const update = {
|
|
913
|
+
// // previousReservationStatusを保管(2023-01-19~)
|
|
914
|
+
// previousReservationStatus: params.previousReservationStatus,
|
|
915
|
+
// reservationStatus: factory.reservationStatusType.ReservationConfirmed,
|
|
916
|
+
// modifiedTime: new Date(),
|
|
917
|
+
// ...(params.underName !== undefined) ? { underName: params.underName } : undefined,
|
|
918
|
+
// ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined,
|
|
919
|
+
// ...(typeof params.issuedThrough?.typeOf === 'string') ? { issuedThrough: params.issuedThrough } : undefined
|
|
920
|
+
// };
|
|
921
|
+
// await this.reservationModel.updateMany(conditions, update)
|
|
922
|
+
// .exec();
|
|
923
|
+
// }
|
|
926
924
|
confirmManyIfNotExist(params) {
|
|
927
925
|
return __awaiter(this, void 0, void 0, function* () {
|
|
928
926
|
const modifiedTime = new Date();
|
|
@@ -930,11 +928,26 @@ class MongoRepository {
|
|
|
930
928
|
if (Array.isArray(params.subReservation)) {
|
|
931
929
|
params.subReservation.forEach((subReservation) => {
|
|
932
930
|
var _a, _b;
|
|
931
|
+
let setOnInsert;
|
|
932
|
+
switch (subReservation.typeOf) {
|
|
933
|
+
case factory.reservationType.BusReservation:
|
|
934
|
+
setOnInsert = Object.assign(Object.assign(Object.assign(Object.assign({}, subReservation), { _id: subReservation.id, issuedThrough: params.issuedThrough, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime,
|
|
935
|
+
// providerを追加(2023-07-19~)
|
|
936
|
+
provider: params.provider }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined);
|
|
937
|
+
break;
|
|
938
|
+
case factory.reservationType.EventReservation:
|
|
939
|
+
setOnInsert = Object.assign(Object.assign(Object.assign(Object.assign({}, subReservation), { _id: subReservation.id, issuedThrough: params.issuedThrough, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime,
|
|
940
|
+
// providerを追加(2023-07-19~)
|
|
941
|
+
provider: params.provider }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_b = params.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { broker: params.broker } : undefined);
|
|
942
|
+
break;
|
|
943
|
+
default:
|
|
944
|
+
throw new factory.errors.NotImplemented(`${subReservation.typeOf} not implemented`);
|
|
945
|
+
}
|
|
933
946
|
bulkWriteOps.push({
|
|
934
947
|
updateOne: {
|
|
935
|
-
filter: { _id: { $eq:
|
|
948
|
+
filter: { _id: { $eq: setOnInsert.id } },
|
|
936
949
|
update: {
|
|
937
|
-
$setOnInsert:
|
|
950
|
+
$setOnInsert: setOnInsert
|
|
938
951
|
},
|
|
939
952
|
upsert: true
|
|
940
953
|
}
|
|
@@ -1099,10 +1112,10 @@ class MongoRepository {
|
|
|
1099
1112
|
/**
|
|
1100
1113
|
* 予約部分更新
|
|
1101
1114
|
*/
|
|
1102
|
-
// public async findByIdAndUpdate(params: {
|
|
1103
1115
|
updatePartiallyById(params) {
|
|
1104
1116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1105
1117
|
return this.reservationModel.findOneAndUpdate({ _id: { $eq: params.id } }, params.update, { new: true })
|
|
1118
|
+
.select({ _id: 1 })
|
|
1106
1119
|
.exec()
|
|
1107
1120
|
.then((doc) => {
|
|
1108
1121
|
if (doc === null) {
|
|
@@ -1172,5 +1185,10 @@ class MongoRepository {
|
|
|
1172
1185
|
.exec();
|
|
1173
1186
|
});
|
|
1174
1187
|
}
|
|
1188
|
+
getCursor(conditions, projection) {
|
|
1189
|
+
return this.reservationModel.find(conditions, projection)
|
|
1190
|
+
.sort({ bookingTime: factory.sortType.Descending })
|
|
1191
|
+
.cursor();
|
|
1192
|
+
}
|
|
1175
1193
|
}
|
|
1176
1194
|
exports.MongoRepository = MongoRepository;
|
|
@@ -4,8 +4,13 @@ import { IAcceptedAddOn } from './factory/price';
|
|
|
4
4
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
5
5
|
export { IAcceptedAddOn };
|
|
6
6
|
export declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
|
|
7
|
+
provider: {
|
|
8
|
+
/**
|
|
9
|
+
* 販売者ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
7
13
|
reservationNumber: string;
|
|
8
|
-
disablePendingReservations: boolean;
|
|
9
14
|
useHoldStockByTransactionNumber: boolean;
|
|
10
15
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve>;
|
|
11
16
|
/**
|
|
@@ -11,9 +11,13 @@ const price_1 = require("./factory/price");
|
|
|
11
11
|
function createStartParams(params) {
|
|
12
12
|
var _a;
|
|
13
13
|
const reservationNumber = params.reservationNumber;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const provider = {
|
|
15
|
+
id: params.provider.id,
|
|
16
|
+
typeOf: factory.organizationType.Corporation
|
|
17
|
+
};
|
|
18
|
+
const reservationPackage = Object.assign({ provider, reservationNumber: reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending,
|
|
19
|
+
// trueで固定(2023-07-19~)
|
|
20
|
+
disablePendingReservations: true, useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, typeOf: factory.reservationType.ReservationPackage }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined);
|
|
17
21
|
return {
|
|
18
22
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
19
23
|
typeOf: factory.assetTransactionType.Reserve,
|
|
@@ -413,36 +417,14 @@ function createReservation(params) {
|
|
|
413
417
|
}
|
|
414
418
|
// priceを最適化
|
|
415
419
|
const price4reservation = (0, price_1.createPrice)(params);
|
|
416
|
-
// const eventOffers = <factory.event.screeningEvent.IOffer | undefined>params.reservationFor.offers;
|
|
417
|
-
// // offersは必ず存在するはず
|
|
418
|
-
// if (eventOffers === undefined) {
|
|
419
|
-
// throw new factory.errors.NotFound('reservationFor.offers');
|
|
420
|
-
// }
|
|
421
|
-
// const serviceTypeOfIssuedThrough: factory.reservation.eventReservation.IServiceTypeOfIssuedThrough | undefined
|
|
422
|
-
// = (typeof eventOffers.itemOffered.serviceType?.codeValue === 'string')
|
|
423
|
-
// ? {
|
|
424
|
-
// codeValue: eventOffers.itemOffered.serviceType.codeValue,
|
|
425
|
-
// inCodeSet: {
|
|
426
|
-
// typeOf: 'CategoryCodeSet',
|
|
427
|
-
// identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
|
|
428
|
-
// },
|
|
429
|
-
// typeOf: 'CategoryCode'
|
|
430
|
-
// }
|
|
431
|
-
// : undefined;
|
|
432
|
-
// const availableChannel: factory.reservation.IServiceChannel = eventOffers.itemOffered.availableChannel;
|
|
433
420
|
if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
|
|
434
|
-
// const issuedThrough: factory.reservation.eventReservation.IIssuedThrough = {
|
|
435
|
-
// typeOf: factory.product.ProductType.EventService,
|
|
436
|
-
// // 興行IDを追加(2022-09-08~)
|
|
437
|
-
// id: eventOffers.itemOffered.id,
|
|
438
|
-
// availableChannel,
|
|
439
|
-
// // issuedThrough.serviceTypeを連携
|
|
440
|
-
// ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
441
|
-
// };
|
|
442
421
|
return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id,
|
|
443
422
|
// reservationPackage保管に移行(2023-06-06~)
|
|
444
423
|
// issuedThrough,
|
|
445
|
-
additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber,
|
|
424
|
+
additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber,
|
|
425
|
+
// statusは不要なので削除(2023-07-19~)
|
|
426
|
+
// reservationStatus: factory.reservationStatusType.ReservationPending,
|
|
427
|
+
reservedTicket: params.reservedTicket,
|
|
446
428
|
// 最適化(2022-12-19~)
|
|
447
429
|
underName: {
|
|
448
430
|
typeOf: params.agent.typeOf,
|
|
@@ -463,18 +445,13 @@ function createReservation(params) {
|
|
|
463
445
|
: undefined);
|
|
464
446
|
}
|
|
465
447
|
else {
|
|
466
|
-
// const issuedThrough: factory.reservation.busReservation.IIssuedThrough = {
|
|
467
|
-
// typeOf: factory.product.ProductType.Transportation,
|
|
468
|
-
// // 興行IDを追加(2022-09-08~)
|
|
469
|
-
// id: eventOffers.itemOffered.id,
|
|
470
|
-
// availableChannel,
|
|
471
|
-
// // issuedThrough.serviceTypeを連携
|
|
472
|
-
// ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
473
|
-
// };
|
|
474
448
|
return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id,
|
|
475
449
|
// reservationPackage保管に移行(2023-06-06~)
|
|
476
450
|
// issuedThrough,
|
|
477
|
-
additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber,
|
|
451
|
+
additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber,
|
|
452
|
+
// statusは不要なので削除(2023-07-19~)
|
|
453
|
+
// reservationStatus: factory.reservationStatusType.ReservationPending,
|
|
454
|
+
reservedTicket: params.reservedTicket, underName: {
|
|
478
455
|
typeOf: params.agent.typeOf,
|
|
479
456
|
name: params.agent.name
|
|
480
457
|
}, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
|
|
@@ -96,7 +96,6 @@ type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail &
|
|
|
96
96
|
* 取引開始
|
|
97
97
|
*/
|
|
98
98
|
export declare function start(params: IStartParams & {
|
|
99
|
-
disablePendingReservations: boolean;
|
|
100
99
|
useHoldStockByTransactionNumber: boolean;
|
|
101
100
|
stockHoldUntilDaysAfterEventEnd: number;
|
|
102
101
|
}): IStartOperation<{
|
|
@@ -55,7 +55,7 @@ function start(params) {
|
|
|
55
55
|
now,
|
|
56
56
|
store: { id: (_c = params.availableAtOrFrom) === null || _c === void 0 ? void 0 : _c.id }
|
|
57
57
|
});
|
|
58
|
-
const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { reservationNumber: reservationNumber }));
|
|
58
|
+
const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { provider: { id: event.organizer.id }, reservationNumber: reservationNumber }));
|
|
59
59
|
// 取引作成
|
|
60
60
|
let transaction;
|
|
61
61
|
try {
|
|
@@ -139,20 +139,6 @@ function addReservations(params) {
|
|
|
139
139
|
// 予約イベント最適化
|
|
140
140
|
const reservationFor = (0, factory_1.createReservationFor)(event);
|
|
141
141
|
const { issuedThrough } = (0, factory_1.createIssuedThrough)({ reservationFor: event });
|
|
142
|
-
// const minimizedObjectSubReservations: factory.assetTransaction.reserve.IMinimizedObjectSubReservation[] =
|
|
143
|
-
// objectSubReservations.map((r) => {
|
|
144
|
-
// return {
|
|
145
|
-
// id: r.id,
|
|
146
|
-
// typeOf: r.typeOf,
|
|
147
|
-
// reservedTicket: {
|
|
148
|
-
// ticketType: r.reservedTicket.ticketType,
|
|
149
|
-
// ...(typeof r.reservedTicket.ticketedSeat?.typeOf === 'string')
|
|
150
|
-
// ? { ticketedSeat: r.reservedTicket.ticketedSeat }
|
|
151
|
-
// : undefined
|
|
152
|
-
// },
|
|
153
|
-
// ...(Array.isArray(r.subReservation)) ? { subReservation: r.subReservation } : undefined
|
|
154
|
-
// };
|
|
155
|
-
// });
|
|
156
142
|
// 取引に予約追加
|
|
157
143
|
let lockedOfferRateLimitKeys = [];
|
|
158
144
|
try {
|
|
@@ -165,9 +151,7 @@ function addReservations(params) {
|
|
|
165
151
|
// issuedThroughを追加(2023-06-05~)
|
|
166
152
|
issuedThrough,
|
|
167
153
|
reservationFor,
|
|
168
|
-
// subReservationにreservationForを保管しない(2021-10-19~)
|
|
169
154
|
subReservation: objectSubReservations
|
|
170
|
-
// subReservation: minimizedObjectSubReservations
|
|
171
155
|
}
|
|
172
156
|
});
|
|
173
157
|
}
|
|
@@ -191,10 +175,11 @@ function addReservations(params) {
|
|
|
191
175
|
},
|
|
192
176
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
193
177
|
})(repos);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
178
|
+
// 完全廃止(2023-07-19~)
|
|
179
|
+
// if (transaction.object.disablePendingReservations !== true) {
|
|
180
|
+
// // 予約作成(insertManyで実装)
|
|
181
|
+
// await repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
|
|
182
|
+
// }
|
|
198
183
|
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
199
184
|
yield onReservationsCreated({ event })(repos);
|
|
200
185
|
return { transaction, objectSubReservations, issuedThrough };
|
|
@@ -67,7 +67,8 @@ function authorize(params) {
|
|
|
67
67
|
unitPriceOffers,
|
|
68
68
|
validateEvent: params.validateEvent === true,
|
|
69
69
|
validateEventOfferPeriod: params.validateEventOfferPeriod === true,
|
|
70
|
-
|
|
70
|
+
// 完全廃止(2023-07-19~)
|
|
71
|
+
// disablePendingReservations: params.disablePendingReservations,
|
|
71
72
|
useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber,
|
|
72
73
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
73
74
|
})(repos);
|
|
@@ -165,7 +166,10 @@ function processStartReserve4chevre(params) {
|
|
|
165
166
|
// requestBody = startParams;
|
|
166
167
|
const startParamObject = yield validateObjectWithoutDetail(startParams)(repos);
|
|
167
168
|
// 予約取引開始
|
|
168
|
-
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true,
|
|
169
|
+
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true,
|
|
170
|
+
// 完全廃止(2023-07-19~)
|
|
171
|
+
// disablePendingReservations: params.disablePendingReservations,
|
|
172
|
+
useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }))(repos);
|
|
169
173
|
responseBody = startReserveTransactionResult.transaction;
|
|
170
174
|
// 予約取引からオファー情報を生成する
|
|
171
175
|
acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|