@chevre/domain 21.2.0-alpha.12 → 21.2.0-alpha.120

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 (293) 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 +2 -1
  8. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  9. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  10. package/example/src/chevre/migrateStockHolderKeys.ts +1 -1
  11. package/example/src/chevre/processPay.ts +5 -1
  12. package/example/src/chevre/processRegisterMembership.ts +8 -4
  13. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  14. package/example/src/chevre/processReserve.ts +5 -2
  15. package/example/src/chevre/saveTasks.ts +13 -10
  16. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  17. package/example/src/chevre/searchActions.ts +33 -0
  18. package/example/src/chevre/searchEventSeats.ts +2 -1
  19. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  20. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  21. package/example/src/chevre/task/executeTasks.ts +26 -0
  22. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  23. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  24. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  25. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  26. package/example/src/chevre/updateScreeningRoom.ts +41 -0
  27. package/example/src/chevre/updateTransaction.ts +1 -1
  28. package/example/src/playOnMoment.ts +24 -0
  29. package/lib/chevre/credentials.d.ts +1 -0
  30. package/lib/chevre/credentials.js +2 -1
  31. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  32. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  33. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  34. package/lib/chevre/eventEmitter/task.js +25 -0
  35. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  36. package/lib/chevre/eventEmitter/transaction.js +25 -0
  37. package/lib/chevre/eventEmitter.d.ts +4 -0
  38. package/lib/chevre/eventEmitter.js +9 -0
  39. package/lib/chevre/index.d.ts +3 -2
  40. package/lib/chevre/index.js +5 -3
  41. package/lib/chevre/repo/account.js +3 -2
  42. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  43. package/lib/chevre/repo/accountTransaction.js +3 -55
  44. package/lib/chevre/repo/action.d.ts +42 -2
  45. package/lib/chevre/repo/action.js +130 -57
  46. package/lib/chevre/repo/additionalProperty.js +2 -1
  47. package/lib/chevre/repo/aggregation.d.ts +3 -0
  48. package/lib/chevre/repo/aggregation.js +3 -0
  49. package/lib/chevre/repo/assetTransaction.d.ts +25 -9
  50. package/lib/chevre/repo/assetTransaction.js +259 -87
  51. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  52. package/lib/chevre/repo/categoryCode.js +37 -25
  53. package/lib/chevre/repo/code.js +3 -2
  54. package/lib/chevre/repo/comment.d.ts +4 -1
  55. package/lib/chevre/repo/comment.js +22 -6
  56. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  57. package/lib/chevre/repo/confirmationNumber.js +3 -15
  58. package/lib/chevre/repo/creativeWork.d.ts +2 -4
  59. package/lib/chevre/repo/creativeWork.js +35 -12
  60. package/lib/chevre/repo/customer.js +2 -1
  61. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  62. package/lib/chevre/repo/emailMessage.js +2 -1
  63. package/lib/chevre/repo/event.d.ts +27 -1
  64. package/lib/chevre/repo/event.js +67 -33
  65. package/lib/chevre/repo/member.js +4 -3
  66. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  67. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  68. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  69. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  70. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  72. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  73. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  74. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  75. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  76. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  77. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  78. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  79. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  80. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  81. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  82. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  83. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  84. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  85. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  86. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  87. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  88. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  89. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +56 -0
  90. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  91. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  92. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  93. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  94. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  95. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  96. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  97. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  98. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  99. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  100. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  101. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  102. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  103. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  104. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  105. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  106. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  107. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  108. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  109. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  110. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  111. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  112. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  113. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  114. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  116. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  117. package/lib/chevre/repo/offer.js +3 -2
  118. package/lib/chevre/repo/offerCatalog.js +0 -27
  119. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  120. package/lib/chevre/repo/offerItemCondition.js +121 -0
  121. package/lib/chevre/repo/order.d.ts +55 -3
  122. package/lib/chevre/repo/order.js +62 -10
  123. package/lib/chevre/repo/ownershipInfo.js +2 -7
  124. package/lib/chevre/repo/place.d.ts +20 -5
  125. package/lib/chevre/repo/place.js +63 -23
  126. package/lib/chevre/repo/priceSpecification.js +3 -2
  127. package/lib/chevre/repo/product.d.ts +1 -3
  128. package/lib/chevre/repo/product.js +25 -4
  129. package/lib/chevre/repo/project.js +2 -1
  130. package/lib/chevre/repo/reservation.d.ts +20 -4
  131. package/lib/chevre/repo/reservation.js +40 -59
  132. package/lib/chevre/repo/role.js +3 -2
  133. package/lib/chevre/repo/seller.d.ts +1 -1
  134. package/lib/chevre/repo/seller.js +44 -23
  135. package/lib/chevre/repo/serviceOutput.js +2 -1
  136. package/lib/chevre/repo/stockHolder.d.ts +35 -5
  137. package/lib/chevre/repo/stockHolder.js +306 -87
  138. package/lib/chevre/repo/task.d.ts +45 -2
  139. package/lib/chevre/repo/task.js +94 -15
  140. package/lib/chevre/repo/transaction.d.ts +23 -3
  141. package/lib/chevre/repo/transaction.js +177 -56
  142. package/lib/chevre/repo/trip.js +2 -1
  143. package/lib/chevre/repository.d.ts +5 -2
  144. package/lib/chevre/repository.js +8 -4
  145. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +8 -6
  146. package/lib/chevre/service/aggregation/system.d.ts +110 -23
  147. package/lib/chevre/service/aggregation/system.js +213 -91
  148. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  149. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
  150. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  151. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  152. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  153. package/lib/chevre/service/assetTransaction/pay.js +20 -34
  154. package/lib/chevre/service/assetTransaction/refund.js +2 -24
  155. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  156. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  157. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  158. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  159. package/lib/chevre/service/assetTransaction/reserve.js +85 -69
  160. package/lib/chevre/service/assetTransaction.d.ts +6 -0
  161. package/lib/chevre/service/assetTransaction.js +9 -4
  162. package/lib/chevre/service/event.js +16 -5
  163. package/lib/chevre/service/notification/factory.js +2 -2
  164. package/lib/chevre/service/notification.d.ts +3 -1
  165. package/lib/chevre/service/notification.js +41 -7
  166. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  167. package/lib/chevre/service/offer/event/authorize.js +8 -2
  168. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  169. package/lib/chevre/service/offer/event/factory.js +16 -5
  170. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  171. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  172. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  173. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  174. package/lib/chevre/service/offer/product.js +2 -2
  175. package/lib/chevre/service/offer.d.ts +16 -8
  176. package/lib/chevre/service/offer.js +69 -8
  177. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  178. package/lib/chevre/service/order/deleteOrder.js +8 -8
  179. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  180. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  181. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  182. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  183. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  184. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  185. package/lib/chevre/service/order/placeOrder.js +41 -24
  186. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  187. package/lib/chevre/service/order/returnOrder.js +7 -12
  188. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  189. package/lib/chevre/service/order/sendOrder.js +7 -10
  190. package/lib/chevre/service/order.d.ts +2 -1
  191. package/lib/chevre/service/order.js +3 -1
  192. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  193. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  194. package/lib/chevre/service/payment/any.d.ts +9 -5
  195. package/lib/chevre/service/payment/any.js +80 -18
  196. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  197. package/lib/chevre/service/payment/creditCard.js +23 -17
  198. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  199. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  200. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  201. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  202. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  203. package/lib/chevre/service/payment/movieTicket/validation.js +55 -32
  204. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  205. package/lib/chevre/service/payment/movieTicket.js +7 -6
  206. package/lib/chevre/service/product.js +1 -5
  207. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  208. package/lib/chevre/service/report/telemetry.js +21 -24
  209. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  210. package/lib/chevre/service/reserve/cancelReservation.js +147 -139
  211. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  212. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  213. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  214. package/lib/chevre/service/reserve/confirmReservation.js +133 -58
  215. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  216. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  217. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  218. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  219. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  220. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  221. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  222. package/lib/chevre/service/reserve/useReservation.js +61 -71
  223. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  224. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  225. package/lib/chevre/service/reserve.d.ts +3 -2
  226. package/lib/chevre/service/reserve.js +4 -2
  227. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  228. package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
  229. package/lib/chevre/service/task/cancelReservation.js +1 -1
  230. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  231. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  232. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  233. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  234. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  235. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  236. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  237. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  238. package/lib/chevre/service/task/onResourceUpdated.js +352 -0
  239. package/lib/chevre/service/task/placeOrder.js +1 -1
  240. package/lib/chevre/service/task/reserve.js +10 -7
  241. package/lib/chevre/service/task/returnOrder.js +1 -1
  242. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  243. package/lib/chevre/service/task/sendOrder.js +1 -1
  244. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  245. package/lib/chevre/service/task/useReservation.js +36 -0
  246. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  247. package/lib/chevre/service/task.d.ts +9 -0
  248. package/lib/chevre/service/task.js +43 -4
  249. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  250. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  251. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  252. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  253. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  254. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  255. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  256. package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
  257. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  258. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  259. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
  260. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  261. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  262. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  263. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  264. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  265. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  266. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  267. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  268. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  269. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  270. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  271. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  272. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  273. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  274. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  275. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  276. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  277. package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
  278. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  279. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  280. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  281. package/lib/chevre/service/transaction/returnOrder.js +228 -36
  282. package/lib/chevre/service/transaction.d.ts +8 -13
  283. package/lib/chevre/service/transaction.js +12 -145
  284. package/lib/chevre/settings.d.ts +12 -1
  285. package/lib/chevre/settings.js +53 -6
  286. package/package.json +5 -5
  287. package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
  288. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  289. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  290. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  291. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  292. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  293. 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
  /**
@@ -385,7 +414,7 @@ function createReservations4transactionObject(params) {
385
414
  id: reservationId,
386
415
  reserveDate: params.now,
387
416
  agent: params.transaction.agent,
388
- broker: params.transaction.object.broker,
417
+ // broker: params.transaction.object.broker,
389
418
  reservationNumber: reservationNumber,
390
419
  reservationFor: params.event,
391
420
  reservedTicket: reservedTicket,
@@ -596,7 +625,7 @@ function processLockOfferRateLimit(params) {
596
625
  */
597
626
  function processLockSeats(params) {
598
627
  return (repos) => __awaiter(this, void 0, void 0, function* () {
599
- var _a;
628
+ var _a, _b;
600
629
  const offers = [];
601
630
  params.reservations.forEach((r) => {
602
631
  var _a, _b;
@@ -636,10 +665,16 @@ function processLockSeats(params) {
636
665
  }
637
666
  });
638
667
  const expires = moment(params.event.endDate)
639
- .add(1, 'month')
668
+ // 設定化(2023-06-05~)
669
+ // .add(1, 'month')
670
+ .add(params.stockHoldUntilDaysAfterEventEnd, 'days')
640
671
  .toDate();
641
- const holder = params.transaction.id;
642
- const maximumAttendeeCapacity4event = (_a = params.event.location) === null || _a === void 0 ? void 0 : _a.maximumAttendeeCapacity;
672
+ // holder:取引番号に対応(2023-06-05~)
673
+ let holder = params.transaction.id;
674
+ if (((_a = params.transaction.object) === null || _a === void 0 ? void 0 : _a.useHoldStockByTransactionNumber) === true) {
675
+ holder = params.transaction.transactionNumber;
676
+ }
677
+ const maximumAttendeeCapacity4event = (_b = params.event.location) === null || _b === void 0 ? void 0 : _b.maximumAttendeeCapacity;
643
678
  if (typeof maximumAttendeeCapacity4event === 'number') {
644
679
  yield repos.stockHolder.lockIfNotLimitExceeded({
645
680
  eventId: params.event.id,
@@ -698,20 +733,22 @@ function confirm(params) {
698
733
  throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
699
734
  }
700
735
  const order = yield fixOrderAsPurpose(params, transaction)(repos);
701
- const potentialActions = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction: transaction, order }));
736
+ const { potentialActions, underName } = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction,
737
+ order }));
702
738
  // 取引確定
703
739
  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)
740
+ yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Reserve, id: transaction.id, result: result, potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
709
741
  ? { reserve: [] }
710
- : potentialActions
711
- });
742
+ : potentialActions }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string')
743
+ ? { object: { underName } }
744
+ : undefined));
712
745
  if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
713
746
  // sync対応(2023-01-13~)
714
- yield (0, confirmReservation_1.confirmReservation)(potentialActions.reserve)(repos);
747
+ yield (0, confirmReservation_1.confirmReservation)({
748
+ actionAttributesList: potentialActions.reserve,
749
+ useOnReservationConfirmed: true,
750
+ byTask: true
751
+ })(repos);
715
752
  }
716
753
  });
717
754
  }
@@ -732,7 +769,7 @@ function fixOrderAsPurpose(params, transaction) {
732
769
  project: { id: { $eq: transaction.project.id } },
733
770
  confirmationNumbers: [payPurposeConfirmationNumber],
734
771
  orderNumbers: [payPurposeOrderNumber]
735
- });
772
+ }, { customer: 1, orderNumber: 1, typeOf: 1 });
736
773
  order = orders.shift();
737
774
  if (order === undefined) {
738
775
  throw new factory.errors.NotFound('Order as purpose');
@@ -754,8 +791,8 @@ function cancel(params) {
754
791
  });
755
792
  // 本来非同期でタスクが実行されるが、同期的に仮予約取消が実行されていないと、サービス利用側が困る可能性があるので、
756
793
  // 同期的にもcancelPendingReservationを実行しておく
757
- const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
758
- if (cancelActionAttributes.length > 0) {
794
+ const cancelActionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction });
795
+ if (cancelActionAttributes !== undefined) {
759
796
  yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
760
797
  }
761
798
  });
@@ -773,27 +810,6 @@ function exportTasksById(params) {
773
810
  });
774
811
  const potentialActions = transaction.potentialActions;
775
812
  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
813
  switch (transaction.status) {
798
814
  case factory.transactionStatusType.Confirmed:
799
815
  // tslint:disable-next-line:no-single-line-block-comment
@@ -821,8 +837,8 @@ function exportTasksById(params) {
821
837
  case factory.transactionStatusType.Canceled:
822
838
  // sync対応(2023-01-13~)
823
839
  if (!settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
824
- const cancelActionAttributes4canceled = (0, factory_1.createPendingReservationAction)({ transaction });
825
- if (cancelActionAttributes4canceled.length > 0) {
840
+ const cancelActionAttributes4canceled = (0, factory_1.createCancelPendingReservationAction)({ transaction });
841
+ if (cancelActionAttributes4canceled !== undefined) {
826
842
  const cancelPendingReservationTask = {
827
843
  project: transaction.project,
828
844
  name: factory.taskName.CancelPendingReservation,
@@ -832,7 +848,7 @@ function exportTasksById(params) {
832
848
  numberOfTried: 0,
833
849
  executionResults: [],
834
850
  data: {
835
- actionAttributes: cancelActionAttributes4canceled
851
+ actionAttributes: [cancelActionAttributes4canceled]
836
852
  }
837
853
  };
838
854
  taskAttributes.push(cancelPendingReservationTask);
@@ -840,8 +856,8 @@ function exportTasksById(params) {
840
856
  }
841
857
  break;
842
858
  case factory.transactionStatusType.Expired:
843
- const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
844
- if (cancelActionAttributes.length > 0) {
859
+ const cancelActionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction });
860
+ if (cancelActionAttributes !== undefined) {
845
861
  const cancelPendingReservationTask = {
846
862
  project: transaction.project,
847
863
  name: factory.taskName.CancelPendingReservation,
@@ -851,7 +867,7 @@ function exportTasksById(params) {
851
867
  numberOfTried: 0,
852
868
  executionResults: [],
853
869
  data: {
854
- actionAttributes: cancelActionAttributes
870
+ actionAttributes: [cancelActionAttributes]
855
871
  }
856
872
  };
857
873
  taskAttributes.push(cancelPendingReservationTask);
@@ -860,7 +876,7 @@ function exportTasksById(params) {
860
876
  default:
861
877
  throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
862
878
  }
863
- return repos.task.saveMany(taskAttributes);
879
+ return repos.task.saveMany(taskAttributes, { emitImmediately: true });
864
880
  });
865
881
  }
866
882
  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,
@@ -584,7 +586,10 @@ function createScreeningEventSeriesFromCOA(params) {
584
586
  endDate: endDate,
585
587
  startDate: startDate,
586
588
  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),
589
+ offers: Object.assign({
590
+ // 不要なので廃止(2023-06-09~)
591
+ // project: { typeOf: params.project.typeOf, id: params.project.id },
592
+ typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY }, (Array.isArray(unacceptedPaymentMethod)) ? { unacceptedPaymentMethod: unacceptedPaymentMethod } : undefined),
588
593
  additionalProperty
589
594
  };
590
595
  }
@@ -765,8 +770,14 @@ function updateEvent4ttts(params) {
765
770
  throw error;
766
771
  }
767
772
  // アクション完了
768
- yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: {} });
769
- yield (0, offer_1.onEventChanged)({ event, isNew: false })({
773
+ yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: { id: event.id } });
774
+ yield (0, offer_1.onEventChanged)({
775
+ id: [event.id],
776
+ project: { id: event.project.id },
777
+ typeOf: event.typeOf,
778
+ isNew: false,
779
+ useInform: true
780
+ })({
770
781
  event: repos.event,
771
782
  project: repos.project,
772
783
  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: {
@@ -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);
@@ -20,7 +20,7 @@ function importFromCOA(params) {
20
20
  page: 1,
21
21
  project: { id: { $eq: params.project.id } },
22
22
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.CurrencyType } }
23
- });
23
+ }, [], []);
24
24
  const defaultCurrencyType = currencyTypes.shift();
25
25
  // メンバーシップ区分検索
26
26
  const membershipTypes = yield repos.categoryCode.search({
@@ -28,7 +28,7 @@ function importFromCOA(params) {
28
28
  page: 1,
29
29
  project: { id: { $eq: params.project.id } },
30
30
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.MembershipType } }
31
- });
31
+ }, [], []);
32
32
  const defaultMembershipType = membershipTypes.shift();
33
33
  try {
34
34
  const ticketResults = yield repos.masterService.ticket({ theaterCode: params.theaterCode });