@chevre/domain 21.20.0-alpha.51 → 21.20.0-alpha.53

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.
@@ -65,6 +65,9 @@ exports.handleMongoError = handleMongoError;
65
65
  function handleCOAError(error) {
66
66
  var _a;
67
67
  let handledError = error;
68
+ if (error.name === 'AbortError') {
69
+ handledError = new factory_1.errors.GatewayTimeout(`Gateway Timeout. name:${error.name} code:${error.code} message:${error.message}`);
70
+ }
68
71
  if (error.name === 'COAServiceError') {
69
72
  // error.requestOptions.uriを処理
70
73
  const uri = (_a = error.requestOptions) === null || _a === void 0 ? void 0 : _a.uri;
@@ -87,10 +87,9 @@ function importFromCOA(params) {
87
87
  }
88
88
  catch (error) {
89
89
  let throwsError = true;
90
- // "name": "COAServiceError",
91
- // "code": 500,
92
- // "status": "",
93
- // "message": "ESOCKETTIMEDOUT",
90
+ if (error.name === 'AbortError') {
91
+ throwsError = false;
92
+ }
94
93
  if (error.name === 'COAServiceError') {
95
94
  if (error.message === 'ESOCKETTIMEDOUT') {
96
95
  throwsError = false;
@@ -167,10 +167,11 @@ function importFromCOA(params) {
167
167
  }
168
168
  catch (error) {
169
169
  let throwsError = true;
170
- // "name": "COAServiceError",
171
- // "code": 500,
172
- // "status": "",
173
- // "message": "ESOCKETTIMEDOUT",
170
+ if (error.name === 'AbortError') {
171
+ // tslint:disable-next-line:no-console
172
+ console.error('saveScreeningEvents throwed an error', error.name, error.message);
173
+ throwsError = false;
174
+ }
174
175
  if (error.name === 'COAServiceError') {
175
176
  if (error.message === 'ESOCKETTIMEDOUT') {
176
177
  // tslint:disable-next-line:no-console
@@ -46,10 +46,9 @@ function importFromCOA(params) {
46
46
  }
47
47
  catch (error) {
48
48
  let throwsError = true;
49
- // "name": "COAServiceError",
50
- // "code": 500,
51
- // "status": "",
52
- // "message": "ESOCKETTIMEDOUT",
49
+ if (error.name === 'AbortError') {
50
+ throwsError = false;
51
+ }
53
52
  if (error.name === 'COAServiceError') {
54
53
  if (error.message === 'ESOCKETTIMEDOUT') {
55
54
  throwsError = false;
@@ -115,10 +114,9 @@ function importCategoryCodesFromCOA(params) {
115
114
  }
116
115
  catch (error) {
117
116
  let throwsError = true;
118
- // "name": "COAServiceError",
119
- // "code": 500,
120
- // "status": "",
121
- // "message": "ESOCKETTIMEDOUT",
117
+ if (error.name === 'AbortError') {
118
+ throwsError = false;
119
+ }
122
120
  if (error.name === 'COAServiceError') {
123
121
  if (error.message === 'ESOCKETTIMEDOUT') {
124
122
  throwsError = false;
@@ -139,7 +139,7 @@ function processVoidTransaction4coa(params) {
139
139
  // tslint:disable-next-line:no-single-line-block-comment
140
140
  /* istanbul ignore if */
141
141
  if (error.name === 'COAServiceError') {
142
- if (Number.isInteger(error.code) && error.code < http_status_1.INTERNAL_SERVER_ERROR) {
142
+ if (typeof error.code === 'number' && error.code < http_status_1.INTERNAL_SERVER_ERROR) {
143
143
  // すでに取消済の場合こうなるので、okとする
144
144
  if (error.message === '座席取消失敗') {
145
145
  deleted = true;
@@ -304,22 +304,35 @@ function voidTransaction(params) {
304
304
  endpoint: String(availableChannel.serviceUrl),
305
305
  useFetch: credentials_1.credentials.gmo.useFetch
306
306
  }, { timeout: credentials_1.credentials.gmo.timeout });
307
- // オーソリ取消
308
- // 現時点では、ここで失敗したらオーソリ取消をあきらめる
309
- // GMO混雑エラーはここでも発生する(取消処理でも混雑エラーが発生することは確認済)
310
- // try {
311
- // } catch (error) {
312
- // // no op
313
- // }
314
- const searchTradeResult = yield creditCardService.searchTrade({
315
- shopId: shopId,
316
- shopPass: shopPass,
317
- orderId: paymentMethodId,
318
- siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
319
- sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
320
- });
307
+ let searchTradeResult;
308
+ try {
309
+ searchTradeResult = yield creditCardService.searchTrade({
310
+ shopId: shopId,
311
+ shopPass: shopPass,
312
+ orderId: paymentMethodId,
313
+ siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
314
+ sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
315
+ });
316
+ }
317
+ catch (error) {
318
+ // searchTradeでのエラーをハンドリング(2024-01-27~)
319
+ let throwsError = true;
320
+ if (error.name === 'GMOServiceBadRequestError') {
321
+ if (Array.isArray(error.errors) && error.errors.length > 0) {
322
+ const gmoErrors = error.errors;
323
+ // 指定されたIDとパスワードの取引が存在しません。
324
+ const notFoundErrorExists = gmoErrors.some(({ info }) => info === 'E01110002');
325
+ if (notFoundErrorExists) {
326
+ throwsError = false;
327
+ }
328
+ }
329
+ }
330
+ if (throwsError) {
331
+ throw error;
332
+ }
333
+ }
321
334
  // 仮売上であれば取消
322
- if (searchTradeResult.status === GMO.utils.util.JobCd.Auth) {
335
+ if ((searchTradeResult === null || searchTradeResult === void 0 ? void 0 : searchTradeResult.status) === GMO.utils.util.JobCd.Auth) {
323
336
  yield creditCardService.alterTran({
324
337
  shopId: shopId,
325
338
  shopPass: shopPass,
@@ -30,9 +30,7 @@ interface ICheckInReservationParams {
30
30
  code: string;
31
31
  };
32
32
  }
33
- export declare function checkInReservation(params: ICheckInReservationParams & {
34
- reserveIfNotYet: boolean;
35
- }): (repos: {
33
+ export declare function checkInReservation(params: ICheckInReservationParams): (repos: {
36
34
  action: ActionRepo;
37
35
  assetTransaction: AssetTransactionRepo;
38
36
  event: EventRepo;
@@ -19,10 +19,7 @@ function checkInReservation(params) {
19
19
  return (repos) => __awaiter(this, void 0, void 0, function* () {
20
20
  const now = new Date();
21
21
  // confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
22
- debug('reserveIfNotYet?', params.reserveIfNotYet, 'ids:', params.object.ids, 'reservationNumbers:', params.object.reservationNumbers);
23
- if (params.reserveIfNotYet === true) {
24
- yield reserveIfNotYet(params)(repos);
25
- }
22
+ yield reserveIfNotYet(params)(repos);
26
23
  // 発券処理(Array対応)
27
24
  let checkedInReservationIds;
28
25
  if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
@@ -25,7 +25,6 @@ export declare function useReservation(params: {
25
25
  identifier?: string;
26
26
  };
27
27
  verifyToken: boolean;
28
- reserveIfNotYet: boolean;
29
28
  }): (repos: {
30
29
  action: ActionRepo;
31
30
  assetTransaction: AssetTransactionRepo;
@@ -38,10 +38,7 @@ function useReservation(params) {
38
38
  }
39
39
  }
40
40
  // confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
41
- debug('reserveIfNotYet?', params.reserveIfNotYet, 'id:', params.object.id);
42
- if (params.reserveIfNotYet === true) {
43
- yield reserveIfNotYet({ object: params.object })(repos);
44
- }
41
+ yield reserveIfNotYet({ object: params.object })(repos);
45
42
  // 予約検索
46
43
  // 取得属性最適化(2023-01-30~)
47
44
  const reservation = yield repos.reservation.findById({
@@ -91,7 +91,6 @@ function onAuthorizationCreated(params) {
91
91
  reservationNumbers: reservationNumbers,
92
92
  reservationFor: { ids: reservationForIds }
93
93
  },
94
- reserveIfNotYet: params.reserveIfNotYet,
95
94
  purpose: { code: params.code }
96
95
  })({
97
96
  action: repos.action,
@@ -24,7 +24,7 @@ function call(data) {
24
24
  var _a, _b;
25
25
  yield (0, reserve_1.useReservation)(Object.assign(Object.assign({ project: data.project, agent: data.agent, object: data.object,
26
26
  // タスク作成前に検証済なので検証不要
27
- verifyToken: false, reserveIfNotYet: data.reserveIfNotYet }, (typeof ((_a = data.instrument) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { instrument: data.instrument } : undefined), (typeof ((_b = data.location) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { location: data.location } : undefined))({
27
+ verifyToken: false }, (typeof ((_a = data.instrument) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { instrument: data.instrument } : undefined), (typeof ((_b = data.location) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { location: data.location } : undefined))({
28
28
  action: new action_1.MongoRepository(settings.connection),
29
29
  assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
30
30
  order: new order_1.MongoRepository(settings.connection),
package/package.json CHANGED
@@ -10,9 +10,9 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.352.0-alpha.7",
13
+ "@chevre/factory": "4.352.0-alpha.8",
14
14
  "@cinerino/sdk": "5.9.0-alpha.1",
15
- "@motionpicture/coa-service": "9.3.0-alpha.3",
15
+ "@motionpicture/coa-service": "9.3.0-alpha.4",
16
16
  "@motionpicture/gmo-service": "5.3.0-alpha.2",
17
17
  "@sendgrid/mail": "6.4.0",
18
18
  "@surfrock/sdk": "1.2.0",
@@ -111,5 +111,5 @@
111
111
  "postversion": "git push origin --tags",
112
112
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
113
113
  },
114
- "version": "21.20.0-alpha.51"
114
+ "version": "21.20.0-alpha.53"
115
115
  }