@chevre/domain 21.2.0-alpha.15 → 21.2.0-alpha.151

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 (308) 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/findScreeningRoomsByBranchCode.ts +4 -3
  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/searchPaymentServiceProviders.ts +39 -0
  20. package/example/src/chevre/searchPermissions.ts +54 -0
  21. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  22. package/example/src/chevre/searchScreeningRooms.ts +35 -0
  23. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  24. package/example/src/chevre/syncScreeningRooms.ts +22 -0
  25. package/example/src/chevre/syncScreeningRoomsAll.ts +44 -0
  26. package/example/src/chevre/task/executeTasks.ts +26 -0
  27. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  28. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  29. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  30. package/example/src/chevre/transaction/startExportTasks.ts +2 -1
  31. package/example/src/chevre/updateTransaction.ts +1 -1
  32. package/example/src/playOnMoment.ts +24 -0
  33. package/lib/chevre/credentials.d.ts +1 -0
  34. package/lib/chevre/credentials.js +2 -1
  35. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  36. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  37. package/lib/chevre/eventEmitter/task.d.ts +2 -1
  38. package/lib/chevre/eventEmitter/task.js +1 -4
  39. package/lib/chevre/eventEmitter/transaction.d.ts +1 -1
  40. package/lib/chevre/eventEmitter/transaction.js +1 -4
  41. package/lib/chevre/eventEmitter.d.ts +2 -1
  42. package/lib/chevre/eventEmitter.js +3 -1
  43. package/lib/chevre/index.d.ts +1 -1
  44. package/lib/chevre/index.js +2 -2
  45. package/lib/chevre/repo/account.js +3 -2
  46. package/lib/chevre/repo/accountTransaction.d.ts +3 -1
  47. package/lib/chevre/repo/accountTransaction.js +3 -2
  48. package/lib/chevre/repo/action.d.ts +42 -2
  49. package/lib/chevre/repo/action.js +130 -57
  50. package/lib/chevre/repo/additionalProperty.js +2 -1
  51. package/lib/chevre/repo/aggregation.d.ts +3 -0
  52. package/lib/chevre/repo/aggregation.js +3 -0
  53. package/lib/chevre/repo/assetTransaction.d.ts +23 -8
  54. package/lib/chevre/repo/assetTransaction.js +253 -80
  55. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  56. package/lib/chevre/repo/categoryCode.js +37 -25
  57. package/lib/chevre/repo/code.js +3 -2
  58. package/lib/chevre/repo/comment.d.ts +4 -1
  59. package/lib/chevre/repo/comment.js +22 -6
  60. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  61. package/lib/chevre/repo/confirmationNumber.js +3 -15
  62. package/lib/chevre/repo/creativeWork.d.ts +2 -4
  63. package/lib/chevre/repo/creativeWork.js +35 -12
  64. package/lib/chevre/repo/customer.js +2 -1
  65. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  66. package/lib/chevre/repo/emailMessage.js +2 -1
  67. package/lib/chevre/repo/event.d.ts +27 -1
  68. package/lib/chevre/repo/event.js +67 -33
  69. package/lib/chevre/repo/member.d.ts +14 -0
  70. package/lib/chevre/repo/member.js +31 -3
  71. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  72. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  73. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  74. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  75. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  76. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  77. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  78. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  79. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  80. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  81. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  82. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  83. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  84. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  85. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  86. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  87. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  88. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  89. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  90. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  91. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  92. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  93. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  94. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
  95. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  96. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  97. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  98. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  99. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  100. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  101. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  102. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  103. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  104. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  105. package/lib/chevre/repo/mongoose/schemas/place.d.ts +55 -3
  106. package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
  107. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  108. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  109. package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
  110. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  111. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  112. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  113. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  114. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  115. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  116. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  117. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  118. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  119. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  120. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  121. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  122. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  123. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  124. package/lib/chevre/repo/offer.js +3 -2
  125. package/lib/chevre/repo/offerCatalog.js +0 -27
  126. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  127. package/lib/chevre/repo/offerItemCondition.js +121 -0
  128. package/lib/chevre/repo/order.d.ts +55 -3
  129. package/lib/chevre/repo/order.js +62 -10
  130. package/lib/chevre/repo/ownershipInfo.js +2 -7
  131. package/lib/chevre/repo/place.d.ts +189 -27
  132. package/lib/chevre/repo/place.js +1696 -702
  133. package/lib/chevre/repo/priceSpecification.js +3 -2
  134. package/lib/chevre/repo/product.d.ts +27 -3
  135. package/lib/chevre/repo/product.js +142 -5
  136. package/lib/chevre/repo/project.js +2 -1
  137. package/lib/chevre/repo/reservation.d.ts +20 -4
  138. package/lib/chevre/repo/reservation.js +40 -59
  139. package/lib/chevre/repo/role.d.ts +7 -0
  140. package/lib/chevre/repo/role.js +39 -2
  141. package/lib/chevre/repo/seller.d.ts +1 -1
  142. package/lib/chevre/repo/seller.js +44 -23
  143. package/lib/chevre/repo/serviceOutput.js +2 -1
  144. package/lib/chevre/repo/stockHolder.d.ts +143 -7
  145. package/lib/chevre/repo/stockHolder.js +622 -104
  146. package/lib/chevre/repo/task.d.ts +42 -2
  147. package/lib/chevre/repo/task.js +68 -20
  148. package/lib/chevre/repo/transaction.d.ts +21 -2
  149. package/lib/chevre/repo/transaction.js +160 -48
  150. package/lib/chevre/repo/trip.js +2 -1
  151. package/lib/chevre/repository.d.ts +5 -2
  152. package/lib/chevre/repository.js +8 -4
  153. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +18 -8
  154. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
  155. package/lib/chevre/service/aggregation/system.d.ts +110 -23
  156. package/lib/chevre/service/aggregation/system.js +213 -91
  157. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  158. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
  159. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  160. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  161. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  162. package/lib/chevre/service/assetTransaction/pay.js +20 -34
  163. package/lib/chevre/service/assetTransaction/refund.js +2 -24
  164. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  165. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  166. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  167. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  168. package/lib/chevre/service/assetTransaction/reserve.js +93 -70
  169. package/lib/chevre/service/assetTransaction.d.ts +6 -0
  170. package/lib/chevre/service/assetTransaction.js +9 -4
  171. package/lib/chevre/service/event.d.ts +3 -0
  172. package/lib/chevre/service/event.js +55 -22
  173. package/lib/chevre/service/iam.d.ts +6 -2
  174. package/lib/chevre/service/iam.js +23 -9
  175. package/lib/chevre/service/notification/factory.js +2 -2
  176. package/lib/chevre/service/notification.d.ts +3 -1
  177. package/lib/chevre/service/notification.js +41 -7
  178. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  179. package/lib/chevre/service/offer/event/authorize.js +8 -2
  180. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  181. package/lib/chevre/service/offer/event/factory.js +16 -5
  182. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  183. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  184. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  185. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  186. package/lib/chevre/service/offer/product.js +2 -2
  187. package/lib/chevre/service/offer.d.ts +16 -8
  188. package/lib/chevre/service/offer.js +72 -9
  189. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  190. package/lib/chevre/service/order/deleteOrder.js +8 -8
  191. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  192. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  193. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  194. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  195. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  196. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  197. package/lib/chevre/service/order/placeOrder.js +41 -24
  198. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  199. package/lib/chevre/service/order/returnOrder.js +7 -12
  200. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  201. package/lib/chevre/service/order/sendOrder.js +7 -10
  202. package/lib/chevre/service/order.d.ts +2 -1
  203. package/lib/chevre/service/order.js +3 -1
  204. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  205. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  206. package/lib/chevre/service/payment/any.d.ts +9 -5
  207. package/lib/chevre/service/payment/any.js +80 -18
  208. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  209. package/lib/chevre/service/payment/creditCard.js +23 -17
  210. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  211. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  212. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  213. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  214. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  215. package/lib/chevre/service/payment/movieTicket/validation.js +65 -37
  216. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  217. package/lib/chevre/service/payment/movieTicket.js +7 -6
  218. package/lib/chevre/service/product.js +1 -5
  219. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  220. package/lib/chevre/service/report/telemetry.js +21 -24
  221. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  222. package/lib/chevre/service/reserve/cancelReservation.js +162 -142
  223. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  224. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  225. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  226. package/lib/chevre/service/reserve/confirmReservation.js +133 -58
  227. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  228. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  229. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  230. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  231. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  232. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  233. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  234. package/lib/chevre/service/reserve/useReservation.js +61 -71
  235. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  236. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  237. package/lib/chevre/service/reserve.d.ts +3 -2
  238. package/lib/chevre/service/reserve.js +4 -2
  239. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  240. package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
  241. package/lib/chevre/service/task/cancelReservation.js +1 -1
  242. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  243. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  244. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  245. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  246. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  247. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  248. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  249. package/lib/chevre/service/task/onResourceUpdated.d.ts +10 -0
  250. package/lib/chevre/service/task/onResourceUpdated.js +418 -0
  251. package/lib/chevre/service/task/placeOrder.js +1 -1
  252. package/lib/chevre/service/task/reserve.js +10 -7
  253. package/lib/chevre/service/task/returnOrder.js +1 -1
  254. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  255. package/lib/chevre/service/task/sendOrder.js +1 -1
  256. package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
  257. package/lib/chevre/service/task/syncScreeningRooms.js +24 -0
  258. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  259. package/lib/chevre/service/task/useReservation.js +36 -0
  260. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  261. package/lib/chevre/service/task.d.ts +6 -0
  262. package/lib/chevre/service/task.js +22 -4
  263. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  264. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  265. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  266. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  267. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  268. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  269. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  270. package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
  271. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  272. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  273. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
  274. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  275. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  276. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  277. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  278. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  279. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  280. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  281. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  282. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  283. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  284. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  285. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  286. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  287. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  288. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  289. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  290. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  291. package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
  292. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  293. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  294. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  295. package/lib/chevre/service/transaction/returnOrder.js +228 -36
  296. package/lib/chevre/service/transaction.d.ts +7 -13
  297. package/lib/chevre/service/transaction.js +12 -139
  298. package/lib/chevre/settings.d.ts +15 -2
  299. package/lib/chevre/settings.js +58 -7
  300. package/package.json +5 -5
  301. package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
  302. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  303. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  304. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  305. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
  306. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  307. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  308. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -18,16 +18,24 @@ const factory = require("../factory");
18
18
  const task_1 = require("../repo/task");
19
19
  const NotificationService = require("./notification");
20
20
  const factory_1 = require("./notification/factory");
21
+ const credentials_1 = require("../credentials");
21
22
  const settings_1 = require("../settings");
22
23
  const debug = createDebug('chevre-domain:service:task');
24
+ const DEFAULT_EXECUTOR_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
23
25
  function executeById(params) {
24
26
  return (settings) => __awaiter(this, void 0, void 0, function* () {
27
+ var _a;
25
28
  const taskRepo = new task_1.MongoRepository(settings.connection);
26
29
  // 未実行のタスクを取得
27
30
  // tslint:disable-next-line:no-null-keyword
28
31
  let task = null;
29
32
  try {
30
- task = yield taskRepo.executeById({ id: params.id });
33
+ task = yield taskRepo.executeById({
34
+ id: params.id,
35
+ executor: {
36
+ name: (typeof ((_a = params.executor) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? params.executor.name : DEFAULT_EXECUTOR_NAME
37
+ }
38
+ });
31
39
  }
32
40
  catch (error) {
33
41
  // tslint:disable-next-line:no-single-line-block-comment
@@ -46,12 +54,18 @@ exports.executeById = executeById;
46
54
  */
47
55
  function executeByName(params) {
48
56
  return (settings) => __awaiter(this, void 0, void 0, function* () {
57
+ var _a;
49
58
  const taskRepo = new task_1.MongoRepository(settings.connection);
50
59
  // 未実行のタスクを取得
51
60
  // tslint:disable-next-line:no-null-keyword
52
61
  let task = null;
53
62
  try {
54
- task = yield taskRepo.executeOneByName(params);
63
+ task = yield taskRepo.executeOneByName({
64
+ name: params.name,
65
+ executor: {
66
+ name: (typeof ((_a = params.executor) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? params.executor.name : DEFAULT_EXECUTOR_NAME
67
+ }
68
+ });
55
69
  }
56
70
  catch (error) {
57
71
  // tslint:disable-next-line:no-single-line-block-comment
@@ -127,7 +141,9 @@ function abort(params) {
127
141
  }
128
142
  // 開発者へ報告
129
143
  const message = (0, factory_1.task2lineNotify)({ task: abortedTask });
130
- yield NotificationService.report2developers(message.subject, message.content)();
144
+ yield NotificationService.report2developers(message.subject, message.content)({
145
+ accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
146
+ });
131
147
  }
132
148
  });
133
149
  }
@@ -144,7 +160,9 @@ function notifyAbortedTasks(params) {
144
160
  if (abortedTasks.length > 0) {
145
161
  // 開発者へ報告
146
162
  const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
147
- yield NotificationService.report2developers(message.subject, message.content)();
163
+ yield NotificationService.report2developers(message.subject, message.content)({
164
+ accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
165
+ });
148
166
  }
149
167
  });
150
168
  }
@@ -0,0 +1,21 @@
1
+ import * as factory from '../../factory';
2
+ import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
3
+ import { MongoRepository as ActionRepo } from '../../repo/action';
4
+ import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
5
+ import { MongoRepository as OrderRepo } from '../../repo/order';
6
+ import { MongoRepository as OwnershipInfoRepo } from '../../repo/ownershipInfo';
7
+ import { MongoRepository as ReservationRepo } from '../../repo/reservation';
8
+ import { MongoRepository as TransactionRepo } from '../../repo/transaction';
9
+ /**
10
+ * 取引に関わるリソースを削除する
11
+ * 冪等性を確保すること
12
+ */
13
+ export declare function deleteTransaction(params: factory.task.IData<factory.taskName.DeleteTransaction>): (repos: {
14
+ accountingReport: AccountingReportRepo;
15
+ action: ActionRepo;
16
+ assetTransaction: AssetTransactionRepo;
17
+ order: OrderRepo;
18
+ ownershipInfo: OwnershipInfoRepo;
19
+ reservation: ReservationRepo;
20
+ transaction: TransactionRepo;
21
+ }) => Promise<void>;
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.deleteTransaction = void 0;
13
+ const factory = require("../../factory");
14
+ const deleteOrder_1 = require("../order/deleteOrder");
15
+ /**
16
+ * 取引に関わるリソースを削除する
17
+ * 冪等性を確保すること
18
+ */
19
+ function deleteTransaction(params) {
20
+ // tslint:disable-next-line:max-func-body-length
21
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
22
+ var _a;
23
+ const transactions = yield repos.transaction.search({
24
+ ids: [params.object.id],
25
+ typeOf: params.object.typeOf,
26
+ inclusion: [],
27
+ exclusion: []
28
+ });
29
+ const transaction = transactions.shift();
30
+ if (transaction === undefined) {
31
+ // すでに削除済
32
+ return;
33
+ }
34
+ // アクション開始
35
+ const actionAttributes = {
36
+ typeOf: factory.actionType.DeleteAction,
37
+ project: transaction.project,
38
+ object: params.object,
39
+ agent: transaction.project
40
+ };
41
+ let deletePayTransactionResult;
42
+ let deleteRefundResult;
43
+ let payTransactionNumbers = [];
44
+ let deleteReservationsResult;
45
+ let deleteReserveTransactionResult;
46
+ let deletedReservationNumbers = [];
47
+ let deleteActionResult;
48
+ const action = yield repos.action.start(actionAttributes);
49
+ try {
50
+ const transactionTypeOf = transaction.typeOf;
51
+ switch (transactionTypeOf) {
52
+ case factory.transactionType.PlaceOrder:
53
+ // 取引に対する全ての承認アクションを検索
54
+ const authorizeActions = yield repos.action.searchByPurpose({
55
+ typeOf: factory.actionType.AuthorizeAction,
56
+ purpose: {
57
+ typeOf: transaction.typeOf,
58
+ id: transaction.id
59
+ }
60
+ });
61
+ switch (transaction.status) {
62
+ case factory.transactionStatusType.Canceled:
63
+ case factory.transactionStatusType.Expired:
64
+ break;
65
+ case factory.transactionStatusType.Confirmed:
66
+ const deletingOrder = (_a = transaction.result) === null || _a === void 0 ? void 0 : _a.order;
67
+ if (typeof (deletingOrder === null || deletingOrder === void 0 ? void 0 : deletingOrder.orderNumber) === 'string') {
68
+ yield (0, deleteOrder_1.deleteOrder)({
69
+ object: deletingOrder
70
+ })(repos);
71
+ }
72
+ break;
73
+ default:
74
+ }
75
+ // tslint:disable-next-line:no-suspicious-comment
76
+ // TODO サービス登録取引を削除
77
+ // 決済取引を削除
78
+ const deletePayTransactionsByPlaceOrderResult = yield deletePayTransactionsByPlaceOrder({ authorizeActions, transaction })(repos);
79
+ deletePayTransactionResult = deletePayTransactionsByPlaceOrderResult.deletePayTransactionResult;
80
+ deleteRefundResult = deletePayTransactionsByPlaceOrderResult.deleteRefundResult;
81
+ payTransactionNumbers = deletePayTransactionsByPlaceOrderResult.payTransactionNumbers;
82
+ // 取引上での予約を削除
83
+ const deleteReservationsByPlaceOrderResult = yield deleteReservationsByPlaceOrder({ authorizeActions, transaction })(repos);
84
+ deleteReservationsResult = deleteReservationsByPlaceOrderResult.deleteResult;
85
+ deleteReserveTransactionResult = deleteReservationsByPlaceOrderResult.deleteReserveTransactionResult;
86
+ deletedReservationNumbers = deleteReservationsByPlaceOrderResult.reserveTransactionNumbers;
87
+ // アクション削除(2023-05-19~)
88
+ deleteActionResult = yield repos.action.deleteByPurpose({
89
+ project: { id: transaction.project.id },
90
+ purpose: { id: transaction.id, typeOf: transaction.typeOf },
91
+ typeOf: {
92
+ $in: [
93
+ factory.actionType.AuthorizeAction,
94
+ factory.actionType.InformAction,
95
+ factory.actionType.OrderAction
96
+ ]
97
+ }
98
+ });
99
+ // 取引削除
100
+ yield repos.transaction.findByIdAndDelete({ id: transaction.id });
101
+ break;
102
+ // implemented(2022-06-09~)
103
+ case factory.transactionType.ReturnOrder:
104
+ // 取引削除
105
+ yield repos.transaction.findByIdAndDelete({ id: transaction.id });
106
+ break;
107
+ // implemented(2022-06-09~)
108
+ case factory.transactionType.MoneyTransfer:
109
+ // 取引削除
110
+ yield repos.transaction.findByIdAndDelete({ id: transaction.id });
111
+ break;
112
+ default:
113
+ throw new factory.errors.NotImplemented(`${transactionTypeOf} not implemented`);
114
+ }
115
+ }
116
+ catch (error) {
117
+ // actionにエラー結果を追加
118
+ try {
119
+ const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
120
+ yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: actionError });
121
+ }
122
+ catch (__) {
123
+ // 失敗したら仕方ない
124
+ }
125
+ throw error;
126
+ }
127
+ // アクション完了
128
+ const actionResult = {
129
+ deletePayTransactionResult,
130
+ deleteRefundResult,
131
+ payTransactionNumbers,
132
+ deleteReservationsResult,
133
+ deleteReserveTransactionResult,
134
+ deletedReservationNumbers,
135
+ deleteActionResult
136
+ };
137
+ yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
138
+ });
139
+ }
140
+ exports.deleteTransaction = deleteTransaction;
141
+ function deleteReservationsByPlaceOrder(params) {
142
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
143
+ let deleteResult;
144
+ let deleteReserveTransactionResult;
145
+ const authorizeActions = params.authorizeActions;
146
+ // 予約取引番号を抽出
147
+ const authorizeReservationOfferActions = authorizeActions
148
+ .filter((a) => {
149
+ var _a, _b;
150
+ const pendingTransactionNumber = (_b = (_a = a.object) === null || _a === void 0 ? void 0 : _a.pendingTransaction) === null || _b === void 0 ? void 0 : _b.transactionNumber;
151
+ return a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation
152
+ && typeof pendingTransactionNumber === 'string'
153
+ && pendingTransactionNumber.length > 0;
154
+ });
155
+ const reserveTransactionNumbers = authorizeReservationOfferActions
156
+ .map((a) => { var _a; return String((_a = a.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.transactionNumber); });
157
+ if (reserveTransactionNumbers.length > 0) {
158
+ // 該当予約番号の予約を削除する(プロジェクトでも絞ること)
159
+ const deleteReservationsResult = yield repos.reservation.deleteByReservationNumbers({
160
+ project: { id: params.transaction.project.id },
161
+ reservationNumbers: reserveTransactionNumbers
162
+ });
163
+ deleteResult = {
164
+ n: deleteReservationsResult === null || deleteReservationsResult === void 0 ? void 0 : deleteReservationsResult.n,
165
+ ok: deleteReservationsResult === null || deleteReservationsResult === void 0 ? void 0 : deleteReservationsResult.ok,
166
+ deletedCount: deleteReservationsResult === null || deleteReservationsResult === void 0 ? void 0 : deleteReservationsResult.deletedCount
167
+ };
168
+ // 予約取引を削除(プロジェクトでも絞ること)(2022-06-07~)
169
+ const deleteAssetTransactionsResult = yield repos.assetTransaction.deleteByTransactionNumber({
170
+ project: { id: params.transaction.project.id },
171
+ transactionNumbers: reserveTransactionNumbers,
172
+ typeOf: factory.assetTransactionType.Reserve
173
+ });
174
+ deleteReserveTransactionResult = {
175
+ n: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.n,
176
+ ok: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.ok,
177
+ deletedCount: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.deletedCount
178
+ };
179
+ // tslint:disable-next-line:no-suspicious-comment
180
+ // TODO 予約取消取引も削除可能か?
181
+ }
182
+ return { deleteResult, deleteReserveTransactionResult, reserveTransactionNumbers };
183
+ });
184
+ }
185
+ function deletePayTransactionsByPlaceOrder(params) {
186
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
187
+ let deletePayTransactionResult;
188
+ let deleteRefundResult;
189
+ const authorizeActions = params.authorizeActions;
190
+ // 決済取引番号を抽出
191
+ const authorizePaymentActions = authorizeActions
192
+ .filter((a) => {
193
+ var _a;
194
+ const pendingTransactionNumber = (_a = a.object) === null || _a === void 0 ? void 0 : _a.paymentMethodId;
195
+ return a.object.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment
196
+ && typeof pendingTransactionNumber === 'string'
197
+ && pendingTransactionNumber.length > 0;
198
+ });
199
+ const payTransactionNumbers = authorizePaymentActions.map((a) => String(a.object.paymentMethodId));
200
+ if (payTransactionNumbers.length > 0) {
201
+ // 決済取引を削除(プロジェクトでも絞ること)(2022-06-07~)
202
+ const deleteAssetTransactionsResult = yield repos.assetTransaction.deleteByTransactionNumber({
203
+ project: { id: params.transaction.project.id },
204
+ transactionNumbers: payTransactionNumbers,
205
+ typeOf: factory.assetTransactionType.Pay
206
+ });
207
+ deletePayTransactionResult = {
208
+ n: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.n,
209
+ ok: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.ok,
210
+ deletedCount: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.deletedCount
211
+ };
212
+ // 返金取引も削除(2023-05-19~)
213
+ const refundTransactions = yield repos.assetTransaction.search({
214
+ typeOf: factory.assetTransactionType.Refund,
215
+ object: { paymentMethodId: { $in: payTransactionNumbers } }
216
+ }, ['transactionNumber'], []);
217
+ if (refundTransactions.length > 0) {
218
+ const deleteRefundAssetTransactionsResult = yield repos.assetTransaction.deleteByTransactionNumber({
219
+ project: { id: params.transaction.project.id },
220
+ transactionNumbers: refundTransactions.map((refundTransaction) => refundTransaction.transactionNumber),
221
+ typeOf: factory.assetTransactionType.Refund
222
+ });
223
+ deleteRefundResult = {
224
+ n: deleteRefundAssetTransactionsResult === null || deleteRefundAssetTransactionsResult === void 0 ? void 0 : deleteRefundAssetTransactionsResult.n,
225
+ ok: deleteRefundAssetTransactionsResult === null || deleteRefundAssetTransactionsResult === void 0 ? void 0 : deleteRefundAssetTransactionsResult.ok,
226
+ deletedCount: deleteRefundAssetTransactionsResult === null || deleteRefundAssetTransactionsResult === void 0 ? void 0 : deleteRefundAssetTransactionsResult.deletedCount
227
+ };
228
+ }
229
+ }
230
+ return { deletePayTransactionResult, deleteRefundResult, payTransactionNumbers };
231
+ });
232
+ }
@@ -7,6 +7,7 @@ const settings_1 = require("../../../../settings");
7
7
  /**
8
8
  * 取引のタスクを作成する
9
9
  */
10
+ // tslint:disable-next-line:max-func-body-length
10
11
  function createTasks(params) {
11
12
  const taskAttributes = [];
12
13
  const transaction = params.transaction;
@@ -35,7 +36,16 @@ function createTasks(params) {
35
36
  numberOfTried: 0,
36
37
  executionResults: [],
37
38
  data: {
38
- object: transaction
39
+ object: {
40
+ endDate: transaction.endDate,
41
+ id: transaction.id,
42
+ object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
43
+ ? { pendingTransaction: transaction.object.pendingTransaction }
44
+ : undefined),
45
+ project: transaction.project,
46
+ startDate: transaction.startDate,
47
+ typeOf: transaction.typeOf
48
+ }
39
49
  }
40
50
  };
41
51
  taskAttributes.push(deleteTransactionTask);
@@ -1,2 +1,2 @@
1
1
  import * as factory from '../../../factory';
2
- export declare function createStartParams(params: factory.transaction.moneyTransfer.IStartParamsWithoutDetail, passport: factory.waiter.passport.IPassport | undefined, seller: factory.seller.ISeller, amount: factory.monetaryAmount.IMonetaryAmount, fromLocation: factory.assetTransaction.moneyTransfer.IFromLocationBeforeStart, toLocation: factory.transaction.moneyTransfer.IToLocation, transactionNumber: string): factory.transaction.IStartParams<factory.transactionType.MoneyTransfer>;
2
+ export declare function createStartParams(params: factory.transaction.moneyTransfer.IStartParamsWithoutDetail, passport: factory.waiter.passport.IPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf'>, amount: factory.monetaryAmount.IMonetaryAmount, fromLocation: factory.assetTransaction.moneyTransfer.IFromLocationBeforeStart, toLocation: factory.transaction.moneyTransfer.IToLocation, transactionNumber: string): factory.transaction.IStartParams<factory.transactionType.MoneyTransfer>;
@@ -17,7 +17,9 @@ function createStartParams(params, passport, seller, amount, fromLocation, toLoc
17
17
  // ↓最適化(2022-05-24~)
18
18
  // ...{ project: seller.project }
19
19
  },
20
- object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation, authorizeActions: [], pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
20
+ object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
21
+ // authorizeActions: [],
22
+ pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
21
23
  ? { identifier: params.object.pendingTransaction.identifier }
22
24
  : undefined) }, (passport !== undefined) ? { passport } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined),
23
25
  expires: params.expires
@@ -4,5 +4,6 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
4
4
  * 取引のポストアクションを作成する
5
5
  */
6
6
  export declare function createPotentialActions(params: {
7
+ authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
7
8
  transaction: factory.transaction.ITransaction<factory.transactionType.MoneyTransfer>;
8
9
  }): Promise<factory.transaction.IPotentialActions<factory.transactionType.MoneyTransfer>>;
@@ -13,7 +13,7 @@ exports.createPotentialActions = void 0;
13
13
  const factory = require("../../../factory");
14
14
  function createMoneyTransferActions(params) {
15
15
  const moneyTransferActions = [];
16
- const authorizeMoneyTransferActions = params.transaction.object.authorizeActions
16
+ const authorizeMoneyTransferActions = params.authorizeActions
17
17
  .filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
18
18
  .filter((a) => a.object.typeOf === factory.offerType.Offer)
19
19
  .filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
@@ -28,7 +28,7 @@ const CodeService = require("../code");
28
28
  */
29
29
  function start(params) {
30
30
  return (repos) => __awaiter(this, void 0, void 0, function* () {
31
- const seller = yield repos.seller.findById({ id: params.seller.id });
31
+ const seller = yield repos.seller.findById({ id: params.seller.id }, ['name', 'typeOf'], []);
32
32
  const passport = yield (0, validation_1.validateWaiterPassport)(params);
33
33
  // 金額をfix
34
34
  const amount = params.object.amount;
@@ -519,19 +519,17 @@ function confirm(params) {
519
519
  // throw new factory.errors.Forbidden('Transaction not yours');
520
520
  // }
521
521
  // 取引に対する全ての承認アクションをマージ
522
- transaction.object.authorizeActions = yield searchAuthorizeActions({
522
+ const authorizeActions = yield searchAuthorizeActions({
523
523
  transaction: transaction,
524
524
  now: now
525
525
  })(repos);
526
526
  // ポストアクションを作成
527
- const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
528
- transaction: transaction
529
- });
527
+ const potentialActions = yield (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
530
528
  // 取引確定
531
529
  yield repos.transaction.confirm({
532
530
  typeOf: factory.transactionType.MoneyTransfer,
533
531
  id: transaction.id,
534
- authorizeActions: transaction.object.authorizeActions,
532
+ authorizeActions: [],
535
533
  result: {},
536
534
  potentialActions: potentialActions
537
535
  });
@@ -545,13 +543,14 @@ function searchAuthorizeActions(params) {
545
543
  purpose: {
546
544
  typeOf: params.transaction.typeOf,
547
545
  id: params.transaction.id
548
- }
546
+ },
547
+ // Completedに絞る(2023-05-16~)
548
+ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
549
549
  });
550
550
  // 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
551
551
  authorizeActions = authorizeActions.filter((a) => {
552
- return a.endDate !== undefined
553
- && moment(a.endDate)
554
- .toDate() < params.now;
552
+ return (a.endDate instanceof Date) && moment(a.endDate)
553
+ .isBefore(moment(params.now));
555
554
  });
556
555
  return authorizeActions;
557
556
  });
@@ -576,9 +575,7 @@ function exportTasksById(params) {
576
575
  transaction,
577
576
  runsAt: taskRunsAt
578
577
  });
579
- // saveManyに変更(2023-02-01~)
580
- yield repos.task.saveMany(taskAttributes);
581
- // await Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
578
+ yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
582
579
  });
583
580
  }
584
581
  exports.exportTasksById = exportTasksById;
@@ -106,7 +106,7 @@ function getCreditCardPaymentServiceChannel(params) {
106
106
  project: { id: { $eq: params.project.id } },
107
107
  typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard },
108
108
  serviceType: { codeValue: { $eq: params.paymentMethodType } }
109
- });
109
+ }, [], []);
110
110
  const paymentServiceSetting = paymentServices.shift();
111
111
  if (paymentServiceSetting === undefined) {
112
112
  throw new factory.errors.NotFound('PaymentService');
@@ -22,7 +22,7 @@ function findPaymentCardPermit(params) {
22
22
  page: 1,
23
23
  project: { id: { $eq: params.project.id } },
24
24
  typeOf: { $eq: factory.product.ProductType.PaymentCard }
25
- });
25
+ }, [], []);
26
26
  const accountProduct = searchProductsResult
27
27
  .find((p) => { var _a, _b; return ((_b = (_a = p.serviceOutput) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency) === params.accountType; });
28
28
  if (accountProduct === undefined) {
@@ -316,7 +316,7 @@ function processAuthorizeCreditCard(params) {
316
316
  project: { id: { $eq: params.project.id } },
317
317
  typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard },
318
318
  serviceType: { codeValue: { $eq: params.paymentMethodType } }
319
- });
319
+ }, [], []);
320
320
  const creditCardPaymentService = searchCreditCardPaymentServicesResult.shift();
321
321
  if (creditCardPaymentService === undefined) {
322
322
  throw new factory.errors.NotFound('CreditCardPaymentService');
@@ -338,8 +338,12 @@ function processAuthorizeCreditCard(params) {
338
338
  },
339
339
  purpose: params.purpose,
340
340
  paymentServiceType: factory.service.paymentService.PaymentServiceType.CreditCard,
341
- useCancelPayTransactionOnFailed: false,
342
- useCheckMovieTicketBeforePay: false
341
+ options: {
342
+ useCancelPayTransactionOnFailed: false,
343
+ useCheckMovieTicketBeforePay: false,
344
+ useCheckByIdentifierIfNotYet: false,
345
+ useSearchTrade4accountId: false
346
+ }
343
347
  })(repos);
344
348
  });
345
349
  }
@@ -75,10 +75,49 @@ function createTasks(params) {
75
75
  numberOfTried: 0,
76
76
  executionResults: [],
77
77
  data: {
78
- object: transaction
78
+ object: {
79
+ endDate: transaction.endDate,
80
+ id: transaction.id,
81
+ object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
82
+ ? { confirmationNumber: transaction.object.confirmationNumber }
83
+ : undefined), (typeof transaction.object.orderNumber === 'string')
84
+ ? { orderNumber: transaction.object.orderNumber }
85
+ : undefined),
86
+ project: transaction.project,
87
+ startDate: transaction.startDate,
88
+ typeOf: transaction.typeOf
89
+ }
90
+ }
91
+ };
92
+ // 確定取引にも決済承認中止タスクを追加(2023-05-03~)
93
+ const voidPaymentTaskAttributes = {
94
+ project: transaction.project,
95
+ name: factory.taskName.VoidPayTransaction,
96
+ status: factory.taskStatus.Ready,
97
+ runsAt: taskRunsAt,
98
+ remainingNumberOfTries: 10,
99
+ numberOfTried: 0,
100
+ executionResults: [],
101
+ data: {
102
+ project: transaction.project,
103
+ purpose: { typeOf: transaction.typeOf, id: transaction.id }
79
104
  }
80
105
  };
81
- taskAttributes.push(...triggerWebhookTaskAttributes, deleteTransactionTask);
106
+ // 確定取引にも興行オファー承認中止タスクを追加(2023-05-09~)
107
+ const voidReserveTaskAttributes = {
108
+ project: transaction.project,
109
+ name: factory.taskName.VoidReserveTransaction,
110
+ status: factory.taskStatus.Ready,
111
+ runsAt: taskRunsAt,
112
+ remainingNumberOfTries: 10,
113
+ numberOfTried: 0,
114
+ executionResults: [],
115
+ data: {
116
+ project: transaction.project,
117
+ purpose: { typeOf: transaction.typeOf, id: transaction.id }
118
+ }
119
+ };
120
+ taskAttributes.push(...triggerWebhookTaskAttributes, deleteTransactionTask, voidPaymentTaskAttributes, voidReserveTaskAttributes);
82
121
  switch (transaction.status) {
83
122
  case factory.transactionStatusType.Confirmed:
84
123
  const potentialActions = transaction.potentialActions;
@@ -107,22 +146,8 @@ function createTasks(params) {
107
146
  };
108
147
  taskAttributes.push(placeOrderTaskAttributes);
109
148
  break;
110
- // 期限切れor中止の場合は、タスクリストを作成する
111
149
  case factory.transactionStatusType.Canceled:
112
150
  case factory.transactionStatusType.Expired:
113
- const voidReserveTaskAttributes = {
114
- project: transaction.project,
115
- name: factory.taskName.VoidReserveTransaction,
116
- status: factory.taskStatus.Ready,
117
- runsAt: taskRunsAt,
118
- remainingNumberOfTries: 10,
119
- numberOfTried: 0,
120
- executionResults: [],
121
- data: {
122
- project: transaction.project,
123
- purpose: { typeOf: transaction.typeOf, id: transaction.id }
124
- }
125
- };
126
151
  const voidRegisterServiceTaskAttributes = {
127
152
  project: transaction.project,
128
153
  name: factory.taskName.VoidRegisterServiceTransaction,
@@ -136,19 +161,6 @@ function createTasks(params) {
136
161
  purpose: { typeOf: transaction.typeOf, id: transaction.id }
137
162
  }
138
163
  };
139
- const voidPaymentTaskAttributes = {
140
- project: transaction.project,
141
- name: factory.taskName.VoidPayTransaction,
142
- status: factory.taskStatus.Ready,
143
- runsAt: taskRunsAt,
144
- remainingNumberOfTries: 10,
145
- numberOfTried: 0,
146
- executionResults: [],
147
- data: {
148
- project: transaction.project,
149
- purpose: { typeOf: transaction.typeOf, id: transaction.id }
150
- }
151
- };
152
164
  const voidMoneyTransferTaskAttributes = {
153
165
  project: transaction.project,
154
166
  name: factory.taskName.VoidMoneyTransferTransaction,
@@ -162,7 +174,7 @@ function createTasks(params) {
162
174
  purpose: { typeOf: transaction.typeOf, id: transaction.id }
163
175
  }
164
176
  };
165
- taskAttributes.push(voidReserveTaskAttributes, voidRegisterServiceTaskAttributes, voidPaymentTaskAttributes, voidMoneyTransferTaskAttributes);
177
+ taskAttributes.push(voidRegisterServiceTaskAttributes, voidMoneyTransferTaskAttributes);
166
178
  break;
167
179
  default:
168
180
  throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
@@ -36,11 +36,7 @@ function exportTasksById(params) {
36
36
  transaction,
37
37
  runsAt: taskRunsAt
38
38
  });
39
- // saveManyに変更(2023-02-01~)
40
- yield repos.task.saveMany(taskAttributes);
41
- // await Promise.all(taskAttributes.map(async (taskAttribute) => {
42
- // await repos.task.save(taskAttribute);
43
- // }));
39
+ yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
44
40
  });
45
41
  }
46
42
  exports.exportTasksById = exportTasksById;
@@ -4,7 +4,7 @@ exports.createStartParams = void 0;
4
4
  const factory = require("../../../factory");
5
5
  function createStartParams(params, passport, seller, broker) {
6
6
  var _a, _b, _c, _d;
7
- const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined, authorizeActions: [] }, (passport !== undefined) ? { passport } : undefined), (params.object.clientUser !== undefined && params.object.clientUser !== null)
7
+ const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined }, (passport !== undefined) ? { passport } : undefined), (params.object.clientUser !== undefined && params.object.clientUser !== null)
8
8
  ? { clientUser: params.object.clientUser }
9
9
  : undefined), (typeof ((_b = params.object) === null || _b === void 0 ? void 0 : _b.name) === 'string') ? { name: (_c = params.object) === null || _c === void 0 ? void 0 : _c.name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker: broker } : undefined), (typeof ((_d = params.object.customer) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string') ? { customer: params.object.customer } : undefined);
10
10
  if (typeof seller.id !== 'string') {
@@ -3,4 +3,5 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
3
3
  export declare function createMoneyTransferActions(params: {
4
4
  order: factory.order.IOrder;
5
5
  transaction: factory.transaction.placeOrder.ITransaction;
6
+ authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
6
7
  }): Promise<factory.action.interact.confirm.moneyTransfer.IAttributes[]>;
@@ -15,7 +15,7 @@ const order_1 = require("../../../../factory/order");
15
15
  function createMoneyTransferActions(params) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
17
  const moneyTransferActions = [];
18
- const authorizeMoneyTransferActions = params.transaction.object.authorizeActions
18
+ const authorizeMoneyTransferActions = params.authorizeActions
19
19
  .filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
20
20
  .filter((a) => a.object.typeOf === factory.offerType.Offer)
21
21
  .filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
@@ -2,4 +2,5 @@ import * as factory from '../../../../factory';
2
2
  export declare function createRegisterServiceActions(params: {
3
3
  order: factory.order.IOrder;
4
4
  transaction: factory.transaction.placeOrder.ITransaction;
5
+ authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
5
6
  }): Promise<factory.action.interact.confirm.registerService.IAttributes[]>;