@chevre/domain 21.28.0-alpha.7 → 21.28.0-alpha.9

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.
@@ -477,10 +477,11 @@ class MongoRepository {
477
477
  return __awaiter(this, void 0, void 0, function* () {
478
478
  const uniqid = yield Promise.resolve().then(() => require('uniqid'));
479
479
  let docs;
480
+ const insertingDocs = params.attributes.map((p) => {
481
+ return Object.assign({ _id: uniqid() }, p);
482
+ });
480
483
  try {
481
- docs = yield this.eventModel.insertMany(params.attributes.map((p) => {
482
- return Object.assign({ _id: uniqid() }, p);
483
- }));
484
+ docs = yield this.eventModel.insertMany(insertingDocs);
484
485
  }
485
486
  catch (error) {
486
487
  if (yield (0, errorHandler_1.isMongoError)(error)) {
@@ -64,9 +64,6 @@ export declare function createReservation(params: {
64
64
  typeOf: factory.organizationType.Project;
65
65
  };
66
66
  id: string;
67
- reserveDate: Date;
68
- agent: factory.assetTransaction.reserve.IAgent;
69
- reservationNumber: string;
70
67
  reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
71
68
  reservedTicket: factory.reservation.ITicket;
72
69
  additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
@@ -121,11 +121,7 @@ function createReservedTicket(params) {
121
121
  const ticketType = createTicketType({ availableOffer: params.availableOffer });
122
122
  const issuedBy = createIssuedBy({ acceptedOffer: params.acceptedOffer, availableOffer: params.availableOffer });
123
123
  return Object.assign({ dateIssued: params.dateIssued, issuedBy,
124
- // 不要なので廃止(2022-12-19~)
125
- // priceCurrency: factory.priceCurrency.JPY,
126
- ticketType, typeOf: 'Ticket' }, (ticketedSeat !== undefined)
127
- ? { ticketedSeat: ticketedSeat }
128
- : {});
124
+ ticketType, typeOf: 'Ticket' }, (ticketedSeat !== undefined) ? { ticketedSeat } : {});
129
125
  }
130
126
  exports.createReservedTicket = createReservedTicket;
131
127
  /**
@@ -416,18 +412,19 @@ function createReservation(params) {
416
412
  // priceを最適化
417
413
  const price4reservation = (0, price_1.createPrice)(params);
418
414
  if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
419
- return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id,
415
+ return Object.assign(Object.assign(Object.assign({
416
+ // project: params.project, // 廃止(2024-04-08~)
417
+ typeOf: factory.reservationType.EventReservation, id: params.id,
420
418
  // reservationPackage保管に移行(2023-06-06~)
421
419
  // issuedThrough,
422
- additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber,
420
+ additionalProperty: params.additionalProperty,
421
+ // bookingTime: params.reserveDate, // 廃止(2024-04-08~)
422
+ // modifiedTime: params.reserveDate, // 廃止(2024-04-08~)
423
+ numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY,
424
+ // reservationNumber: params.reservationNumber, // 廃止(2024-04-08~)
423
425
  // statusは不要なので削除(2023-07-19~)
424
426
  // reservationStatus: factory.reservationStatusType.ReservationPending,
425
- reservedTicket: params.reservedTicket,
426
- // 最適化(2022-12-19~)
427
- underName: {
428
- typeOf: params.agent.typeOf,
429
- name: params.agent.name
430
- }, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
427
+ reservedTicket: params.reservedTicket }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
431
428
  ? {
432
429
  subReservation: params.subReservation.map((r) => {
433
430
  return {
@@ -443,16 +440,19 @@ function createReservation(params) {
443
440
  : undefined);
444
441
  }
445
442
  else {
446
- return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id,
443
+ return Object.assign(Object.assign(Object.assign({
444
+ // project: params.project,
445
+ typeOf: factory.reservationType.BusReservation, id: params.id,
447
446
  // reservationPackage保管に移行(2023-06-06~)
448
447
  // issuedThrough,
449
- additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber,
448
+ additionalProperty: params.additionalProperty,
449
+ // bookingTime: params.reserveDate,
450
+ // modifiedTime: params.reserveDate,
451
+ numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY,
452
+ // reservationNumber: params.reservationNumber,
450
453
  // statusは不要なので削除(2023-07-19~)
451
454
  // reservationStatus: factory.reservationStatusType.ReservationPending,
452
- reservedTicket: params.reservedTicket, underName: {
453
- typeOf: params.agent.typeOf,
454
- name: params.agent.name
455
- }, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
455
+ reservedTicket: params.reservedTicket }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
456
456
  ? {
457
457
  subReservation: params.subReservation.map((r) => {
458
458
  return {
@@ -467,10 +467,10 @@ function createReservations4transactionObject(params) {
467
467
  reservations.push((0, factory_1.createReservation)({
468
468
  project: params.transaction.project,
469
469
  id: reservationId,
470
- reserveDate: params.now,
471
- agent: params.transaction.agent,
470
+ // reserveDate: params.now,
471
+ // agent: params.transaction.agent,
472
472
  // broker: params.transaction.object.broker,
473
- reservationNumber: reservationNumber,
473
+ // reservationNumber: reservationNumber,
474
474
  reservationFor: params.event,
475
475
  reservedTicket: reservedTicket,
476
476
  additionalProperty: additionalProperty,
@@ -82,6 +82,10 @@ declare function getGMOInfoFromSeller(params: {
82
82
  paymentAccepted: PaymentAcceptedRepo;
83
83
  paymentServiceProvider: PaymentServiceProviderRepo;
84
84
  }) => Promise<IGMOInfo>;
85
+ /**
86
+ * 決済代行側の取引状態参照
87
+ * 存在しない場合NotFoundエラー
88
+ */
85
89
  declare function searchGMOTrade(params: {
86
90
  availableChannel: factory.product.IAvailableChannel;
87
91
  paymentMethodId: string;
@@ -167,6 +167,10 @@ function processAuthorizeCreditCard3ds(params) {
167
167
  return { entryTranArgs, entryTranResult, execTranArgs, execTranResult, secureTran2Result };
168
168
  });
169
169
  }
170
+ var GMOErrorInfo;
171
+ (function (GMOErrorInfo) {
172
+ GMOErrorInfo["TransactionNotFound"] = "E01110002";
173
+ })(GMOErrorInfo || (GMOErrorInfo = {}));
170
174
  function handleAuthorizeError(error) {
171
175
  debug('handling creditCard authorizeError:', error);
172
176
  let handledError = error;
@@ -263,7 +267,7 @@ function voidTransaction(params) {
263
267
  if (Array.isArray(error.errors) && error.errors.length > 0) {
264
268
  const gmoErrors = error.errors;
265
269
  // 指定されたIDとパスワードの取引が存在しません。
266
- const notFoundErrorExists = gmoErrors.some(({ info }) => info === 'E01110002');
270
+ const notFoundErrorExists = gmoErrors.some(({ info }) => info === GMOErrorInfo.TransactionNotFound);
267
271
  if (notFoundErrorExists) {
268
272
  throwsError = false;
269
273
  }
@@ -576,6 +580,10 @@ function getGMOInfoFromSeller(params) {
576
580
  });
577
581
  }
578
582
  exports.getGMOInfoFromSeller = getGMOInfoFromSeller;
583
+ /**
584
+ * 決済代行側の取引状態参照
585
+ * 存在しない場合NotFoundエラー
586
+ */
579
587
  function searchGMOTrade(params) {
580
588
  var _a, _b;
581
589
  return __awaiter(this, void 0, void 0, function* () {
@@ -584,15 +592,36 @@ function searchGMOTrade(params) {
584
592
  useFetch: credentials_1.credentials.gmo.useFetch
585
593
  }, { timeout: credentials_1.credentials.gmo.timeout });
586
594
  // 取引状態参照
587
- debug('searching trade...', params.paymentMethodId);
588
- const searchTradeResult = yield creditCardService.searchTrade({
589
- shopId: params.shopId,
590
- shopPass: params.shopPass,
591
- orderId: params.paymentMethodId,
592
- siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId,
593
- sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass
594
- });
595
- debug('searchTradeResult is', searchTradeResult);
595
+ let searchTradeResult;
596
+ try {
597
+ searchTradeResult = yield creditCardService.searchTrade({
598
+ shopId: params.shopId,
599
+ shopPass: params.shopPass,
600
+ orderId: params.paymentMethodId,
601
+ siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId,
602
+ sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass
603
+ });
604
+ }
605
+ catch (error) {
606
+ // searchTradeでのエラーをハンドリング(2024-04-08~)
607
+ let throwsError = true;
608
+ if (error.name === 'GMOServiceBadRequestError') {
609
+ if (Array.isArray(error.errors) && error.errors.length > 0) {
610
+ const gmoErrors = error.errors;
611
+ // 指定されたIDとパスワードの取引が存在しません。
612
+ const notFoundErrorExists = gmoErrors.some(({ info }) => info === GMOErrorInfo.TransactionNotFound);
613
+ if (notFoundErrorExists) {
614
+ throwsError = false;
615
+ }
616
+ }
617
+ }
618
+ if (throwsError) {
619
+ throw error;
620
+ }
621
+ }
622
+ if (searchTradeResult === undefined) {
623
+ throw new factory.errors.NotFound('searchTradeResult');
624
+ }
596
625
  return searchTradeResult;
597
626
  });
598
627
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.366.0-alpha.0",
13
+ "@chevre/factory": "4.366.0-alpha.1",
14
14
  "@cinerino/sdk": "5.17.0",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.28.0-alpha.7"
113
+ "version": "21.28.0-alpha.9"
114
114
  }