@chevre/domain 24.1.0-alpha.3 → 24.1.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.
Files changed (105) hide show
  1. package/README.md +0 -2
  2. package/lib/chevre/repo/acceptedOffer.d.ts +14 -13
  3. package/lib/chevre/repo/acceptedOffer.js +135 -51
  4. package/lib/chevre/repo/acceptedOfferInReserve.d.ts +30 -0
  5. package/lib/chevre/repo/acceptedOfferInReserve.js +78 -0
  6. package/lib/chevre/repo/accountingReport.d.ts +9 -2
  7. package/lib/chevre/repo/accountingReport.js +6 -34
  8. package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
  9. package/lib/chevre/repo/assetTransaction/reserve.d.ts +0 -1
  10. package/lib/chevre/repo/assetTransaction/reserve.js +4 -50
  11. package/lib/chevre/repo/event.js +12 -8
  12. package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +7 -0
  13. package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +74 -0
  14. package/lib/chevre/repo/factory/reservation/createMongoConditions.js +155 -180
  15. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +42 -42
  16. package/lib/chevre/repo/mongoose/schemas/order.js +108 -108
  17. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -1
  18. package/lib/chevre/repo/mongoose/schemas/reservation.js +128 -146
  19. package/lib/chevre/repo/order.d.ts +2 -83
  20. package/lib/chevre/repo/order.js +171 -364
  21. package/lib/chevre/repo/orderInTransaction.d.ts +39 -3
  22. package/lib/chevre/repo/orderInTransaction.js +43 -1
  23. package/lib/chevre/repo/reservation.d.ts +20 -7
  24. package/lib/chevre/repo/reservation.js +14 -10
  25. package/lib/chevre/repo/role.d.ts +1 -15
  26. package/lib/chevre/repo/role.js +7 -14
  27. package/lib/chevre/repo/transaction.d.ts +6 -6
  28. package/lib/chevre/service/aggregation/event/aggregateOffers.js +22 -26
  29. package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
  30. package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
  31. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
  32. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +0 -12
  33. package/lib/chevre/service/assetTransaction/reserve/start/factory/price.d.ts +1 -1
  34. package/lib/chevre/service/delivery/factory.d.ts +6 -1
  35. package/lib/chevre/service/delivery/factory.js +1 -1
  36. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -3
  37. package/lib/chevre/service/delivery/reservation/factory.js +0 -17
  38. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +1 -1
  39. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +1 -1
  40. package/lib/chevre/service/offer/any.d.ts +6 -1
  41. package/lib/chevre/service/offer/event/authorize/factory.d.ts +6 -3
  42. package/lib/chevre/service/offer/event/authorize/factory.js +4 -7
  43. package/lib/chevre/service/offer/event/authorize.d.ts +6 -0
  44. package/lib/chevre/service/offer/event/authorize.js +11 -3
  45. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -3
  46. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -3
  47. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +67 -72
  48. package/lib/chevre/service/order/deleteOrder.js +21 -44
  49. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +9 -11
  50. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +6 -1
  51. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  52. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
  53. package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
  54. package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +0 -5
  55. package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
  56. package/lib/chevre/service/order/sendOrder.js +2 -4
  57. package/lib/chevre/service/payment/creditCard/authorize.js +3 -3
  58. package/lib/chevre/service/payment/creditCard/payCreditCard.js +1 -1
  59. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -1
  60. package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
  61. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  62. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +8 -1
  63. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
  64. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
  65. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +1 -1
  66. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
  67. package/lib/chevre/service/reserve/confirmReservation.js +7 -7
  68. package/lib/chevre/service/reserve/factory.js +2 -1
  69. package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
  70. package/lib/chevre/service/reserve/findByCode.js +2 -1
  71. package/lib/chevre/service/reserve/findReservations.d.ts +4 -4
  72. package/lib/chevre/service/reserve/findReservations.js +16 -26
  73. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +4 -3
  74. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -9
  75. package/lib/chevre/service/reserve/searchByOrder.js +8 -3
  76. package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
  77. package/lib/chevre/service/reserve/useReservation.js +20 -24
  78. package/lib/chevre/service/task/acceptCOAOffer.js +2 -2
  79. package/lib/chevre/service/task/authorizePayment.js +1 -1
  80. package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
  81. package/lib/chevre/service/task/checkMovieTicket.js +1 -1
  82. package/lib/chevre/service/task/confirmReserveTransaction.js +3 -2
  83. package/lib/chevre/service/task/createAccountingReport.js +7 -9
  84. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +1 -1
  85. package/lib/chevre/service/task/importEventsFromCOA.js +1 -1
  86. package/lib/chevre/service/task/importOffersFromCOA.js +1 -1
  87. package/lib/chevre/service/task/pay.js +1 -1
  88. package/lib/chevre/service/task/payment/payByTask.js +3 -2
  89. package/lib/chevre/service/task/refund.js +1 -1
  90. package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
  91. package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
  92. package/lib/chevre/service/task/useReservation.d.ts +2 -2
  93. package/lib/chevre/service/task/useReservation.js +6 -18
  94. package/lib/chevre/service/task/voidPayment.js +1 -1
  95. package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
  96. package/lib/chevre/service/taskHandler.js +1 -0
  97. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
  98. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
  99. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
  100. package/lib/chevre/service/transaction/placeOrder/confirm.js +5 -2
  101. package/lib/chevre/service/transaction/returnOrder/preStart.js +2 -4
  102. package/lib/chevre/service/validation/validateOrder.js +5 -79
  103. package/lib/chevre/settings.d.ts +15 -16
  104. package/lib/chevre/settings.js +53 -19
  105. package/package.json +2 -2
@@ -61,7 +61,8 @@ function confirmReservation(params) {
61
61
  ...rawReservation.reservedTicket,
62
62
  ticketType: ticketTypeByTransaction
63
63
  },
64
- reservationFor: reserveTransaction.object.reservationFor // reservationForは予約取引から参照する(2026-04-05~)
64
+ reservationFor: reserveTransaction.object.reservationFor, // reservationForは予約取引から参照する(2026-04-05~)
65
+ issuedThrough: reserveTransaction.object.issuedThrough // issuedThroughは予約取引から補完する(2026-05-08~)
65
66
  };
66
67
  });
67
68
  confirmedReservations = confirmedReservations.map((r) => {
@@ -189,25 +190,24 @@ params, options) {
189
190
  if (reserveTransaction.object.disablePendingReservations === true) {
190
191
  const reservationFor = reserveTransaction.object.reservationFor;
191
192
  const subReservations = reserveTransaction.object.subReservation;
192
- const issuedThrough = reserveTransaction.object.issuedThrough;
193
+ // const issuedThrough = reserveTransaction.object.issuedThrough;
193
194
  if (Array.isArray(subReservations)
194
195
  && typeof reservationFor?.typeOf === 'string'
195
- && typeof issuedThrough?.typeOf === 'string') {
196
- // confirmManyに変更(2023-06-13~)
197
- const confirmManyIfNotExistResult = await repos.reservation.confirmManyIfNotExist({
196
+ // && typeof issuedThrough?.typeOf === 'string'
197
+ ) {
198
+ await repos.reservation.confirmManyIfNotExist({
198
199
  bookingTime: reserveTransaction.startDate, // startDateに設定(2024-04-08~)
199
200
  project: { id: reserveTransaction.project.id },
200
201
  provider: (typeof reserveTransaction.object.provider?.id === 'string')
201
202
  ? reserveTransaction.object.provider
202
203
  : { id: reserveTransaction.agent.id, typeOf: factory_1.factory.organizationType.Corporation },
203
204
  subReservation: subReservations,
204
- issuedThrough,
205
+ // issuedThrough,
205
206
  reservationFor,
206
207
  reservationNumber: reserveTransaction.object.reservationNumber,
207
208
  underName,
208
209
  broker: reserveTransaction.object.broker
209
210
  });
210
- debug('confirmManyIfNotExistResult:', confirmManyIfNotExistResult, 'reservationNumber:', reservationPackage.reservationNumber);
211
211
  }
212
212
  }
213
213
  else {
@@ -21,7 +21,8 @@ function createCancelPendingReservationAction(params) {
21
21
  const reservationPackage = {
22
22
  typeOf: factory_1.factory.reservationType.ReservationPackage,
23
23
  reservationNumber: transaction.transactionNumber,
24
- reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
24
+ // discontinue reservationFor(2026-05-09~)
25
+ // reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
25
26
  reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
26
27
  ? params.transaction.object.reservationStatus
27
28
  : factory_1.factory.reservationStatusType.ReservationPending
@@ -5,7 +5,7 @@ import type { OrderRepo } from '../../repo/order';
5
5
  import type { ReservationRepo } from '../../repo/reservation';
6
6
  type IReservationResult = Pick<factory.reservation.eventReservation.IReservation, 'id' | 'additionalTicketText' | 'checkedIn' | 'reservationStatus'> & {
7
7
  reservedTicket: {
8
- ticketType: Pick<factory.reservation.eventReservation.ITicketType, 'identifier'> & {
8
+ ticketType: Pick<factory.assetTransaction.reserve.ITicketType, 'identifier'> & {
9
9
  name: {
10
10
  ja?: string;
11
11
  };
@@ -39,7 +39,8 @@ function findByCode(params) {
39
39
  // typeOf?: { $in?: factory.order.IItemOffered['typeOf'][] };
40
40
  }
41
41
  }
42
- }, ['itemOffered'])).shift();
42
+ }, { useReserveTransaction: true } // 予約取引参照(2026-05-18~)
43
+ )).shift();
43
44
  if (acceptedOffer === undefined) {
44
45
  throw new factory_1.factory.errors.NotFound('acceptedOffer');
45
46
  }
@@ -1,21 +1,21 @@
1
1
  import { factory } from '../../factory';
2
2
  import type { ReserveTransactionRepo } from '../../repo/assetTransaction/reserve';
3
- import type { IDeprecatedField, IKeyOfProjection, ReservationRepo } from '../../repo/reservation';
3
+ import type { IKeyOfProjection, ReservationRepo } from '../../repo/reservation';
4
4
  /**
5
5
  * 予約検索レスポンスとしての予約
6
6
  * 予約ドキュメントに予約取引の情報を補完する
7
7
  */
8
- type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor'> & {
9
- price?: factory.reservation.eventReservation.IPrice;
8
+ type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'underName' | 'reservedTicket' | 'reservationFor'> & {
10
9
  underName?: factory.assetTransaction.reserve.IUnderName;
11
10
  reservedTicket?: factory.assetTransaction.reserve.IObjectSubReservation['reservedTicket'];
12
11
  reservationFor?: factory.assetTransaction.reserve.IReservationFor;
12
+ price?: never;
13
13
  };
14
14
  /**
15
15
  * 予約を検索する
16
16
  */
17
17
  export declare function findReservations(params: factory.reservation.eventReservation.ISearchConditions, options: {
18
- inclusion: Partial<Record<IKeyOfProjection | IDeprecatedField, 1>>;
18
+ inclusion: Partial<Record<IKeyOfProjection | 'underName', 1>>;
19
19
  }): (repos: {
20
20
  assetTransaction: {
21
21
  reserve: ReserveTransactionRepo;
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.findReservations = findReservations;
7
- const debug_1 = __importDefault(require("debug"));
8
- const debug = (0, debug_1.default)('chevre-domain:service:reserve:findReservations');
9
4
  /**
10
5
  * 予約を検索する
11
6
  */
@@ -17,41 +12,28 @@ function findReservations(params, options) {
17
12
  return [];
18
13
  }
19
14
  else {
20
- const requirePrice = Object.keys(inclusion).includes('price');
21
15
  const requireUnderName = Object.keys(inclusion).includes('underName');
22
16
  const requireReservedTicket = Object.keys(inclusion).includes('reservedTicket');
23
17
  const requireReservationFor = Object.keys(inclusion).includes('reservationFor');
18
+ // const requirePrice = Object.keys(inclusion).includes('price');
19
+ // const requirePriceCurrency = Object.keys(inclusion).includes('priceCurrency');
20
+ // const requireIssuedThrough = Object.keys(inclusion).includes('issuedThrough');
21
+ // const requireNumSeats = Object.keys(inclusion).includes('numSeats');
24
22
  const reservationIds = rawReservations.map(({ id }) => id);
25
23
  const subReservations = await repos.assetTransaction.reserve.findSubReservationsById({
26
24
  ids: reservationIds
27
25
  });
28
- // 予約取引から参照した予約数と同じはず
29
- debug('useReserveTransaction: true. reservations.length === subReservations.length?', rawReservations.length === subReservations.length);
30
26
  return rawReservations.map((reservation) => {
31
27
  const subReservationByTransaction = subReservations.find((s) => s.id === reservation.id);
32
- const priceByTransaction = subReservationByTransaction?.price;
33
28
  const underNameByTransaction = subReservationByTransaction?.underName;
34
29
  const ticketTypeByTransaction = subReservationByTransaction?.reservedTicket?.ticketType;
35
30
  const reservationForByTransaction = subReservationByTransaction?.reservationFor;
36
- // 予約ドキュメントを最適化し始めたため、もう等しくない(2026-04-06~)
37
- // // 予約取引から参照した属性と全く等しいはず
38
- // if (requirePrice) {
39
- // }
40
- // if (requireUnderName) {
41
- // }
42
- // if (requireReservedTicket) {
43
- // }
44
- // if (requireReservationFor) {
45
- // const reservationForMatched = isDeepStrictEqual(reservation.reservationFor, reservationForByTransaction);
46
- // debug('requireReservationFor. reservationForMatched?', reservationForMatched);
47
- // if (!reservationForMatched) {
48
- // console.error('reservationForMatched: false!!!', reservation.id);
49
- // }
50
- // }
51
- const { reservationFor, reservedTicket, ...rawReservation4result } = reservation; // eslint-disable-line @typescript-eslint/no-unused-vars
31
+ // const priceByTransaction = subReservationByTransaction?.price;
32
+ // const issuedThroughByTransaction = subReservationByTransaction?.issuedThrough;
33
+ // const numSeatsByTransaction = subReservationByTransaction?.numSeats;
34
+ const { reservationFor: _reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, numSeats: _numSeats, reservedTicket, ...rawReservation4result } = reservation;
52
35
  return {
53
36
  ...rawReservation4result, // 予約ドキュメントはそのまま返す
54
- ...(requirePrice && priceByTransaction !== undefined) ? { price: priceByTransaction } : undefined, // priceがあれば上書き
55
37
  ...(requireUnderName && underNameByTransaction !== undefined) ? { underName: underNameByTransaction } : undefined, // underNameがあれば上書き
56
38
  ...(requireReservedTicket && ticketTypeByTransaction !== undefined) // ticketTypeがあれば上書き
57
39
  ? {
@@ -64,6 +46,14 @@ function findReservations(params, options) {
64
46
  ...(requireReservationFor && reservationForByTransaction !== undefined)
65
47
  ? { reservationFor: reservationForByTransaction }
66
48
  : undefined, // reservationForがあれば上書き(2026-04-06~)
49
+ // ...(requirePrice && priceByTransaction !== undefined) ? { price: priceByTransaction } : undefined, // priceがあれば上書き
50
+ // ...(requirePriceCurrency) ? { priceCurrency: factory.priceCurrency.JPY } : undefined, // 必要あらば固定値を補完(2026-05-08~)
51
+ // ...(requireIssuedThrough && issuedThroughByTransaction !== undefined)
52
+ // ? { issuedThrough: issuedThroughByTransaction }
53
+ // : undefined, // issuedThroughがあれば上書き(2026-05-09~)
54
+ // ...(requireNumSeats && numSeatsByTransaction !== undefined)
55
+ // ? { numSeats: numSeatsByTransaction }
56
+ // : undefined, // issuedThroughがあれば上書き(2026-05-09~)
67
57
  };
68
58
  });
69
59
  }
@@ -5,13 +5,14 @@ import { factory } from '../../../factory';
5
5
  import { AuthorizationRepo } from '../../../repo/authorization';
6
6
  import type { SettingRepo } from '../../../repo/setting';
7
7
  import type { TaskRepo } from '../../../repo/task';
8
- export type IConfirmedReservation = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor'> & {
9
- price?: factory.reservation.eventReservation.IPrice;
8
+ export type IConfirmedReservation = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor' | 'issuedThrough'> & {
9
+ price?: factory.assetTransaction.reserve.IPrice;
10
10
  underName?: Pick<factory.reservation.IUnderName, 'id' | 'typeOf'>;
11
11
  reservedTicket: Omit<factory.assetTransaction.reserve.ISubReservationReservedTicket, 'ticketType'> & {
12
- ticketType: factory.reservation.eventReservation.ITicketType;
12
+ ticketType: factory.assetTransaction.reserve.ITicketType;
13
13
  };
14
14
  reservationFor: factory.assetTransaction.reserve.IReservationFor;
15
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
15
16
  };
16
17
  /**
17
18
  * 予約確定後のアクション
@@ -98,22 +98,14 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
98
98
  }
99
99
  }
100
100
  const subReservations4inform = confirmedReservations.map((r) => {
101
- const { additionalProperty, additionalTicketText,
102
- // attended, checkedIn,
103
- id, modifiedTime,
104
- // numSeats,
105
- price, programMembershipUsed, reservedTicket, subReservation, typeOf } = r;
101
+ const { additionalProperty, additionalTicketText, id, modifiedTime, price, programMembershipUsed, reservedTicket, subReservation, typeOf } = r;
106
102
  return {
107
- // bookingTime, // discontinue(2024-10-27~)
108
103
  id,
109
104
  typeOf,
110
105
  reservedTicket,
111
106
  ...(Array.isArray(additionalProperty)) ? { additionalProperty } : undefined,
112
107
  ...(typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined,
113
- // ...(typeof attended === 'boolean') ? { attended } : undefined, // discontinue(2024-10-27~)
114
- // ...(typeof checkedIn === 'boolean') ? { checkedIn } : undefined, // discontinue(2024-10-27~)
115
108
  ...(modifiedTime instanceof Date) ? { modifiedTime } : undefined,
116
- // ...(typeof numSeats === 'number') ? { numSeats } : undefined, // discontinue(2024-10-27~)
117
109
  ...(price !== undefined) ? { price } : undefined,
118
110
  ...(programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined,
119
111
  ...(Array.isArray(subReservation)) ? { subReservation } : undefined
@@ -11,14 +11,19 @@ function searchByOrder(params) {
11
11
  page: params.page,
12
12
  project: { id: { $eq: params.project.id } },
13
13
  orderNumber: { $eq: params.orderNumber },
14
- acceptedOffers: { itemOffered: { typeOf: { $in: [reservationType] } } }
15
- }, ['itemOffered']);
14
+ acceptedOffers: {
15
+ itemOffered: {
16
+ // typeOf: { $in: [reservationType] }
17
+ }
18
+ }
19
+ }, { useReserveTransaction: true } // 予約取引参照(2026-05-18~)
20
+ );
16
21
  const reservationIds = acceptedOffers.map((offer) => {
17
22
  if (offer.itemOffered.typeOf === reservationType) {
18
23
  return offer.itemOffered.id;
19
24
  }
20
25
  else {
21
- // 検索条件にreservationTypeを含めているので、ありえないケース
26
+ // EventReservationしか存在しないので、ありえないケース
22
27
  throw new factory_1.factory.errors.Internal(`unexpected itemOffered.typeOf ${offer.itemOffered.typeOf}`);
23
28
  }
24
29
  });
@@ -20,7 +20,7 @@ export declare function useReservation(params: {
20
20
  */
21
21
  id: string;
22
22
  };
23
- instrument?: Pick<factory.action.consume.use.reservation.ITicketAsInstrument, 'ticketToken'> | factory.action.consume.use.reservation.IInstrument[];
23
+ instrument: factory.action.consume.use.reservation.IInstrument[];
24
24
  location?: {
25
25
  identifier?: string;
26
26
  };
@@ -16,7 +16,6 @@ function useReservation(params) {
16
16
  return async (repos) => {
17
17
  const reservationId = params.object.id;
18
18
  let ticketToken;
19
- // const ticketToken = params?.instrument?.ticketToken;
20
19
  if (Array.isArray(params.instrument)) {
21
20
  for (const eachInstrument of params.instrument) {
22
21
  if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
@@ -24,9 +23,8 @@ function useReservation(params) {
24
23
  break;
25
24
  }
26
25
  }
27
- }
28
- else {
29
- ticketToken = params?.instrument?.ticketToken;
26
+ // } else {
27
+ // ticketToken = params?.instrument?.ticketToken;
30
28
  }
31
29
  // if (params.verifyToken === true) {} // タスク作成前に検証済なので検証不要
32
30
  // confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
@@ -34,36 +32,34 @@ function useReservation(params) {
34
32
  // 予約検索
35
33
  const reservation = await repos.reservation.findReservationById({
36
34
  id: reservationId,
37
- inclusion: ['issuedThrough', 'project', 'reservationFor', 'reservationNumber', 'reservedTicket', 'typeOf']
35
+ inclusion: [
36
+ // 'issuedThrough',
37
+ // 'reservedTicket',
38
+ 'project', 'reservationFor', 'reservationNumber', 'typeOf'
39
+ ]
38
40
  });
39
- if (typeof reservation.issuedThrough.id !== 'string') {
40
- // COA予約では予約使用アクションを想定していないので、興行idは必ず存在するはず
41
- throw new factory_1.factory.errors.Internal('reservation.issuedThrough.id must be string');
42
- }
43
- const { reservedTicket } = reservation;
44
- // optimize(2024-05-07~)
41
+ // if (typeof reservation.issuedThrough.id !== 'string') {
42
+ // // COA予約では予約使用アクションを想定していないので、興行idは必ず存在するはず
43
+ // throw new factory.errors.Internal('reservation.issuedThrough.id must be string');
44
+ // }
45
+ // const { reservedTicket } = reservation;
46
+ // optimize(2026-05-06~)
45
47
  const reservationAsObject = {
46
48
  id: reservation.id,
47
49
  reservationNumber: reservation.reservationNumber,
48
50
  typeOf: reservation.typeOf,
49
- issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
50
51
  reservationFor: { id: reservation.reservationFor.id, typeOf: reservation.reservationFor.typeOf },
51
- reservedTicket: {
52
- typeOf: reservedTicket.typeOf,
53
- // discontinue ticketType(2026-03-25~)
54
- // ticketType: {
55
- // identifier: reservedTicket.ticketType.identifier,
56
- // typeOf: reservedTicket.ticketType.typeOf,
57
- // ...(typeof reservedTicket.ticketType.id === 'string') ? { id: reservedTicket.ticketType.id } : undefined
58
- // },
59
- ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
60
- ...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
61
- }
52
+ // discontinue issuedThrough,reservedTicket(2026-05-06~)
53
+ // issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
54
+ // reservedTicket: {
55
+ // typeOf: reservedTicket.typeOf,
56
+ // ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
57
+ // ...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
58
+ // }
62
59
  };
63
60
  // extend instrument to array(2025-02-18~)
64
61
  const instrument = [
65
62
  {
66
- // ...(typeof token === 'string') ? { token } : undefined, // discontinue token(2024-10-03~)
67
63
  ...(typeof ticketToken === 'string') ? { ticketToken } : undefined,
68
64
  typeOf: 'Ticket'
69
65
  },
@@ -61,11 +61,11 @@ function call(params) {
61
61
  const reserveService = new coa_service_1.COA.service.Reserve({
62
62
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
63
63
  auth: coaAuthClient
64
- }, { timeout: settings.coa.timeout });
64
+ }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
65
65
  const masterService = new coa_service_1.COA.service.Master({
66
66
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
67
67
  auth: coaAuthClient
68
- }, { timeout: settings.coa.timeout });
68
+ }, { timeout: (await settings.getByKey('coa')).timeoutMaster });
69
69
  const { agent, object, potentialActions, purpose } = params.data;
70
70
  // agent.idからflgMemberを自動セット(2024-12-16~)
71
71
  const isMember = memberClients.includes(agent.id);
@@ -48,7 +48,7 @@ function call(params) {
48
48
  const authorizePaymentMethodActionRepo = new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection);
49
49
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
50
50
  const paymentServiceId = params.data.object.issuedThrough.id;
51
- const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
51
+ const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
52
52
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
53
53
  && typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
54
54
  try {
@@ -54,7 +54,7 @@ function call(params) {
54
54
  const reserveService = new coa_service_1.COA.service.Reserve({
55
55
  endpoint: coaAuthClient.options.endpoint,
56
56
  auth: coaAuthClient
57
- }, { timeout: settings.coa.timeout });
57
+ }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
58
58
  const { object, instrument } = data;
59
59
  await (0, cancelReservation_2.cancelPendingReservation)({
60
60
  object,
@@ -25,7 +25,7 @@ function call(params) {
25
25
  const actionRepo = new checkMovieTicket_1.CheckMovieTicketActionRepo(connection);
26
26
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
27
27
  const paymentServiceId = params.data.object[0]?.id;
28
- const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
28
+ const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
29
29
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
30
30
  && typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
31
31
  try {
@@ -41,7 +41,7 @@ function call(params) {
41
41
  const reserveService = new coa_service_1.COA.service.Reserve({
42
42
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
43
43
  auth: coaAuthClient
44
- }, { timeout: settings.coa.timeout });
44
+ }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
45
45
  await confirmReserveTransaction({
46
46
  ...params.data,
47
47
  project: params.project,
@@ -137,7 +137,8 @@ function fixOrderAsPurpose(params) {
137
137
  const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
138
138
  orderNumber: { $eq: order.orderNumber },
139
139
  project: { id: { $eq: params.project.id } }
140
- }, ['itemOffered', 'offeredThrough']);
140
+ }, { useReserveTransaction: true } // 予約取引参照(2026-05-18~)
141
+ );
141
142
  return {
142
143
  ...order,
143
144
  acceptedOffers
@@ -27,9 +27,12 @@ function createAccountingReport(params) {
27
27
  orderNumber: data.object.mainEntity.orderNumber,
28
28
  project: { id: params.project.id },
29
29
  inclusion: [
30
- 'orderNumber', 'project', 'customer', 'confirmationNumber',
31
- 'paymentMethods', 'orderedItem', 'price', 'priceCurrency', 'seller', 'broker', 'typeOf', 'orderDate'
32
- ] // explicit projection(2024-07-25~)
30
+ 'orderNumber', 'project', 'paymentMethods', 'seller', 'typeOf', 'orderDate'
31
+ // 'customer', 'confirmationNumber',
32
+ // 'orderedItem',
33
+ // 'broker',
34
+ // 'price', 'priceCurrency',
35
+ ]
33
36
  });
34
37
  const simpleOrder = {
35
38
  typeOf: order.typeOf,
@@ -37,7 +40,6 @@ function createAccountingReport(params) {
37
40
  orderDate: order.orderDate
38
41
  };
39
42
  const actionObject = {
40
- // ...params,
41
43
  mainEntity: { orderNumber: simpleOrder.orderNumber },
42
44
  typeOf: 'Report'
43
45
  };
@@ -51,13 +53,9 @@ function createAccountingReport(params) {
51
53
  };
52
54
  const action = await repos.action.start(actionAttributes);
53
55
  try {
54
- const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
55
- orderNumber: { $eq: data.object.mainEntity.orderNumber },
56
- project: { id: { $eq: params.project.id } }
57
- });
58
56
  await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)({
59
57
  ...order,
60
- acceptedOffers
58
+ // acceptedOffers
61
59
  })(repos);
62
60
  }
63
61
  catch (error) {
@@ -57,7 +57,7 @@ function call(params) {
57
57
  const reserveService = new coa_service_1.COA.service.Reserve({
58
58
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
59
59
  auth: coaAuthClient
60
- }, { timeout: settings.coa.timeout });
60
+ }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
61
61
  await EventAggregationService.importFromCOA(params.data)({
62
62
  event: new event_1.EventRepo(connection),
63
63
  reserveService
@@ -64,7 +64,7 @@ function call(params) {
64
64
  const masterService = new coa_service_1.COA.service.Master({
65
65
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
66
66
  auth: coaAuthClient
67
- }, { timeout: settings.coa.timeout });
67
+ }, { timeout: (await settings.getByKey('coa')).timeoutMaster });
68
68
  await EventService.importFromCOA(params.data)({
69
69
  action: new action_1.ActionRepo(connection),
70
70
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
@@ -67,7 +67,7 @@ function call(params) {
67
67
  const masterService = new coa_service_1.COA.service.Master({
68
68
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
69
69
  auth: coaAuthClient
70
- }, { timeout: settings.coa.timeout });
70
+ }, { timeout: (await settings.getByKey('coa')).timeoutMaster });
71
71
  await OfferService.event.importFromCOA({
72
72
  project: { id: params.data.project.id },
73
73
  theaterCode: params.data.theaterCode,
@@ -38,7 +38,7 @@ function call(params) {
38
38
  order: new order_1.OrderRepo(connection)
39
39
  });
40
40
  const paymentServiceId = payActionAttributes.object.at(0)?.id;
41
- const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
41
+ const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
42
42
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
43
43
  && typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
44
44
  await (0, payByTask_1.payByTask)(
@@ -71,13 +71,14 @@ function fixOrderAsPurpose(params, transaction) {
71
71
  project: { id: { $eq: transaction.project.id } },
72
72
  acceptedOffers: {
73
73
  itemOffered: {
74
- typeOf: { $in: [factory_1.factory.reservationType.EventReservation] },
74
+ // typeOf: { $in: [factory.reservationType.EventReservation] }, // EventReservationしか存在しないので不要(2026-05-12~)
75
75
  // movieTicketsに結合されたイベントID,座席コードで絞る
76
76
  reservationFor: { id: { $in: [reservationForId] } },
77
77
  reservedTicket: { ticketedSeat: { seatNumber: { $in: seatNumbers } } }
78
78
  }
79
79
  }
80
- }, ['itemOffered', 'priceSpecification']);
80
+ }, { useReserveTransaction: true } // 予約取引参照(2026-05-18~)
81
+ );
81
82
  }
82
83
  return {
83
84
  ...orderWithoutAcceptedOffers,
@@ -35,7 +35,7 @@ function call(params) {
35
35
  data = params;
36
36
  }
37
37
  const paymentServiceId = data.object.at(0)?.id;
38
- const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
38
+ const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
39
39
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
40
40
  && typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
41
41
  await (0, refundByTask_1.refundByTask)(data)({
@@ -75,7 +75,7 @@ function call(params) {
75
75
  const reserveService = new coa_service_1.COA.service.Reserve({
76
76
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
77
77
  auth: coaAuthClient
78
- }, { timeout: settings.coa.timeout });
78
+ }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
79
79
  await returnReserve({
80
80
  ...params.data,
81
81
  sameAs: { id: params.id }
@@ -60,7 +60,7 @@ function call(params) {
60
60
  const masterService = new coa_service_1.COA.service.Master({
61
61
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
62
62
  auth: coaAuthClient
63
- }, { timeout: settings.coa.timeout });
63
+ }, { timeout: (await settings.getByKey('coa')).timeoutMaster });
64
64
  const { agent, object } = params.data;
65
65
  if (object.typeOf === factory_1.factory.eventType.ScreeningEventSeries) {
66
66
  await syncEventSeries({
@@ -1,6 +1,6 @@
1
+ import type { IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
1
2
  import { factory } from '../../factory';
2
- import type { IOperationExecute } from '../taskHandler';
3
3
  /**
4
4
  * タスク実行関数
5
5
  */
6
- export declare function call(data: factory.task.useReservation.IData): IOperationExecute<void>;
6
+ export declare function call(params: Pick<factory.task.useReservation.ITask, IExecutableTaskKeys>): IOperationExecute<void>;
@@ -12,25 +12,15 @@ const useReservation_1 = require("../reserve/useReservation");
12
12
  /**
13
13
  * タスク実行関数
14
14
  */
15
- function call(data) {
15
+ function call(params) {
16
16
  return async ({ connection }) => {
17
- let instrument;
18
- // support array(2025-02-17~)
19
- if (Array.isArray(data.instrument)) {
20
- instrument = data.instrument;
21
- }
22
- else {
23
- if (data.instrument?.typeOf === 'Ticket') {
24
- instrument = [data.instrument];
25
- }
26
- }
17
+ const { data, project } = params;
27
18
  await (0, useReservation_1.useReservation)({
28
- project: data.project,
19
+ project,
29
20
  agent: data.agent,
30
21
  object: data.object,
31
- instrument,
32
- // ...(typeof data.instrument?.typeOf === 'string') ? { instrument: data.instrument } : undefined,
33
- ...(typeof data.location?.typeOf === 'string') ? { location: data.location } : undefined
22
+ instrument: data.instrument,
23
+ ...(typeof data.location?.identifier === 'string') ? { location: data.location } : undefined
34
24
  })({
35
25
  action: new action_1.ActionRepo(connection),
36
26
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
@@ -39,8 +29,6 @@ function call(data) {
39
29
  reservation: new reservation_1.ReservationRepo(connection),
40
30
  setting: new setting_1.SettingRepo(connection),
41
31
  task: new task_1.TaskRepo(connection)
42
- }
43
- // settings
44
- );
32
+ });
45
33
  };
46
34
  }
@@ -24,7 +24,7 @@ function call(data) {
24
24
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
25
25
  }
26
26
  const paymentServiceId = data.object.object.id;
27
- const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
27
+ const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
28
28
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
29
29
  && typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
30
30
  await (0, voidPaymentByTask_1.voidPaymentByTask)(data)({
@@ -50,7 +50,7 @@ function call(params) {
50
50
  const reserveService = new coa_service_1.COA.service.Reserve({
51
51
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
52
52
  auth: coaAuthClient
53
- }, { timeout: settings.coa.timeout });
53
+ }, { timeout: (await settings.getByKey('coa')).timeoutReserve });
54
54
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
55
55
  try {
56
56
  await (0, voidTransaction_1.voidTransaction)({
@@ -74,6 +74,7 @@ function executeTask(task, next) {
74
74
  case factory_1.factory.taskName.SendEmailMessage:
75
75
  case factory_1.factory.taskName.SyncResourcesFromCOA:
76
76
  case factory_1.factory.taskName.TriggerWebhook:
77
+ case factory_1.factory.taskName.UseReservation:
77
78
  callResult = await call(task)(settings, options);
78
79
  break;
79
80
  default:
@@ -4,5 +4,5 @@ declare function validateInvoiceReferencesOrder(authorizePaymentActions: IAuthor
4
4
  /**
5
5
  * 受け入れられた興行オファー
6
6
  */
7
- eventReservationAcceptedOffers: factory.order.IAcceptedOffer[]): void;
7
+ eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered'>[]): void;
8
8
  export { validateInvoiceReferencesOrder };