@chevre/domain 21.4.0-alpha.3 → 21.4.0-alpha.30
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/cleanActions.ts +23 -0
- package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
- package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
- package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
- package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
- package/example/src/chevre/migrateEventOrganizer.ts +125 -0
- package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
- package/example/src/chevre/migrateReservationProvider.ts +119 -0
- package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/example/src/chevre/searchEvents.ts +1 -9
- package/example/src/chevre/searchPermissions.ts +7 -15
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/action.d.ts +6 -0
- package/lib/chevre/repo/action.js +13 -0
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.d.ts +25 -4
- package/lib/chevre/repo/event.js +122 -60
- package/lib/chevre/repo/member.d.ts +76 -1
- package/lib/chevre/repo/member.js +81 -20
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
- package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
- package/lib/chevre/repo/mongoose/schemas/member.js +12 -6
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
- package/lib/chevre/repo/order.d.ts +21 -0
- package/lib/chevre/repo/order.js +54 -62
- package/lib/chevre/repo/place.d.ts +57 -16
- package/lib/chevre/repo/place.js +112 -167
- package/lib/chevre/repo/product.d.ts +2 -4
- package/lib/chevre/repo/product.js +52 -7
- package/lib/chevre/repo/reservation.d.ts +33 -21
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/repo/seller.d.ts +18 -5
- package/lib/chevre/repo/seller.js +53 -46
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/registerService.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +10 -4
- package/lib/chevre/service/assetTransaction/reserve/factory.js +21 -40
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +7 -22
- package/lib/chevre/service/event/createEvent.d.ts +11 -0
- package/lib/chevre/service/event/createEvent.js +112 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +26 -26
- package/lib/chevre/service/iam.d.ts +5 -0
- package/lib/chevre/service/iam.js +7 -19
- package/lib/chevre/service/moneyTransfer.js +1 -1
- 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/offer/event/searchEventTicketOffers.js +16 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +8 -1
- package/lib/chevre/service/order/sendOrder.js +8 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +14 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
- package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
- package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
- package/example/src/chevre/searchScreeningRooms.ts +0 -33
- package/example/src/chevre/syncScreeningRooms.ts +0 -21
- package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
|
@@ -34,7 +34,7 @@ class MongoRepository {
|
|
|
34
34
|
}
|
|
35
35
|
// tslint:disable-next-line:max-func-body-length
|
|
36
36
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
38
38
|
// MongoDB検索条件
|
|
39
39
|
const andConditions = [];
|
|
40
40
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -45,6 +45,11 @@ class MongoRepository {
|
|
|
45
45
|
if (typeof idEq === 'string') {
|
|
46
46
|
andConditions.push({ _id: { $eq: idEq } });
|
|
47
47
|
}
|
|
48
|
+
// メンバー条件追加(2023-07-24~)
|
|
49
|
+
const memberMemberOfIdIn = (_f = (_e = (_d = params.member) === null || _d === void 0 ? void 0 : _d.memberOf) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$in;
|
|
50
|
+
if (Array.isArray(memberMemberOfIdIn)) {
|
|
51
|
+
andConditions.push({ _id: { $in: memberMemberOfIdIn } });
|
|
52
|
+
}
|
|
48
53
|
const nameRegex = params.name;
|
|
49
54
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
50
55
|
andConditions.push({
|
|
@@ -64,7 +69,7 @@ class MongoRepository {
|
|
|
64
69
|
]
|
|
65
70
|
});
|
|
66
71
|
}
|
|
67
|
-
const branchCodeEq = (
|
|
72
|
+
const branchCodeEq = (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
68
73
|
if (typeof branchCodeEq === 'string') {
|
|
69
74
|
andConditions.push({
|
|
70
75
|
branchCode: {
|
|
@@ -72,7 +77,7 @@ class MongoRepository {
|
|
|
72
77
|
}
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
|
-
const branchCodeRegex = (
|
|
80
|
+
const branchCodeRegex = (_h = params.branchCode) === null || _h === void 0 ? void 0 : _h.$regex;
|
|
76
81
|
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
77
82
|
andConditions.push({
|
|
78
83
|
branchCode: {
|
|
@@ -80,7 +85,7 @@ class MongoRepository {
|
|
|
80
85
|
}
|
|
81
86
|
});
|
|
82
87
|
}
|
|
83
|
-
const additionalPropertyAll = (
|
|
88
|
+
const additionalPropertyAll = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$all;
|
|
84
89
|
if (Array.isArray(additionalPropertyAll)) {
|
|
85
90
|
andConditions.push({
|
|
86
91
|
additionalProperty: {
|
|
@@ -89,7 +94,7 @@ class MongoRepository {
|
|
|
89
94
|
}
|
|
90
95
|
});
|
|
91
96
|
}
|
|
92
|
-
const additionalPropertyIn = (
|
|
97
|
+
const additionalPropertyIn = (_k = params.additionalProperty) === null || _k === void 0 ? void 0 : _k.$in;
|
|
93
98
|
if (Array.isArray(additionalPropertyIn)) {
|
|
94
99
|
andConditions.push({
|
|
95
100
|
additionalProperty: {
|
|
@@ -98,7 +103,7 @@ class MongoRepository {
|
|
|
98
103
|
}
|
|
99
104
|
});
|
|
100
105
|
}
|
|
101
|
-
const additionalPropertyNin = (
|
|
106
|
+
const additionalPropertyNin = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$nin;
|
|
102
107
|
if (Array.isArray(additionalPropertyNin)) {
|
|
103
108
|
andConditions.push({
|
|
104
109
|
additionalProperty: {
|
|
@@ -106,7 +111,7 @@ class MongoRepository {
|
|
|
106
111
|
}
|
|
107
112
|
});
|
|
108
113
|
}
|
|
109
|
-
const additionalPropertyElemMatch = (
|
|
114
|
+
const additionalPropertyElemMatch = (_m = params.additionalProperty) === null || _m === void 0 ? void 0 : _m.$elemMatch;
|
|
110
115
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
111
116
|
andConditions.push({
|
|
112
117
|
additionalProperty: {
|
|
@@ -115,7 +120,7 @@ class MongoRepository {
|
|
|
115
120
|
}
|
|
116
121
|
});
|
|
117
122
|
}
|
|
118
|
-
const hasMerchantReturnPolicyItemConditionIdEq = (
|
|
123
|
+
const hasMerchantReturnPolicyItemConditionIdEq = (_q = (_p = (_o = params.hasMerchantReturnPolicy) === null || _o === void 0 ? void 0 : _o.itemCondition) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.$eq;
|
|
119
124
|
if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
|
|
120
125
|
andConditions.push({
|
|
121
126
|
'hasMerchantReturnPolicy.itemCondition.id': {
|
|
@@ -128,37 +133,39 @@ class MongoRepository {
|
|
|
128
133
|
}
|
|
129
134
|
/**
|
|
130
135
|
* 特定販売者検索
|
|
136
|
+
* searchに置き換え(2023-07-13~)
|
|
131
137
|
*/
|
|
132
|
-
findById(
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
138
|
+
// public async findById(
|
|
139
|
+
// conditions: {
|
|
140
|
+
// id: string;
|
|
141
|
+
// },
|
|
142
|
+
// inclusion: string[],
|
|
143
|
+
// exclusion: string[]
|
|
144
|
+
// ): Promise<ISeller> {
|
|
145
|
+
// let projection: { [key: string]: number } = {};
|
|
146
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
147
|
+
// inclusion.forEach((field) => {
|
|
148
|
+
// projection[field] = 1;
|
|
149
|
+
// });
|
|
150
|
+
// } else {
|
|
151
|
+
// projection = {
|
|
152
|
+
// __v: 0,
|
|
153
|
+
// createdAt: 0,
|
|
154
|
+
// updatedAt: 0
|
|
155
|
+
// };
|
|
156
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
157
|
+
// exclusion.forEach((field) => {
|
|
158
|
+
// projection[field] = 0;
|
|
159
|
+
// });
|
|
160
|
+
// }
|
|
161
|
+
// }
|
|
162
|
+
// const doc = await this.organizationModel.findOne({ _id: conditions.id }, projection)
|
|
163
|
+
// .exec();
|
|
164
|
+
// if (doc === null) {
|
|
165
|
+
// throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
166
|
+
// }
|
|
167
|
+
// return doc.toObject();
|
|
168
|
+
// }
|
|
162
169
|
/**
|
|
163
170
|
* 販売者を保管する
|
|
164
171
|
*/
|
|
@@ -172,7 +179,10 @@ class MongoRepository {
|
|
|
172
179
|
else {
|
|
173
180
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
174
181
|
const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
|
|
175
|
-
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
182
|
+
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
183
|
+
_id: params.id,
|
|
184
|
+
'project.id': { $eq: project.id }
|
|
185
|
+
}, updateFields, { upsert: false, new: true })
|
|
176
186
|
.exec();
|
|
177
187
|
if (doc === null) {
|
|
178
188
|
throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
@@ -182,12 +192,6 @@ class MongoRepository {
|
|
|
182
192
|
return organization;
|
|
183
193
|
});
|
|
184
194
|
}
|
|
185
|
-
// public async count(params: factory.seller.ISearchConditions): Promise<number> {
|
|
186
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
187
|
-
// return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
188
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
189
|
-
// .exec();
|
|
190
|
-
// }
|
|
191
195
|
/**
|
|
192
196
|
* 販売者検索
|
|
193
197
|
*/
|
|
@@ -270,7 +274,10 @@ class MongoRepository {
|
|
|
270
274
|
*/
|
|
271
275
|
deleteById(params) {
|
|
272
276
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
-
yield this.organizationModel.findOneAndRemove({
|
|
277
|
+
yield this.organizationModel.findOneAndRemove({
|
|
278
|
+
_id: params.id,
|
|
279
|
+
'project.id': { $eq: params.project.id }
|
|
280
|
+
})
|
|
274
281
|
.exec();
|
|
275
282
|
});
|
|
276
283
|
}
|
|
@@ -63,7 +63,7 @@ export declare class MongoRepository {
|
|
|
63
63
|
*/
|
|
64
64
|
$nin?: factory.taskName[];
|
|
65
65
|
};
|
|
66
|
-
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
66
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
67
67
|
retry(params: {
|
|
68
68
|
intervalInMinutes: number;
|
|
69
69
|
}): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
1
|
+
import { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../../repo/event';
|
|
2
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
4
|
import { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
@@ -28,5 +28,5 @@ export declare function aggregateScreeningEvent(params: {
|
|
|
28
28
|
id: string;
|
|
29
29
|
}): IAggregateScreeningEventOperation<void>;
|
|
30
30
|
export declare function aggregateByEvent(params: {
|
|
31
|
-
event: factory.
|
|
31
|
+
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
32
32
|
}): IAggregateScreeningEventOperation<void>;
|
|
@@ -80,6 +80,7 @@ function aggregateByEvent(params) {
|
|
|
80
80
|
movieTheaterId = String((_a = params.event.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.availableChannel.serviceLocation.containedInPlace.id);
|
|
81
81
|
}
|
|
82
82
|
const screeningRoom = yield repos.place.findScreeningRoomsByBranchCode({
|
|
83
|
+
project: { id: event.project.id },
|
|
83
84
|
branchCode: { $eq: event.location.branchCode },
|
|
84
85
|
containedInPlace: { id: { $eq: movieTheaterId } }
|
|
85
86
|
});
|
|
@@ -174,7 +175,7 @@ function findOffers(params) {
|
|
|
174
175
|
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
175
176
|
const eventOffers = params.event.offers;
|
|
176
177
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
177
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
178
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
178
179
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
179
180
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
180
181
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
@@ -208,7 +209,7 @@ function calculateOfferCount(params) {
|
|
|
208
209
|
try {
|
|
209
210
|
const eventOffers = params.event.offers;
|
|
210
211
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
211
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
212
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
212
213
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
213
214
|
const catalogs = yield repos.offerCatalog.search({
|
|
214
215
|
limit: 1,
|
|
@@ -100,7 +100,7 @@ function findOffers(params) {
|
|
|
100
100
|
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
101
101
|
const eventOffers = params.event.offers;
|
|
102
102
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
103
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
103
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
104
104
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
105
105
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
106
106
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
@@ -28,7 +28,15 @@ function validateAccount(params) {
|
|
|
28
28
|
if (typeof sellerId !== 'string') {
|
|
29
29
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: sellerId }
|
|
35
|
+
}, ['paymentAccepted'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
33
41
|
if (paymentAccepted !== true) {
|
|
34
42
|
throw new factory.errors.Argument('recipient', `payment not accepted`);
|
|
@@ -210,7 +210,15 @@ function validateSeller(params) {
|
|
|
210
210
|
if (typeof sellerId !== 'string') {
|
|
211
211
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const sellers = yield repos.seller.search({
|
|
214
|
+
limit: 1,
|
|
215
|
+
page: 1,
|
|
216
|
+
id: { $eq: sellerId }
|
|
217
|
+
}, ['paymentAccepted'], []);
|
|
218
|
+
const seller = sellers.shift();
|
|
219
|
+
if (seller === undefined) {
|
|
220
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
|
+
}
|
|
214
222
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
215
223
|
if (typeof paymentMethodType !== 'string') {
|
|
216
224
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -40,7 +40,7 @@ function start(params) {
|
|
|
40
40
|
throw new factory.errors.ArgumentNull('object.itemOffered.id');
|
|
41
41
|
}
|
|
42
42
|
// プロダクト確認
|
|
43
|
-
const product = yield repos.product.findById({ id: productId });
|
|
43
|
+
const product = yield repos.product.findById({ id: productId }, [], []);
|
|
44
44
|
const transactionNumber = params.transactionNumber;
|
|
45
45
|
if (typeof transactionNumber !== 'string' || transactionNumber.length === 0) {
|
|
46
46
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
@@ -124,7 +124,7 @@ function createTransactionObject(params) {
|
|
|
124
124
|
function createPermitService(params) {
|
|
125
125
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
126
126
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
127
|
-
const product = yield repos.product.findById({ id: params.issuedThrough.id });
|
|
127
|
+
const product = yield repos.product.findById({ id: params.issuedThrough.id }, [], []);
|
|
128
128
|
const permitServiceEndpoint = (_a = product.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
129
129
|
const permitServiceAuthorizeServerDomain = (_c = (_b = product.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
130
130
|
const permitServiceClientId = (_e = (_d = product.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
2
3
|
import { IAcceptedAddOn } from './factory/price';
|
|
3
4
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
4
5
|
export { IAcceptedAddOn };
|
|
5
6
|
export declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
|
|
7
|
+
provider: {
|
|
8
|
+
/**
|
|
9
|
+
* 販売者ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
6
13
|
reservationNumber: string;
|
|
7
|
-
disablePendingReservations: boolean;
|
|
8
14
|
useHoldStockByTransactionNumber: boolean;
|
|
9
15
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve>;
|
|
10
16
|
/**
|
|
@@ -46,9 +52,9 @@ export declare function createAdditionalTicketText(params: {
|
|
|
46
52
|
reservedTicket: factory.reservation.ITicket;
|
|
47
53
|
}): string | undefined;
|
|
48
54
|
export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
49
|
-
export declare function createReservationFor(params: factory.
|
|
55
|
+
export declare function createReservationFor(params: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>): factory.assetTransaction.reserve.IReservationFor;
|
|
50
56
|
export declare function createIssuedThrough(params: {
|
|
51
|
-
reservationFor: factory.
|
|
57
|
+
reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
52
58
|
}): {
|
|
53
59
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
54
60
|
};
|
|
@@ -61,7 +67,7 @@ export declare function createReservation(params: {
|
|
|
61
67
|
reserveDate: Date;
|
|
62
68
|
agent: factory.assetTransaction.reserve.IAgent;
|
|
63
69
|
reservationNumber: string;
|
|
64
|
-
reservationFor: factory.
|
|
70
|
+
reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
65
71
|
reservedTicket: factory.reservation.ITicket;
|
|
66
72
|
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
67
73
|
additionalTicketText?: string;
|
|
@@ -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,
|
|
@@ -327,7 +331,9 @@ function createAdditionalTicketText(params) {
|
|
|
327
331
|
return (_b = (_a = params.acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.additionalTicketText;
|
|
328
332
|
}
|
|
329
333
|
exports.createAdditionalTicketText = createAdditionalTicketText;
|
|
330
|
-
function createReservationFor(
|
|
334
|
+
function createReservationFor(
|
|
335
|
+
// params: factory.event.screeningEvent.IEvent | factory.event.event.IEvent
|
|
336
|
+
params) {
|
|
331
337
|
var _a, _b;
|
|
332
338
|
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
333
339
|
return Object.assign({ endDate: params.endDate, id: params.id, location: params.location, name: params.name, startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params), typeOf: params.typeOf }, (params.doorTime instanceof Date)
|
|
@@ -343,7 +349,9 @@ function createReservationFor(params) {
|
|
|
343
349
|
}
|
|
344
350
|
}
|
|
345
351
|
exports.createReservationFor = createReservationFor;
|
|
346
|
-
function optimizeReservationSuperEvent(
|
|
352
|
+
function optimizeReservationSuperEvent(
|
|
353
|
+
// params: factory.event.screeningEvent.IEvent
|
|
354
|
+
params) {
|
|
347
355
|
const superEvent = params.superEvent;
|
|
348
356
|
return Object.assign(Object.assign({ additionalProperty: (Array.isArray(superEvent.additionalProperty))
|
|
349
357
|
? superEvent.additionalProperty
|
|
@@ -409,36 +417,14 @@ function createReservation(params) {
|
|
|
409
417
|
}
|
|
410
418
|
// priceを最適化
|
|
411
419
|
const price4reservation = (0, price_1.createPrice)(params);
|
|
412
|
-
// const eventOffers = <factory.event.screeningEvent.IOffer | undefined>params.reservationFor.offers;
|
|
413
|
-
// // offersは必ず存在するはず
|
|
414
|
-
// if (eventOffers === undefined) {
|
|
415
|
-
// throw new factory.errors.NotFound('reservationFor.offers');
|
|
416
|
-
// }
|
|
417
|
-
// const serviceTypeOfIssuedThrough: factory.reservation.eventReservation.IServiceTypeOfIssuedThrough | undefined
|
|
418
|
-
// = (typeof eventOffers.itemOffered.serviceType?.codeValue === 'string')
|
|
419
|
-
// ? {
|
|
420
|
-
// codeValue: eventOffers.itemOffered.serviceType.codeValue,
|
|
421
|
-
// inCodeSet: {
|
|
422
|
-
// typeOf: 'CategoryCodeSet',
|
|
423
|
-
// identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
|
|
424
|
-
// },
|
|
425
|
-
// typeOf: 'CategoryCode'
|
|
426
|
-
// }
|
|
427
|
-
// : undefined;
|
|
428
|
-
// const availableChannel: factory.reservation.IServiceChannel = eventOffers.itemOffered.availableChannel;
|
|
429
420
|
if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
|
|
430
|
-
// const issuedThrough: factory.reservation.eventReservation.IIssuedThrough = {
|
|
431
|
-
// typeOf: factory.product.ProductType.EventService,
|
|
432
|
-
// // 興行IDを追加(2022-09-08~)
|
|
433
|
-
// id: eventOffers.itemOffered.id,
|
|
434
|
-
// availableChannel,
|
|
435
|
-
// // issuedThrough.serviceTypeを連携
|
|
436
|
-
// ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
437
|
-
// };
|
|
438
421
|
return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id,
|
|
439
422
|
// reservationPackage保管に移行(2023-06-06~)
|
|
440
423
|
// issuedThrough,
|
|
441
|
-
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,
|
|
442
428
|
// 最適化(2022-12-19~)
|
|
443
429
|
underName: {
|
|
444
430
|
typeOf: params.agent.typeOf,
|
|
@@ -459,18 +445,13 @@ function createReservation(params) {
|
|
|
459
445
|
: undefined);
|
|
460
446
|
}
|
|
461
447
|
else {
|
|
462
|
-
// const issuedThrough: factory.reservation.busReservation.IIssuedThrough = {
|
|
463
|
-
// typeOf: factory.product.ProductType.Transportation,
|
|
464
|
-
// // 興行IDを追加(2022-09-08~)
|
|
465
|
-
// id: eventOffers.itemOffered.id,
|
|
466
|
-
// availableChannel,
|
|
467
|
-
// // issuedThrough.serviceTypeを連携
|
|
468
|
-
// ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
469
|
-
// };
|
|
470
448
|
return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id,
|
|
471
449
|
// reservationPackage保管に移行(2023-06-06~)
|
|
472
450
|
// issuedThrough,
|
|
473
|
-
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: {
|
|
474
455
|
typeOf: params.agent.typeOf,
|
|
475
456
|
name: params.agent.name
|
|
476
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 };
|
|
@@ -546,7 +531,7 @@ function validateProgramMembershipUsed(params) {
|
|
|
546
531
|
function createPermitService(params) {
|
|
547
532
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
548
533
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
549
|
-
const product = yield repos.product.findById({ id: params.issuedThrough.id });
|
|
534
|
+
const product = yield repos.product.findById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
550
535
|
const permitServiceEndpoint = (_a = product.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
551
536
|
const permitServiceAuthorizeServerDomain = (_c = (_b = product.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
552
537
|
const permitServiceClientId = (_e = (_d = product.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
|
+
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
|
+
import { MongoRepository as PlaceRepo } from '../../repo/place';
|
|
5
|
+
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
6
|
+
export declare function createEvent(params: factory.task.createEvent.IData): (repos: {
|
|
7
|
+
action: ActionRepo;
|
|
8
|
+
event: EventRepo;
|
|
9
|
+
place: PlaceRepo;
|
|
10
|
+
task: TaskRepo;
|
|
11
|
+
}) => Promise<void>;
|