@chevre/domain 21.2.0-alpha.10 → 21.2.0-alpha.101

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 (257) hide show
  1. package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
  2. package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
  3. package/example/src/chevre/deleteTasksByName.ts +10 -2
  4. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  5. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  6. package/example/src/chevre/processPay.ts +5 -1
  7. package/example/src/chevre/processReserve.ts +4 -1
  8. package/example/src/chevre/saveTasks.ts +13 -10
  9. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  10. package/example/src/chevre/searchActions.ts +33 -0
  11. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  12. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  13. package/example/src/chevre/task/executeTasks.ts +26 -0
  14. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  15. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  16. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  17. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  18. package/example/src/chevre/updateTransaction.ts +1 -1
  19. package/example/src/playOnMoment.ts +24 -0
  20. package/lib/chevre/credentials.d.ts +1 -0
  21. package/lib/chevre/credentials.js +2 -1
  22. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  23. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  24. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  25. package/lib/chevre/eventEmitter/task.js +25 -0
  26. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  27. package/lib/chevre/eventEmitter/transaction.js +25 -0
  28. package/lib/chevre/eventEmitter.d.ts +4 -0
  29. package/lib/chevre/eventEmitter.js +9 -0
  30. package/lib/chevre/index.d.ts +3 -2
  31. package/lib/chevre/index.js +5 -3
  32. package/lib/chevre/repo/account.js +3 -2
  33. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  34. package/lib/chevre/repo/accountTransaction.js +3 -55
  35. package/lib/chevre/repo/action.d.ts +29 -1
  36. package/lib/chevre/repo/action.js +100 -56
  37. package/lib/chevre/repo/additionalProperty.js +2 -1
  38. package/lib/chevre/repo/assetTransaction.d.ts +25 -9
  39. package/lib/chevre/repo/assetTransaction.js +259 -87
  40. package/lib/chevre/repo/categoryCode.js +3 -2
  41. package/lib/chevre/repo/code.js +3 -2
  42. package/lib/chevre/repo/comment.d.ts +4 -1
  43. package/lib/chevre/repo/comment.js +22 -6
  44. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  45. package/lib/chevre/repo/confirmationNumber.js +3 -15
  46. package/lib/chevre/repo/creativeWork.d.ts +1 -3
  47. package/lib/chevre/repo/creativeWork.js +3 -2
  48. package/lib/chevre/repo/customer.js +2 -1
  49. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  50. package/lib/chevre/repo/emailMessage.js +2 -1
  51. package/lib/chevre/repo/event.d.ts +5 -1
  52. package/lib/chevre/repo/event.js +4 -3
  53. package/lib/chevre/repo/member.js +4 -3
  54. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  55. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  56. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  57. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  58. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  59. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  60. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  61. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  62. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  63. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  64. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  65. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  66. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  67. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  68. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  69. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  70. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  71. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  72. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  73. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  74. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  75. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  76. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  77. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  78. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  79. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  80. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  81. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  82. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  83. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  84. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  85. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  86. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  87. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  88. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  89. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  90. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  91. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  92. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  93. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  94. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  95. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  96. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  97. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  98. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  99. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  100. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  101. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  102. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  103. package/lib/chevre/repo/offer.js +3 -2
  104. package/lib/chevre/repo/offerCatalog.js +0 -27
  105. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  106. package/lib/chevre/repo/offerItemCondition.js +121 -0
  107. package/lib/chevre/repo/order.d.ts +55 -3
  108. package/lib/chevre/repo/order.js +62 -10
  109. package/lib/chevre/repo/ownershipInfo.js +2 -7
  110. package/lib/chevre/repo/place.js +3 -2
  111. package/lib/chevre/repo/priceSpecification.js +3 -2
  112. package/lib/chevre/repo/product.js +2 -1
  113. package/lib/chevre/repo/project.js +2 -1
  114. package/lib/chevre/repo/reservation.d.ts +12 -4
  115. package/lib/chevre/repo/reservation.js +20 -59
  116. package/lib/chevre/repo/role.js +3 -2
  117. package/lib/chevre/repo/seller.js +22 -21
  118. package/lib/chevre/repo/serviceOutput.js +2 -1
  119. package/lib/chevre/repo/task.d.ts +42 -2
  120. package/lib/chevre/repo/task.js +93 -11
  121. package/lib/chevre/repo/transaction.d.ts +23 -3
  122. package/lib/chevre/repo/transaction.js +177 -56
  123. package/lib/chevre/repo/trip.js +2 -1
  124. package/lib/chevre/repository.d.ts +5 -2
  125. package/lib/chevre/repository.js +8 -4
  126. package/lib/chevre/service/aggregation/system.d.ts +67 -22
  127. package/lib/chevre/service/aggregation/system.js +101 -89
  128. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  129. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
  130. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  131. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  132. package/lib/chevre/service/assetTransaction/pay.js +18 -32
  133. package/lib/chevre/service/assetTransaction/refund.js +1 -23
  134. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  135. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  136. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  137. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  138. package/lib/chevre/service/assetTransaction/reserve.js +85 -69
  139. package/lib/chevre/service/assetTransaction.d.ts +6 -2
  140. package/lib/chevre/service/assetTransaction.js +9 -5
  141. package/lib/chevre/service/event.js +3 -1
  142. package/lib/chevre/service/notification/factory.js +2 -2
  143. package/lib/chevre/service/notification.d.ts +3 -1
  144. package/lib/chevre/service/notification.js +41 -7
  145. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  146. package/lib/chevre/service/offer/event/authorize.js +8 -2
  147. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  148. package/lib/chevre/service/offer/event/factory.js +16 -5
  149. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  150. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  151. package/lib/chevre/service/offer.d.ts +12 -7
  152. package/lib/chevre/service/offer.js +57 -2
  153. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  154. package/lib/chevre/service/order/deleteOrder.js +8 -8
  155. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  156. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  157. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  158. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  159. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  160. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  161. package/lib/chevre/service/order/placeOrder.js +41 -24
  162. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  163. package/lib/chevre/service/order/returnOrder.js +7 -12
  164. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  165. package/lib/chevre/service/order/sendOrder.js +7 -10
  166. package/lib/chevre/service/order.d.ts +2 -1
  167. package/lib/chevre/service/order.js +3 -1
  168. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  169. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  170. package/lib/chevre/service/payment/any.d.ts +9 -5
  171. package/lib/chevre/service/payment/any.js +80 -18
  172. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  173. package/lib/chevre/service/payment/creditCard.js +21 -15
  174. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +7 -6
  175. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  176. package/lib/chevre/service/payment/movieTicket/validation.js +54 -31
  177. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  178. package/lib/chevre/service/payment/movieTicket.js +5 -4
  179. package/lib/chevre/service/product.js +1 -5
  180. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  181. package/lib/chevre/service/report/telemetry.js +21 -24
  182. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  183. package/lib/chevre/service/reserve/cancelReservation.js +147 -139
  184. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  185. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  186. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  187. package/lib/chevre/service/reserve/confirmReservation.js +125 -58
  188. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  189. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  190. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  191. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  192. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  193. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  194. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  195. package/lib/chevre/service/reserve/useReservation.js +61 -71
  196. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  197. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  198. package/lib/chevre/service/reserve.d.ts +3 -2
  199. package/lib/chevre/service/reserve.js +4 -2
  200. package/lib/chevre/service/task/cancelPendingReservation.js +5 -1
  201. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  202. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  203. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  204. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  205. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  206. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  207. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  208. package/lib/chevre/service/task/placeOrder.js +1 -1
  209. package/lib/chevre/service/task/reserve.js +10 -7
  210. package/lib/chevre/service/task/returnOrder.js +1 -1
  211. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  212. package/lib/chevre/service/task/sendOrder.js +1 -1
  213. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  214. package/lib/chevre/service/task/useReservation.js +36 -0
  215. package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
  216. package/lib/chevre/service/task.d.ts +9 -0
  217. package/lib/chevre/service/task.js +43 -4
  218. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  219. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  220. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  221. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  222. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  223. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  224. package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
  225. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -2
  226. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  227. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  228. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  229. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  230. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  231. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  232. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  233. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  234. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  235. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  236. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  237. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  238. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  239. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  240. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  241. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  242. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  243. package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
  244. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  245. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  246. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  247. package/lib/chevre/service/transaction/returnOrder.js +225 -35
  248. package/lib/chevre/service/transaction.d.ts +8 -13
  249. package/lib/chevre/service/transaction.js +12 -145
  250. package/lib/chevre/settings.d.ts +8 -1
  251. package/lib/chevre/settings.js +35 -6
  252. package/package.json +5 -5
  253. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  254. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  255. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  256. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  257. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -46,7 +46,7 @@ function onPaid(payAction) {
46
46
  }));
47
47
  }
48
48
  // タスク保管
49
- return repos.task.saveMany(taskAttributes);
49
+ return repos.task.saveMany(taskAttributes, { emitImmediately: true });
50
50
  });
51
51
  }
52
52
  exports.onPaid = onPaid;
@@ -92,7 +92,7 @@ function onRefund(refundAction) {
92
92
  }));
93
93
  }
94
94
  // タスク保管
95
- return repos.task.saveMany(taskAttributes);
95
+ return repos.task.saveMany(taskAttributes, { emitImmediately: true });
96
96
  });
97
97
  }
98
98
  exports.onRefund = onRefund;
@@ -108,10 +108,14 @@ declare function authorize(params: {
108
108
  purpose: factory.action.authorize.paymentMethod.any.IPurpose;
109
109
  paymentServiceType: factory.service.paymentService.PaymentServiceType;
110
110
  location?: factory.action.trade.pay.ILocation;
111
- /**
112
- * アクション失敗時に即時に決済取引を中止するかどうか
113
- */
114
- useCancelPayTransactionOnFailed: boolean;
115
- useCheckMovieTicketBeforePay: boolean;
111
+ options: {
112
+ /**
113
+ * アクション失敗時に即時に決済取引を中止するかどうか
114
+ */
115
+ useCancelPayTransactionOnFailed: boolean;
116
+ useCheckMovieTicketBeforePay: boolean;
117
+ useCheckByIdentifierIfNotYet: boolean;
118
+ useSearchTrade4accountId: boolean;
119
+ };
116
120
  }): IAuthorizeOperation<IAuthorizePaymentAction>;
117
121
  export { onPaymentStatusChanged, authorize, invalidatePaymentUrl, voidPayTransaction, person2username, processVoidPayTransaction, publishPaymentUrl };
@@ -52,10 +52,18 @@ exports.voidPayTransaction = voidPayTransaction;
52
52
  function invalidatePaymentUrl(params) {
53
53
  return (repos) => __awaiter(this, void 0, void 0, function* () {
54
54
  var _a, _b, _c, _d, _e;
55
+ if (params.purpose.typeOf !== factory.transactionType.PlaceOrder) {
56
+ throw new factory.errors.Argument('purpose.typeOf', `must be ${factory.transactionType.PlaceOrder}`);
57
+ }
55
58
  const transaction = yield repos.transaction.findById({
56
59
  typeOf: params.purpose.typeOf,
57
60
  id: params.purpose.id
58
61
  });
62
+ // 確定取引に対応(2023-05-03~)
63
+ if (transaction.status === factory.transactionStatusType.Confirmed) {
64
+ // no op
65
+ return;
66
+ }
59
67
  const paymentMethodIdByPaymentUrl = (_a = transaction.object.paymentMethods) === null || _a === void 0 ? void 0 : _a.paymentMethodId;
60
68
  const paymentMethodType = (_b = transaction.object.paymentMethods) === null || _b === void 0 ? void 0 : _b.typeOf;
61
69
  if (typeof paymentMethodIdByPaymentUrl === 'string' && paymentMethodIdByPaymentUrl.length > 0
@@ -70,12 +78,10 @@ function invalidatePaymentUrl(params) {
70
78
  ? transaction.seller.name
71
79
  : String((_c = transaction.seller.name) === null || _c === void 0 ? void 0 : _c.ja),
72
80
  id: transaction.seller.id
73
- // project: transaction.seller.project
74
81
  },
75
82
  recipient: { typeOf: transaction.agent.typeOf, name: transaction.agent.name },
76
83
  object: [{
77
84
  typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
78
- // tslint:disable-next-line:max-line-length
79
85
  id: (_e = (_d = transaction.object.paymentMethods) === null || _d === void 0 ? void 0 : _d.issuedThrough) === null || _e === void 0 ? void 0 : _e.id,
80
86
  paymentMethod: {
81
87
  additionalProperty: [],
@@ -96,17 +102,20 @@ exports.invalidatePaymentUrl = invalidatePaymentUrl;
96
102
  * apiもしくはタスクから決済承認を取り消す
97
103
  */
98
104
  function processVoidPayTransaction(params) {
105
+ // tslint:disable-next-line:max-func-body-length
99
106
  return (repos) => __awaiter(this, void 0, void 0, function* () {
107
+ var _a, _b;
100
108
  let transaction;
101
109
  // アクションID指定の場合、進行中取引検証(2023-02-24~)
102
110
  if (typeof params.id === 'string') {
103
111
  transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id });
104
112
  }
105
113
  else {
106
- transaction = yield repos.transaction.findById({
114
+ transaction = (yield repos.transaction.findById({
107
115
  typeOf: params.purpose.typeOf,
108
- id: params.purpose.id
109
- });
116
+ id: params.purpose.id,
117
+ inclusion: ['_id', 'typeOf', 'status', 'result.order.paymentMethods']
118
+ }));
110
119
  }
111
120
  // 承認アクションを取得
112
121
  let authorizeActions;
@@ -122,7 +131,7 @@ function processVoidPayTransaction(params) {
122
131
  const authorizeActionsOnTransaction = yield repos.action.searchByPurpose({
123
132
  typeOf: factory.actionType.AuthorizeAction,
124
133
  purpose: {
125
- typeOf: factory.transactionType.PlaceOrder,
134
+ typeOf: transaction.typeOf,
126
135
  id: transaction.id
127
136
  }
128
137
  });
@@ -131,12 +140,37 @@ function processVoidPayTransaction(params) {
131
140
  return ((_a = a.object) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment
132
141
  && ((_b = a.instrument) === null || _b === void 0 ? void 0 : _b.identifier) === factory.action.authorize.paymentMethod.any.ServiceIdentifier.Chevre;
133
142
  });
143
+ switch (transaction.status) {
144
+ case factory.transactionStatusType.InProgress:
145
+ throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
146
+ // 確定取引に対応(2023-05-03~)
147
+ case factory.transactionStatusType.Confirmed:
148
+ // アクションステータスを検証する
149
+ authorizeActions = authorizeActions.filter((a) => a.actionStatus !== factory.actionStatusType.CompletedActionStatus);
150
+ if (transaction.typeOf === factory.transactionType.PlaceOrder) {
151
+ const paymentMethodIds = (_b = (_a = transaction.result) === null || _a === void 0 ? void 0 : _a.order) === null || _b === void 0 ? void 0 : _b.paymentMethods.map((p) => {
152
+ return p.paymentMethodId;
153
+ });
154
+ if (!Array.isArray(paymentMethodIds)) {
155
+ throw new factory.errors.Argument('Transaction', `${transaction.id} must have result.order.paymentMethods`);
156
+ }
157
+ if (paymentMethodIds.length > 0) {
158
+ authorizeActions = authorizeActions.filter((a) => {
159
+ // paymentMethodIdが存在しない、あるいは、注文のpaymentMethodIdsに含まれなければ、アクション取消対象
160
+ const paymentMethodIdByAction = a.object.paymentMethodId;
161
+ const includedInOrder = typeof paymentMethodIdByAction === 'string'
162
+ && paymentMethodIds.includes(paymentMethodIdByAction);
163
+ return !includedInOrder;
164
+ });
165
+ }
166
+ }
167
+ break;
168
+ default:
169
+ // no op
170
+ }
134
171
  }
135
172
  const errors = [];
136
173
  for (const action of authorizeActions) {
137
- // 直列にゆっくり処理する場合↓
138
- // tslint:disable-next-line:no-magic-numbers
139
- // await new Promise((resolve) => setTimeout(() => { resolve(); }, 1000));
140
174
  // 失敗するケースがあっても、残りが少なくとも処理されるようにエラーハンドリング
141
175
  try {
142
176
  // 取引が存在すれば中止
@@ -194,7 +228,7 @@ function publishPaymentUrl(params) {
194
228
  paymentUrl: result.paymentUrl,
195
229
  issuedThrough: { id: (typeof startParams.object.id === 'string') ? startParams.object.id : '' }
196
230
  };
197
- yield repos.transaction.findByIdAndUpdate({
231
+ yield repos.transaction.findByIdAndUpdateInProgress({
198
232
  id: transaction.id,
199
233
  update: { $set: { 'object.paymentMethods': paymentMethodByPaymentUrl } }
200
234
  });
@@ -206,6 +240,7 @@ exports.publishPaymentUrl = publishPaymentUrl;
206
240
  * 決済承認
207
241
  */
208
242
  function authorize(params) {
243
+ // tslint:disable-next-line:max-func-body-length
209
244
  return (repos) => __awaiter(this, void 0, void 0, function* () {
210
245
  var _a, _b;
211
246
  const transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id });
@@ -217,6 +252,21 @@ function authorize(params) {
217
252
  const paymentMethodIdByTransaction = (_a = transaction.object.paymentMethods) === null || _a === void 0 ? void 0 : _a.paymentMethodId;
218
253
  if (params.object.paymentMethodId === paymentMethodIdByTransaction) {
219
254
  transactionNumber = params.object.paymentMethodId;
255
+ // 既に承認済であれば何もしない(2023-05-15~)
256
+ const existingCompletedAuthorizeActions = yield repos.action.searchByPurpose({
257
+ typeOf: factory.actionType.AuthorizeAction,
258
+ purpose: { id: transaction.id, typeOf: transaction.typeOf },
259
+ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus },
260
+ object: {
261
+ paymentMethodId: { $eq: transactionNumber },
262
+ typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment }
263
+ },
264
+ sort: { startDate: factory.sortType.Ascending }
265
+ });
266
+ const existingCompletedAuthorizeAction = existingCompletedAuthorizeActions.shift();
267
+ if (existingCompletedAuthorizeAction !== undefined) {
268
+ return existingCompletedAuthorizeAction;
269
+ }
220
270
  }
221
271
  else {
222
272
  // 取引にないpaymentMethodIdの指定はクライアントエラー
@@ -264,7 +314,11 @@ function authorize(params) {
264
314
  transactionNumber: transactionNumber,
265
315
  location: params.location
266
316
  });
267
- payTransaction = yield PayTransactionService.start(startParams, params.useCheckMovieTicketBeforePay)(repos);
317
+ payTransaction = yield PayTransactionService.start(startParams, {
318
+ useCheckMovieTicketBeforePay: params.options.useCheckMovieTicketBeforePay,
319
+ useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
320
+ searchTrade4accountId: params.options.useSearchTrade4accountId
321
+ })(repos);
268
322
  }
269
323
  catch (error) {
270
324
  try {
@@ -275,13 +329,21 @@ function authorize(params) {
275
329
  // no op
276
330
  }
277
331
  // 即時に決済取引を中止するか?(2023-02-03~)
278
- if (params.useCancelPayTransactionOnFailed) {
279
- yield processVoidPayTransaction({
280
- project: action.project,
281
- agent: { id: action.project.id },
282
- id: action.id,
283
- purpose: action.purpose
284
- })(repos);
332
+ if (params.options.useCancelPayTransactionOnFailed) {
333
+ // abortエラーの場合は状態不明なので即時中止しない(2023-06-01~)
334
+ // {
335
+ // "type": "aborted",
336
+ // "message": "The user aborted a request.",
337
+ // "name": "AbortError"
338
+ // }
339
+ if (error.name !== 'AbortError') {
340
+ yield processVoidPayTransaction({
341
+ project: action.project,
342
+ agent: { id: action.project.id },
343
+ id: action.id,
344
+ purpose: action.purpose
345
+ })(repos);
346
+ }
285
347
  }
286
348
  throw error;
287
349
  }
@@ -13,7 +13,7 @@ import { MongoRepository as TaskRepo } from '../../repo/task';
13
13
  /**
14
14
  * クレジットカード決済承認
15
15
  */
16
- declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
16
+ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, searchTrade4accountId: boolean): (repos: {
17
17
  person: PersonRepo;
18
18
  product: ProductRepo;
19
19
  project: ProjectRepo;
@@ -21,11 +21,11 @@ const factory = require("../../factory");
21
21
  const onPaid_1 = require("./any/onPaid");
22
22
  const onRefund_1 = require("./any/onRefund");
23
23
  const person2username_1 = require("./any/person2username");
24
- const debug = createDebug('chevre-domain:service');
24
+ const debug = createDebug('chevre-domain:service:payment');
25
25
  /**
26
26
  * クレジットカード決済承認
27
27
  */
28
- function authorize(params, paymentServiceId) {
28
+ function authorize(params, paymentServiceId, searchTrade4accountId) {
29
29
  return (repos) => __awaiter(this, void 0, void 0, function* () {
30
30
  var _a, _b, _c, _d;
31
31
  const project = yield repos.project.findById({ id: params.project.id });
@@ -65,19 +65,25 @@ function authorize(params, paymentServiceId) {
65
65
  catch (error) {
66
66
  throw handleAuthorizeError(error);
67
67
  }
68
- try {
69
- const creditCardService = new GMO.service.Credit({ endpoint: String(availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
70
- // ベストエフォートでクレジットカード詳細情報を取得
71
- searchTradeResult = yield creditCardService.searchTrade({
72
- shopId: shopId,
73
- shopPass: shopPass,
74
- orderId: orderId,
75
- siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
76
- sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
77
- });
78
- }
79
- catch (error) {
80
- // no op
68
+ if (searchTrade4accountId) {
69
+ try {
70
+ const creditCardService = new GMO.service.Credit({ endpoint: String(availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
71
+ // ベストエフォートでクレジットカード詳細情報を取得
72
+ const startSearchTradeDate = Date.now();
73
+ debug('searchTrade processing...orderId:', orderId, startSearchTradeDate);
74
+ searchTradeResult = yield creditCardService.searchTrade({
75
+ shopId: shopId,
76
+ shopPass: shopPass,
77
+ orderId: orderId,
78
+ siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
79
+ sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
80
+ });
81
+ debug('searchTrade processed. orderId:', orderId, 'execution time:', (Date.now() - startSearchTradeDate), 'ms');
82
+ }
83
+ catch (error) {
84
+ // no op
85
+ debug('searchTrade throwed an error. orderId:', orderId, error);
86
+ }
81
87
  }
82
88
  return {
83
89
  accountId: (searchTradeResult !== undefined) ? searchTradeResult.cardNo : '',
@@ -6,16 +6,17 @@ interface ICheckResult {
6
6
  purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
7
7
  purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
8
8
  }
9
- /**
10
- * MovieTicket認証
11
- */
12
- declare function checkByIdentifier(params: {
9
+ interface ICheckByIdentifierParams {
13
10
  movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
14
11
  seller: factory.seller.ISeller;
15
12
  screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
16
13
  paymentServiceId: string;
17
- }): (repos: {
14
+ }
15
+ /**
16
+ * MovieTicket認証
17
+ */
18
+ declare function checkByIdentifier(params: ICheckByIdentifierParams): (repos: {
18
19
  product: ProductRepo;
19
20
  project: ProjectRepo;
20
21
  }) => Promise<ICheckResult>;
21
- export { ICheckResult, checkByIdentifier };
22
+ export { ICheckByIdentifierParams, ICheckResult, checkByIdentifier };
@@ -1,15 +1,15 @@
1
- /**
2
- * 決済取引サービス
3
- */
4
1
  import * as factory from '../../../factory';
2
+ import { MongoRepository as ActionRepo } from '../../../repo/action';
5
3
  import { MongoRepository as EventRepo } from '../../../repo/event';
6
4
  import { MongoRepository as ProductRepo } from '../../../repo/product';
7
5
  import { MongoRepository as ProjectRepo } from '../../../repo/project';
8
6
  import { MongoRepository as SellerRepo } from '../../../repo/seller';
9
- import { ICheckResult } from './checkByIdentifier';
10
- export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean): (repos: {
7
+ export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
8
+ action: ActionRepo;
11
9
  event: EventRepo;
12
10
  product: ProductRepo;
13
11
  project: ProjectRepo;
14
12
  seller: SellerRepo;
15
- }) => Promise<ICheckResult | undefined>;
13
+ }) => Promise<{
14
+ accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
15
+ }>;
@@ -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') {
@@ -54,32 +54,26 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
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;
@@ -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;
@@ -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
  * 販売者が対象のフローデータ