@chevre/domain 24.1.0-alpha.8 → 25.0.0-alpha.0

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 (223) hide show
  1. package/lib/chevre/emailMessageBuilder.d.ts +1 -1
  2. package/lib/chevre/emailMessageBuilder.js +4 -12
  3. package/lib/chevre/factory/transaction/placeOrder.d.ts +2 -10
  4. package/lib/chevre/factory/transaction/placeOrder.js +1 -0
  5. package/lib/chevre/index.d.ts +1 -2
  6. package/lib/chevre/index.js +1 -3
  7. package/lib/chevre/repo/acceptedOffer.d.ts +25 -27
  8. package/lib/chevre/repo/acceptedOffer.js +102 -67
  9. package/lib/chevre/repo/acceptedOfferInReserve.d.ts +34 -0
  10. package/lib/chevre/repo/acceptedOfferInReserve.js +86 -0
  11. package/lib/chevre/repo/accountingReport.js +2 -30
  12. package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
  13. package/lib/chevre/repo/assetTransaction/reserve.d.ts +1 -2
  14. package/lib/chevre/repo/assetTransaction/reserve.js +4 -50
  15. package/lib/chevre/repo/event.js +12 -8
  16. package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +9 -0
  17. package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +76 -0
  18. package/lib/chevre/repo/factory/reservation/createMongoConditions.d.ts +1 -1
  19. package/lib/chevre/repo/factory/reservation/createMongoConditions.js +171 -363
  20. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +42 -42
  21. package/lib/chevre/repo/mongoose/schemas/order.js +134 -131
  22. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -2
  23. package/lib/chevre/repo/mongoose/schemas/reservation.js +6 -57
  24. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +84 -0
  25. package/lib/chevre/repo/mongoose/schemas/setting.js +2 -1
  26. package/lib/chevre/repo/order.d.ts +1 -82
  27. package/lib/chevre/repo/order.js +11 -372
  28. package/lib/chevre/repo/orderInTransaction.d.ts +58 -7
  29. package/lib/chevre/repo/orderInTransaction.js +58 -4
  30. package/lib/chevre/repo/place/hasPOS.js +2 -1
  31. package/lib/chevre/repo/reservation.d.ts +20 -9
  32. package/lib/chevre/repo/reservation.js +16 -12
  33. package/lib/chevre/repo/role.d.ts +1 -15
  34. package/lib/chevre/repo/role.js +7 -14
  35. package/lib/chevre/repo/setting/integration.d.ts +27 -0
  36. package/lib/chevre/repo/setting/integration.js +102 -0
  37. package/lib/chevre/repo/transaction/placeOrder.d.ts +8 -3
  38. package/lib/chevre/repo/transaction/placeOrder.js +5 -1
  39. package/lib/chevre/repo/transaction.d.ts +6 -6
  40. package/lib/chevre/repo/transaction.js +0 -776
  41. package/lib/chevre/repository.d.ts +5 -0
  42. package/lib/chevre/repository.js +11 -0
  43. package/lib/chevre/service/aggregation/event/aggregateOffers.js +6 -1
  44. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
  45. package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
  46. package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
  47. package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
  48. package/lib/chevre/service/assetTransaction/pay/check.d.ts +1 -1
  49. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +1 -1
  50. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
  51. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -1
  52. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +1 -1
  53. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
  54. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  55. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +1 -1
  56. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +1 -1
  57. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +2 -2
  58. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +1 -8
  59. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +20 -32
  60. package/lib/chevre/service/assetTransaction/reserve/start/factory/price.d.ts +1 -1
  61. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +1 -1
  62. package/lib/chevre/service/delivery/factory.d.ts +6 -1
  63. package/lib/chevre/service/delivery/factory.js +1 -1
  64. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -3
  65. package/lib/chevre/service/delivery/reservation/factory.js +0 -17
  66. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +2 -4
  67. package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +3 -3
  68. package/lib/chevre/service/notification/notifyByEmail.d.ts +3 -3
  69. package/lib/chevre/service/notification/notifyByEmail.js +7 -12
  70. package/lib/chevre/service/notification/sendEmailMessage.d.ts +2 -3
  71. package/lib/chevre/service/notification/sendEmailMessage.js +5 -4
  72. package/lib/chevre/service/offer/any.d.ts +7 -2
  73. package/lib/chevre/service/offer/event/authorize/factory.d.ts +6 -3
  74. package/lib/chevre/service/offer/event/authorize/factory.js +17 -18
  75. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
  76. package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
  77. package/lib/chevre/service/offer/event/authorize.js +55 -107
  78. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +1 -1
  79. package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
  80. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
  81. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -3
  82. package/lib/chevre/service/order/deleteOrder.d.ts +1 -1
  83. package/lib/chevre/service/order/deleteOrder.js +19 -46
  84. package/lib/chevre/service/order/{findPlaceOrderTransaction.d.ts → findConfirmedPlaceOrder.d.ts} +1 -1
  85. package/lib/chevre/service/order/{findPlaceOrderTransaction.js → findConfirmedPlaceOrder.js} +12 -7
  86. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +2 -2
  87. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +1 -1
  88. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +1 -1
  89. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +1 -1
  90. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +11 -18
  91. package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.d.ts +1 -1
  92. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +1 -1
  93. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +0 -1
  94. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +6 -1
  95. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +0 -1
  96. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +1 -1
  97. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  98. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
  99. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
  100. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +0 -1
  101. package/lib/chevre/service/order/onOrderUpdated.js +0 -1
  102. package/lib/chevre/service/order/payOrder.d.ts +1 -1
  103. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +1 -1
  104. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +19 -7
  105. package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
  106. package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +0 -5
  107. package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
  108. package/lib/chevre/service/order/placeOrder/factory.js +33 -22
  109. package/lib/chevre/service/order/placeOrder.d.ts +3 -2
  110. package/lib/chevre/service/order/placeOrder.js +0 -9
  111. package/lib/chevre/service/order/returnOrder.js +0 -1
  112. package/lib/chevre/service/order/sendOrder.js +1 -7
  113. package/lib/chevre/service/payment/any/authorize.d.ts +1 -1
  114. package/lib/chevre/service/payment/any/factory.js +7 -6
  115. package/lib/chevre/service/payment/any/person2username.js +0 -1
  116. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +1 -1
  117. package/lib/chevre/service/payment/creditCard/authorize.d.ts +1 -1
  118. package/lib/chevre/service/payment/creditCard/authorize.js +4 -3
  119. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -1
  120. package/lib/chevre/service/payment/creditCard/payCreditCard.js +1 -1
  121. package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +1 -1
  122. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -1
  123. package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +1 -1
  124. package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
  125. package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +1 -1
  126. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  127. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +8 -1
  128. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
  129. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -1
  130. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +1 -1
  131. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -1
  132. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
  133. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
  134. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +1 -1
  135. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +1 -1
  136. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
  137. package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +1 -1
  138. package/lib/chevre/service/reserve/confirmReservation.js +7 -7
  139. package/lib/chevre/service/reserve/factory.js +2 -1
  140. package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
  141. package/lib/chevre/service/reserve/findByCode.js +1 -1
  142. package/lib/chevre/service/reserve/findReservations.d.ts +14 -6
  143. package/lib/chevre/service/reserve/findReservations.js +26 -36
  144. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +0 -1
  145. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +0 -1
  146. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +4 -3
  147. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -10
  148. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +0 -1
  149. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +0 -1
  150. package/lib/chevre/service/reserve/searchByOrder.js +7 -3
  151. package/lib/chevre/service/task/acceptCOAOffer.js +6 -3
  152. package/lib/chevre/service/task/authorizePayment.js +4 -2
  153. package/lib/chevre/service/task/cancelPendingReservation.js +4 -2
  154. package/lib/chevre/service/task/checkMovieTicket.js +4 -2
  155. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +1 -1
  156. package/lib/chevre/service/task/confirmReserveTransaction.js +5 -3
  157. package/lib/chevre/service/task/createAccountingReport.js +0 -4
  158. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +4 -2
  159. package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
  160. package/lib/chevre/service/task/importOffersFromCOA.js +4 -2
  161. package/lib/chevre/service/task/invalidatePaymentUrl.js +3 -1
  162. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -1
  163. package/lib/chevre/service/task/onOrderPaymentCompleted.js +3 -1
  164. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
  165. package/lib/chevre/service/task/pay.js +4 -2
  166. package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +1 -1
  167. package/lib/chevre/service/task/payment/payByTask.d.ts +1 -1
  168. package/lib/chevre/service/task/payment/payByTask.js +6 -7
  169. package/lib/chevre/service/task/payment/refundByTask.d.ts +1 -1
  170. package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +1 -1
  171. package/lib/chevre/service/task/placeOrder.js +3 -1
  172. package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
  173. package/lib/chevre/service/task/refund.js +4 -2
  174. package/lib/chevre/service/task/returnReserveTransaction.js +4 -2
  175. package/lib/chevre/service/task/sendEmailMessage.js +5 -3
  176. package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
  177. package/lib/chevre/service/task/voidPayment.js +4 -2
  178. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  179. package/lib/chevre/service/task.d.ts +0 -7
  180. package/lib/chevre/service/transaction/deleteTransaction.js +13 -7
  181. package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.d.ts +0 -1
  182. package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.js +7 -17
  183. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +7 -1
  184. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +0 -1
  185. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +7 -1
  186. package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +0 -1
  187. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
  188. package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
  189. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +5 -4
  190. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +5 -4
  191. package/lib/chevre/service/transaction/placeOrder/confirm.js +55 -58
  192. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +0 -1
  193. package/lib/chevre/service/transaction/placeOrder/start/factory.d.ts +11 -2
  194. package/lib/chevre/service/transaction/placeOrder/start/factory.js +12 -10
  195. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +1 -2
  196. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +5 -16
  197. package/lib/chevre/service/transaction/placeOrder/start.d.ts +3 -4
  198. package/lib/chevre/service/transaction/placeOrder/start.js +2 -2
  199. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +0 -1
  200. package/lib/chevre/service/transaction/placeOrder.d.ts +2 -2
  201. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +0 -1
  202. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +1 -1
  203. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +0 -1
  204. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +1 -1
  205. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -1
  206. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -1
  207. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -4
  208. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  209. package/lib/chevre/service/transaction.js +3 -5
  210. package/lib/chevre/service/validation/validateOrder.js +4 -79
  211. package/lib/chevre/settings.d.ts +0 -55
  212. package/lib/chevre/settings.js +1 -29
  213. package/lib/chevre/taskSettings.d.ts +0 -22
  214. package/lib/chevre/taskSettings.js +1 -7
  215. package/package.json +2 -2
  216. package/lib/chevre/credentials/customSearch.d.ts +0 -13
  217. package/lib/chevre/credentials/customSearch.js +0 -16
  218. package/lib/chevre/credentials/lineNotify.d.ts +0 -17
  219. package/lib/chevre/credentials/lineNotify.js +0 -20
  220. package/lib/chevre/credentials/sendGrid.d.ts +0 -24
  221. package/lib/chevre/credentials/sendGrid.js +0 -18
  222. package/lib/chevre/credentials.d.ts +0 -20
  223. package/lib/chevre/credentials.js +0 -42
@@ -1,22 +1,27 @@
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
  }
14
18
  /**
15
19
  * 取引進行中の注文からacceptedOffersを検索する
20
+ * 予約取引から予約ごとの価格仕様も参照する
16
21
  */
17
- async findAcceptedOffersByOrderNumber(params) {
22
+ async findAcceptedOffersWithPriceByOrderNumber(params) {
18
23
  const doc = await this.orderModel.findOne({
19
- orderNumber: { $eq: params.orderNumber.$eq },
24
+ orderNumber: { $eq: params.orderNumber },
20
25
  typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
21
26
  }, { acceptedOffers: 1 })
22
27
  .lean()
@@ -24,10 +29,59 @@ class OrderInTransactionRepo {
24
29
  if (doc === null) {
25
30
  throw new factory_1.factory.errors.NotFound('orderInTransaction');
26
31
  }
27
- return doc.acceptedOffers;
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 }, { noName: true });
42
+ }
43
+ return doc.acceptedOffers.map((acceptedOffer) => {
44
+ const acceptedOfferByReserve = acceptedOffersByReserveTransaction.find((acceptedOfferByReserveTransaction) => acceptedOfferByReserveTransaction.itemOffered.id === acceptedOffer.itemOffered.id);
45
+ const priceSpecification = acceptedOfferByReserve?.priceSpecification;
46
+ // COA予約でなければ、予約取引の価格は必ず存在するはず(2026-05-20~)
47
+ if (priceSpecification === undefined) {
48
+ throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber: priceSpecification undefined. ${acceptedOffer.itemOffered.id}`);
49
+ }
50
+ const itemOffered = acceptedOfferByReserve?.itemOffered;
51
+ // COA予約でなければ、予約取引のitemOfferedは必ず存在するはず(2026-05-25~)
52
+ if (itemOffered === undefined) {
53
+ throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber: itemOffered undefined. ${acceptedOffer.itemOffered.id}`);
54
+ }
55
+ return {
56
+ ...acceptedOffer,
57
+ itemOffered,
58
+ priceSpecification
59
+ };
60
+ });
28
61
  }
62
+ // /**
63
+ // * 取引進行中の注文からacceptedOffersを検索する
64
+ // */
65
+ // public async findAcceptedOffersByOrderNumber(
66
+ // params: { orderNumber: { $eq: string } }
67
+ // ): Promise<Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'serialNumber'>[]> {
68
+ // const doc = await this.orderModel.findOne<HydratedDocument<Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'serialNumber'>>>(
69
+ // {
70
+ // orderNumber: { $eq: params.orderNumber.$eq },
71
+ // typeOf: { $eq: factory.transactionType.PlaceOrder }
72
+ // },
73
+ // { acceptedOffers: 1 }
74
+ // )
75
+ // .lean<Pick<IOrderInTransaction, 'acceptedOffers'>>()
76
+ // .exec();
77
+ // if (doc === null) {
78
+ // throw new factory.errors.NotFound('orderInTransaction');
79
+ // }
80
+ // return doc.acceptedOffers;
81
+ // }
29
82
  /**
30
83
  * 注文を受注する
84
+ * typeOf: PlaceOrder -> typeOf: Order
31
85
  */
32
86
  async placeOrder(order) {
33
87
  if (!(order.orderDate instanceof Date)) {
@@ -67,7 +67,8 @@ class HasPOSRepo {
67
67
  throw new factory_1.factory.errors.NotFound(factory_1.factory.placeType.MovieTheater);
68
68
  }
69
69
  const creatingPOS = {
70
- id: params.branchCode, // 互換性維持対応として
70
+ // 互換性維持対応としてidを保管
71
+ id: params.branchCode, // eslint-disable-line @typescript-eslint/no-explicit-any
71
72
  branchCode: params.branchCode,
72
73
  name: params.name
73
74
  };
@@ -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,18 +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;
150
- priceCurrency?: factory.priceCurrency;
158
+ price?: never;
159
+ priceCurrency?: never;
160
+ issuedThrough?: never;
151
161
  } & Required<{
152
162
  _id: string;
153
163
  }> & {
154
164
  __v: number;
155
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"> & {
156
166
  _id: string;
157
- bookingAgent?: any;
158
167
  previousReservationStatus?: factory.reservationStatusType;
159
- priceCurrency?: factory.priceCurrency;
168
+ price?: never;
169
+ priceCurrency?: never;
170
+ issuedThrough?: never;
160
171
  } & Required<{
161
172
  _id: string;
162
173
  }> & {
@@ -19,7 +19,7 @@ class ReservationRepo {
19
19
  * 汎用予約カウント
20
20
  */
21
21
  async count(params) {
22
- const conditions = (0, createMongoConditions_1.CREATE_MONGO_CONDITIONS)(params);
22
+ const conditions = (0, createMongoConditions_1.createMongoConditions)(params);
23
23
  return this.reservationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
24
24
  .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
25
25
  .exec();
@@ -28,7 +28,7 @@ class ReservationRepo {
28
28
  * 予約検索
29
29
  */
30
30
  async findReservations(params, inclusion) {
31
- const conditions = (0, createMongoConditions_1.CREATE_MONGO_CONDITIONS)(params);
31
+ const conditions = (0, createMongoConditions_1.createMongoConditions)(params);
32
32
  let projection;
33
33
  if (inclusion !== undefined && inclusion !== null) {
34
34
  projection = {
@@ -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,27 @@
1
+ import type { Connection } from 'mongoose';
2
+ import { IIntegrationSettings, ISendGridSettings, IHubSettings } 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 defaultOptions;
12
+ private static cachedSettings;
13
+ private static cacheExpiry;
14
+ private static readonly CACHE_TTL_MS;
15
+ constructor(options: IDBOptions);
16
+ /**
17
+ * 設定全体をDBまたはキャッシュから取得する
18
+ */
19
+ private getAllSettings;
20
+ /**
21
+ * 設定名称から設定を参照する
22
+ */
23
+ getByKey<T extends keyof IIntegrationSettings>(key: T): Promise<IIntegrationSettings[T]>;
24
+ addSendGridSettings(params: ISendGridSettings): Promise<import("mongoose").UpdateWriteOpResult>;
25
+ addHubSettings(params: IHubSettings): Promise<import("mongoose").UpdateWriteOpResult>;
26
+ }
27
+ export {};
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IntegrationSettingRepo = void 0;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const factory_1 = require("../../factory");
9
+ const setting_1 = require("../mongoose/schemas/setting");
10
+ const debug = (0, debug_1.default)('chevre-domain:repo:integrationSetting');
11
+ const defaultOptions = {
12
+ abortedTasksWithoutReport: [
13
+ factory_1.factory.taskName.ImportEventCapacitiesFromCOA,
14
+ factory_1.factory.taskName.ImportEventsFromCOA,
15
+ factory_1.factory.taskName.ImportOffersFromCOA,
16
+ ],
17
+ numTryConfirmReserveTransaction: 10,
18
+ deliverOrderLimit: 10,
19
+ coa: {
20
+ timeoutReserve: 20000,
21
+ timeoutMaster: 30000
22
+ },
23
+ gmo: {
24
+ timeout: 4000,
25
+ timeoutBackground: 6000
26
+ },
27
+ movieticketReserve: {
28
+ timeoutPay: 5000,
29
+ timeoutRefund: 5000,
30
+ timeoutCheck: 4000,
31
+ minIntervalBetweenPayAndRefund: 10000,
32
+ credentialsExpireInSeconds: 600
33
+ },
34
+ useExperimentalFeature: false
35
+ };
36
+ /**
37
+ * 外部連携設定リポジトリ
38
+ */
39
+ class IntegrationSettingRepo {
40
+ settingModel;
41
+ defaultOptions;
42
+ // static にすることで、クラスが何回 new されてもメモリ上で1つだけ保持される
43
+ static cachedSettings;
44
+ static cacheExpiry = 0;
45
+ static CACHE_TTL_MS = 10 * 60 * 1000; // 10分
46
+ constructor(options) {
47
+ const { connection } = options;
48
+ this.settingModel = connection.model(setting_1.modelName, (0, setting_1.createSchema)());
49
+ this.defaultOptions = defaultOptions;
50
+ }
51
+ /**
52
+ * 設定全体をDBまたはキャッシュから取得する
53
+ */
54
+ async getAllSettings() {
55
+ const now = Date.now();
56
+ // static プロパティにアクセスするため、クラス名(IntegrationSettingRepo)経由で参照
57
+ if (IntegrationSettingRepo.cachedSettings !== undefined && now < IntegrationSettingRepo.cacheExpiry) {
58
+ debug('cache exist!', JSON.stringify(IntegrationSettingRepo.cachedSettings));
59
+ return IntegrationSettingRepo.cachedSettings;
60
+ }
61
+ const settingDoc = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, {
62
+ _id: 0,
63
+ integration: 1
64
+ })
65
+ .lean()
66
+ .exec();
67
+ // キャッシュを更新
68
+ if (settingDoc?.integration !== undefined) {
69
+ // console.log('docuemnt exist!');
70
+ IntegrationSettingRepo.cachedSettings = settingDoc.integration;
71
+ }
72
+ else {
73
+ IntegrationSettingRepo.cachedSettings = this.defaultOptions;
74
+ }
75
+ IntegrationSettingRepo.cacheExpiry = now + IntegrationSettingRepo.CACHE_TTL_MS;
76
+ return IntegrationSettingRepo.cachedSettings;
77
+ }
78
+ /**
79
+ * 設定名称から設定を参照する
80
+ */
81
+ async getByKey(key) {
82
+ const settings = await this.getAllSettings();
83
+ return settings[key];
84
+ }
85
+ async addSendGridSettings(params) {
86
+ return this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
87
+ $set: {
88
+ 'integration.sendGrid': params
89
+ }
90
+ })
91
+ .exec();
92
+ }
93
+ async addHubSettings(params) {
94
+ return this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
95
+ $set: {
96
+ 'integration.hub': params
97
+ }
98
+ })
99
+ .exec();
100
+ }
101
+ }
102
+ exports.IntegrationSettingRepo = IntegrationSettingRepo;
@@ -17,20 +17,22 @@ export type IPlaceOrder = Pick<factory.transaction.placeOrder.ITransaction, IKey
17
17
  };
18
18
  type IStartedPlaceOrderFields = 'expires' | 'id' | 'startDate' | 'status';
19
19
  export type IStartedPlaceOrder = Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, IStartedPlaceOrderFields>;
20
+ type IFindParams = factory.transaction.ISearchConditions<factory.transactionType.PlaceOrder>;
20
21
  /**
21
22
  * 注文取引リポジトリ
22
23
  */
23
24
  export declare class PlaceOrderRepo {
24
25
  private readonly transactionModel;
25
26
  constructor(connection: Connection);
26
- static CREATE_MONGO_CONDITIONS(params: factory.transaction.ISearchConditions<factory.transactionType.PlaceOrder>): FilterQuery<import("@chevre/factory/lib/chevre/transaction/placeOrder").ITransaction>[];
27
- countPlaceOrder(params: factory.transaction.ISearchConditions<factory.transactionType.PlaceOrder>): Promise<{
27
+ static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<import("@chevre/factory/lib/chevre/transaction/placeOrder").ITransaction>[];
28
+ countPlaceOrder(params: IFindParams): Promise<{
28
29
  count: number;
29
30
  }>;
30
31
  /**
31
32
  * 取引を検索する
32
33
  */
33
- findPlaceOrderTransactions(params: factory.transaction.ISearchConditions<factory.transactionType.PlaceOrder> & {
34
+ findPlaceOrderTransactions(params: Omit<IFindParams, 'result'> & {
35
+ result?: never;
34
36
  inclusion: IKeyOfProjection[];
35
37
  }): Promise<(Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, IKeyOfProjection> & {
36
38
  id: string;
@@ -126,6 +128,9 @@ export declare class PlaceOrderRepo {
126
128
  confirmPlaceOrder(params: {
127
129
  typeOf: factory.transactionType.PlaceOrder;
128
130
  id: string;
131
+ object: {
132
+ orderDate: Date;
133
+ };
129
134
  result: factory.transaction.IResult<factory.transactionType.PlaceOrder>;
130
135
  potentialActions: factory.transaction.IPotentialActions<factory.transactionType.PlaceOrder>;
131
136
  }): Promise<void>;
@@ -136,6 +136,10 @@ class PlaceOrderRepo {
136
136
  if (typeof objectOrderNumberEq === 'string') {
137
137
  andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
138
138
  }
139
+ const objectConfirmationNumberEq = params.object?.confirmationNumber?.$eq;
140
+ if (typeof objectConfirmationNumberEq === 'string') {
141
+ andConditions.push({ 'object.confirmationNumber': { $exists: true, $eq: objectConfirmationNumberEq } });
142
+ }
139
143
  return andConditions;
140
144
  }
141
145
  async countPlaceOrder(params) {
@@ -425,7 +429,7 @@ class PlaceOrderRepo {
425
429
  }, {
426
430
  status: factory_1.factory.transactionStatusType.Confirmed, // ステータス変更
427
431
  endDate,
428
- // 'object.authorizeActions': params.authorizeActions,
432
+ 'object.orderDate': params.object.orderDate, // add(2026-06-15~)
429
433
  result: params.result, // resultを更新
430
434
  potentialActions: params.potentialActions // resultを更新
431
435
  }, {
@@ -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
  } & {