@chevre/domain 24.1.0-alpha.3 → 24.1.0-alpha.31

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 (173) 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/mongoose/schemas/setting.d.ts +43 -0
  20. package/lib/chevre/repo/mongoose/schemas/setting.js +2 -1
  21. package/lib/chevre/repo/order.d.ts +2 -83
  22. package/lib/chevre/repo/order.js +171 -364
  23. package/lib/chevre/repo/orderInTransaction.d.ts +39 -3
  24. package/lib/chevre/repo/orderInTransaction.js +43 -1
  25. package/lib/chevre/repo/reservation.d.ts +20 -7
  26. package/lib/chevre/repo/reservation.js +14 -10
  27. package/lib/chevre/repo/role.d.ts +1 -15
  28. package/lib/chevre/repo/role.js +7 -14
  29. package/lib/chevre/repo/setting/integration.d.ts +19 -0
  30. package/lib/chevre/repo/setting/integration.js +72 -0
  31. package/lib/chevre/repo/transaction.d.ts +6 -6
  32. package/lib/chevre/repository.d.ts +5 -0
  33. package/lib/chevre/repository.js +11 -0
  34. package/lib/chevre/service/aggregation/event/aggregateOffers.js +22 -26
  35. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
  36. package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
  37. package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
  38. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
  39. package/lib/chevre/service/assetTransaction/pay/check.d.ts +1 -1
  40. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +1 -1
  41. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
  42. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -1
  43. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +1 -1
  44. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
  45. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  46. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +1 -1
  47. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +1 -1
  48. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +0 -12
  49. package/lib/chevre/service/assetTransaction/reserve/start/factory/price.d.ts +1 -1
  50. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +1 -1
  51. package/lib/chevre/service/delivery/factory.d.ts +6 -1
  52. package/lib/chevre/service/delivery/factory.js +1 -1
  53. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -3
  54. package/lib/chevre/service/delivery/reservation/factory.js +0 -17
  55. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +2 -2
  56. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +1 -1
  57. package/lib/chevre/service/offer/any.d.ts +6 -1
  58. package/lib/chevre/service/offer/event/authorize/factory.d.ts +6 -3
  59. package/lib/chevre/service/offer/event/authorize/factory.js +4 -7
  60. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
  61. package/lib/chevre/service/offer/event/authorize.d.ts +7 -1
  62. package/lib/chevre/service/offer/event/authorize.js +11 -3
  63. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +1 -1
  64. package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
  65. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
  66. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -3
  67. package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -3
  68. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +67 -72
  69. package/lib/chevre/service/order/deleteOrder.js +21 -44
  70. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +1 -1
  71. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +1 -1
  72. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +1 -1
  73. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +9 -11
  74. package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.d.ts +1 -1
  75. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +1 -1
  76. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +0 -1
  77. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +6 -1
  78. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +0 -1
  79. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +1 -1
  80. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  81. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
  82. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
  83. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +0 -1
  84. package/lib/chevre/service/order/onOrderUpdated.js +0 -1
  85. package/lib/chevre/service/order/payOrder.d.ts +1 -1
  86. package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
  87. package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +0 -5
  88. package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
  89. package/lib/chevre/service/order/placeOrder.d.ts +1 -1
  90. package/lib/chevre/service/order/returnOrder.js +0 -1
  91. package/lib/chevre/service/order/sendOrder.js +2 -5
  92. package/lib/chevre/service/payment/any/authorize.d.ts +1 -1
  93. package/lib/chevre/service/payment/any/person2username.js +0 -1
  94. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +1 -1
  95. package/lib/chevre/service/payment/creditCard/authorize.d.ts +1 -1
  96. package/lib/chevre/service/payment/creditCard/authorize.js +3 -3
  97. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -1
  98. package/lib/chevre/service/payment/creditCard/payCreditCard.js +1 -1
  99. package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +1 -1
  100. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -1
  101. package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +1 -1
  102. package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
  103. package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +1 -1
  104. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  105. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +8 -1
  106. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
  107. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -1
  108. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +1 -1
  109. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -1
  110. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
  111. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
  112. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +1 -1
  113. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +1 -1
  114. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
  115. package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +1 -1
  116. package/lib/chevre/service/reserve/confirmReservation.js +7 -7
  117. package/lib/chevre/service/reserve/factory.js +2 -1
  118. package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
  119. package/lib/chevre/service/reserve/findByCode.js +2 -1
  120. package/lib/chevre/service/reserve/findReservations.d.ts +4 -4
  121. package/lib/chevre/service/reserve/findReservations.js +16 -26
  122. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +0 -1
  123. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +0 -1
  124. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +4 -3
  125. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -10
  126. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +0 -1
  127. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +0 -1
  128. package/lib/chevre/service/reserve/searchByOrder.js +8 -3
  129. package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
  130. package/lib/chevre/service/reserve/useReservation.js +20 -24
  131. package/lib/chevre/service/task/acceptCOAOffer.js +2 -2
  132. package/lib/chevre/service/task/authorizePayment.js +1 -1
  133. package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
  134. package/lib/chevre/service/task/checkMovieTicket.js +1 -1
  135. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +1 -1
  136. package/lib/chevre/service/task/confirmReserveTransaction.js +3 -2
  137. package/lib/chevre/service/task/createAccountingReport.js +7 -9
  138. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +1 -1
  139. package/lib/chevre/service/task/importEventsFromCOA.js +1 -1
  140. package/lib/chevre/service/task/importOffersFromCOA.js +1 -1
  141. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
  142. package/lib/chevre/service/task/pay.js +1 -1
  143. package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +1 -1
  144. package/lib/chevre/service/task/payment/payByTask.d.ts +1 -1
  145. package/lib/chevre/service/task/payment/payByTask.js +3 -2
  146. package/lib/chevre/service/task/payment/refundByTask.d.ts +1 -1
  147. package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +1 -1
  148. package/lib/chevre/service/task/refund.js +1 -1
  149. package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
  150. package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
  151. package/lib/chevre/service/task/useReservation.d.ts +2 -2
  152. package/lib/chevre/service/task/useReservation.js +6 -18
  153. package/lib/chevre/service/task/voidPayment.js +1 -1
  154. package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
  155. package/lib/chevre/service/task.d.ts +1 -1
  156. package/lib/chevre/service/taskHandler.js +1 -0
  157. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +0 -1
  158. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +0 -1
  159. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
  160. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
  161. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
  162. package/lib/chevre/service/transaction/placeOrder/confirm.js +5 -3
  163. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +0 -1
  164. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +0 -1
  165. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +0 -1
  166. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +0 -1
  167. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -1
  168. package/lib/chevre/service/transaction/returnOrder/preStart.js +2 -4
  169. package/lib/chevre/service/validation/validateOrder.js +5 -79
  170. package/lib/chevre/settings.d.ts +0 -55
  171. package/lib/chevre/settings.js +1 -29
  172. package/lib/chevre/taskSettings.d.ts +1 -1
  173. package/package.json +2 -2
@@ -1,16 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrderInTransactionRepo = void 0;
4
+ // import { isDeepStrictEqual } from 'util';
4
5
  const factory_1 = require("../factory");
5
6
  const order_1 = require("./mongoose/schemas/order");
7
+ const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
8
+ // const debug = createDebug('chevre-domain:repo:orderInTransaction');
6
9
  /**
7
10
  * 取引中注文リポジトリ
8
11
  */
9
- class OrderInTransactionRepo {
12
+ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveRepo {
10
13
  orderModel;
11
14
  constructor(connection) {
15
+ super(connection);
12
16
  this.orderModel = connection.model(order_1.modelName, (0, order_1.createSchema)());
13
17
  }
18
+ /**
19
+ * 取引進行中の注文からacceptedOffersを検索する
20
+ * 予約取引から予約ごとの価格仕様も参照する
21
+ */
22
+ async findAcceptedOffersWithPriceByOrderNumber(params) {
23
+ const doc = await this.orderModel.findOne({
24
+ orderNumber: { $eq: params.orderNumber },
25
+ typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
26
+ }, { acceptedOffers: 1 })
27
+ .lean()
28
+ .exec();
29
+ if (doc === null) {
30
+ throw new factory_1.factory.errors.NotFound('orderInTransaction');
31
+ }
32
+ const isCOA = doc.acceptedOffers.at(0)?.offeredThrough?.identifier === factory_1.factory.service.webAPI.Identifier.COA;
33
+ // COAの場合、予約取引は存在しないのでそのまま返す
34
+ if (isCOA) {
35
+ return doc.acceptedOffers;
36
+ }
37
+ // priceSpecificationを予約取引から補完する(2026-05-12~)
38
+ let acceptedOffersByReserveTransaction = [];
39
+ const reservationNumbers = [...new Set(doc.acceptedOffers.map((aceptedOffer) => aceptedOffer.itemOffered.reservationNumber))];
40
+ if (reservationNumbers.length > 0) {
41
+ acceptedOffersByReserveTransaction = await this.findAcceptedOffersByReservationNumbers({ reservationNumbers });
42
+ }
43
+ return doc.acceptedOffers.map((acceptedOffer) => {
44
+ const priceSpecification = acceptedOffersByReserveTransaction.find((acceptedOfferByReserveTransaction) => acceptedOfferByReserveTransaction.itemOffered.id === acceptedOffer.itemOffered.id)?.priceSpecification;
45
+ // COA予約でなければ、予約取引の価格は必ず存在するはず(2026-05-20~)
46
+ if (priceSpecification === undefined) {
47
+ throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber: priceSpecification undefined. ${acceptedOffer.itemOffered.id}`);
48
+ }
49
+ return {
50
+ ...acceptedOffer,
51
+ priceSpecification
52
+ };
53
+ });
54
+ }
14
55
  /**
15
56
  * 取引進行中の注文からacceptedOffersを検索する
16
57
  */
@@ -28,6 +69,7 @@ class OrderInTransactionRepo {
28
69
  }
29
70
  /**
30
71
  * 注文を受注する
72
+ * typeOf: PlaceOrder -> typeOf: Order
31
73
  */
32
74
  async placeOrder(order) {
33
75
  if (!(order.orderDate instanceof Date)) {
@@ -8,9 +8,7 @@ export interface IUpdatePartiallyParams {
8
8
  export type ICancelResult = UpdateWriteOpResult;
9
9
  export type ICheckedInResult = UpdateWriteOpResult;
10
10
  type ISavingReservedTicket = Omit<factory.assetTransaction.reserve.ISubReservationReservedTicket, 'ticketType'> & {
11
- ticketType: {
12
- id?: string;
13
- };
11
+ ticketType?: never;
14
12
  };
15
13
  /**
16
14
  * ドキュメントとして保管する予約
@@ -22,7 +20,7 @@ export type ICreatingReservation = Omit<factory.reservation.eventReservation.IRe
22
20
  /**
23
21
  * 廃止予定の予約属性
24
22
  */
25
- export type IDeprecatedField = 'price' | 'underName';
23
+ export type IDeprecatedField = 'price' | 'underName' | 'priceCurrency' | 'issuedThrough' | 'numSeats';
26
24
  export type IKeyOfProjection = Exclude<keyof factory.reservation.eventReservation.IReservation, IDeprecatedField> | 'reservedTicket.dateUsed' | 'reservationFor.id' | 'reservationFor.typeOf';
27
25
  export type IAttendedReservation = Pick<factory.reservation.eventReservation.IReservation, 'id' | 'typeOf' | 'project' | 'modifiedTime'> & {
28
26
  reservationFor: Pick<factory.reservation.eventReservation.IReservationForMinimized, 'id' | 'typeOf'>;
@@ -37,6 +35,18 @@ export type IReservationAsFindResult = Omit<factory.reservation.eventReservation
37
35
  * 実データとしてはまだ存在しているが型から廃止(2026-03-26~)
38
36
  */
39
37
  underName?: never;
38
+ /**
39
+ * discontinue(2026-05-10~)
40
+ */
41
+ priceCurrency?: never;
42
+ /**
43
+ * discontinue(2026-05-10~)
44
+ */
45
+ issuedThrough?: never;
46
+ /**
47
+ * discontinue(2026-05-11~)
48
+ */
49
+ numSeats?: never;
40
50
  };
41
51
  /**
42
52
  * 予約リポジトリ
@@ -63,7 +73,6 @@ export declare class ReservationRepo {
63
73
  };
64
74
  provider: factory.reservation.IProvider;
65
75
  subReservation: factory.assetTransaction.reserve.IObjectSubReservation[];
66
- issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
67
76
  reservationFor: factory.assetTransaction.reserve.IReservationFor;
68
77
  reservationNumber: string;
69
78
  underName?: factory.reservation.IUnderName;
@@ -145,16 +154,20 @@ export declare class ReservationRepo {
145
154
  }): Promise<string[]>;
146
155
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id"> & {
147
156
  _id: string;
148
- bookingAgent?: any;
149
157
  previousReservationStatus?: factory.reservationStatusType;
158
+ price?: never;
159
+ priceCurrency?: never;
160
+ issuedThrough?: never;
150
161
  } & Required<{
151
162
  _id: string;
152
163
  }> & {
153
164
  __v: number;
154
165
  }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id"> & {
155
166
  _id: string;
156
- bookingAgent?: any;
157
167
  previousReservationStatus?: factory.reservationStatusType;
168
+ price?: never;
169
+ priceCurrency?: never;
170
+ issuedThrough?: never;
158
171
  } & Required<{
159
172
  _id: string;
160
173
  }> & {
@@ -114,15 +114,19 @@ class ReservationRepo {
114
114
  const bulkWriteOps = [];
115
115
  if (Array.isArray(params.subReservation)) {
116
116
  params.subReservation.forEach((subReservation) => {
117
- const { price: _discontinuePrice, reservedTicket, ...subReservationWithoutPrice } = subReservation;
118
- const { ticketType, ...reservedTicketWithoutTicketType } = reservedTicket;
119
- // 予約ドキュメントのticketTypeを最小化(2026-04-03~)
120
- const savingReservedTicket = {
121
- ...reservedTicketWithoutTicketType,
122
- ticketType: {
123
- ...((typeof ticketType.id === 'string') && { id: ticketType.id })
124
- }
125
- };
117
+ const { price: _discontinuePrice, reservedTicket, priceCurrency: _discontinuePriceCurrency, // discontinue priceCurrency
118
+ numSeats: _numSeats, // discontinue(2026-05-11~)
119
+ ...subReservationWithoutPrice } = subReservation;
120
+ const { ticketType: _ticketType, ...reservedTicketWithoutTicketType } = reservedTicket;
121
+ // discontinue ticketType(2026-05-09~)
122
+ const savingReservedTicket = reservedTicketWithoutTicketType;
123
+ // // 予約ドキュメントのticketTypeを最小化(2026-04-03~)
124
+ // const savingReservedTicket: ISavingReservedTicket = {
125
+ // ...reservedTicketWithoutTicketType,
126
+ // ticketType: {
127
+ // ...((typeof ticketType.id === 'string') && { id: ticketType.id })
128
+ // }
129
+ // };
126
130
  // reservationFor最小化(2026-04-06~)
127
131
  const { minimizedReservationFor } = (0, minimizeReservationFor_1.minimizeReservationFor)(params.reservationFor);
128
132
  const setOnInsert = {
@@ -132,7 +136,7 @@ class ReservationRepo {
132
136
  bookingTime: params.bookingTime,
133
137
  checkedIn: false,
134
138
  attended: false,
135
- issuedThrough: params.issuedThrough,
139
+ // issuedThrough: params.issuedThrough, // discontinue issuedThrough
136
140
  project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
137
141
  reservationFor: minimizedReservationFor,
138
142
  reservationNumber: params.reservationNumber,
@@ -59,23 +59,9 @@ export declare class RoleRepo {
59
59
  } & {
60
60
  __v: number;
61
61
  }) | null>;
62
- addMember(params: Pick<IRole, 'member' | 'memberOf' | 'roleName'>): Promise<(import("mongoose").FlattenMaps<{
63
- typeOf: import("@chevre/factory/lib/chevre/role").RoleType;
64
- memberOf: {
65
- typeOf: factory.organizationType.Corporation | factory.organizationType.Project;
66
- };
67
- member: {
68
- typeOf: import("@chevre/factory/lib/chevre/role/organizationRole").IMemberType;
69
- };
70
- roleName: import("@chevre/factory/lib/chevre/role/organizationRole").RoleName;
71
- permissions: string[];
72
- }> & {
73
- _id: import("mongoose").Types.ObjectId;
74
- } & {
75
- __v: number;
76
- }) | null>;
77
62
  create(params: Pick<IRole, 'member' | 'memberOf' | 'permissions' | 'roleName'>): Promise<{
78
63
  id: string;
79
64
  }>;
65
+ deleteByRoleName(params: Pick<IRole, 'roleName'>): Promise<import("mongodb").DeleteResult>;
80
66
  }
81
67
  export {};
@@ -139,20 +139,6 @@ class RoleRepo {
139
139
  .lean()
140
140
  .exec();
141
141
  }
142
- async addMember(params) {
143
- const { roleName, member, memberOf } = params;
144
- return this.roleModel.findOneAndUpdate({
145
- roleName: { $eq: roleName },
146
- 'member.typeOf': { $ne: member.typeOf }
147
- }, {
148
- $set: { member, memberOf }
149
- }, {
150
- new: true,
151
- projection: { _id: 1 }
152
- })
153
- .lean()
154
- .exec();
155
- }
156
142
  async create(params) {
157
143
  const { member, memberOf, permissions, roleName } = params;
158
144
  const creatingRole = {
@@ -167,5 +153,12 @@ class RoleRepo {
167
153
  const savedId = insertedId;
168
154
  return { id: savedId };
169
155
  }
156
+ async deleteByRoleName(params) {
157
+ const { roleName } = params;
158
+ return this.roleModel.deleteOne({
159
+ roleName: { $eq: roleName }
160
+ })
161
+ .exec();
162
+ }
170
163
  }
171
164
  exports.RoleRepo = RoleRepo;
@@ -0,0 +1,19 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { IIntegrationSettings } from '../mongoose/schemas/setting';
3
+ interface IDBOptions {
4
+ connection: Connection;
5
+ }
6
+ /**
7
+ * 外部連携設定リポジトリ
8
+ */
9
+ export declare class IntegrationSettingRepo {
10
+ private readonly settingModel;
11
+ private readonly options;
12
+ constructor(options: IDBOptions);
13
+ /**
14
+ * 設定名称から設定を参照する
15
+ */
16
+ getByKey<T extends keyof IIntegrationSettings>(key: T): Promise<IIntegrationSettings[T]>;
17
+ addIntegrationSettings(params: IIntegrationSettings): Promise<import("mongoose").UpdateWriteOpResult>;
18
+ }
19
+ export {};
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegrationSettingRepo = void 0;
4
+ const factory_1 = require("../../factory");
5
+ const setting_1 = require("../mongoose/schemas/setting");
6
+ const defaultOptions = {
7
+ abortedTasksWithoutReport: [
8
+ factory_1.factory.taskName.ImportEventCapacitiesFromCOA,
9
+ factory_1.factory.taskName.ImportEventsFromCOA,
10
+ factory_1.factory.taskName.ImportOffersFromCOA,
11
+ ],
12
+ numTryConfirmReserveTransaction: 10,
13
+ deliverOrderLimit: 10,
14
+ coa: {
15
+ timeoutReserve: 20000,
16
+ timeoutMaster: 30000
17
+ },
18
+ gmo: {
19
+ timeout: 4000,
20
+ timeoutBackground: 6000
21
+ },
22
+ movieticketReserve: {
23
+ timeoutPay: 5000,
24
+ timeoutRefund: 5000,
25
+ timeoutCheck: 4000,
26
+ minIntervalBetweenPayAndRefund: 10000,
27
+ credentialsExpireInSeconds: 600
28
+ },
29
+ useExperimentalFeature: false
30
+ };
31
+ /**
32
+ * 外部連携設定リポジトリ
33
+ */
34
+ class IntegrationSettingRepo {
35
+ settingModel;
36
+ options;
37
+ constructor(options
38
+ // options: IOptions & IDBOptions
39
+ ) {
40
+ const { connection
41
+ // ...restOptions
42
+ } = options;
43
+ this.settingModel = connection.model(setting_1.modelName, (0, setting_1.createSchema)());
44
+ this.options = defaultOptions;
45
+ // this.options = restOptions; // defaultOptionsでひとまず固定化(2026-05-23~)
46
+ }
47
+ /**
48
+ * 設定名称から設定を参照する
49
+ */
50
+ async getByKey(key) {
51
+ const projection = {
52
+ _id: 0,
53
+ [`integration.${key}`]: 1
54
+ };
55
+ const settingDoc = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, projection)
56
+ .lean()
57
+ .exec();
58
+ if (settingDoc?.integration !== undefined) {
59
+ return settingDoc.integration[key];
60
+ }
61
+ return this.options[key];
62
+ }
63
+ async addIntegrationSettings(params) {
64
+ return this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
65
+ $set: {
66
+ integration: params
67
+ }
68
+ })
69
+ .exec();
70
+ }
71
+ }
72
+ exports.IntegrationSettingRepo = IntegrationSettingRepo;
@@ -136,11 +136,11 @@ export declare class TransactionRepo {
136
136
  result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
137
137
  startDate: Date;
138
138
  endDate?: Date | undefined;
139
- agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
140
139
  instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
141
- potentialActions?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IPotentialActions | undefined;
140
+ agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
142
141
  status: factory.transactionStatusType;
143
142
  tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
143
+ potentialActions?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IPotentialActions | undefined;
144
144
  } & {
145
145
  _id: import("mongoose").Types.ObjectId;
146
146
  } & {
@@ -156,10 +156,10 @@ export declare class TransactionRepo {
156
156
  startDate: Date;
157
157
  endDate?: Date | undefined;
158
158
  agent: import("@chevre/factory/lib/chevre/transaction").IAgent;
159
- potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
160
159
  recipient?: undefined;
161
160
  status: factory.transactionStatusType;
162
161
  tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
162
+ potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
163
163
  } & {
164
164
  _id: import("mongoose").Types.ObjectId;
165
165
  } & {
@@ -174,11 +174,11 @@ export declare class TransactionRepo {
174
174
  result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
175
175
  startDate: Date;
176
176
  endDate?: Date | undefined;
177
- agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
178
177
  instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
179
- potentialActions?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IPotentialActions | undefined;
178
+ agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
180
179
  status: factory.transactionStatusType;
181
180
  tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
181
+ potentialActions?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IPotentialActions | undefined;
182
182
  } & {
183
183
  _id: import("mongoose").Types.ObjectId;
184
184
  } & {
@@ -194,10 +194,10 @@ export declare class TransactionRepo {
194
194
  startDate: Date;
195
195
  endDate?: Date | undefined;
196
196
  agent: import("@chevre/factory/lib/chevre/transaction").IAgent;
197
- potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
198
197
  recipient?: undefined;
199
198
  status: factory.transactionStatusType;
200
199
  tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
200
+ potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
201
201
  } & {
202
202
  _id: import("mongoose").Types.ObjectId;
203
203
  } & {
@@ -79,6 +79,7 @@ import type { SellerPaymentAcceptedRepo } from './repo/sellerPaymentAccepted';
79
79
  import type { SellerReturnPolicyRepo } from './repo/sellerReturnPolicy';
80
80
  import type { ServiceAvailableHourRepo } from './repo/service/availableHour';
81
81
  import type { SettingRepo } from './repo/setting';
82
+ import type { IntegrationSettingRepo } from './repo/setting/integration';
82
83
  import type { JWTSettingRepo } from './repo/setting/jwt';
83
84
  import type { StockHolderRepo } from './repo/stockHolder';
84
85
  import type { TaskRepo } from './repo/task';
@@ -437,6 +438,10 @@ export declare namespace Setting {
437
438
  function createInstance(...params: ConstructorParameters<typeof SettingRepo>): Promise<SettingRepo>;
438
439
  }
439
440
  export declare namespace setting {
441
+ type Integration = IntegrationSettingRepo;
442
+ namespace Integration {
443
+ function createInstance(...params: ConstructorParameters<typeof IntegrationSettingRepo>): Promise<IntegrationSettingRepo>;
444
+ }
440
445
  type JWT = JWTSettingRepo;
441
446
  namespace JWT {
442
447
  function createInstance(...params: ConstructorParameters<typeof JWTSettingRepo>): Promise<JWTSettingRepo>;
@@ -911,6 +911,17 @@ var Setting;
911
911
  })(Setting || (exports.Setting = Setting = {}));
912
912
  var setting;
913
913
  (function (setting) {
914
+ let Integration;
915
+ (function (Integration) {
916
+ let repo;
917
+ async function createInstance(...params) {
918
+ if (repo === undefined) {
919
+ repo = (await import('./repo/setting/integration.js')).IntegrationSettingRepo;
920
+ }
921
+ return new repo(...params);
922
+ }
923
+ Integration.createInstance = createInstance;
924
+ })(Integration = setting.Integration || (setting.Integration = {}));
914
925
  let JWT;
915
926
  (function (JWT) {
916
927
  let repo;
@@ -125,48 +125,44 @@ function aggregateOfferByEvent(params) {
125
125
  function aggregateReservationByOffer(params) {
126
126
  return async (repos) => {
127
127
  let reservationCount4offer;
128
- // let attendeeCount4offer: number | undefined;
129
- // let checkInCount4offer: number | undefined;
130
128
  const reservationType = factory_1.factory.reservationType.EventReservation;
131
129
  const offerIdsWithSameCategory = params.availableOffers.filter(({ category }) => {
132
130
  return typeof category?.codeValue === 'string' && category.codeValue === params.offer.category?.codeValue;
133
131
  })
134
132
  .map(({ id }) => id);
135
133
  if (offerIdsWithSameCategory.length > 0) {
136
- reservationCount4offer = await repos.reservation.count({
137
- typeOf: reservationType,
138
- reservationFor: { id: { $eq: params.event.id } },
139
- reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed],
140
- // オファーカテゴリーごとに集計する(2024-11-10~)
141
- // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } }
142
- reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } }
143
- });
144
- // attendeeCount4offer = await repos.reservation.count({
134
+ // オファーIDによる集計を座席区分(オファーの適用座席区分を参照)による集計に変更(2026-05-05~)
135
+ // reservationCount4offer = await repos.reservation.count({
145
136
  // typeOf: reservationType,
146
137
  // reservationFor: { id: { $eq: params.event.id } },
147
138
  // reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
148
- // // オファーカテゴリーごとに集計する(2024-11-10~)
149
- // // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } },
150
- // reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } },
151
- // attended: true
152
- // });
153
- // checkInCount4offer = await repos.reservation.count({
154
- // typeOf: reservationType,
155
- // reservationFor: { id: { $eq: params.event.id } },
156
- // reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
157
- // // オファーカテゴリーごとに集計する(2024-11-10~)
158
- // // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } },
159
- // reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } },
160
- // checkedIn: true
139
+ // reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } }
161
140
  // });
141
+ const aggregateSeatingType = params.offer.eligibleSeatingType?.at(0)?.codeValue;
142
+ if (typeof aggregateSeatingType === 'string') {
143
+ reservationCount4offer = await repos.reservation.count({
144
+ typeOf: reservationType,
145
+ reservationFor: { id: { $eq: params.event.id } },
146
+ reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed],
147
+ reservedTicket: {
148
+ ticketedSeat: {
149
+ seatingType: { $in: [aggregateSeatingType] }
150
+ }
151
+ }
152
+ });
153
+ // console.log(
154
+ // 'aggregateReservationByOffer: reservationCount4offer:', reservationCount4offer,
155
+ // 'aggregateSeatingType:', aggregateSeatingType,
156
+ // 'offer.id:', params.offer.id,
157
+ // 'offer.category:', params.offer.category?.codeValue
158
+ // );
159
+ }
162
160
  }
163
161
  const { maximumAttendeeCapacity, remainingAttendeeCapacity } = await calculateCapacityByOffer(params)(repos);
164
162
  return {
165
163
  aggregateReservation: {
166
164
  typeOf: 'AggregateReservation',
167
165
  reservationCount: reservationCount4offer
168
- // attendeeCount: attendeeCount4offer, // discontinue(2024-11-10~)
169
- // checkInCount: checkInCount4offer // discontinue(2024-11-10~)
170
166
  },
171
167
  ...(typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined,
172
168
  ...(typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined
@@ -10,7 +10,6 @@ exports.aggregateScreeningEvent = aggregateScreeningEvent;
10
10
  const debug_1 = __importDefault(require("debug"));
11
11
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
12
12
  const factory_1 = require("../../../factory");
13
- // import { Settings } from '../../../settings';
14
13
  const findEventOffers_1 = require("./findEventOffers");
15
14
  const debug = (0, debug_1.default)('chevre-domain:service:aggregation');
16
15
  /**
@@ -69,10 +69,11 @@ function createPotentialActions(params) {
69
69
  const reservationForByReserveTransaction = transaction.object.transaction?.object.reservationFor;
70
70
  if (reservationForByReserveTransaction !== undefined && typeof reservationNumber === 'string') {
71
71
  const cancelObject = {
72
- reservationFor: {
73
- typeOf: reservationForByReserveTransaction.typeOf,
74
- id: String(reservationForByReserveTransaction.id)
75
- },
72
+ // discontinue reservationFor(2026-05-09~)
73
+ // reservationFor: {
74
+ // typeOf: reservationForByReserveTransaction.typeOf,
75
+ // id: String(reservationForByReserveTransaction.id)
76
+ // },
76
77
  reservationNumber,
77
78
  // ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
78
79
  reservationStatus: factory_1.factory.reservationStatusType.ReservationConfirmed,
@@ -100,13 +101,15 @@ function createPotentialActions(params) {
100
101
  cancelObject = {
101
102
  typeOf: reservation.typeOf,
102
103
  id: reservation.id,
103
- issuedThrough: {
104
- typeOf: reservation.issuedThrough?.typeOf
105
- },
106
- reservationFor: {
107
- typeOf: reservation.reservationFor.typeOf,
108
- id: String(reservation.reservationFor.id)
109
- },
104
+ // discontinue issuedThrough(2026-05-08~)
105
+ // issuedThrough: {
106
+ // typeOf: reservation.issuedThrough?.typeOf
107
+ // },
108
+ // discontinue reservationFor(2026-05-09~)
109
+ // reservationFor: {
110
+ // typeOf: reservation.reservationFor.typeOf,
111
+ // id: String(reservation.reservationFor.id)
112
+ // },
110
113
  reservationNumber: reservation.reservationNumber,
111
114
  // ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
112
115
  reservationStatus: factory_1.factory.reservationStatusType.ReservationConfirmed
@@ -18,7 +18,7 @@ export declare function validateStartParams(params: IStartParams): (repos: {
18
18
  assetTransaction: AssetTransactionRepo;
19
19
  }) => Promise<{
20
20
  reserveTransaction: import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction | undefined;
21
- reservations: (Pick<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id" | "typeOf" | "issuedThrough" | "reservationNumber"> & {
21
+ reservations: (Pick<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id" | "typeOf" | "reservationNumber"> & {
22
22
  reservationFor: Pick<factory.reservation.eventReservation.IReservationForMinimized, "id" | "typeOf">;
23
23
  })[] | undefined;
24
24
  }>;
@@ -43,7 +43,7 @@ function validateStartParams(params) {
43
43
  const reservation = await repos.reservation.findReservationById({
44
44
  id: params.object.reservation.id,
45
45
  inclusion: [
46
- 'issuedThrough', 'typeOf', 'reservationNumber', 'reservationFor.id', 'reservationFor.typeOf', 'provider', 'reservationStatus'
46
+ 'typeOf', 'reservationNumber', 'reservationFor.id', 'reservationFor.typeOf', 'provider', 'reservationStatus'
47
47
  ]
48
48
  });
49
49
  // 販売者検証(2023-08-01~)
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../factory';
2
- import { Settings } from '../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
3
  import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
4
4
  import type { CredentialsRepo } from '../../../repo/credentials';
5
5
  import type { EventRepo } from '../../../repo/event';
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../factory';
2
- import { Settings } from '../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
3
  import type { AcceptPayActionRepo } from '../../../repo/action/acceptPay';
4
4
  import type { AuthorizeInvoiceActionRepo } from '../../../repo/action/authorizeInvoice';
5
5
  import type { EventRepo } from '../../../repo/event';
@@ -2,7 +2,7 @@
2
2
  * 決済取引サービス
3
3
  */
4
4
  import type { GMO } from '@motionpicture/gmo-service';
5
- import { Settings } from '../../../settings';
5
+ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
6
6
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
7
7
  import type { PaymentServiceRepo } from '../../../repo/paymentService';
8
8
  import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../../factory';
2
- import { Settings } from '../../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../../repo/setting/integration';
3
3
  import type { AccountingReportRepo } from '../../../../repo/accountingReport';
4
4
  import type { PayActionRepo } from '../../../../repo/action/pay';
5
5
  import type { RefundActionRepo } from '../../../../repo/action/refund';
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../../factory';
2
- import { Settings } from '../../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../../repo/setting/integration';
3
3
  import type { AuthorizeInvoiceActionRepo } from '../../../../repo/action/authorizeInvoice';
4
4
  import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
5
5
  import type { PaymentServiceRepo } from '../../../../repo/paymentService';
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../../factory';
2
- import { Settings } from '../../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../../repo/setting/integration';
3
3
  import type { AccountingReportRepo } from '../../../../repo/accountingReport';
4
4
  import type { PayActionRepo } from '../../../../repo/action/pay';
5
5
  import type { RefundActionRepo } from '../../../../repo/action/refund';
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../factory';
2
- import { Settings } from '../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
3
  import type { AccountingReportRepo } from '../../../repo/accountingReport';
4
4
  import type { PayActionRepo } from '../../../repo/action/pay';
5
5
  import type { RefundActionRepo } from '../../../repo/action/refund';
@@ -1,4 +1,4 @@
1
- import { Settings } from '../../../settings';
1
+ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
2
2
  import type { ActionRepo } from '../../../repo/action';
3
3
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
4
4
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
@@ -1,5 +1,5 @@
1
1
  import { factory } from '../../../factory';
2
- import { Settings } from '../../../settings';
2
+ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
3
  import type { ActionRepo } from '../../../repo/action';
4
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
5
  import type { AuthorizationRepo } from '../../../repo/authorization';