@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
@@ -10,13 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.validateMovieTicket = void 0;
13
- /**
14
- * 決済取引サービス
15
- */
13
+ const createDebug = require("debug");
16
14
  const factory = require("../../../factory");
17
15
  const checkByIdentifier_1 = require("./checkByIdentifier");
18
- // tslint:disable-next-line:max-func-body-length
19
- function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay) {
16
+ const debug = createDebug('chevre-domain:service:payment');
17
+ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
18
+ // tslint:disable-next-line:max-func-body-length
20
19
  return (repos) => __awaiter(this, void 0, void 0, function* () {
21
20
  var _a, _b, _c, _d;
22
21
  const movieTickets = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.movieTickets;
@@ -33,6 +32,7 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
33
32
  if (movieTicketIdentifiers.length !== 1) {
34
33
  throw new factory.errors.Argument('movieTickets', 'Number of movie ticket identifiers must be 1');
35
34
  }
35
+ const movieTicketIdentifier = movieTicketIdentifiers[0];
36
36
  // ムビチケ系統の決済方法タイプは動的
37
37
  const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
38
38
  if (typeof paymentMethodType !== 'string') {
@@ -47,39 +47,33 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
47
47
  if (typeof sellerId !== 'string') {
48
48
  throw new factory.errors.ArgumentNull('recipient.id');
49
49
  }
50
- const seller = yield repos.seller.findById({ id: sellerId });
50
+ const seller = yield repos.seller.findById({ id: sellerId }, ['paymentAccepted', 'project'], []);
51
51
  const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
52
52
  if (paymentAccepted !== true) {
53
53
  throw new factory.errors.Argument('recipient', 'payment not accepted');
54
54
  }
55
55
  // オプション追加(2023-03-06~)
56
56
  if (!useCheckMovieTicketBeforePay) {
57
- return;
57
+ return { accountsReceivablesByServiceType: [] };
58
58
  }
59
- const checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)({
59
+ const checkResult = yield checkByIdentifierIfNotYet({
60
+ movieTicketIdentifier,
60
61
  movieTickets: movieTickets,
61
62
  seller: seller,
62
63
  screeningEvent: screeningEvent,
63
- paymentServiceId
64
+ paymentServiceId,
65
+ useCheckByIdentifierIfNotYet
64
66
  })(repos);
65
- // checkResult.movieTicketsへの依存排除(2023-03-24~)
66
- // 要求に対して十分かどうか検証する
67
- // const availableMovieTickets = checkResult.movieTickets.filter((t) => t.amount?.validThrough === undefined);
68
- // 総数が足りているか(券種ごとに枚数検証を実行するので不要)
69
- // if (availableMovieTickets.length < movieTickets.length) {
70
- // throw new factory.errors.Argument(
71
- // 'movieTickets',
72
- // `${movieTickets.length - availableMovieTickets.length} movie tickets short`
73
- // );
74
- // }
67
+ const accountsReceivablesByServiceType = [];
75
68
  // 券種ごとに枚数が足りているか
76
69
  const serviceTypes = [...new Set(movieTickets.map((t) => t.serviceType))];
77
70
  serviceTypes.forEach((serviceType) => {
78
- var _a, _b, _c;
71
+ var _a, _b;
79
72
  const requiredMovieTicketsCountByServiceType = movieTickets.filter((t) => t.serviceType === serviceType).length;
80
73
  let availableMovieTicketsCountByServiceType = 0;
81
74
  const ykknInfos = (_b = (_a = checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find((knyknrNoInfoOut) => knyknrNoInfoOut.knyknrNo === movieTicketIdentifiers[0])) === null || _b === void 0 ? void 0 : _b.ykknInfo;
82
- const ykknKnshbtsmiNum = (_c = ykknInfos === null || ykknInfos === void 0 ? void 0 : ykknInfos.find((ykknInfo) => ykknInfo.ykknshTyp === serviceType)) === null || _c === void 0 ? void 0 : _c.ykknKnshbtsmiNum;
75
+ const ykknInfoOfServiceType = ykknInfos === null || ykknInfos === void 0 ? void 0 : ykknInfos.find((ykknInfo) => ykknInfo.ykknshTyp === serviceType);
76
+ const ykknKnshbtsmiNum = ykknInfoOfServiceType === null || ykknInfoOfServiceType === void 0 ? void 0 : ykknInfoOfServiceType.ykknKnshbtsmiNum;
83
77
  if (typeof ykknKnshbtsmiNum === 'string') {
84
78
  availableMovieTicketsCountByServiceType = Number(ykknKnshbtsmiNum);
85
79
  }
@@ -87,18 +81,47 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
87
81
  const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsCountByServiceType;
88
82
  throw new factory.errors.Argument('movieTickets', `${shortNumber} movie tickets by service type ${serviceType} short`);
89
83
  }
90
- // const availableMovieTicketsByServiceType = availableMovieTickets.filter((t) => t.serviceType === serviceType);
91
- // if (availableMovieTicketsByServiceType.length < requiredMovieTicketsCountByServiceType) {
92
- // const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsByServiceType.length;
93
- // throw new factory.errors.Argument(
94
- // 'movieTickets',
95
- // `${shortNumber} movie tickets by service type ${serviceType} short`
96
- // );
97
- // }
84
+ // checkResultから計上金額を取得
85
+ const accountsReceivableByResponse = ykknInfoOfServiceType === null || ykknInfoOfServiceType === void 0 ? void 0 : ykknInfoOfServiceType.kijUnip;
86
+ accountsReceivablesByServiceType.push(Object.assign({ serviceType }, (typeof accountsReceivableByResponse === 'string')
87
+ ? { accountsReceivable: Number(accountsReceivableByResponse) }
88
+ : undefined));
98
89
  });
99
- // checkはするが保管は保留(2023-03-09~)
100
- return;
101
- // return checkResult;
90
+ return { accountsReceivablesByServiceType };
102
91
  });
103
92
  }
104
93
  exports.validateMovieTicket = validateMovieTicket;
94
+ function checkByIdentifierIfNotYet(params) {
95
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
96
+ var _a;
97
+ let checkResult;
98
+ if (params.useCheckByIdentifierIfNotYet === true) {
99
+ // すでにCheckActionが存在すれば認証しない(2023-06-06~)
100
+ debug('searching alreadyCheckedActions...movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
101
+ const alreadyCheckedAction = yield repos.action.search({
102
+ limit: 1,
103
+ page: 1,
104
+ sort: { startDate: factory.sortType.Descending },
105
+ typeOf: { $eq: factory.actionType.CheckAction },
106
+ actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
107
+ object: {
108
+ typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
109
+ id: { $eq: params.paymentServiceId },
110
+ movieTickets: {
111
+ identifier: { $eq: params.movieTicketIdentifier },
112
+ serviceOutput: {
113
+ reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
114
+ }
115
+ }
116
+ }
117
+ }, ['result'], []);
118
+ debug('alreadyCheckedAction found', alreadyCheckedAction, 'movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
119
+ checkResult = (_a = alreadyCheckedAction.shift()) === null || _a === void 0 ? void 0 : _a.result;
120
+ }
121
+ if (checkResult === undefined) {
122
+ debug('checkByIdentifier processing because movieTickets not checked yet...', checkResult);
123
+ checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)(params)(repos);
124
+ }
125
+ return checkResult;
126
+ });
127
+ }
@@ -42,14 +42,14 @@ declare function checkMovieTicket(params: factory.action.check.paymentMethod.mov
42
42
  }>;
43
43
  interface IAuthorizeResult {
44
44
  accountId: string;
45
- checkResult?: ICheckResult;
45
+ accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
46
46
  payAction: factory.action.trade.pay.IAction;
47
47
  }
48
48
  /**
49
49
  * MovieTicket承認
50
50
  * オーソリサービスが存在するわけではないので、実質着券する
51
51
  */
52
- declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean): (repos: {
52
+ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
53
53
  action: ActionRepo;
54
54
  accountingReport: AccountingReportRepo;
55
55
  event: EventRepo;
@@ -58,7 +58,7 @@ function checkMovieTicket(params) {
58
58
  id: eventIds[0]
59
59
  });
60
60
  // ショップ情報取得
61
- const seller = yield repos.seller.findById({ id: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id });
61
+ const seller = yield repos.seller.findById({ id: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id }, ['paymentAccepted', 'project'], []);
62
62
  const paymentAccepted = (_f = seller.paymentAccepted) === null || _f === void 0 ? void 0 : _f.some((a) => a.paymentMethodType === paymentMethodType);
63
63
  if (paymentAccepted !== true) {
64
64
  throw new factory.errors.Argument('transactionId', 'payment not accepted');
@@ -102,15 +102,16 @@ exports.checkMovieTicket = checkMovieTicket;
102
102
  * MovieTicket承認
103
103
  * オーソリサービスが存在するわけではないので、実質着券する
104
104
  */
105
- function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay) {
105
+ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
106
106
  return (repos) => __awaiter(this, void 0, void 0, function* () {
107
107
  var _a, _b;
108
108
  let accountId;
109
- let checkResult;
110
109
  let payAction;
110
+ let accountsReceivablesByServiceType = [];
111
111
  try {
112
112
  // MovieTicket決済の場合、認証
113
- checkResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay)(repos);
113
+ const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
114
+ accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
114
115
  const paymentMethod = transaction.object.paymentMethod;
115
116
  const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
116
117
  const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
@@ -141,7 +142,7 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
141
142
  catch (error) {
142
143
  throw (0, errorHandler_1.handleMvtkReserveError)(error);
143
144
  }
144
- return { accountId, checkResult, payAction };
145
+ return { accountId, payAction, accountsReceivablesByServiceType };
145
146
  });
146
147
  }
147
148
  exports.authorize = authorize;
@@ -301,7 +302,7 @@ function payActionParams2seatInfoSyncIn(params) {
301
302
  // イベント取得属性最適化(2023-01-23~)
302
303
  // const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
303
304
  const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
304
- const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) });
305
+ const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) }, ['paymentAccepted', 'project'], []);
305
306
  // 全購入管理番号のMovieTicketをマージ
306
307
  const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
307
308
  const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
@@ -77,10 +77,6 @@ function onRegistered(actionAttributes, __) {
77
77
  }
78
78
  }
79
79
  // タスク保管
80
- // saveManyに変更(2023-02-01~)
81
- yield repos.task.saveMany(taskAttributes);
82
- // await Promise.all(taskAttributes.map(async (taskAttribute) => {
83
- // return repos.task.save(taskAttribute);
84
- // }));
80
+ yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
85
81
  });
86
82
  }
@@ -148,19 +148,15 @@ export interface ISellerFlowTransactionResult {
148
148
  /**
149
149
  * イベントまでの合計残り時間(ミリ秒)
150
150
  */
151
- totalTimeLeftUntilEventInMilliseconds: number;
152
151
  /**
153
152
  * イベントまでの最大残り時間(ミリ秒)
154
153
  */
155
- maxTimeLeftUntilEventInMilliseconds: number;
156
154
  /**
157
155
  * イベントまでの最小残り時間(ミリ秒)
158
156
  */
159
- minTimeLeftUntilEventInMilliseconds: number;
160
157
  /**
161
158
  * イベントまでの平均残り時間(ミリ秒)
162
159
  */
163
- averageTimeLeftUntilEventInMilliseconds: number;
164
160
  /**
165
161
  * 取引の合計金額(yen)
166
162
  */
@@ -180,15 +176,12 @@ export interface ISellerFlowTransactionResult {
180
176
  /**
181
177
  * アクション数合計値(成立取引)
182
178
  */
183
- totalNumberOfActionsOnConfirmed: number;
184
179
  /**
185
180
  * 最大アクション数(成立取引)
186
181
  */
187
- maxNumberOfActionsOnConfirmed: number;
188
182
  /**
189
183
  * 最小アクション数(成立取引)
190
184
  */
191
- minNumberOfActionsOnConfirmed: number;
192
185
  /**
193
186
  * 注文アイテム数合計値
194
187
  */
@@ -205,10 +198,6 @@ export interface ISellerFlowTransactionResult {
205
198
  * 平均注文アイテム数
206
199
  */
207
200
  averageNumberOfOrderItems: number;
208
- /**
209
- * 平均アクション数(成立取引)
210
- */
211
- averageNumberOfActionsOnConfirmed: number;
212
201
  }
213
202
  /**
214
203
  * 販売者が対象のフローデータ
@@ -247,17 +247,12 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
247
247
  const maxRequiredTimeInMilliseconds = requiredTimesConfirmed.reduce((a, b) => Math.max(a, b), 0);
248
248
  const minRequiredTimeInMilliseconds = requiredTimesConfirmed.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? requiredTimesConfirmed[0] : 0);
249
249
  const averageRequiredTimeInMilliseconds = (numberOfTransactionsConfirmed > 0) ? totalRequiredTimeInMilliseconds / numberOfTransactionsConfirmed : 0;
250
- // イベントまでの残り時間算出(イベント開始日時と成立日時の差)
251
- const timesLeftUntilEvent = confirmedTransactions.map((transaction) => {
252
- // 座席予約は必ず存在する
253
- const seatReservation = transaction.object.authorizeActions.find((action) => action.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
254
- return moment(seatReservation.object.event.startDate)
255
- .diff(moment(transaction.endDate), 'milliseconds');
256
- });
257
- const totalTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => a + b, 0);
258
- const maxTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.max(a, b), 0);
259
- const minTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? timesLeftUntilEvent[0] : 0);
260
- const averageTimeLeftUntilEventInMilliseconds = (numberOfTransactionsConfirmed > 0) ? totalTimeLeftUntilEventInMilliseconds / numberOfTransactionsConfirmed : 0;
250
+ // const totalTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => a + b, 0);
251
+ // const maxTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.max(a, b), 0);
252
+ // const minTimeLeftUntilEventInMilliseconds =
253
+ // timesLeftUntilEvent.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? timesLeftUntilEvent[0] : 0);
254
+ // const averageTimeLeftUntilEventInMilliseconds =
255
+ // (numberOfTransactionsConfirmed > 0) ? totalTimeLeftUntilEventInMilliseconds / numberOfTransactionsConfirmed : 0;
261
256
  // 金額算出
262
257
  const amounts = confirmedTransactions.map((transaction) => transaction.result.order.price);
263
258
  const totalAmount = amounts.reduce((a, b) => a + b, 0);
@@ -265,11 +260,13 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
265
260
  const minAmount = amounts.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? amounts[0] : 0);
266
261
  const averageAmount = (numberOfTransactionsConfirmed > 0) ? totalAmount / numberOfTransactionsConfirmed : 0;
267
262
  // アクション数集計
268
- const numbersOfActions = confirmedTransactions.map((t) => t.object.authorizeActions.length);
269
- const totalNumberOfActions = numbersOfActions.reduce((a, b) => a + b, 0);
270
- const maxNumberOfActions = numbersOfActions.reduce((a, b) => Math.max(a, b), 0);
271
- const minNumberOfActions = numbersOfActions.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? numbersOfActions[0] : 0);
272
- const averageNumberOfActions = (numberOfTransactionsConfirmed > 0) ? totalNumberOfActions / numberOfTransactionsConfirmed : 0;
263
+ // const numbersOfActions = confirmedTransactions.map((t) => t.object.authorizeActions.length);
264
+ // const totalNumberOfActions = numbersOfActions.reduce((a, b) => a + b, 0);
265
+ // const maxNumberOfActions = numbersOfActions.reduce((a, b) => Math.max(a, b), 0);
266
+ // const minNumberOfActions = numbersOfActions.reduce(
267
+ // (a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? numbersOfActions[0] : 0
268
+ // );
269
+ // const averageNumberOfActions = (numberOfTransactionsConfirmed > 0) ? totalNumberOfActions / numberOfTransactionsConfirmed : 0;
273
270
  // 期限切れ取引数
274
271
  const numberOfTransactionsExpired = expiredTransactions.length;
275
272
  const expiredTransactionIds = expiredTransactions.map((transaction) => transaction.id);
@@ -284,18 +281,18 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
284
281
  maxRequiredTimeInMilliseconds: maxRequiredTimeInMilliseconds,
285
282
  minRequiredTimeInMilliseconds: minRequiredTimeInMilliseconds,
286
283
  averageRequiredTimeInMilliseconds: parseFloat(averageRequiredTimeInMilliseconds.toFixed(1)),
287
- totalTimeLeftUntilEventInMilliseconds: totalTimeLeftUntilEventInMilliseconds,
288
- maxTimeLeftUntilEventInMilliseconds: maxTimeLeftUntilEventInMilliseconds,
289
- minTimeLeftUntilEventInMilliseconds: minTimeLeftUntilEventInMilliseconds,
290
- averageTimeLeftUntilEventInMilliseconds: averageTimeLeftUntilEventInMilliseconds,
284
+ // totalTimeLeftUntilEventInMilliseconds: totalTimeLeftUntilEventInMilliseconds,
285
+ // maxTimeLeftUntilEventInMilliseconds: maxTimeLeftUntilEventInMilliseconds,
286
+ // minTimeLeftUntilEventInMilliseconds: minTimeLeftUntilEventInMilliseconds,
287
+ // averageTimeLeftUntilEventInMilliseconds: averageTimeLeftUntilEventInMilliseconds,
291
288
  totalAmount: totalAmount,
292
289
  maxAmount: maxAmount,
293
290
  minAmount: minAmount,
294
291
  averageAmount: parseFloat(averageAmount.toFixed(1)),
295
- totalNumberOfActionsOnConfirmed: totalNumberOfActions,
296
- maxNumberOfActionsOnConfirmed: maxNumberOfActions,
297
- minNumberOfActionsOnConfirmed: minNumberOfActions,
298
- averageNumberOfActionsOnConfirmed: parseFloat(averageNumberOfActions.toFixed(1)),
292
+ // totalNumberOfActionsOnConfirmed: totalNumberOfActions,
293
+ // maxNumberOfActionsOnConfirmed: maxNumberOfActions,
294
+ // minNumberOfActionsOnConfirmed: minNumberOfActions,
295
+ // averageNumberOfActionsOnConfirmed: parseFloat(averageNumberOfActions.toFixed(1)),
299
296
  // tslint:disable-next-line:no-suspicious-comment
300
297
  totalNumberOfOrderItems: 0,
301
298
  // tslint:disable-next-line:no-suspicious-comment
@@ -5,11 +5,10 @@ import { RedisRepository as OfferRateLimitRepo } from '../../repo/rateLimit/offe
5
5
  import { MongoRepository as ReservationRepo } from '../../repo/reservation';
6
6
  import { StockHolderRepository as StockHolderRepo } from '../../repo/stockHolder';
7
7
  import { MongoRepository as TaskRepo } from '../../repo/task';
8
- type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
9
8
  /**
10
9
  * 進行中の予約をキャンセルする
11
10
  */
12
- declare function cancelPendingReservation(actionAttributesList: factory.action.cancel.reservation.IAttributes[]): (repos: {
11
+ declare function cancelPendingReservation(actionAttributes: factory.action.cancel.reservation.IAttributes): (repos: {
13
12
  action: ActionRepo;
14
13
  assetTransaction: AssetTransactionRepo;
15
14
  stockHolder: StockHolderRepo;
@@ -29,7 +28,10 @@ declare function cancelReservation(actionAttributesList: factory.action.cancel.r
29
28
  assetTransaction: AssetTransactionRepo;
30
29
  }) => Promise<void>;
31
30
  declare function processUnlockOfferRateLimit(params: {
32
- reservation: Pick<IObjectSubReservation, 'reservationNumber' | 'reservedTicket'>;
31
+ reservation: {
32
+ reservationNumber: string;
33
+ reservedTicket: factory.assetTransaction.reserve.IObjectSubReservationReservedTicket;
34
+ };
33
35
  reservationFor: factory.assetTransaction.reserve.IReservationFor;
34
36
  }): (repos: {
35
37
  offerRateLimit: OfferRateLimitRepo;