@chevre/domain 21.2.0-alpha.13 → 21.2.0-alpha.131

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 (296) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +85 -27
  3. package/example/src/chevre/countDelayedTasks.ts +7 -2
  4. package/example/src/chevre/deleteTasksByName.ts +10 -2
  5. package/example/src/chevre/findMovieTheaterById.ts +40 -0
  6. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  7. package/example/src/chevre/lockStockHolder.ts +5 -2
  8. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  9. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  10. package/example/src/chevre/processPay.ts +5 -1
  11. package/example/src/chevre/processRegisterMembership.ts +8 -4
  12. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  13. package/example/src/chevre/processReserve.ts +5 -2
  14. package/example/src/chevre/saveTasks.ts +13 -10
  15. package/example/src/chevre/searchAbortedTasks.ts +34 -0
  16. package/example/src/chevre/searchActions.ts +33 -0
  17. package/example/src/chevre/searchEventSeats.ts +5 -2
  18. package/example/src/chevre/searchHoldReservations.ts +38 -0
  19. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  20. package/example/src/chevre/searchScreeningRooms.ts +23 -0
  21. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  22. package/example/src/chevre/task/executeTasks.ts +26 -0
  23. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  24. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  25. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  26. package/example/src/chevre/transaction/startExportTasks.ts +2 -1
  27. package/example/src/chevre/updateScreeningRoom.ts +41 -0
  28. package/example/src/chevre/updateTransaction.ts +1 -1
  29. package/example/src/playOnMoment.ts +24 -0
  30. package/lib/chevre/credentials.d.ts +1 -0
  31. package/lib/chevre/credentials.js +2 -1
  32. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  33. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  34. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  35. package/lib/chevre/eventEmitter/task.js +25 -0
  36. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  37. package/lib/chevre/eventEmitter/transaction.js +25 -0
  38. package/lib/chevre/eventEmitter.d.ts +4 -0
  39. package/lib/chevre/eventEmitter.js +9 -0
  40. package/lib/chevre/index.d.ts +3 -2
  41. package/lib/chevre/index.js +5 -3
  42. package/lib/chevre/repo/account.js +3 -2
  43. package/lib/chevre/repo/accountTransaction.d.ts +3 -1
  44. package/lib/chevre/repo/accountTransaction.js +3 -2
  45. package/lib/chevre/repo/action.d.ts +42 -2
  46. package/lib/chevre/repo/action.js +130 -57
  47. package/lib/chevre/repo/additionalProperty.js +2 -1
  48. package/lib/chevre/repo/aggregation.d.ts +3 -0
  49. package/lib/chevre/repo/aggregation.js +3 -0
  50. package/lib/chevre/repo/assetTransaction.d.ts +23 -8
  51. package/lib/chevre/repo/assetTransaction.js +253 -80
  52. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  53. package/lib/chevre/repo/categoryCode.js +37 -25
  54. package/lib/chevre/repo/code.js +3 -2
  55. package/lib/chevre/repo/comment.d.ts +4 -1
  56. package/lib/chevre/repo/comment.js +22 -6
  57. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  58. package/lib/chevre/repo/confirmationNumber.js +3 -15
  59. package/lib/chevre/repo/creativeWork.d.ts +2 -4
  60. package/lib/chevre/repo/creativeWork.js +35 -12
  61. package/lib/chevre/repo/customer.js +2 -1
  62. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  63. package/lib/chevre/repo/emailMessage.js +2 -1
  64. package/lib/chevre/repo/event.d.ts +27 -1
  65. package/lib/chevre/repo/event.js +67 -33
  66. package/lib/chevre/repo/member.js +4 -3
  67. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  68. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  69. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  70. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  72. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  73. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  74. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  75. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  76. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  77. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  78. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  79. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  80. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  81. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  82. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  83. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  84. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  85. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  86. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  87. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  88. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  89. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  90. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +92 -0
  91. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  92. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  93. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  94. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  95. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  96. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  97. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  98. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  99. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  100. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  101. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  102. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  103. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  104. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  105. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  106. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  107. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  108. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  109. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  110. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  111. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  112. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  113. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  114. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  116. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  117. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  118. package/lib/chevre/repo/offer.js +3 -2
  119. package/lib/chevre/repo/offerCatalog.js +0 -27
  120. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  121. package/lib/chevre/repo/offerItemCondition.js +121 -0
  122. package/lib/chevre/repo/order.d.ts +55 -3
  123. package/lib/chevre/repo/order.js +62 -10
  124. package/lib/chevre/repo/ownershipInfo.js +2 -7
  125. package/lib/chevre/repo/place.d.ts +20 -5
  126. package/lib/chevre/repo/place.js +63 -23
  127. package/lib/chevre/repo/priceSpecification.js +3 -2
  128. package/lib/chevre/repo/product.d.ts +1 -3
  129. package/lib/chevre/repo/product.js +25 -4
  130. package/lib/chevre/repo/project.js +2 -1
  131. package/lib/chevre/repo/reservation.d.ts +20 -4
  132. package/lib/chevre/repo/reservation.js +40 -59
  133. package/lib/chevre/repo/role.js +3 -2
  134. package/lib/chevre/repo/seller.d.ts +1 -1
  135. package/lib/chevre/repo/seller.js +44 -23
  136. package/lib/chevre/repo/serviceOutput.js +2 -1
  137. package/lib/chevre/repo/stockHolder.d.ts +139 -7
  138. package/lib/chevre/repo/stockHolder.js +569 -102
  139. package/lib/chevre/repo/task.d.ts +45 -2
  140. package/lib/chevre/repo/task.js +94 -15
  141. package/lib/chevre/repo/transaction.d.ts +21 -2
  142. package/lib/chevre/repo/transaction.js +171 -50
  143. package/lib/chevre/repo/trip.js +2 -1
  144. package/lib/chevre/repository.d.ts +5 -2
  145. package/lib/chevre/repository.js +8 -4
  146. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -2
  147. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +8 -6
  148. package/lib/chevre/service/aggregation/system.d.ts +110 -23
  149. package/lib/chevre/service/aggregation/system.js +213 -91
  150. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  151. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
  152. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  153. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  154. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  155. package/lib/chevre/service/assetTransaction/pay.js +20 -34
  156. package/lib/chevre/service/assetTransaction/refund.js +2 -24
  157. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  158. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  159. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  160. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  161. package/lib/chevre/service/assetTransaction/reserve.js +92 -69
  162. package/lib/chevre/service/assetTransaction.d.ts +6 -0
  163. package/lib/chevre/service/assetTransaction.js +9 -4
  164. package/lib/chevre/service/event.js +25 -6
  165. package/lib/chevre/service/notification/factory.js +2 -2
  166. package/lib/chevre/service/notification.d.ts +3 -1
  167. package/lib/chevre/service/notification.js +41 -7
  168. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  169. package/lib/chevre/service/offer/event/authorize.js +8 -2
  170. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  171. package/lib/chevre/service/offer/event/factory.js +16 -5
  172. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  173. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  174. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  175. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  176. package/lib/chevre/service/offer/product.js +2 -2
  177. package/lib/chevre/service/offer.d.ts +16 -8
  178. package/lib/chevre/service/offer.js +71 -8
  179. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  180. package/lib/chevre/service/order/deleteOrder.js +8 -8
  181. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  182. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  183. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  184. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  185. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  186. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  187. package/lib/chevre/service/order/placeOrder.js +41 -24
  188. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  189. package/lib/chevre/service/order/returnOrder.js +7 -12
  190. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  191. package/lib/chevre/service/order/sendOrder.js +7 -10
  192. package/lib/chevre/service/order.d.ts +2 -1
  193. package/lib/chevre/service/order.js +3 -1
  194. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  195. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  196. package/lib/chevre/service/payment/any.d.ts +9 -5
  197. package/lib/chevre/service/payment/any.js +80 -18
  198. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  199. package/lib/chevre/service/payment/creditCard.js +23 -17
  200. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  201. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  202. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  203. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  204. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  205. package/lib/chevre/service/payment/movieTicket/validation.js +55 -32
  206. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  207. package/lib/chevre/service/payment/movieTicket.js +7 -6
  208. package/lib/chevre/service/product.js +1 -5
  209. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  210. package/lib/chevre/service/report/telemetry.js +21 -24
  211. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  212. package/lib/chevre/service/reserve/cancelReservation.js +162 -142
  213. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  214. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  215. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  216. package/lib/chevre/service/reserve/confirmReservation.js +133 -58
  217. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  218. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  219. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  220. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  221. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  222. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  223. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  224. package/lib/chevre/service/reserve/useReservation.js +61 -71
  225. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  226. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  227. package/lib/chevre/service/reserve.d.ts +3 -2
  228. package/lib/chevre/service/reserve.js +4 -2
  229. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  230. package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
  231. package/lib/chevre/service/task/cancelReservation.js +1 -1
  232. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  233. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  234. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  235. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  236. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  237. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  238. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  239. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  240. package/lib/chevre/service/task/onResourceUpdated.js +352 -0
  241. package/lib/chevre/service/task/placeOrder.js +1 -1
  242. package/lib/chevre/service/task/reserve.js +10 -7
  243. package/lib/chevre/service/task/returnOrder.js +1 -1
  244. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  245. package/lib/chevre/service/task/sendOrder.js +1 -1
  246. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  247. package/lib/chevre/service/task/useReservation.js +36 -0
  248. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  249. package/lib/chevre/service/task.d.ts +9 -0
  250. package/lib/chevre/service/task.js +43 -4
  251. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  252. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  253. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  254. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  255. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  256. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  257. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  258. package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
  259. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  260. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  261. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
  262. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  263. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  264. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  265. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  266. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  267. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  268. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  269. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  270. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  271. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  272. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  273. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  274. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  275. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  276. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  277. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  278. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  279. package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
  280. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  281. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  282. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  283. package/lib/chevre/service/transaction/returnOrder.js +228 -36
  284. package/lib/chevre/service/transaction.d.ts +7 -13
  285. package/lib/chevre/service/transaction.js +12 -139
  286. package/lib/chevre/settings.d.ts +13 -1
  287. package/lib/chevre/settings.js +56 -6
  288. package/package.json +5 -5
  289. package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
  290. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  291. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  292. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  293. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
  294. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  295. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  296. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -62,6 +62,7 @@ interface IConfirmRepo {
62
62
  task: TaskRepo;
63
63
  }
64
64
  export type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
65
+ type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
65
66
  type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
66
67
  /**
67
68
  * 承認アクションを介した場合に検索済のイベント
@@ -94,7 +95,15 @@ type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail &
94
95
  /**
95
96
  * 取引開始
96
97
  */
97
- export declare function start(params: IStartParams): IStartOperation<factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>>;
98
+ export declare function start(params: IStartParams & {
99
+ disablePendingReservations: boolean;
100
+ useHoldStockByTransactionNumber: boolean;
101
+ stockHoldUntilDaysAfterEventEnd: number;
102
+ }): IStartOperation<{
103
+ transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
104
+ objectSubReservations: IObjectSubReservation[];
105
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
106
+ }>;
98
107
  /**
99
108
  * 取引確定
100
109
  */
@@ -27,7 +27,7 @@ const validateStartRequest_1 = require("./reserve/validateStartRequest");
27
27
  */
28
28
  function start(params) {
29
29
  return (repos) => __awaiter(this, void 0, void 0, function* () {
30
- var _a, _b, _c, _d, _e;
30
+ var _a, _b, _c, _d;
31
31
  const now = new Date();
32
32
  // 自動発行廃止(2022-05-17~)
33
33
  const reservationNumber = params.transactionNumber;
@@ -35,7 +35,8 @@ function start(params) {
35
35
  throw new factory.errors.ArgumentNull('transactionNumber');
36
36
  }
37
37
  // eventをfix
38
- if (typeof ((_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id) !== 'string' || params.object.reservationFor.id.length === 0) {
38
+ const reservationForId = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id;
39
+ if (typeof reservationForId !== 'string' || reservationForId.length === 0) {
39
40
  throw new factory.errors.ArgumentNull('object.reservationFor.id');
40
41
  }
41
42
  let event;
@@ -43,7 +44,7 @@ function start(params) {
43
44
  event = params.preSearchedEvent;
44
45
  }
45
46
  else {
46
- event = yield repos.event.findMinimizedIndividualEventById({ id: params.object.reservationFor.id });
47
+ event = yield repos.event.findMinimizedIndividualEventById({ id: reservationForId });
47
48
  }
48
49
  // validationを承認アクション開始前から移行(2023-01-27~)
49
50
  (0, validateStartRequest_1.validateStartRequest)({
@@ -63,19 +64,24 @@ function start(params) {
63
64
  catch (error) {
64
65
  throw error;
65
66
  }
66
- // 指定があれば予約追加
67
- if (typeof ((_d = params.object.reservationFor) === null || _d === void 0 ? void 0 : _d.id) === 'string') {
68
- transaction = yield addReservations({
69
- id: transaction.id,
70
- object: params.object,
71
- event,
72
- preSearchedTicketOffers: params.preSearchedTicketOffers,
73
- preSearchedUnitPriceOffers: params.preSearchedUnitPriceOffers,
74
- availableAtOrFrom: { id: (_e = params.availableAtOrFrom) === null || _e === void 0 ? void 0 : _e.id },
75
- validateAppliesToMovieTicket: params.validateAppliesToMovieTicket
76
- })(repos);
77
- }
78
- return transaction;
67
+ let objectSubReservations = [];
68
+ const addReservationsResult = yield addReservations({
69
+ id: transaction.id,
70
+ object: params.object,
71
+ event,
72
+ preSearchedTicketOffers: params.preSearchedTicketOffers,
73
+ preSearchedUnitPriceOffers: params.preSearchedUnitPriceOffers,
74
+ availableAtOrFrom: { id: (_d = params.availableAtOrFrom) === null || _d === void 0 ? void 0 : _d.id },
75
+ validateAppliesToMovieTicket: params.validateAppliesToMovieTicket,
76
+ stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
77
+ })(repos);
78
+ transaction = addReservationsResult.transaction;
79
+ objectSubReservations = addReservationsResult.objectSubReservations;
80
+ return {
81
+ transaction,
82
+ objectSubReservations,
83
+ issuedThrough: addReservationsResult.issuedThrough
84
+ };
79
85
  });
80
86
  }
81
87
  exports.start = start;
@@ -132,6 +138,21 @@ function addReservations(params) {
132
138
  })(repos);
133
139
  // 予約イベント最適化
134
140
  const reservationFor = (0, factory_1.createReservationFor)(event);
141
+ const { issuedThrough } = (0, factory_1.createIssuedThrough)({ reservationFor: event });
142
+ // const minimizedObjectSubReservations: factory.assetTransaction.reserve.IMinimizedObjectSubReservation[] =
143
+ // objectSubReservations.map((r) => {
144
+ // return {
145
+ // id: r.id,
146
+ // typeOf: r.typeOf,
147
+ // reservedTicket: {
148
+ // ticketType: r.reservedTicket.ticketType,
149
+ // ...(typeof r.reservedTicket.ticketedSeat?.typeOf === 'string')
150
+ // ? { ticketedSeat: r.reservedTicket.ticketedSeat }
151
+ // : undefined
152
+ // },
153
+ // ...(Array.isArray(r.subReservation)) ? { subReservation: r.subReservation } : undefined
154
+ // };
155
+ // });
135
156
  // 取引に予約追加
136
157
  let lockedOfferRateLimitKeys = [];
137
158
  try {
@@ -140,12 +161,13 @@ function addReservations(params) {
140
161
  typeOf: factory.assetTransactionType.Reserve,
141
162
  id: transaction.id,
142
163
  object: {
143
- project: transaction.project,
144
164
  acceptedOffer: acceptedOffers4transactionObject,
165
+ // issuedThroughを追加(2023-06-05~)
166
+ issuedThrough,
145
167
  reservationFor,
146
168
  // subReservationにreservationForを保管しない(2021-10-19~)
147
- subReservation: objectSubReservations,
148
- typeOf: factory.reservationType.ReservationPackage
169
+ subReservation: objectSubReservations
170
+ // subReservation: minimizedObjectSubReservations
149
171
  }
150
172
  });
151
173
  }
@@ -162,13 +184,20 @@ function addReservations(params) {
162
184
  yield processLockSeats({
163
185
  event: event,
164
186
  reservations: objectSubReservations,
165
- transaction: transaction
187
+ transaction: {
188
+ id: transaction.id,
189
+ transactionNumber: transaction.transactionNumber,
190
+ object: { useHoldStockByTransactionNumber: transaction.object.useHoldStockByTransactionNumber === true }
191
+ },
192
+ stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
166
193
  })(repos);
167
- // 予約作成(insertManyで実装)
168
- yield repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
169
- // 予約作成後処理
194
+ if (transaction.object.disablePendingReservations !== true) {
195
+ // 予約作成(insertManyで実装)
196
+ yield repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
197
+ }
198
+ // ストックホルダー処理(stockHolderで残席数を集計しているので必要)
170
199
  yield onReservationsCreated({ event })(repos);
171
- return transaction;
200
+ return { transaction, objectSubReservations, issuedThrough };
172
201
  });
173
202
  }
174
203
  /**
@@ -210,9 +239,11 @@ function searchEventSeatOffers(params) {
210
239
  });
211
240
  if (seats.length > 0) {
212
241
  const availabilities = yield repos.stockHolder.searchHolders({
242
+ project: { id: params.event.project.id },
213
243
  eventId: params.event.id,
214
244
  startDate: moment(params.event.startDate)
215
245
  .toDate(),
246
+ hasTicketedSeat: true,
216
247
  offers: seats.map((s) => {
217
248
  var _a;
218
249
  return {
@@ -385,7 +416,7 @@ function createReservations4transactionObject(params) {
385
416
  id: reservationId,
386
417
  reserveDate: params.now,
387
418
  agent: params.transaction.agent,
388
- broker: params.transaction.object.broker,
419
+ // broker: params.transaction.object.broker,
389
420
  reservationNumber: reservationNumber,
390
421
  reservationFor: params.event,
391
422
  reservedTicket: reservedTicket,
@@ -596,7 +627,7 @@ function processLockOfferRateLimit(params) {
596
627
  */
597
628
  function processLockSeats(params) {
598
629
  return (repos) => __awaiter(this, void 0, void 0, function* () {
599
- var _a;
630
+ var _a, _b, _c, _d, _e;
600
631
  const offers = [];
601
632
  params.reservations.forEach((r) => {
602
633
  var _a, _b;
@@ -636,15 +667,24 @@ function processLockSeats(params) {
636
667
  }
637
668
  });
638
669
  const expires = moment(params.event.endDate)
639
- .add(1, 'month')
670
+ // 設定化(2023-06-05~)
671
+ // .add(1, 'month')
672
+ .add(params.stockHoldUntilDaysAfterEventEnd, 'days')
640
673
  .toDate();
641
- const holder = params.transaction.id;
642
- const maximumAttendeeCapacity4event = (_a = params.event.location) === null || _a === void 0 ? void 0 : _a.maximumAttendeeCapacity;
674
+ // holder:取引番号に対応(2023-06-05~)
675
+ let holder = params.transaction.id;
676
+ if (((_a = params.transaction.object) === null || _a === void 0 ? void 0 : _a.useHoldStockByTransactionNumber) === true) {
677
+ holder = params.transaction.transactionNumber;
678
+ }
679
+ const hasTicketedSeat = ((_d = (_c = (_b = params.event.offers.itemOffered.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.typeOf) === factory.placeType.Seat;
680
+ const maximumAttendeeCapacity4event = (_e = params.event.location) === null || _e === void 0 ? void 0 : _e.maximumAttendeeCapacity;
643
681
  if (typeof maximumAttendeeCapacity4event === 'number') {
644
682
  yield repos.stockHolder.lockIfNotLimitExceeded({
683
+ project: { id: params.event.project.id },
645
684
  eventId: params.event.id,
646
685
  startDate: moment(params.event.startDate)
647
686
  .toDate(),
687
+ hasTicketedSeat,
648
688
  offers,
649
689
  expires,
650
690
  holder
@@ -652,9 +692,11 @@ function processLockSeats(params) {
652
692
  }
653
693
  else {
654
694
  yield repos.stockHolder.lock({
695
+ project: { id: params.event.project.id },
655
696
  eventId: params.event.id,
656
697
  startDate: moment(params.event.startDate)
657
698
  .toDate(),
699
+ hasTicketedSeat,
658
700
  offers,
659
701
  expires,
660
702
  holder
@@ -698,20 +740,22 @@ function confirm(params) {
698
740
  throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
699
741
  }
700
742
  const order = yield fixOrderAsPurpose(params, transaction)(repos);
701
- const potentialActions = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction: transaction, order }));
743
+ const { potentialActions, underName } = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction,
744
+ order }));
702
745
  // 取引確定
703
746
  const result = {};
704
- yield repos.assetTransaction.confirm({
705
- typeOf: factory.assetTransactionType.Reserve,
706
- id: transaction.id,
707
- result: result,
708
- potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
747
+ yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Reserve, id: transaction.id, result: result, potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
709
748
  ? { reserve: [] }
710
- : potentialActions
711
- });
749
+ : potentialActions }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string')
750
+ ? { object: { underName } }
751
+ : undefined));
712
752
  if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
713
753
  // sync対応(2023-01-13~)
714
- yield (0, confirmReservation_1.confirmReservation)(potentialActions.reserve)(repos);
754
+ yield (0, confirmReservation_1.confirmReservation)({
755
+ actionAttributesList: potentialActions.reserve,
756
+ useOnReservationConfirmed: true,
757
+ byTask: true
758
+ })(repos);
715
759
  }
716
760
  });
717
761
  }
@@ -732,7 +776,7 @@ function fixOrderAsPurpose(params, transaction) {
732
776
  project: { id: { $eq: transaction.project.id } },
733
777
  confirmationNumbers: [payPurposeConfirmationNumber],
734
778
  orderNumbers: [payPurposeOrderNumber]
735
- });
779
+ }, { customer: 1, orderNumber: 1, typeOf: 1 });
736
780
  order = orders.shift();
737
781
  if (order === undefined) {
738
782
  throw new factory.errors.NotFound('Order as purpose');
@@ -754,8 +798,8 @@ function cancel(params) {
754
798
  });
755
799
  // 本来非同期でタスクが実行されるが、同期的に仮予約取消が実行されていないと、サービス利用側が困る可能性があるので、
756
800
  // 同期的にもcancelPendingReservationを実行しておく
757
- const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
758
- if (cancelActionAttributes.length > 0) {
801
+ const cancelActionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction });
802
+ if (cancelActionAttributes !== undefined) {
759
803
  yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
760
804
  }
761
805
  });
@@ -773,27 +817,6 @@ function exportTasksById(params) {
773
817
  });
774
818
  const potentialActions = transaction.potentialActions;
775
819
  const taskAttributes = [];
776
- // 資産取引削除タスクを作成
777
- const deleteTransactionTask = {
778
- project: transaction.project,
779
- name: factory.taskName.DeleteAssetTransaction,
780
- status: factory.taskStatus.Ready,
781
- runsAt: moment(transaction.endDate)
782
- .add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
783
- .toDate(),
784
- remainingNumberOfTries: 3,
785
- numberOfTried: 0,
786
- executionResults: [],
787
- data: {
788
- object: {
789
- project: transaction.project,
790
- id: transaction.id,
791
- transactionNumber: transaction.transactionNumber,
792
- typeOf: transaction.typeOf
793
- }
794
- }
795
- };
796
- taskAttributes.push(deleteTransactionTask);
797
820
  switch (transaction.status) {
798
821
  case factory.transactionStatusType.Confirmed:
799
822
  // tslint:disable-next-line:no-single-line-block-comment
@@ -821,8 +844,8 @@ function exportTasksById(params) {
821
844
  case factory.transactionStatusType.Canceled:
822
845
  // sync対応(2023-01-13~)
823
846
  if (!settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
824
- const cancelActionAttributes4canceled = (0, factory_1.createPendingReservationAction)({ transaction });
825
- if (cancelActionAttributes4canceled.length > 0) {
847
+ const cancelActionAttributes4canceled = (0, factory_1.createCancelPendingReservationAction)({ transaction });
848
+ if (cancelActionAttributes4canceled !== undefined) {
826
849
  const cancelPendingReservationTask = {
827
850
  project: transaction.project,
828
851
  name: factory.taskName.CancelPendingReservation,
@@ -832,7 +855,7 @@ function exportTasksById(params) {
832
855
  numberOfTried: 0,
833
856
  executionResults: [],
834
857
  data: {
835
- actionAttributes: cancelActionAttributes4canceled
858
+ actionAttributes: [cancelActionAttributes4canceled]
836
859
  }
837
860
  };
838
861
  taskAttributes.push(cancelPendingReservationTask);
@@ -840,8 +863,8 @@ function exportTasksById(params) {
840
863
  }
841
864
  break;
842
865
  case factory.transactionStatusType.Expired:
843
- const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
844
- if (cancelActionAttributes.length > 0) {
866
+ const cancelActionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction });
867
+ if (cancelActionAttributes !== undefined) {
845
868
  const cancelPendingReservationTask = {
846
869
  project: transaction.project,
847
870
  name: factory.taskName.CancelPendingReservation,
@@ -851,7 +874,7 @@ function exportTasksById(params) {
851
874
  numberOfTried: 0,
852
875
  executionResults: [],
853
876
  data: {
854
- actionAttributes: cancelActionAttributes
877
+ actionAttributes: [cancelActionAttributes]
855
878
  }
856
879
  };
857
880
  taskAttributes.push(cancelPendingReservationTask);
@@ -860,7 +883,7 @@ function exportTasksById(params) {
860
883
  default:
861
884
  throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
862
885
  }
863
- return repos.task.saveMany(taskAttributes);
886
+ return repos.task.saveMany(taskAttributes, { emitImmediately: true });
864
887
  });
865
888
  }
866
889
  exports.exportTasksById = exportTasksById;
@@ -28,6 +28,12 @@ export declare function exportTasks<T extends factory.assetTransactionType>(para
28
28
  typeOf?: {
29
29
  $in: T[];
30
30
  };
31
+ id?: string;
32
+ tasksExportAction?: {
33
+ agent: {
34
+ name: string;
35
+ };
36
+ };
31
37
  }): (repos: {
32
38
  task: TaskRepo;
33
39
  assetTransaction: AssetTransactionRepo;
@@ -20,6 +20,7 @@ const PayTransactionService = require("./assetTransaction/pay");
20
20
  const RefundTransactionService = require("./assetTransaction/refund");
21
21
  const RegisterServiceTransactionService = require("./assetTransaction/registerService");
22
22
  const ReserveTransactionService = require("./assetTransaction/reserve");
23
+ const settings_1 = require("../settings");
23
24
  exports.cancelReservation = CancelReservationTransactionService;
24
25
  exports.moneyTransfer = MoneyTransferTransactionService;
25
26
  exports.pay = PayTransactionService;
@@ -31,10 +32,14 @@ exports.reserve = ReserveTransactionService;
31
32
  */
32
33
  function exportTasks(params) {
33
34
  return (repos) => __awaiter(this, void 0, void 0, function* () {
34
- const transaction = yield repos.assetTransaction.startExportTasks({
35
- typeOf: params.typeOf,
36
- status: params.status
37
- });
35
+ var _a;
36
+ const transaction = yield repos.assetTransaction.startExportTasks(Object.assign({ typeOf: params.typeOf, status: params.status, tasksExportAction: {
37
+ agent: {
38
+ name: (typeof ((_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.agent.name) === 'string')
39
+ ? params.tasksExportAction.agent.name
40
+ : settings_1.DEFAULT_TASKS_EXPORT_AGENT_NAME
41
+ }
42
+ } }, (typeof params.id === 'string') ? { id: params.id } : undefined));
38
43
  if (transaction === null) {
39
44
  return;
40
45
  }
@@ -127,7 +127,7 @@ function importFromCOA(params) {
127
127
  })(repos);
128
128
  savedScreeningEventSeriesCount = savedEventsCount;
129
129
  try {
130
- // イベントごとに永続化トライ
130
+ // イベント永続化
131
131
  const screeningEvents = yield saveScreeningEvents({
132
132
  locationBranchCode: params.locationBranchCode,
133
133
  movieTheater: movieTheater,
@@ -154,6 +154,8 @@ function importFromCOA(params) {
154
154
  // "message": "ESOCKETTIMEDOUT",
155
155
  if (error.name === 'COAServiceError') {
156
156
  if (error.message === 'ESOCKETTIMEDOUT') {
157
+ // tslint:disable-next-line:no-console
158
+ console.error('saveScreeningEvents throwed an error', error.name, error.message);
157
159
  throwsError = false;
158
160
  }
159
161
  }
@@ -212,7 +214,7 @@ function saveScreeningEventSeries(params) {
212
214
  const availablePaymentMethodTypes = yield repos.categoryCode.search({
213
215
  project: { id: { $eq: params.project.id } },
214
216
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
215
- });
217
+ }, [], []);
216
218
  const screeningEventSerieses = filmsFromCOA.map((filmFromCOA) => {
217
219
  return createScreeningEventSeriesFromCOA({
218
220
  project: project,
@@ -446,7 +448,15 @@ function createScreeningEventFromCOA(params) {
446
448
  typeOf: 'WebAPI',
447
449
  identifier: factory.service.webAPI.Identifier.COA
448
450
  },
449
- priceCurrency: factory.priceCurrency.JPY
451
+ priceCurrency: factory.priceCurrency.JPY,
452
+ itemOffered: {
453
+ serviceOutput: {
454
+ reservedTicket: {
455
+ typeOf: 'Ticket',
456
+ ticketedSeat: { typeOf: factory.placeType.Seat }
457
+ }
458
+ }
459
+ }
450
460
  };
451
461
  const { additionalProperty, coaInfo } = createScreeningEventAdditionalPropertyFromCOA(params);
452
462
  return {
@@ -584,7 +594,10 @@ function createScreeningEventSeriesFromCOA(params) {
584
594
  endDate: endDate,
585
595
  startDate: startDate,
586
596
  coaInfo,
587
- offers: Object.assign({ project: { typeOf: params.project.typeOf, id: params.project.id }, typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY }, (Array.isArray(unacceptedPaymentMethod)) ? { unacceptedPaymentMethod: unacceptedPaymentMethod } : undefined),
597
+ offers: Object.assign({
598
+ // 不要なので廃止(2023-06-09~)
599
+ // project: { typeOf: params.project.typeOf, id: params.project.id },
600
+ typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY }, (Array.isArray(unacceptedPaymentMethod)) ? { unacceptedPaymentMethod: unacceptedPaymentMethod } : undefined),
588
601
  additionalProperty
589
602
  };
590
603
  }
@@ -765,8 +778,14 @@ function updateEvent4ttts(params) {
765
778
  throw error;
766
779
  }
767
780
  // アクション完了
768
- yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: {} });
769
- yield (0, offer_1.onEventChanged)({ event, isNew: false })({
781
+ yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: { id: event.id } });
782
+ yield (0, offer_1.onEventChanged)({
783
+ id: [event.id],
784
+ project: { id: event.project.id },
785
+ typeOf: event.typeOf,
786
+ isNew: false,
787
+ useInform: true
788
+ })({
770
789
  event: repos.event,
771
790
  project: repos.project,
772
791
  task: repos.task
@@ -12,7 +12,7 @@ function task2lineNotify(params) {
12
12
  const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
13
13
  let lastError = lastExecutionResult === null || lastExecutionResult === void 0 ? void 0 : lastExecutionResult.error;
14
14
  if (typeof lastError === 'string') {
15
- lastError = { message: lastError };
15
+ lastError = { message: lastError, name: 'Error' };
16
16
  }
17
17
  const lastMessage = `${String(lastError === null || lastError === void 0 ? void 0 : lastError.name)} ${String(lastError === null || lastError === void 0 ? void 0 : lastError.message)}`;
18
18
  const content = `project:${(_a = task.project) === null || _a === void 0 ? void 0 : _a.id}
@@ -38,7 +38,7 @@ function tasks2lineNotify(params) {
38
38
  const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
39
39
  let lastError = lastExecutionResult === null || lastExecutionResult === void 0 ? void 0 : lastExecutionResult.error;
40
40
  if (typeof lastError === 'string') {
41
- lastError = { message: lastError };
41
+ lastError = { message: lastError, name: 'Error' };
42
42
  }
43
43
  const lastMessage = `${String(lastError === null || lastError === void 0 ? void 0 : lastError.name)} ${String(lastError === null || lastError === void 0 ? void 0 : lastError.message)}`;
44
44
  return `project:${(_a = task.project) === null || _a === void 0 ? void 0 : _a.id}
@@ -1,7 +1,9 @@
1
1
  import * as factory from '../factory';
2
2
  import { MongoRepository as ActionRepo } from '../repo/action';
3
3
  import { MongoRepository as ProjectRepo } from '../repo/project';
4
- export type Operation<T> = () => Promise<T>;
4
+ export type Operation<T> = (repos: {
5
+ accessToken: string;
6
+ }) => Promise<T>;
5
7
  /**
6
8
  * Eメールメッセージを送信する
7
9
  * https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html
@@ -111,15 +111,11 @@ exports.sendEmailMessage = sendEmailMessage;
111
111
  * https://notify-bot.line.me/doc/ja/
112
112
  */
113
113
  function report2developers(subject, content, imageThumbnail, imageFullsize) {
114
- return () => __awaiter(this, void 0, void 0, function* () {
114
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
115
115
  const LINE_NOTIFY_URL = credentials_1.credentials.lineNotify.url;
116
- const LINE_NOTIFY_ACCESS_TOKEN = credentials_1.credentials.lineNotify.accessToken;
117
116
  if (LINE_NOTIFY_URL === undefined) {
118
117
  throw new Error('Environment variable LINE_NOTIFY_URL not set');
119
118
  }
120
- if (LINE_NOTIFY_ACCESS_TOKEN === undefined) {
121
- throw new Error('Environment variable LINE_NOTIFY_ACCESS_TOKEN not set');
122
- }
123
119
  const message = `--------
124
120
  ${subject}
125
121
  --------
@@ -130,7 +126,7 @@ ${content}`;
130
126
  var _a;
131
127
  request.post({
132
128
  url: LINE_NOTIFY_URL,
133
- auth: { bearer: LINE_NOTIFY_ACCESS_TOKEN },
129
+ auth: { bearer: repos.accessToken },
134
130
  form: formData,
135
131
  json: true,
136
132
  timeout: (_a = settings_1.settings.webhook) === null || _a === void 0 ? void 0 : _a.timeout
@@ -154,6 +150,45 @@ ${content}`;
154
150
  exports.report2developers = report2developers;
155
151
  const USERNAME_ARGUMENT_REQUIRED_MESSAGE = 'Missing required key \'Username\' in params';
156
152
  function triggerWebhook(params) {
153
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
154
+ // retryableにする(2023-05-12~)
155
+ let retry = true;
156
+ let numberOfTry = 0;
157
+ while (numberOfTry >= 0) {
158
+ try {
159
+ numberOfTry += 1;
160
+ if (numberOfTry > settings_1.TRIGGER_WEBHOOK_MAX_RETRY_COUNT) {
161
+ retry = false;
162
+ }
163
+ // retryInterval
164
+ if (numberOfTry > 1) {
165
+ yield sleep(settings_1.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS * (numberOfTry - 1));
166
+ }
167
+ yield processInformAction(params)(repos);
168
+ break;
169
+ }
170
+ catch (error) {
171
+ if (retry) {
172
+ continue;
173
+ }
174
+ else {
175
+ throw error;
176
+ }
177
+ }
178
+ }
179
+ });
180
+ }
181
+ exports.triggerWebhook = triggerWebhook;
182
+ function sleep(waitTime) {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ return new Promise((resolve) => {
185
+ setTimeout(() => {
186
+ resolve();
187
+ }, waitTime);
188
+ });
189
+ });
190
+ }
191
+ function processInformAction(params) {
157
192
  return (repos) => __awaiter(this, void 0, void 0, function* () {
158
193
  var _a, _b;
159
194
  // アクション開始
@@ -219,4 +254,3 @@ function triggerWebhook(params) {
219
254
  yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
220
255
  });
221
256
  }
222
- exports.triggerWebhook = triggerWebhook;
@@ -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,
@@ -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: {