@chevre/domain 21.2.0-alpha.1 → 21.2.0-alpha.100

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 (306) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
  3. package/example/src/chevre/countDelayedTasks.ts +17 -0
  4. package/example/src/chevre/countDelayedTransactions.ts +60 -0
  5. package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
  6. package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
  7. package/example/src/chevre/deleteTasksByName.ts +10 -2
  8. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  9. package/example/src/chevre/lockStockHolder.ts +48 -0
  10. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  11. package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
  12. package/example/src/chevre/processPay.ts +5 -1
  13. package/example/src/chevre/processReserve.ts +6 -3
  14. package/example/src/chevre/saveTasks.ts +13 -10
  15. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  16. package/example/src/chevre/searchActions.ts +33 -0
  17. package/example/src/chevre/searchEventSeats.ts +42 -0
  18. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  19. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  20. package/example/src/chevre/task/executeTasks.ts +26 -0
  21. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  22. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  23. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  24. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  25. package/example/src/chevre/updateTransaction.ts +1 -1
  26. package/example/src/playOnMoment.ts +24 -0
  27. package/lib/chevre/credentials.d.ts +1 -0
  28. package/lib/chevre/credentials.js +2 -1
  29. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  30. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  31. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  32. package/lib/chevre/eventEmitter/task.js +25 -0
  33. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  34. package/lib/chevre/eventEmitter/transaction.js +25 -0
  35. package/lib/chevre/eventEmitter.d.ts +4 -0
  36. package/lib/chevre/eventEmitter.js +9 -0
  37. package/lib/chevre/index.d.ts +3 -2
  38. package/lib/chevre/index.js +5 -3
  39. package/lib/chevre/repo/account.js +0 -4
  40. package/lib/chevre/repo/accountTitle.js +0 -4
  41. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  42. package/lib/chevre/repo/accountTransaction.js +1 -58
  43. package/lib/chevre/repo/accountingReport.js +0 -4
  44. package/lib/chevre/repo/action.d.ts +29 -1
  45. package/lib/chevre/repo/action.js +98 -59
  46. package/lib/chevre/repo/additionalProperty.js +0 -4
  47. package/lib/chevre/repo/aggregation.js +0 -4
  48. package/lib/chevre/repo/assetTransaction.d.ts +25 -9
  49. package/lib/chevre/repo/assetTransaction.js +261 -89
  50. package/lib/chevre/repo/categoryCode.js +0 -4
  51. package/lib/chevre/repo/code.js +0 -4
  52. package/lib/chevre/repo/comment.d.ts +4 -1
  53. package/lib/chevre/repo/comment.js +20 -9
  54. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  55. package/lib/chevre/repo/confirmationNumber.js +3 -15
  56. package/lib/chevre/repo/creativeWork.d.ts +1 -3
  57. package/lib/chevre/repo/creativeWork.js +0 -4
  58. package/lib/chevre/repo/customer.js +0 -4
  59. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  60. package/lib/chevre/repo/emailMessage.js +0 -4
  61. package/lib/chevre/repo/event.d.ts +5 -1
  62. package/lib/chevre/repo/event.js +0 -4
  63. package/lib/chevre/repo/member.js +0 -4
  64. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  65. package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
  66. package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
  67. package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
  68. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
  69. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
  70. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
  72. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
  73. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
  74. package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
  75. package/lib/chevre/repo/mongoose/schemas/action.js +20 -1
  76. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
  77. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
  78. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
  79. package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
  80. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
  81. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +33 -19
  82. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
  83. package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
  84. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
  85. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
  86. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
  87. package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
  88. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
  89. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
  90. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
  91. package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
  92. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
  93. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
  94. package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
  95. package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
  96. package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
  97. package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
  98. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
  99. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
  100. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
  101. package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
  102. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
  103. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
  104. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  105. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  106. package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
  107. package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
  108. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
  109. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
  110. package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
  111. package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
  112. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
  113. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
  114. package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
  115. package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
  116. package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
  117. package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
  118. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +64 -5
  119. package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
  120. package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
  121. package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
  122. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
  123. package/lib/chevre/repo/mongoose/schemas/seller.js +7 -0
  124. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
  125. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
  126. package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
  127. package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
  128. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
  129. package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
  130. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
  131. package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
  132. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
  133. package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
  134. package/lib/chevre/repo/offer.js +0 -5
  135. package/lib/chevre/repo/offerCatalog.js +0 -4
  136. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  137. package/lib/chevre/repo/offerItemCondition.js +120 -0
  138. package/lib/chevre/repo/order.d.ts +55 -3
  139. package/lib/chevre/repo/order.js +56 -9
  140. package/lib/chevre/repo/orderNumber.d.ts +0 -1
  141. package/lib/chevre/repo/orderNumber.js +2 -12
  142. package/lib/chevre/repo/ownershipInfo.js +0 -4
  143. package/lib/chevre/repo/permit.js +0 -4
  144. package/lib/chevre/repo/place.d.ts +5 -1
  145. package/lib/chevre/repo/place.js +1 -10
  146. package/lib/chevre/repo/priceSpecification.js +0 -4
  147. package/lib/chevre/repo/product.js +0 -4
  148. package/lib/chevre/repo/project.js +0 -4
  149. package/lib/chevre/repo/rateLimit/offer.d.ts +3 -2
  150. package/lib/chevre/repo/rateLimit/offer.js +14 -14
  151. package/lib/chevre/repo/reservation.d.ts +12 -4
  152. package/lib/chevre/repo/reservation.js +16 -48
  153. package/lib/chevre/repo/role.js +0 -4
  154. package/lib/chevre/repo/seller.js +19 -23
  155. package/lib/chevre/repo/serviceOutput.js +0 -4
  156. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +2 -1
  157. package/lib/chevre/repo/serviceOutputIdentifier.js +14 -15
  158. package/lib/chevre/repo/{itemAvailability/screeningEvent.d.ts → stockHolder.d.ts} +5 -8
  159. package/lib/chevre/repo/stockHolder.js +273 -0
  160. package/lib/chevre/repo/task.d.ts +45 -2
  161. package/lib/chevre/repo/task.js +101 -12
  162. package/lib/chevre/repo/telemetry.js +0 -4
  163. package/lib/chevre/repo/transaction.d.ts +23 -3
  164. package/lib/chevre/repo/transaction.js +174 -58
  165. package/lib/chevre/repo/transactionNumber.d.ts +2 -1
  166. package/lib/chevre/repo/transactionNumber.js +14 -15
  167. package/lib/chevre/repo/trip.js +0 -4
  168. package/lib/chevre/repository.d.ts +8 -7
  169. package/lib/chevre/repository.js +12 -11
  170. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
  171. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +4 -3
  172. package/lib/chevre/service/aggregation/system.d.ts +67 -22
  173. package/lib/chevre/service/aggregation/system.js +101 -89
  174. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  175. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
  176. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  177. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  178. package/lib/chevre/service/assetTransaction/pay.js +18 -32
  179. package/lib/chevre/service/assetTransaction/refund.js +1 -23
  180. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  181. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  182. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  183. package/lib/chevre/service/assetTransaction/reserve.d.ts +14 -5
  184. package/lib/chevre/service/assetTransaction/reserve.js +156 -74
  185. package/lib/chevre/service/assetTransaction.d.ts +6 -2
  186. package/lib/chevre/service/assetTransaction.js +9 -5
  187. package/lib/chevre/service/event.js +3 -1
  188. package/lib/chevre/service/notification/factory.js +2 -2
  189. package/lib/chevre/service/notification.d.ts +3 -1
  190. package/lib/chevre/service/notification.js +41 -7
  191. package/lib/chevre/service/offer/event/authorize.d.ts +5 -2
  192. package/lib/chevre/service/offer/event/authorize.js +8 -2
  193. package/lib/chevre/service/offer/event/cancel.d.ts +2 -2
  194. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  195. package/lib/chevre/service/offer/event/factory.js +16 -5
  196. package/lib/chevre/service/offer/event/voidTransaction.d.ts +4 -2
  197. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  198. package/lib/chevre/service/offer.d.ts +13 -26
  199. package/lib/chevre/service/offer.js +22 -117
  200. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  201. package/lib/chevre/service/order/deleteOrder.js +8 -8
  202. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  203. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  204. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  205. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  206. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  207. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  208. package/lib/chevre/service/order/placeOrder.js +41 -24
  209. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  210. package/lib/chevre/service/order/returnOrder.js +7 -12
  211. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  212. package/lib/chevre/service/order/sendOrder.js +7 -10
  213. package/lib/chevre/service/order.d.ts +2 -1
  214. package/lib/chevre/service/order.js +3 -1
  215. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  216. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  217. package/lib/chevre/service/payment/any.d.ts +9 -5
  218. package/lib/chevre/service/payment/any.js +80 -18
  219. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  220. package/lib/chevre/service/payment/creditCard.js +21 -15
  221. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +7 -6
  222. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  223. package/lib/chevre/service/payment/movieTicket/validation.js +54 -31
  224. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  225. package/lib/chevre/service/payment/movieTicket.js +5 -4
  226. package/lib/chevre/service/product.js +1 -5
  227. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  228. package/lib/chevre/service/report/telemetry.js +21 -24
  229. package/lib/chevre/service/reserve/cancelReservation.d.ts +8 -6
  230. package/lib/chevre/service/reserve/cancelReservation.js +153 -145
  231. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  232. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  233. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  234. package/lib/chevre/service/reserve/confirmReservation.js +125 -58
  235. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  236. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  237. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  238. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  239. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  240. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  241. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  242. package/lib/chevre/service/reserve/useReservation.js +61 -71
  243. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  244. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  245. package/lib/chevre/service/reserve.d.ts +3 -2
  246. package/lib/chevre/service/reserve.js +4 -2
  247. package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -2
  248. package/lib/chevre/service/task/cancelPendingReservation.js +8 -4
  249. package/lib/chevre/service/task/cancelReservation.js +3 -3
  250. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  251. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  252. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  253. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  254. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  255. package/lib/chevre/service/task/placeOrder.js +1 -1
  256. package/lib/chevre/service/task/reserve.js +10 -7
  257. package/lib/chevre/service/task/returnOrder.js +1 -1
  258. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  259. package/lib/chevre/service/task/sendOrder.js +1 -1
  260. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  261. package/lib/chevre/service/task/useReservation.js +36 -0
  262. package/lib/chevre/service/task/voidReserveTransaction.js +6 -4
  263. package/lib/chevre/service/task.d.ts +9 -0
  264. package/lib/chevre/service/task.js +43 -4
  265. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  266. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  267. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  268. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  269. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  270. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  271. package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
  272. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -2
  273. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  274. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  275. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  276. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  277. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  278. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  279. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  280. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  281. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  282. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  283. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  284. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  285. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  286. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  287. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  288. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  289. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  290. package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
  291. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  292. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  293. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  294. package/lib/chevre/service/transaction/returnOrder.js +225 -35
  295. package/lib/chevre/service/transaction.d.ts +8 -13
  296. package/lib/chevre/service/transaction.js +12 -145
  297. package/lib/chevre/settings.d.ts +4 -1
  298. package/lib/chevre/settings.js +16 -6
  299. package/package.json +5 -5
  300. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  301. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  302. package/lib/chevre/repo/itemAvailability/screeningEvent.js +0 -181
  303. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  304. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  305. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
  306. package/lib/chevre/service/task/deleteOrder.js +0 -35
@@ -2,7 +2,6 @@ import * as factory from '../../../factory';
2
2
  import { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
4
4
  import { MongoRepository as EventRepo } from '../../../repo/event';
5
- import { RedisRepository as ScreeningEventAvailabilityRepo } from '../../../repo/itemAvailability/screeningEvent';
6
5
  import { MongoRepository as OfferRepo } from '../../../repo/offer';
7
6
  import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
8
7
  import { MongoRepository as PlaceRepo } from '../../../repo/place';
@@ -11,6 +10,7 @@ import { MongoRepository as ProductRepo } from '../../../repo/product';
11
10
  import { MongoRepository as ProjectRepo } from '../../../repo/project';
12
11
  import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
13
12
  import { MongoRepository as ReservationRepo } from '../../../repo/reservation';
13
+ import { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
14
14
  import { MongoRepository as TaskRepo } from '../../../repo/task';
15
15
  import { MongoRepository as TransactionRepo } from '../../../repo/transaction';
16
16
  import { RedisRepository as TransactionNumberRepo } from '../../../repo/transactionNumber';
@@ -19,7 +19,7 @@ interface IAuthorizeRepos {
19
19
  action: ActionRepo;
20
20
  assetTransaction: AssetTransactionRepo;
21
21
  event: EventRepo;
22
- eventAvailability: ScreeningEventAvailabilityRepo;
22
+ stockHolder: StockHolderRepo;
23
23
  offer: OfferRepo;
24
24
  offerCatalog: OfferCatalogRepo;
25
25
  offerRateLimit: OfferRateLimitRepo;
@@ -57,5 +57,8 @@ declare function authorize(params: {
57
57
  */
58
58
  id: string;
59
59
  };
60
+ disablePendingReservations: boolean;
61
+ useHoldStockByTransactionNumber: boolean;
62
+ stockHoldUntilDaysAfterEventEnd: number;
60
63
  }): IAuthorizeOperation<IAuthorizeOfferAction>;
61
64
  export { authorize };
@@ -66,7 +66,10 @@ function authorize(params) {
66
66
  ticketOffers,
67
67
  unitPriceOffers,
68
68
  validateEvent: params.validateEvent === true,
69
- validateEventOfferPeriod: params.validateEventOfferPeriod === true
69
+ validateEventOfferPeriod: params.validateEventOfferPeriod === true,
70
+ disablePendingReservations: params.disablePendingReservations,
71
+ useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber,
72
+ stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
70
73
  })(repos);
71
74
  // requestBody = processStartReserveResult.requestBody;
72
75
  // responseBody = processStartReserveResult.responseBody;
@@ -162,9 +165,12 @@ function processStartReserve4chevre(params) {
162
165
  // requestBody = startParams;
163
166
  const startParamObject = yield validateObjectWithoutDetail(startParams)(repos);
164
167
  // 予約取引開始
165
- responseBody = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true }))(repos);
168
+ const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true, disablePendingReservations: params.disablePendingReservations, useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }))(repos);
169
+ responseBody = startReserveTransactionResult.transaction;
166
170
  // 予約取引からオファー情報を生成する
167
171
  acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
172
+ issuedThrough: startReserveTransactionResult.issuedThrough,
173
+ objectSubReservations: startReserveTransactionResult.objectSubReservations,
168
174
  responseBody: responseBody,
169
175
  event: event,
170
176
  project: transaction.project,
@@ -1,15 +1,15 @@
1
1
  import * as factory from '../../../factory';
2
2
  import { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
4
- import { RedisRepository as ScreeningEventAvailabilityRepo } from '../../../repo/itemAvailability/screeningEvent';
5
4
  import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
6
5
  import { MongoRepository as ReservationRepo } from '../../../repo/reservation';
6
+ import { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
7
7
  import { MongoRepository as TaskRepo } from '../../../repo/task';
8
8
  import { MongoRepository as TransactionRepo } from '../../../repo/transaction';
9
9
  interface ICancelRepos {
10
10
  action: ActionRepo;
11
11
  assetTransaction: AssetTransactionRepo;
12
- eventAvailability: ScreeningEventAvailabilityRepo;
12
+ stockHolder: StockHolderRepo;
13
13
  offerRateLimit: OfferRateLimitRepo;
14
14
  reservation: ReservationRepo;
15
15
  task: TaskRepo;
@@ -23,8 +23,11 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
23
23
  export declare function acceptedOffers2amount(params: {
24
24
  acceptedOffers: IResultAcceptedOffer[];
25
25
  }): number;
26
+ type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
26
27
  type IResultAcceptedOffer = factory.action.authorize.offer.seatReservation.IResultAcceptedOffer;
27
28
  export declare function responseBody2acceptedOffers4result(params: {
29
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
30
+ objectSubReservations: IObjectSubReservation[];
28
31
  responseBody: factory.assetTransaction.reserve.ITransaction;
29
32
  event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
30
33
  project: {
@@ -154,10 +154,15 @@ exports.acceptedOffers2amount = acceptedOffers2amount;
154
154
  function responseBody2acceptedOffers4result(params) {
155
155
  let acceptedOffers4result = [];
156
156
  // 予約取引からacceptedOffers4resultを生成する
157
- if (Array.isArray(params.responseBody.object.subReservation)) {
158
- acceptedOffers4result = params.responseBody.object.subReservation.map((itemOffered) => {
157
+ if (Array.isArray(params.objectSubReservations)) {
158
+ acceptedOffers4result = params.objectSubReservations.map((itemOffered) => {
159
159
  var _a;
160
- const reservation = createReservation({ project: params.project, itemOffered, event: params.event });
160
+ const reservation = createReservation({
161
+ project: params.project,
162
+ itemOffered,
163
+ event: params.event,
164
+ issuedThrough: params.issuedThrough
165
+ });
161
166
  // appliesToMovieTicketがArrayでないケースは廃止(2022-09-12~)
162
167
  const priceSpecification = itemOffered.price;
163
168
  const priceComponent = priceSpecification.priceComponent.map((c) => {
@@ -244,7 +249,10 @@ function createReservation(params) {
244
249
  // 最適化(2022-05-31~)
245
250
  superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, kanaName: event.superEvent.kanaName, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
246
251
  };
247
- reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
252
+ if (params.issuedThrough.typeOf !== factory.product.ProductType.EventService) {
253
+ throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.EventService}`);
254
+ }
255
+ reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
248
256
  reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
249
257
  ? { programMembershipUsed: itemOffered.programMembershipUsed }
250
258
  : undefined);
@@ -269,7 +277,10 @@ function createReservation(params) {
269
277
  busNumber: tripByEvent.busNumber,
270
278
  identifier: tripByEvent.identifier
271
279
  };
272
- reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
280
+ if (params.issuedThrough.typeOf !== factory.product.ProductType.Transportation) {
281
+ throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.Transportation}`);
282
+ }
283
+ reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
273
284
  reservedTicket }, (typeof ((_d = itemOffered.programMembershipUsed) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
274
285
  ? { programMembershipUsed: itemOffered.programMembershipUsed }
275
286
  : undefined);
@@ -1,18 +1,20 @@
1
1
  import * as factory from '../../../factory';
2
2
  import { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
4
- import { RedisRepository as ScreeningEventAvailabilityRepo } from '../../../repo/itemAvailability/screeningEvent';
5
4
  import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
6
5
  import { MongoRepository as ReservationRepo } from '../../../repo/reservation';
6
+ import { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
7
7
  import { MongoRepository as TaskRepo } from '../../../repo/task';
8
+ import { MongoRepository as TransactionRepo } from '../../../repo/transaction';
8
9
  export import WebAPIIdentifier = factory.service.webAPI.Identifier;
9
10
  interface IVoidTransactionRepos {
10
11
  action: ActionRepo;
11
12
  assetTransaction: AssetTransactionRepo;
12
- eventAvailability: ScreeningEventAvailabilityRepo;
13
+ stockHolder: StockHolderRepo;
13
14
  offerRateLimit: OfferRateLimitRepo;
14
15
  reservation: ReservationRepo;
15
16
  task: TaskRepo;
17
+ transaction: TransactionRepo;
16
18
  }
17
19
  /**
18
20
  * イベントオファー承認取消(タスクから実行)
@@ -26,8 +26,13 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
26
26
  */
27
27
  function voidTransaction(params) {
28
28
  return (repos) => __awaiter(this, void 0, void 0, function* () {
29
+ const transaction = yield repos.transaction.findById({
30
+ typeOf: params.purpose.typeOf,
31
+ id: params.purpose.id,
32
+ inclusion: ['_id', 'typeOf', 'status']
33
+ });
29
34
  // 座席仮予約アクション検索
30
- const authorizeActions = yield repos.action.searchByPurpose({
35
+ let authorizeActions = yield repos.action.searchByPurpose({
31
36
  typeOf: factory.actionType.AuthorizeAction,
32
37
  purpose: {
33
38
  typeOf: params.purpose.typeOf,
@@ -36,6 +41,17 @@ function voidTransaction(params) {
36
41
  })
37
42
  .then((actions) => actions
38
43
  .filter((a) => a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation));
44
+ switch (transaction.status) {
45
+ case factory.transactionStatusType.InProgress:
46
+ throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
47
+ // 確定取引に対応(2023-05-07~)
48
+ case factory.transactionStatusType.Confirmed:
49
+ // アクションステータスを検証する
50
+ authorizeActions = authorizeActions.filter((a) => a.actionStatus !== factory.actionStatusType.CompletedActionStatus);
51
+ break;
52
+ default:
53
+ // no op
54
+ }
39
55
  yield Promise.all(authorizeActions.map((action) => __awaiter(this, void 0, void 0, function* () {
40
56
  yield repos.action.cancel({ typeOf: action.typeOf, id: action.id });
41
57
  switch (action.instrument.identifier) {
@@ -1,8 +1,8 @@
1
1
  import { MongoRepository as EventRepo } from '../repo/event';
2
- import { RedisRepository as EventAvailabilityRepo } from '../repo/itemAvailability/screeningEvent';
3
2
  import { MongoRepository as PlaceRepo } from '../repo/place';
4
3
  import { MongoRepository as PriceSpecificationRepo } from '../repo/priceSpecification';
5
4
  import { MongoRepository as ProjectRepo } from '../repo/project';
5
+ import { StockHolderRepository as StockHolderRepo } from '../repo/stockHolder';
6
6
  import { MongoRepository as TaskRepo } from '../repo/task';
7
7
  import * as factory from '../factory';
8
8
  import * as EventOfferService from './offer/event';
@@ -11,35 +11,22 @@ import * as MoneyTransferOfferService from './offer/moneyTransfer';
11
11
  import * as ProductOfferService from './offer/product';
12
12
  export { EventOfferService as event, EventServiceByCOAOfferService as eventServiceByCOA, MoneyTransferOfferService as moneyTransfer, ProductOfferService as product };
13
13
  /**
14
- * イベントに対する座席オファーを座席コードとセクションコード指定で検索する
14
+ * 座席にオファー情報を付加する
15
15
  */
16
- export declare function searchEventSeatOffers(params: {
17
- branchCode?: {
18
- $in?: string[];
19
- };
20
- containedInPlace?: {
21
- branchCode?: {
22
- $in?: string[];
23
- };
24
- };
25
- event: {
26
- id: string;
27
- };
28
- $projection?: {
29
- [key: string]: number;
30
- };
31
- }): (repos: {
32
- event: EventRepo;
33
- priceSpecification: PriceSpecificationRepo;
34
- eventAvailability: EventAvailabilityRepo;
35
- place: PlaceRepo;
36
- }) => Promise<factory.place.seat.IPlaceWithOffer[]>;
16
+ export declare function addOffers2Seat(params: {
17
+ seat: factory.place.seat.IPlace;
18
+ availability: factory.itemAvailability;
19
+ /**
20
+ * 座席区分加算料金
21
+ */
22
+ priceSpecs: factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.CategoryCodeChargeSpecification>[];
23
+ }): factory.place.seat.IPlaceWithOffer;
37
24
  /**
38
25
  * イベントに対する座席オファーを検索する
39
26
  */
40
27
  export declare function searchEventSeatOffersWithPaging(params: {
41
- limit?: number;
42
- page?: number;
28
+ limit: number;
29
+ page: number;
43
30
  branchCode?: {
44
31
  $eq?: string;
45
32
  };
@@ -57,7 +44,7 @@ export declare function searchEventSeatOffersWithPaging(params: {
57
44
  }): (repos: {
58
45
  event: EventRepo;
59
46
  priceSpecification: PriceSpecificationRepo;
60
- eventAvailability: EventAvailabilityRepo;
47
+ stockHolder: StockHolderRepo;
61
48
  place: PlaceRepo;
62
49
  }) => Promise<factory.place.seat.IPlaceWithOffer[]>;
63
50
  interface IChangedEvent {
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.searchEventSeatOffers = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
12
+ exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
13
13
  const moment = require("moment");
14
14
  const factory = require("../factory");
15
15
  const EventOfferService = require("./offer/event");
@@ -24,121 +24,33 @@ exports.product = ProductOfferService;
24
24
  * 座席にオファー情報を付加する
25
25
  */
26
26
  function addOffers2Seat(params) {
27
- const seatNumber = params.seat.branchCode;
28
- const unavailableOffer = params.unavailableOffers.find((o) => o.seatSection === params.seatSection && o.seatNumber === seatNumber);
29
- const priceComponent = [];
30
27
  // 座席タイプが指定されていれば、適用される価格仕様を構成要素に追加
31
28
  const seatingTypes = (Array.isArray(params.seat.seatingType))
32
29
  ? params.seat.seatingType
33
- : (typeof params.seat.seatingType === 'string' && params.seat.seatingType.length > 0) ? [params.seat.seatingType]
34
- : [];
35
- priceComponent.push(...params.priceSpecs.filter((s) => {
30
+ : (typeof params.seat.seatingType === 'string' && params.seat.seatingType.length > 0) ? [params.seat.seatingType] : [];
31
+ const priceComponent = params.priceSpecs.filter((s) => {
36
32
  // 適用カテゴリーコードに座席タイプが含まれる価格仕様を検索
37
33
  return (Array.isArray(s.appliesToCategoryCode))
38
34
  && s.appliesToCategoryCode.some((categoryCode) => {
39
- return seatingTypes.includes(categoryCode.codeValue)
40
- // tslint:disable-next-line:max-line-length
41
- && categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
35
+ return seatingTypes.includes(categoryCode.codeValue);
36
+ // && categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
42
37
  });
43
- }));
44
- // 最適化(2022-11-15~)
38
+ });
45
39
  const priceSpecification = {
46
40
  typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
47
- // priceCurrency: factory.priceCurrency.JPY,
48
- // valueAddedTaxIncluded: true,
49
- priceComponent: priceComponent
41
+ priceComponent
50
42
  };
51
- let availability = (unavailableOffer !== undefined)
52
- ? factory.itemAvailability.OutOfStock
53
- : factory.itemAvailability.InStock;
54
- if (params.availability !== undefined) {
43
+ let availability = factory.itemAvailability.InStock;
44
+ if (typeof params.availability === 'string') {
55
45
  availability = params.availability;
56
46
  }
57
47
  return Object.assign(Object.assign({}, params.seat), { offers: [{
58
- // 最適化(2022-11-15~)
59
- // project: params.project,
60
48
  typeOf: factory.offerType.Offer,
61
- // priceCurrency: factory.priceCurrency.JPY,
62
- availability: availability,
63
- priceSpecification: priceSpecification
49
+ availability,
50
+ priceSpecification
64
51
  }] });
65
52
  }
66
- /**
67
- * イベントに対する座席オファーを座席コードとセクションコード指定で検索する
68
- */
69
- function searchEventSeatOffers(params) {
70
- return (repos) => __awaiter(this, void 0, void 0, function* () {
71
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
72
- let offers = [];
73
- // イベント取得属性最適化(2023-01-23~)
74
- // const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
75
- // id: params.event.id
76
- // });
77
- const event = yield repos.event.findMinimizedIndividualEventById({
78
- id: params.event.id
79
- });
80
- // 座席指定利用可能かどうか
81
- const eventOffers = event.offers;
82
- const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
83
- if (reservedSeatsAvailable) {
84
- // 座席タイプ価格仕様を検索
85
- const priceSpecs = yield repos.priceSpecification.search({
86
- project: { id: { $eq: event.project.id } },
87
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
88
- appliesToCategoryCode: {
89
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
90
- }
91
- });
92
- // const roomBranchCode = event.location.branchCode;
93
- // const movieTheaterBranchCode = event.superEvent.location.branchCode;
94
- const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
95
- const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
96
- const seats = yield repos.place.searchSeats({
97
- project: { id: { $eq: event.project.id } },
98
- branchCode: { $in: (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in },
99
- containedInPlace: {
100
- branchCode: {
101
- $in: (_j = (_h = params.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$in
102
- },
103
- containedInPlace: {
104
- branchCode: { $eq: roomBranchCode },
105
- containedInPlace: {
106
- branchCode: { $eq: movieTheaterBranchCode }
107
- }
108
- }
109
- },
110
- $projection: params.$projection
111
- });
112
- if (seats.length > 0) {
113
- const availabilities = yield repos.eventAvailability.searchAvailability({
114
- eventId: params.event.id,
115
- startDate: moment(event.startDate)
116
- .toDate(),
117
- offers: seats.map((s) => {
118
- var _a;
119
- return {
120
- seatNumber: s.branchCode,
121
- seatSection: (_a = s.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
122
- };
123
- })
124
- });
125
- offers = seats.map((seat, index) => {
126
- var _a;
127
- return addOffers2Seat({
128
- project: event.project,
129
- seat: seat,
130
- seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
131
- unavailableOffers: [],
132
- availability: availabilities[index].availability,
133
- priceSpecs: priceSpecs
134
- });
135
- });
136
- }
137
- }
138
- return offers;
139
- });
140
- }
141
- exports.searchEventSeatOffers = searchEventSeatOffers;
53
+ exports.addOffers2Seat = addOffers2Seat;
142
54
  /**
143
55
  * イベントに対する座席オファーを検索する
144
56
  */
@@ -147,12 +59,7 @@ function searchEventSeatOffersWithPaging(params) {
147
59
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
148
60
  let offers = [];
149
61
  // イベント取得属性最適化(2023-01-23~)
150
- // const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
151
- // id: params.event.id
152
- // });
153
- const event = yield repos.event.findMinimizedIndividualEventById({
154
- id: params.event.id
155
- });
62
+ const event = yield repos.event.findMinimizedIndividualEventById({ id: params.event.id });
156
63
  // 座席指定利用可能かどうか
157
64
  const eventOffers = event.offers;
158
65
  const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
@@ -165,8 +72,6 @@ function searchEventSeatOffersWithPaging(params) {
165
72
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
166
73
  }
167
74
  });
168
- // const roomBranchCode = event.location.branchCode;
169
- // const movieTheaterBranchCode = event.superEvent.location.branchCode;
170
75
  const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
171
76
  const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
172
77
  const seats = yield repos.place.searchSeats(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
@@ -183,7 +88,7 @@ function searchEventSeatOffersWithPaging(params) {
183
88
  }
184
89
  } }));
185
90
  if (seats.length > 0) {
186
- const availabilities = yield repos.eventAvailability.searchAvailability({
91
+ const availabilities = yield repos.stockHolder.searchHolders({
187
92
  eventId: params.event.id,
188
93
  startDate: moment(event.startDate)
189
94
  .toDate(),
@@ -196,14 +101,14 @@ function searchEventSeatOffersWithPaging(params) {
196
101
  })
197
102
  });
198
103
  offers = seats.map((seat, index) => {
199
- var _a;
200
104
  return addOffers2Seat({
201
- project: event.project,
202
- seat: seat,
203
- seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
204
- unavailableOffers: [],
205
- availability: availabilities[index].availability,
206
- priceSpecs: priceSpecs
105
+ seat,
106
+ // unavailableOffers: [],
107
+ // availability: availabilities[index].availability,
108
+ availability: (typeof availabilities[index] === 'string')
109
+ ? factory.itemAvailability.OutOfStock // ホルダーが存在すればOutOfStock
110
+ : factory.itemAvailability.InStock,
111
+ priceSpecs
207
112
  });
208
113
  });
209
114
  }
@@ -281,7 +186,7 @@ function createAggregateScreeningEventIfNotExist(params) {
281
186
  }
282
187
  }
283
188
  if (aggregateTasks.length > 0) {
284
- yield repos.task.saveMany(aggregateTasks);
189
+ yield repos.task.saveMany(aggregateTasks, { emitImmediately: true });
285
190
  }
286
191
  });
287
192
  }
@@ -7,7 +7,9 @@ import * as factory from '../../factory';
7
7
  * 注文に関わるリソースを削除する
8
8
  * 冪等性を確保すること
9
9
  */
10
- declare function deleteOrder(params: factory.task.IData<factory.taskName.DeleteOrder>): (repos: {
10
+ declare function deleteOrder(params: {
11
+ object: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'confirmationNumber' | 'orderDate' | 'orderNumber'>;
12
+ }): (repos: {
11
13
  accountingReport: AccountingReportRepo;
12
14
  order: OrderRepo;
13
15
  ownershipInfo: OwnershipInfoRepo;
@@ -18,7 +18,14 @@ const factory = require("../../factory");
18
18
  */
19
19
  function deleteOrder(params) {
20
20
  return (repos) => __awaiter(this, void 0, void 0, function* () {
21
- const order = params.object;
21
+ const orders = yield repos.order.search({
22
+ orderNumbers: [params.object.orderNumber]
23
+ });
24
+ const order = orders.shift();
25
+ if (order === undefined) {
26
+ // すでに削除済
27
+ return;
28
+ }
22
29
  // 注文アイテムの予約を削除
23
30
  yield deleteReservationsByOrder(order)(repos);
24
31
  // 所有権削除
@@ -63,13 +70,6 @@ function deleteOwnershipInfosByOrder(order) {
63
70
  // 所有期限切れのもの(ownedThroughの存在しないものは削除してはいけない)
64
71
  ownedThrough: { $lt: now }
65
72
  });
66
- // await repos.ownershipInfo.ownershipInfoModel.deleteMany({
67
- // 'project.id': { $eq: order.project.id },
68
- // identifier: { $in: ownershipIdentifiers },
69
- // // 所有期限切れのもの(ownedThroughの存在しないものは削除してはいけない)
70
- // ownedThrough: { $exists: true, $lt: now }
71
- // })
72
- // .exec();
73
73
  }
74
74
  });
75
75
  }
@@ -6,8 +6,11 @@ export declare function getOrderWithToken(params: {
6
6
  order: factory.order.IOrder;
7
7
  expiresIn: number;
8
8
  }): Promise<factory.order.IOrder | IOrderWithToken>;
9
- export declare function createInformTasks(order: factory.order.IOrder | IOrderWithToken): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
10
- export declare function createDeleteTasks(order: factory.order.IOrder): factory.task.IAttributes<factory.taskName.DeleteOrder>[];
9
+ export type IUpdatedOrder4inform = Pick<factory.order.IOrder, 'typeOf' | 'orderNumber' | 'name' | 'additionalProperty' | 'project'> & {
10
+ orderStatus?: undefined;
11
+ updatedAt: Date;
12
+ };
13
+ export declare function createInformTasks(order: factory.order.IOrder | IOrderWithToken | IUpdatedOrder4inform): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
11
14
  export declare function createConfirmReservationActionObject4ChevreByOrder(params: {
12
15
  order: factory.order.IOrder;
13
16
  }): factory.action.interact.confirm.reservation.IObject<factory.service.webAPI.Identifier.Chevre>[];