@chevre/domain 24.0.0-alpha.80 → 24.0.0-alpha.81
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/errorHandler.d.ts +5 -0
- package/lib/chevre/errorHandler.js +26 -4
- package/lib/chevre/repo/accountingReport.js +2 -25
- package/lib/chevre/repo/aggregateOffer.js +11 -36
- package/lib/chevre/repo/event.js +2 -37
- package/lib/chevre/repo/eventSeries.js +0 -144
- package/lib/chevre/repo/message.js +1 -3
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
- package/lib/chevre/repo/order.js +2 -4
- package/lib/chevre/repo/ownershipInfo.js +2 -4
- package/lib/chevre/repo/passport.js +1 -1
- package/lib/chevre/repo/pendingReservation.js +2 -35
- package/lib/chevre/repo/task.js +5 -7
- package/lib/chevre/repo/transactionNumberCounter.js +4 -6
- package/lib/chevre/repository.d.ts +0 -8
- package/lib/chevre/repository.js +0 -14
- package/lib/chevre/service/aggregation/event/importFromCOA.js +4 -8
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +15 -23
- package/lib/chevre/service/event.js +4 -10
- package/lib/chevre/service/offer/event/importFromCOA/factory.js +0 -12
- package/lib/chevre/service/offer/event/importFromCOA.js +5 -16
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +5 -15
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +0 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +1 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +0 -15
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +2 -5
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +2 -3
- package/lib/chevre/service/offer/factory.js +6 -2
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/processSeatInfoSync.js +2 -2
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.js +2 -2
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.js +1 -2
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +10 -3
- package/lib/chevre/service/reserveCOA/cancelReservation.js +12 -16
- package/lib/chevre/service/taskHandler.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +26 -32
- package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -4
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +2 -5
- package/package.json +2 -2
- package/lib/chevre/repo/place/busStop.d.ts +0 -27
- package/lib/chevre/repo/place/busStop.js +0 -169
|
@@ -7,8 +7,13 @@ export declare enum MongoErrorCode {
|
|
|
7
7
|
ExceededTimeLimit = 262,
|
|
8
8
|
DuplicateKey = 11000
|
|
9
9
|
}
|
|
10
|
+
export declare function isMongoDuplicateError(error: unknown): Promise<boolean>;
|
|
10
11
|
export declare function isMongoError(error: unknown): Promise<boolean>;
|
|
11
12
|
export declare function handleMongoError(error: unknown): Promise<unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* COAServiceErrorかつクライアントエラーかどうか
|
|
15
|
+
*/
|
|
16
|
+
export declare function isCOAClientError(error: unknown): boolean;
|
|
12
17
|
/**
|
|
13
18
|
* 汎用的なCOAエラーハンドリング
|
|
14
19
|
*/
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME = exports.MongoErrorCode = void 0;
|
|
4
|
+
exports.isMongoDuplicateError = isMongoDuplicateError;
|
|
4
5
|
exports.isMongoError = isMongoError;
|
|
5
6
|
exports.handleMongoError = handleMongoError;
|
|
7
|
+
exports.isCOAClientError = isCOAClientError;
|
|
6
8
|
exports.handleCOAError = handleCOAError;
|
|
7
9
|
exports.handleCOAReserveTemporarilyError = handleCOAReserveTemporarilyError;
|
|
8
10
|
exports.handlePecorinoError = handlePecorinoError;
|
|
9
11
|
exports.handleMvtkReserveError = handleMvtkReserveError;
|
|
10
12
|
exports.handleAWSError = handleAWSError;
|
|
11
|
-
/**
|
|
12
|
-
* エラーハンドラー
|
|
13
|
-
* 外部サービスと連携している場合に、サービス(API)のエラーを本ドメインのエラーに変換する責任を担います。
|
|
14
|
-
*/
|
|
15
13
|
const http_status_1 = require("http-status");
|
|
16
14
|
const factory_1 = require("./factory");
|
|
17
15
|
let mongo;
|
|
@@ -26,6 +24,13 @@ var MongoErrorCode;
|
|
|
26
24
|
MongoErrorCode[MongoErrorCode["ExceededTimeLimit"] = 262] = "ExceededTimeLimit";
|
|
27
25
|
MongoErrorCode[MongoErrorCode["DuplicateKey"] = 11000] = "DuplicateKey";
|
|
28
26
|
})(MongoErrorCode || (exports.MongoErrorCode = MongoErrorCode = {}));
|
|
27
|
+
async function isMongoDuplicateError(error) {
|
|
28
|
+
if (mongo === undefined) {
|
|
29
|
+
mongo = (await import('mongoose')).mongo;
|
|
30
|
+
}
|
|
31
|
+
return (error instanceof mongo.MongoError || error instanceof mongo.MongoServerError)
|
|
32
|
+
&& error.code === MongoErrorCode.DuplicateKey;
|
|
33
|
+
}
|
|
29
34
|
async function isMongoError(error) {
|
|
30
35
|
if (mongo === undefined) {
|
|
31
36
|
mongo = (await import('mongoose')).mongo;
|
|
@@ -65,6 +70,23 @@ async function handleMongoError(error) {
|
|
|
65
70
|
}
|
|
66
71
|
return handledError;
|
|
67
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* COAServiceErrorかつクライアントエラーかどうか
|
|
75
|
+
*/
|
|
76
|
+
function isCOAClientError(error) {
|
|
77
|
+
if (error instanceof Error) {
|
|
78
|
+
// COAサービスエラーの場合ハンドリング
|
|
79
|
+
if (error.name === 'COAServiceError') {
|
|
80
|
+
// COAはクライアントエラーかサーバーエラーかに関わらずステータスコード200 or 500を返却する。
|
|
81
|
+
// 500未満であればクライアントエラーとみなす
|
|
82
|
+
if (typeof error.code === 'number'
|
|
83
|
+
&& error.code < http_status_1.status.INTERNAL_SERVER_ERROR) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
68
90
|
/**
|
|
69
91
|
* 汎用的なCOAエラーハンドリング
|
|
70
92
|
*/
|
|
@@ -73,27 +73,6 @@ class AccountingReportRepo {
|
|
|
73
73
|
}
|
|
74
74
|
return matchStages;
|
|
75
75
|
}
|
|
76
|
-
// public async createIfNotExist(params: IAccountingReport) {
|
|
77
|
-
// try {
|
|
78
|
-
// await this.accountingReportModel.findOneAndUpdate(
|
|
79
|
-
// { 'mainEntity.orderNumber': params.mainEntity.orderNumber },
|
|
80
|
-
// { $setOnInsert: params },
|
|
81
|
-
// { upsert: true }
|
|
82
|
-
// )
|
|
83
|
-
// .exec();
|
|
84
|
-
// } catch (error) {
|
|
85
|
-
// let throwsError = true;
|
|
86
|
-
// if (await isMongoError(error)) {
|
|
87
|
-
// // すでにorderNumberが存在する場合ok
|
|
88
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
89
|
-
// throwsError = false;
|
|
90
|
-
// }
|
|
91
|
-
// }
|
|
92
|
-
// if (throwsError) {
|
|
93
|
-
// throw error;
|
|
94
|
-
// }
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
76
|
async syncMainEntity(params) {
|
|
98
77
|
const setOnInsert = {
|
|
99
78
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
@@ -112,11 +91,9 @@ class AccountingReportRepo {
|
|
|
112
91
|
}
|
|
113
92
|
catch (error) {
|
|
114
93
|
let throwsError = true;
|
|
115
|
-
if (await (0, errorHandler_1.
|
|
94
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
116
95
|
// すでにorderNumberが存在する場合ok
|
|
117
|
-
|
|
118
|
-
throwsError = false;
|
|
119
|
-
}
|
|
96
|
+
throwsError = false;
|
|
120
97
|
}
|
|
121
98
|
if (throwsError) {
|
|
122
99
|
throw error;
|
|
@@ -110,17 +110,17 @@ class AggregateOfferRepo {
|
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
const eligibleMonetaryAmountCurrencyEq = params.eligibleMonetaryAmount?.currency?.$eq;
|
|
114
|
-
if (typeof eligibleMonetaryAmountCurrencyEq === 'string') {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
113
|
+
// const eligibleMonetaryAmountCurrencyEq = params.eligibleMonetaryAmount?.currency?.$eq;
|
|
114
|
+
// if (typeof eligibleMonetaryAmountCurrencyEq === 'string') {
|
|
115
|
+
// matchStages.push({
|
|
116
|
+
// $match: {
|
|
117
|
+
// 'offers.eligibleMonetaryAmount.currency': {
|
|
118
|
+
// $exists: true,
|
|
119
|
+
// $eq: eligibleMonetaryAmountCurrencyEq
|
|
120
|
+
// }
|
|
121
|
+
// }
|
|
122
|
+
// });
|
|
123
|
+
// }
|
|
124
124
|
const eligibleSeatingTypeCodeValueEq = params.eligibleSeatingType?.codeValue?.$eq;
|
|
125
125
|
if (typeof eligibleSeatingTypeCodeValueEq === 'string') {
|
|
126
126
|
matchStages.push({
|
|
@@ -722,31 +722,6 @@ class AggregateOfferRepo {
|
|
|
722
722
|
upsert: true
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
|
-
// updateBulkWriteOps.push({
|
|
726
|
-
// updateOne: {
|
|
727
|
-
// filter: {
|
|
728
|
-
// 'project.id': { $eq: aggregateOffer.project.id },
|
|
729
|
-
// 'offers.identifier': { $exists: true, $eq: subOffer.identifier }
|
|
730
|
-
// },
|
|
731
|
-
// update: {
|
|
732
|
-
// // 特定の属性のみ更新する(IDを上書きできないので)
|
|
733
|
-
// $set: {
|
|
734
|
-
// 'offers.0.name': subOffer.name,
|
|
735
|
-
// 'offers.0.description': subOffer.description,
|
|
736
|
-
// 'offers.0.alternateName': subOffer.alternateName,
|
|
737
|
-
// 'offers.0.priceSpecification': subOffer.priceSpecification,
|
|
738
|
-
// 'offers.0.additionalProperty': subOffer.additionalProperty,
|
|
739
|
-
// ...(Array.isArray(subOffer.eligibleMembershipType))
|
|
740
|
-
// ? { 'offers.0.eligibleMembershipType': subOffer.eligibleMembershipType }
|
|
741
|
-
// : undefined,
|
|
742
|
-
// ...(Array.isArray(subOffer.eligibleMonetaryAmount))
|
|
743
|
-
// ? { 'offers.0.eligibleMonetaryAmount': subOffer.eligibleMonetaryAmount }
|
|
744
|
-
// : undefined
|
|
745
|
-
// },
|
|
746
|
-
// },
|
|
747
|
-
// upsert: false
|
|
748
|
-
// }
|
|
749
|
-
// });
|
|
750
725
|
});
|
|
751
726
|
}
|
|
752
727
|
if (insertBulkWriteOps.length > 0) {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -264,39 +264,6 @@ class EventRepo {
|
|
|
264
264
|
}
|
|
265
265
|
return andConditions;
|
|
266
266
|
}
|
|
267
|
-
// /**
|
|
268
|
-
// * 複数イベントを作成する
|
|
269
|
-
// */
|
|
270
|
-
// public async createManyEvents(params: {
|
|
271
|
-
// attributes: factory.event.screeningEvent.IAttributes[];
|
|
272
|
-
// expectsNoContent: boolean;
|
|
273
|
-
// }): Promise<string[] | void> { // optimize response(only id)(2024-08-02~)
|
|
274
|
-
// const insertingDocs: (factory.event.screeningEvent.IAttributes & { _id: string })[] =
|
|
275
|
-
// params.attributes.map((p) => {
|
|
276
|
-
// return {
|
|
277
|
-
// _id: EventRepo.CREATE_ID(),
|
|
278
|
-
// ...p
|
|
279
|
-
// };
|
|
280
|
-
// });
|
|
281
|
-
// try {
|
|
282
|
-
// await this.eventModel.insertMany<factory.event.screeningEvent.IAttributes & { _id: string }>(
|
|
283
|
-
// insertingDocs,
|
|
284
|
-
// { rawResult: true } // rawResult(2024-08-02~)
|
|
285
|
-
// );
|
|
286
|
-
// // console.dir(insertResult, { depth: null });
|
|
287
|
-
// } catch (error) {
|
|
288
|
-
// if (await isMongoError(error)) {
|
|
289
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
290
|
-
// throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEvent, ['offeredBy.member.identifier']);
|
|
291
|
-
// }
|
|
292
|
-
// }
|
|
293
|
-
// throw error;
|
|
294
|
-
// }
|
|
295
|
-
// if (params.expectsNoContent) {
|
|
296
|
-
// return;
|
|
297
|
-
// }
|
|
298
|
-
// return insertingDocs.map(({ _id }) => _id);
|
|
299
|
-
// }
|
|
300
267
|
/**
|
|
301
268
|
* イベントコードをキーにして冪等置換
|
|
302
269
|
*/
|
|
@@ -444,10 +411,8 @@ class EventRepo {
|
|
|
444
411
|
.exec();
|
|
445
412
|
}
|
|
446
413
|
catch (error) {
|
|
447
|
-
if (await (0, errorHandler_1.
|
|
448
|
-
|
|
449
|
-
throw new factory_1.factory.errors.AlreadyInUse(factory_1.factory.eventType.ScreeningEvent, ['offeredBy.member.identifier']);
|
|
450
|
-
}
|
|
414
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
415
|
+
throw new factory_1.factory.errors.AlreadyInUse(factory_1.factory.eventType.ScreeningEvent, ['offeredBy.member.identifier']);
|
|
451
416
|
}
|
|
452
417
|
throw error;
|
|
453
418
|
}
|
|
@@ -192,88 +192,6 @@ class EventSeriesRepo {
|
|
|
192
192
|
}
|
|
193
193
|
return andConditions;
|
|
194
194
|
}
|
|
195
|
-
// /**
|
|
196
|
-
// * 複数イベントを作成する
|
|
197
|
-
// */
|
|
198
|
-
// public async createManyEventSeries(params: {
|
|
199
|
-
// attributes: factory.eventSeries.IAttributes[];
|
|
200
|
-
// expectsNoContent: boolean;
|
|
201
|
-
// }): Promise<string[] | void> { // optimize response(only id)(2024-08-02~)
|
|
202
|
-
// const { default: uniqid } = await import('uniqid');
|
|
203
|
-
// const insertingDocs: (factory.eventSeries.IAttributes & { _id: string })[] =
|
|
204
|
-
// params.attributes.map((p) => {
|
|
205
|
-
// return {
|
|
206
|
-
// _id: uniqid(),
|
|
207
|
-
// ...p
|
|
208
|
-
// };
|
|
209
|
-
// });
|
|
210
|
-
// try {
|
|
211
|
-
// await this.eventSeriesModel.insertMany<factory.eventSeries.IAttributes & { _id: string }>(
|
|
212
|
-
// insertingDocs,
|
|
213
|
-
// { rawResult: true } // rawResult(2024-08-02~)
|
|
214
|
-
// );
|
|
215
|
-
// // console.dir(insertResult, { depth: null });
|
|
216
|
-
// } catch (error) {
|
|
217
|
-
// if (await isMongoError(error)) {
|
|
218
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
219
|
-
// throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
|
|
220
|
-
// }
|
|
221
|
-
// }
|
|
222
|
-
// throw error;
|
|
223
|
-
// }
|
|
224
|
-
// if (params.expectsNoContent) {
|
|
225
|
-
// return;
|
|
226
|
-
// }
|
|
227
|
-
// return insertingDocs.map(({ _id }) => _id);
|
|
228
|
-
// }
|
|
229
|
-
// /**
|
|
230
|
-
// * コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
|
|
231
|
-
// */
|
|
232
|
-
// public async createIfNotExistByWorkPerformed(params: {
|
|
233
|
-
// attributes: factory.eventSeries.IAttributes;
|
|
234
|
-
// }[]): Promise<BulkWriteResult | void> {
|
|
235
|
-
// const { default: uniqid } = await import('uniqid');
|
|
236
|
-
// const bulkWriteOps: AnyBulkWriteOperation<IDocType>[] = [];
|
|
237
|
-
// if (Array.isArray(params)) {
|
|
238
|
-
// params.forEach((creatingEventParams) => {
|
|
239
|
-
// const version = creatingEventParams.attributes.workPerformed.version;
|
|
240
|
-
// if (typeof version !== 'string') {
|
|
241
|
-
// throw new factory.errors.ArgumentNull('workPerformed.version');
|
|
242
|
-
// }
|
|
243
|
-
// const setOnInsertFields = creatingEventParams.attributes;
|
|
244
|
-
// bulkWriteOps.push({
|
|
245
|
-
// updateOne: {
|
|
246
|
-
// filter: {
|
|
247
|
-
// typeOf: creatingEventParams.attributes.typeOf,
|
|
248
|
-
// 'project.id': { $eq: creatingEventParams.attributes.project.id },
|
|
249
|
-
// 'location.branchCode': {
|
|
250
|
-
// $exists: true,
|
|
251
|
-
// $eq: creatingEventParams.attributes.location.branchCode
|
|
252
|
-
// },
|
|
253
|
-
// 'workPerformed.identifier': {
|
|
254
|
-
// $exists: true,
|
|
255
|
-
// $eq: creatingEventParams.attributes.workPerformed.identifier
|
|
256
|
-
// },
|
|
257
|
-
// 'workPerformed.version': {
|
|
258
|
-
// $exists: true,
|
|
259
|
-
// $eq: version
|
|
260
|
-
// }
|
|
261
|
-
// },
|
|
262
|
-
// update: {
|
|
263
|
-
// $setOnInsert: {
|
|
264
|
-
// ...setOnInsertFields,
|
|
265
|
-
// _id: uniqid()
|
|
266
|
-
// }
|
|
267
|
-
// },
|
|
268
|
-
// upsert: true
|
|
269
|
-
// }
|
|
270
|
-
// });
|
|
271
|
-
// });
|
|
272
|
-
// }
|
|
273
|
-
// if (bulkWriteOps.length > 0) {
|
|
274
|
-
// return this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
275
|
-
// }
|
|
276
|
-
// }
|
|
277
195
|
/**
|
|
278
196
|
* 施設+コンテンツ+バージョンをキーにして冪等置換
|
|
279
197
|
*/
|
|
@@ -356,68 +274,6 @@ class EventSeriesRepo {
|
|
|
356
274
|
}
|
|
357
275
|
return { modifiedEvents: [] };
|
|
358
276
|
}
|
|
359
|
-
// public async saveEventSeries(params: {
|
|
360
|
-
// id?: string;
|
|
361
|
-
// attributes: factory.eventSeries.IAttributes;
|
|
362
|
-
// /**
|
|
363
|
-
// * ドキュメント作成時には無視される
|
|
364
|
-
// */
|
|
365
|
-
// $unset?: IUnset;
|
|
366
|
-
// // upsert?: boolean;
|
|
367
|
-
// }): Promise<{ id: string }> {
|
|
368
|
-
// let savedEventId: string;
|
|
369
|
-
// let doc: Document | { _id: string } | null;
|
|
370
|
-
// const { identifier, project, typeOf, ...updateFields } = params.attributes;
|
|
371
|
-
// if (typeof typeOf !== 'string' || typeOf.length === 0) {
|
|
372
|
-
// throw new factory.errors.ArgumentNull('attributes.typeOf');
|
|
373
|
-
// }
|
|
374
|
-
// try {
|
|
375
|
-
// if (params.id === undefined) {
|
|
376
|
-
// const { default: uniqid } = await import('uniqid');
|
|
377
|
-
// const id = uniqid();
|
|
378
|
-
// doc = await this.eventSeriesModel.create({ ...params.attributes, _id: id });
|
|
379
|
-
// savedEventId = id;
|
|
380
|
-
// } else {
|
|
381
|
-
// // const upsert: boolean = params.upsert === true;
|
|
382
|
-
// const upsert: boolean = false;
|
|
383
|
-
// doc = await this.eventSeriesModel.findOneAndUpdate(
|
|
384
|
-
// {
|
|
385
|
-
// _id: { $eq: params.id },
|
|
386
|
-
// typeOf: { $eq: typeOf }
|
|
387
|
-
// },
|
|
388
|
-
// {
|
|
389
|
-
// // 上書き禁止属性を除外(2022-08-24~)
|
|
390
|
-
// $setOnInsert: {
|
|
391
|
-
// typeOf,
|
|
392
|
-
// project,
|
|
393
|
-
// ...(identifier !== undefined) ? { identifier } : undefined
|
|
394
|
-
// },
|
|
395
|
-
// $set: updateFields,
|
|
396
|
-
// ...(params.$unset !== undefined) ? { $unset: params.$unset } : undefined
|
|
397
|
-
// },
|
|
398
|
-
// {
|
|
399
|
-
// upsert,
|
|
400
|
-
// new: true,
|
|
401
|
-
// projection: { _id: 1 }
|
|
402
|
-
// }
|
|
403
|
-
// )
|
|
404
|
-
// .lean<{ _id: string }>()
|
|
405
|
-
// .exec();
|
|
406
|
-
// savedEventId = params.id;
|
|
407
|
-
// }
|
|
408
|
-
// } catch (error) {
|
|
409
|
-
// if (await isMongoError(error)) {
|
|
410
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
411
|
-
// throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
|
|
412
|
-
// }
|
|
413
|
-
// }
|
|
414
|
-
// throw error;
|
|
415
|
-
// }
|
|
416
|
-
// if (doc === null) {
|
|
417
|
-
// throw new factory.errors.NotFound(this.eventSeriesModel.modelName);
|
|
418
|
-
// }
|
|
419
|
-
// return { id: savedEventId }; // optimize(2024-07-31~)
|
|
420
|
-
// }
|
|
421
277
|
/**
|
|
422
278
|
* sskts施設コンテンツ保管
|
|
423
279
|
*/
|
|
@@ -187,11 +187,9 @@ class MessageRepo {
|
|
|
187
187
|
catch (error) {
|
|
188
188
|
const throwsError = true;
|
|
189
189
|
// ひとまず保留
|
|
190
|
-
// if (await
|
|
190
|
+
// if (await isMongoDuplicateError(error)) {
|
|
191
191
|
// // すでにidentifierが存在する場合ok
|
|
192
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
193
192
|
// throwsError = false;
|
|
194
|
-
// }
|
|
195
193
|
// }
|
|
196
194
|
if (throwsError) {
|
|
197
195
|
throw error;
|
|
@@ -50,7 +50,7 @@ class OfferRepo {
|
|
|
50
50
|
eligibleCustomerType: '$offers.eligibleCustomerType',
|
|
51
51
|
eligibleDuration: '$offers.eligibleDuration',
|
|
52
52
|
eligibleMembershipType: '$offers.eligibleMembershipType',
|
|
53
|
-
eligibleMonetaryAmount: '$offers.eligibleMonetaryAmount',
|
|
53
|
+
// eligibleMonetaryAmount: '$offers.eligibleMonetaryAmount', // discontinue(2026-04-19~)
|
|
54
54
|
eligibleQuantity: '$offers.eligibleQuantity',
|
|
55
55
|
eligibleRegion: '$offers.eligibleRegion',
|
|
56
56
|
eligibleSeatingType: '$offers.eligibleSeatingType',
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -668,11 +668,9 @@ class OrderRepo {
|
|
|
668
668
|
}
|
|
669
669
|
catch (error) {
|
|
670
670
|
let throwsError = true;
|
|
671
|
-
if (await (0, errorHandler_1.
|
|
671
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
672
672
|
// すでにorderNumberが存在する場合ok
|
|
673
|
-
|
|
674
|
-
throwsError = false;
|
|
675
|
-
}
|
|
673
|
+
throwsError = false;
|
|
676
674
|
}
|
|
677
675
|
if (throwsError) {
|
|
678
676
|
throw error;
|
|
@@ -230,11 +230,9 @@ class OwnershipInfoRepo {
|
|
|
230
230
|
.exec();
|
|
231
231
|
}
|
|
232
232
|
catch (error) {
|
|
233
|
-
if (await (0, errorHandler_1.
|
|
233
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
234
234
|
// すでに所有権が存在する場合ok
|
|
235
|
-
|
|
236
|
-
duplicate = true;
|
|
237
|
-
}
|
|
235
|
+
duplicate = true;
|
|
238
236
|
}
|
|
239
237
|
if (!duplicate) {
|
|
240
238
|
throw error;
|
|
@@ -109,7 +109,7 @@ class PassportRepo {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
catch (error) {
|
|
112
|
-
let message = `Invalid token: ${error.message}`;
|
|
112
|
+
let message = `Invalid token: ${(error instanceof Error) ? error.message : String(error)}`;
|
|
113
113
|
if (error instanceof jsonwebtoken_1.JsonWebTokenError) {
|
|
114
114
|
// remove -> 'jwt issuer invalid. expected: [OPTIONS ISSUER]'
|
|
115
115
|
const indexOfExpected = message.indexOf('expected:');
|
|
@@ -468,37 +468,6 @@ class PendingReservationRepo {
|
|
|
468
468
|
}
|
|
469
469
|
return aggregations[0].numSeats;
|
|
470
470
|
}
|
|
471
|
-
// private async createIfNotExist(aggregateReservation: IAggregateReservation): Promise<void> {
|
|
472
|
-
// try {
|
|
473
|
-
// const { expires, project, reservationFor, typeOf } = aggregateReservation;
|
|
474
|
-
// await this.aggregateReservationModel.updateOne(
|
|
475
|
-
// {
|
|
476
|
-
// 'reservationFor.id': { $eq: aggregateReservation.reservationFor.id }
|
|
477
|
-
// },
|
|
478
|
-
// {
|
|
479
|
-
// $setOnInsert: {
|
|
480
|
-
// expires, project, reservationFor, typeOf,
|
|
481
|
-
// reservationCount: 0, reservationIds: []
|
|
482
|
-
// }
|
|
483
|
-
// },
|
|
484
|
-
// {
|
|
485
|
-
// upsert: true
|
|
486
|
-
// }
|
|
487
|
-
// )
|
|
488
|
-
// .exec();
|
|
489
|
-
// } catch (error) {
|
|
490
|
-
// let throwsError = true;
|
|
491
|
-
// if (await isMongoError(error)) {
|
|
492
|
-
// // すでに存在する場合ok
|
|
493
|
-
// if (error.code === MongoErrorCode.DuplicateKey) {
|
|
494
|
-
// throwsError = false;
|
|
495
|
-
// }
|
|
496
|
-
// }
|
|
497
|
-
// if (throwsError) {
|
|
498
|
-
// throw error;
|
|
499
|
-
// }
|
|
500
|
-
// }
|
|
501
|
-
// }
|
|
502
471
|
async createReservationPackageIfPossible(reservationPackage) {
|
|
503
472
|
try {
|
|
504
473
|
const result = await this.pendingReservationModel.insertMany({
|
|
@@ -513,10 +482,8 @@ class PendingReservationRepo {
|
|
|
513
482
|
}
|
|
514
483
|
}
|
|
515
484
|
catch (error) {
|
|
516
|
-
if (await (0, errorHandler_1.
|
|
517
|
-
|
|
518
|
-
throw new factory_1.factory.errors.AlreadyInUse(factory_1.factory.reservationType.EventReservation, ['ticketedSeat'], 'Already hold');
|
|
519
|
-
}
|
|
485
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
486
|
+
throw new factory_1.factory.errors.AlreadyInUse(factory_1.factory.reservationType.EventReservation, ['ticketedSeat'], 'Already hold');
|
|
520
487
|
}
|
|
521
488
|
throw error;
|
|
522
489
|
}
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -248,14 +248,12 @@ class TaskRepo {
|
|
|
248
248
|
}
|
|
249
249
|
catch (error) {
|
|
250
250
|
let throwsError = true;
|
|
251
|
-
if (await (0, errorHandler_1.
|
|
251
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
252
252
|
// すでにalternateNameが存在する場合ok
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
.exec();
|
|
258
|
-
}
|
|
253
|
+
throwsError = false;
|
|
254
|
+
createdTask = await this.taskModel.findOne(filterQuery, projection)
|
|
255
|
+
.lean()
|
|
256
|
+
.exec();
|
|
259
257
|
}
|
|
260
258
|
if (throwsError) {
|
|
261
259
|
throw error;
|
|
@@ -97,12 +97,10 @@ class TransactionNumberCounterRepo {
|
|
|
97
97
|
break;
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
|
-
if (await (0, errorHandler_1.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
100
|
+
if (await (0, errorHandler_1.isMongoDuplicateError)(error)) {
|
|
101
|
+
// すでに存在するので、リトライすればincrementに成功するはず
|
|
102
|
+
retryCount += 1;
|
|
103
|
+
continue;
|
|
106
104
|
}
|
|
107
105
|
throw error;
|
|
108
106
|
}
|
|
@@ -61,7 +61,6 @@ import type { PaymentServiceChannelRepo } from './repo/paymentServiceChannel';
|
|
|
61
61
|
import type { PaymentServiceProviderRepo } from './repo/paymentServiceProvider';
|
|
62
62
|
import type { PendingReservationRepo } from './repo/pendingReservation';
|
|
63
63
|
import type { PermitRepo } from './repo/permit';
|
|
64
|
-
import type { BusStopRepo } from './repo/place/busStop';
|
|
65
64
|
import type { EntranceGateRepo } from './repo/place/entranceGate';
|
|
66
65
|
import type { HasPOSRepo } from './repo/place/hasPOS';
|
|
67
66
|
import type { MovieTheaterRepo } from './repo/place/movieTheater';
|
|
@@ -359,13 +358,6 @@ export declare namespace Permit {
|
|
|
359
358
|
function createInstance(...params: ConstructorParameters<typeof PermitRepo>): Promise<PermitRepo>;
|
|
360
359
|
}
|
|
361
360
|
export declare namespace place {
|
|
362
|
-
type BusStop = BusStopRepo;
|
|
363
|
-
/**
|
|
364
|
-
* ターミナルリポジトリ
|
|
365
|
-
*/
|
|
366
|
-
namespace BusStop {
|
|
367
|
-
function createInstance(...params: ConstructorParameters<typeof BusStopRepo>): Promise<BusStopRepo>;
|
|
368
|
-
}
|
|
369
361
|
type EntranceGate = EntranceGateRepo;
|
|
370
362
|
/**
|
|
371
363
|
* 施設の入場ゲートリポジトリ
|
package/lib/chevre/repository.js
CHANGED
|
@@ -703,20 +703,6 @@ var Permit;
|
|
|
703
703
|
})(Permit || (exports.Permit = Permit = {}));
|
|
704
704
|
var place;
|
|
705
705
|
(function (place) {
|
|
706
|
-
/**
|
|
707
|
-
* ターミナルリポジトリ
|
|
708
|
-
*/
|
|
709
|
-
let BusStop;
|
|
710
|
-
(function (BusStop) {
|
|
711
|
-
let repo;
|
|
712
|
-
async function createInstance(...params) {
|
|
713
|
-
if (repo === undefined) {
|
|
714
|
-
repo = (await import('./repo/place/busStop.js')).BusStopRepo;
|
|
715
|
-
}
|
|
716
|
-
return new repo(...params);
|
|
717
|
-
}
|
|
718
|
-
BusStop.createInstance = createInstance;
|
|
719
|
-
})(BusStop = place.BusStop || (place.BusStop = {}));
|
|
720
706
|
/**
|
|
721
707
|
* 施設の入場ゲートリポジトリ
|
|
722
708
|
*/
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.importFromCOA = importFromCOA;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
|
+
const factory_1 = require("../../../factory");
|
|
9
10
|
const saveScreeningEvents_1 = require("../../event/saveScreeningEvents");
|
|
11
|
+
const errorHandler_1 = require("../../../errorHandler");
|
|
10
12
|
const debug = (0, debug_1.default)('chevre-domain:service');
|
|
11
13
|
/**
|
|
12
14
|
* イベント席数を更新する
|
|
@@ -66,16 +68,10 @@ function importFromCOA(params) {
|
|
|
66
68
|
}
|
|
67
69
|
catch (error) {
|
|
68
70
|
let throwsError = true;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
) {
|
|
71
|
+
const handledCOAError = (0, errorHandler_1.handleCOAError)(error);
|
|
72
|
+
if (handledCOAError instanceof factory_1.factory.errors.GatewayTimeout) {
|
|
72
73
|
throwsError = false;
|
|
73
74
|
}
|
|
74
|
-
if (error.name === 'COAServiceError') {
|
|
75
|
-
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
76
|
-
throwsError = false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
75
|
if (throwsError) {
|
|
80
76
|
throw error;
|
|
81
77
|
}
|