@chevre/domain 22.2.0-alpha.3 → 22.2.0-alpha.30

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 (260) hide show
  1. package/example/src/chevre/createProject.ts +19 -0
  2. package/example/src/chevre/findValidAuthorization.ts +1 -2
  3. package/example/src/chevre/migrateDeleteTransactionTasks.ts +1 -1
  4. package/example/src/chevre/{migrateMovieTheaterAdditionalProperties.ts → migrateRoomAdditionalProperties.ts} +17 -17
  5. package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +119 -0
  6. package/example/src/chevre/playAroundTicket.ts +3 -2
  7. package/example/src/chevre/processAction.ts +3 -1
  8. package/example/src/chevre/projectFields.ts +42 -0
  9. package/example/src/chevre/{projectEventFieldsById.ts → projectFieldsById.ts} +7 -12
  10. package/example/src/chevre/{projectReservationFieldsById.ts → projectOwnershipInfoFieldsById.ts} +4 -4
  11. package/example/src/chevre/searchActionsByPurpose.ts +38 -0
  12. package/example/src/chevre/searchProjects.ts +9 -4
  13. package/example/src/chevre/searchSellersByAggregate.ts +3 -3
  14. package/example/src/chevre/searchTransactions.ts +1 -1
  15. package/example/src/chevre/unsetUnnecessaryFields.ts +2 -41
  16. package/lib/chevre/repo/accountTitle.d.ts +9 -3
  17. package/lib/chevre/repo/accountingReport.d.ts +2 -15
  18. package/lib/chevre/repo/action.d.ts +64 -47
  19. package/lib/chevre/repo/action.js +170 -133
  20. package/lib/chevre/repo/aggregateReservation.d.ts +1 -14
  21. package/lib/chevre/repo/assetTransaction.d.ts +134 -7
  22. package/lib/chevre/repo/assetTransaction.js +2 -2
  23. package/lib/chevre/repo/authorization.d.ts +3 -1
  24. package/lib/chevre/repo/authorization.js +21 -10
  25. package/lib/chevre/repo/categoryCode.d.ts +18 -2
  26. package/lib/chevre/repo/categoryCode.js +47 -19
  27. package/lib/chevre/repo/comment.d.ts +5 -1
  28. package/lib/chevre/repo/creativeWork.d.ts +14 -2
  29. package/lib/chevre/repo/customer.d.ts +5 -1
  30. package/lib/chevre/repo/customerType.d.ts +1 -1
  31. package/lib/chevre/repo/event.d.ts +49 -2
  32. package/lib/chevre/repo/member.d.ts +5 -1
  33. package/lib/chevre/repo/merchantReturnPolicy.d.ts +22 -2
  34. package/lib/chevre/repo/message.d.ts +1 -15
  35. package/lib/chevre/repo/mongoose/schemas/account.d.ts +8 -3
  36. package/lib/chevre/repo/mongoose/schemas/account.js +1 -1
  37. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +8 -3
  38. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -2
  39. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +8 -3
  40. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  41. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +22 -3
  42. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -1
  43. package/lib/chevre/repo/mongoose/schemas/action.d.ts +12 -3
  44. package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
  45. package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +14 -3
  46. package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -5
  47. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +8 -3
  48. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +12 -12
  49. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +11 -3
  50. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +1 -1
  51. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +22 -3
  52. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
  53. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +7 -3
  54. package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
  55. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +10 -3
  56. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +1 -1
  57. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +8 -3
  58. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  59. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +8 -3
  60. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +22 -24
  61. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +8 -3
  62. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  63. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +10 -3
  64. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -2
  65. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +8 -3
  66. package/lib/chevre/repo/mongoose/schemas/customer.js +1 -1
  67. package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +9 -3
  68. package/lib/chevre/repo/mongoose/schemas/customerType.js +1 -1
  69. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +8 -3
  70. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -1
  71. package/lib/chevre/repo/mongoose/schemas/event.d.ts +19 -3
  72. package/lib/chevre/repo/mongoose/schemas/event.js +1 -1
  73. package/lib/chevre/repo/mongoose/schemas/member.d.ts +8 -3
  74. package/lib/chevre/repo/mongoose/schemas/member.js +1 -1
  75. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +8 -3
  76. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -1
  77. package/lib/chevre/repo/mongoose/schemas/message.d.ts +23 -3
  78. package/lib/chevre/repo/mongoose/schemas/message.js +1 -1
  79. package/lib/chevre/repo/mongoose/schemas/note.d.ts +8 -3
  80. package/lib/chevre/repo/mongoose/schemas/note.js +1 -1
  81. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +12 -3
  82. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
  83. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +12 -3
  84. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +1 -1
  85. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +8 -3
  86. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +1 -1
  87. package/lib/chevre/repo/mongoose/schemas/order.d.ts +10 -3
  88. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  89. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +10 -3
  90. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  91. package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +10 -3
  92. package/lib/chevre/repo/mongoose/schemas/paymentService.js +13 -4
  93. package/lib/chevre/repo/mongoose/schemas/place.d.ts +16 -3
  94. package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
  95. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +11 -3
  96. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -1
  97. package/lib/chevre/repo/mongoose/schemas/product.d.ts +12 -3
  98. package/lib/chevre/repo/mongoose/schemas/product.js +6 -13
  99. package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +30 -3
  100. package/lib/chevre/repo/mongoose/schemas/productModel.js +1 -1
  101. package/lib/chevre/repo/mongoose/schemas/project.d.ts +12 -3
  102. package/lib/chevre/repo/mongoose/schemas/project.js +3 -3
  103. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +12 -3
  104. package/lib/chevre/repo/mongoose/schemas/reservation.js +5 -5
  105. package/lib/chevre/repo/mongoose/schemas/role.d.ts +9 -3
  106. package/lib/chevre/repo/mongoose/schemas/role.js +1 -1
  107. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +8 -3
  108. package/lib/chevre/repo/mongoose/schemas/seller.js +22 -24
  109. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +8 -3
  110. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  111. package/lib/chevre/repo/mongoose/schemas/task.d.ts +8 -3
  112. package/lib/chevre/repo/mongoose/schemas/task.js +1 -1
  113. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +7 -3
  114. package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
  115. package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +26 -3
  116. package/lib/chevre/repo/mongoose/schemas/ticket.js +1 -1
  117. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +8 -3
  118. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -2
  119. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +8 -3
  120. package/lib/chevre/repo/mongoose/schemas/trip.js +3 -3
  121. package/lib/chevre/repo/offer.d.ts +13 -4
  122. package/lib/chevre/repo/offerCatalog.d.ts +15 -2
  123. package/lib/chevre/repo/order.d.ts +13 -1
  124. package/lib/chevre/repo/ownershipInfo.d.ts +23 -7
  125. package/lib/chevre/repo/ownershipInfo.js +75 -19
  126. package/lib/chevre/repo/paymentService.d.ts +2 -2
  127. package/lib/chevre/repo/paymentService.js +108 -58
  128. package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
  129. package/lib/chevre/repo/place/movieTheater.d.ts +54 -2
  130. package/lib/chevre/repo/priceSpecification.d.ts +42 -1
  131. package/lib/chevre/repo/product.d.ts +8 -3
  132. package/lib/chevre/repo/product.js +67 -33
  133. package/lib/chevre/repo/productModel.d.ts +1 -22
  134. package/lib/chevre/repo/project.d.ts +25 -5
  135. package/lib/chevre/repo/project.js +69 -28
  136. package/lib/chevre/repo/reservation.d.ts +35 -3
  137. package/lib/chevre/repo/reservation.js +1 -1
  138. package/lib/chevre/repo/role.d.ts +2 -9
  139. package/lib/chevre/repo/role.js +20 -10
  140. package/lib/chevre/repo/seller.d.ts +64 -14
  141. package/lib/chevre/repo/seller.js +61 -27
  142. package/lib/chevre/repo/task.d.ts +64 -3
  143. package/lib/chevre/repo/telemetry.d.ts +3 -2
  144. package/lib/chevre/repo/ticket.d.ts +4 -20
  145. package/lib/chevre/repo/ticket.js +23 -10
  146. package/lib/chevre/repo/transaction.d.ts +30 -14
  147. package/lib/chevre/repo/transaction.js +106 -77
  148. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
  149. package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
  150. package/lib/chevre/service/aggregation/project.js +1 -1
  151. package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +1 -1
  152. package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
  153. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  154. package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
  155. package/lib/chevre/service/assetTransaction/pay/factory.js +1 -1
  156. package/lib/chevre/service/assetTransaction/pay.js +3 -3
  157. package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
  158. package/lib/chevre/service/assetTransaction/refund/factory.js +1 -1
  159. package/lib/chevre/service/assetTransaction/refund.js +3 -3
  160. package/lib/chevre/service/assetTransaction/registerService.js +4 -6
  161. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +26 -23
  162. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
  163. package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
  164. package/lib/chevre/service/code.d.ts +0 -4
  165. package/lib/chevre/service/code.js +22 -18
  166. package/lib/chevre/service/event.js +4 -4
  167. package/lib/chevre/service/moneyTransfer.js +3 -5
  168. package/lib/chevre/service/notification.js +2 -2
  169. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
  170. package/lib/chevre/service/offer/event/authorize/factory.js +34 -6
  171. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -2
  172. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +22 -22
  173. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -4
  174. package/lib/chevre/service/offer/event/authorize.d.ts +4 -4
  175. package/lib/chevre/service/offer/event/authorize.js +3 -2
  176. package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +3 -1
  177. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  178. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
  179. package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
  180. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
  181. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.d.ts +2 -2
  182. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +41 -4
  183. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +3 -3
  184. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +3 -3
  185. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +7 -3
  186. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +10 -5
  187. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +3 -1
  188. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +3 -1
  189. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +14 -6
  190. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +8 -5
  191. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  192. package/lib/chevre/service/offer/moneyTransfer/authorize.js +1 -1
  193. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
  194. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
  195. package/lib/chevre/service/offer/product.d.ts +4 -2
  196. package/lib/chevre/service/offer/product.js +12 -12
  197. package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
  198. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  199. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  200. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  201. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  202. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -3
  203. package/lib/chevre/service/order/placeOrder.js +1 -1
  204. package/lib/chevre/service/order/returnOrder.js +1 -1
  205. package/lib/chevre/service/order/sendOrder.js +9 -5
  206. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  207. package/lib/chevre/service/payment/any/onPaid.d.ts +1 -1
  208. package/lib/chevre/service/payment/any/onRefund.d.ts +1 -1
  209. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -6
  210. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -34
  211. package/lib/chevre/service/payment/any.d.ts +3 -3
  212. package/lib/chevre/service/payment/any.js +21 -13
  213. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -1
  214. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -1
  215. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -2
  216. package/lib/chevre/service/payment/creditCard/payCreditCard.js +12 -5
  217. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +13 -3
  218. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  219. package/lib/chevre/service/payment/faceToFace.d.ts +2 -2
  220. package/lib/chevre/service/payment/faceToFace.js +28 -10
  221. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
  222. package/lib/chevre/service/payment/movieTicket/authorize.js +8 -3
  223. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -2
  224. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +12 -4
  225. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +15 -4
  226. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  227. package/lib/chevre/service/payment/paymentCard.d.ts +2 -2
  228. package/lib/chevre/service/payment/paymentCard.js +29 -16
  229. package/lib/chevre/service/payment.d.ts +1 -1
  230. package/lib/chevre/service/report/ownershipInfo.d.ts +3 -1
  231. package/lib/chevre/service/report/telemetry.js +2 -2
  232. package/lib/chevre/service/reserve/cancelReservation.js +1 -1
  233. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  234. package/lib/chevre/service/task/authorizePayment.js +0 -2
  235. package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
  236. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
  237. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  238. package/lib/chevre/service/task/onResourceUpdated.js +16 -4
  239. package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
  240. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  241. package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
  242. package/lib/chevre/service/transaction/moneyTransfer.js +4 -4
  243. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +1 -1
  244. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +36 -2
  245. package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -2
  246. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
  247. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
  248. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
  249. package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
  250. package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
  251. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  252. package/lib/chevre/service/transaction/returnOrder.js +2 -2
  253. package/lib/chevre/service/transaction.js +1 -1
  254. package/package.json +4 -4
  255. package/example/src/chevre/findTransactionById.ts +0 -23
  256. package/example/src/chevre/findTransactionInProgressById.ts +0 -23
  257. package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +0 -154
  258. package/example/src/chevre/projectReservationFields.ts +0 -31
  259. package/example/src/chevre/searchActions.ts +0 -40
  260. package/example/src/chevre/searchProducts.ts +0 -28
@@ -31,7 +31,7 @@ function payMovieTicket(params) {
31
31
  processSeatInfoSyncResult: { seatInfoSyncIn },
32
32
  project: { id: params.project.id }
33
33
  });
34
- let action = yield repos.action.start(startingAction, { recipe });
34
+ const action = yield repos.action.start(startingAction, { recipe });
35
35
  let processSeatInfoSyncResult;
36
36
  try {
37
37
  // 着券済に対する冪等性を確保する必要はあるが、
@@ -91,9 +91,17 @@ function payMovieTicket(params) {
91
91
  // ? { seatInfoSyncResult: <factory.action.trade.pay.ISeatInfoSyncResult>seatInfoSyncResult }
92
92
  // : undefined
93
93
  };
94
- action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result, recipe }));
95
- yield (0, onPaid_1.onPaid)(action)(repos);
96
- return action;
94
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe });
95
+ yield (0, onPaid_1.onPaid)({
96
+ actionStatus: factory.actionStatusType.CompletedActionStatus,
97
+ id: action.id,
98
+ object: startingAction.object,
99
+ potentialActions: startingAction.potentialActions,
100
+ project: startingAction.project,
101
+ purpose: startingAction.purpose,
102
+ typeOf: action.typeOf
103
+ })(repos);
104
+ // return action;
97
105
  });
98
106
  }
99
107
  exports.payMovieTicket = payMovieTicket;
@@ -58,7 +58,7 @@ function refundMovieTicket(params) {
58
58
  const refundActionAttributes = Object.assign({ agent, object, potentialActions, project, purpose, recipient, typeOf }, (typeof (sameAs === null || sameAs === void 0 ? void 0 : sameAs.id) === 'string') ? { sameAs: { id: sameAs.id, typeOf: 'Task' } } : undefined
59
59
  // instrument // discontinue(2024-06-10~)
60
60
  );
61
- let action = yield repos.action.start(refundActionAttributes, { recipe });
61
+ const action = yield repos.action.start(refundActionAttributes, { recipe });
62
62
  let processSeatInfoSyncCancelResult;
63
63
  let processSeatInfoSyncResult;
64
64
  try {
@@ -92,8 +92,10 @@ function refundMovieTicket(params) {
92
92
  }
93
93
  // アクションとしてはFailedだが後続処理を実行するケースに対応(2024-03-21~)
94
94
  const seatInfoSyncResultAsError = processSeatInfoSyncResult === null || processSeatInfoSyncResult === void 0 ? void 0 : processSeatInfoSyncResult.seatInfoSyncResultAsError;
95
+ let actionStatus;
95
96
  if (seatInfoSyncResultAsError !== undefined) {
96
- action = (yield repos.action.giveUpWithObject({ typeOf: action.typeOf, id: action.id, error: seatInfoSyncResultAsError }));
97
+ yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: seatInfoSyncResultAsError });
98
+ actionStatus = factory.actionStatusType.FailedActionStatus;
97
99
  }
98
100
  else {
99
101
  // add recipe(2024-06-04~)
@@ -107,9 +109,18 @@ function refundMovieTicket(params) {
107
109
  // ? { seatInfoSyncCancelResult: processSeatInfoSyncCancelResult.seatInfoSyncCancelResult }
108
110
  // : undefined
109
111
  };
110
- action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
112
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
113
+ actionStatus = factory.actionStatusType.CompletedActionStatus;
111
114
  }
112
- yield (0, onRefund_1.onRefund)(action)(repos);
115
+ yield (0, onRefund_1.onRefund)({
116
+ actionStatus,
117
+ id: action.id,
118
+ object: refundActionAttributes.object,
119
+ potentialActions: refundActionAttributes.potentialActions,
120
+ project: refundActionAttributes.project,
121
+ purpose: refundActionAttributes.purpose,
122
+ typeOf: action.typeOf
123
+ })(repos);
113
124
  });
114
125
  }
115
126
  exports.refundMovieTicket = refundMovieTicket;
@@ -150,7 +150,7 @@ function checkByIdentifierIfNotYet(params) {
150
150
  reservationFor: { id: { $eq: params.screeningEvent.id } } // 指定のイベントにおいて
151
151
  }
152
152
  }
153
- } }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['_id'], [])).shift();
153
+ } }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'], [])).shift();
154
154
  debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
155
155
  if (alreadyCheckedAction !== undefined) {
156
156
  const recipe = yield repos.action.findRecipeByAction({
@@ -21,7 +21,7 @@ declare function payPaymentCard(params: factory.action.trade.pay.IAttributes): (
21
21
  accountingReport: AccountingReportRepo;
22
22
  product: ProductRepo;
23
23
  task: TaskRepo;
24
- }) => Promise<import("@chevre/factory/lib/action/trade/pay").IAction>;
24
+ }) => Promise<void>;
25
25
  declare function refundPaymentCard(params: factory.task.refund.IData): (repos: {
26
26
  action: ActionRepo;
27
27
  accountingReport: AccountingReportRepo;
@@ -29,5 +29,5 @@ declare function refundPaymentCard(params: factory.task.refund.IData): (repos: {
29
29
  task: TaskRepo;
30
30
  assetTransaction: AssetTransactionRepo;
31
31
  transactionNumber: TransactionNumberRepo;
32
- }) => Promise<import("@chevre/factory/lib/action/trade/refund").IAction>;
32
+ }) => Promise<void>;
33
33
  export { authorize, payPaymentCard, refundPaymentCard, voidTransaction };
@@ -79,9 +79,7 @@ function validatePaymentMethod(params, paymentServiceId) {
79
79
  throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
80
80
  }
81
81
  // プロダクトから通貨区分を取得
82
- // const paymentCatdProduct = <Pick<factory.product.IProduct, 'serviceOutput'>>
83
- // await repos.product.findProductById({ id: paymentServiceId }, ['serviceOutput'], []);
84
- const paymentCatdProduct = (yield repos.product.searchProducts({
82
+ const paymentCatdProduct = (yield repos.product.projectFields({
85
83
  limit: 1,
86
84
  page: 1,
87
85
  id: { $eq: paymentServiceId },
@@ -235,12 +233,11 @@ function payPaymentCard(params) {
235
233
  var _a, _b, _c;
236
234
  const payObject = params.object;
237
235
  const paymentServiceId = payObject[0].id;
238
- // アクション開始
239
- let action = yield repos.action.start(params);
236
+ const action = yield repos.action.start(params);
240
237
  try {
241
238
  const transactionNumber = payObject[0].paymentMethod.paymentMethodId;
242
239
  const availableChannel = yield repos.product.findAvailableChannel({
243
- project: { id: action.project.id },
240
+ project: { id: params.project.id },
244
241
  typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard,
245
242
  id: paymentServiceId
246
243
  });
@@ -267,9 +264,17 @@ function payPaymentCard(params) {
267
264
  }
268
265
  // アクション完了
269
266
  const actionResult = {};
270
- action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
271
- yield (0, onPaid_1.onPaid)(action)(repos);
272
- return action;
267
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
268
+ yield (0, onPaid_1.onPaid)({
269
+ actionStatus: factory.actionStatusType.CompletedActionStatus,
270
+ id: action.id,
271
+ object: params.object,
272
+ potentialActions: params.potentialActions,
273
+ project: params.project,
274
+ purpose: params.purpose,
275
+ typeOf: action.typeOf
276
+ })(repos);
277
+ // return action;
273
278
  });
274
279
  }
275
280
  exports.payPaymentCard = payPaymentCard;
@@ -289,11 +294,11 @@ function refundPaymentCard(params) {
289
294
  if (typeof accountNumber !== 'string') {
290
295
  throw new factory.errors.ArgumentNull('serviceOutput.paymentAccount.accountNumber');
291
296
  }
292
- let action = yield repos.action.start(params);
297
+ const action = yield repos.action.start(params);
293
298
  let accountTransactionNumber4refund;
294
299
  try {
295
300
  const availableChannel = yield repos.product.findAvailableChannel({
296
- project: { id: action.project.id },
301
+ project: { id: params.project.id },
297
302
  typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard,
298
303
  id: paymentServiceId
299
304
  });
@@ -309,7 +314,7 @@ function refundPaymentCard(params) {
309
314
  });
310
315
  // 返金のユニークネスを保証するため識別子を指定する
311
316
  const accountTransactionIdentifier = (0, accountTransactionIdentifier_1.createRefundIdentifier)({
312
- project: { id: action.project.id },
317
+ project: { id: params.project.id },
313
318
  paymentMethodId
314
319
  });
315
320
  // すでに返金済かどうか確認
@@ -318,7 +323,7 @@ function refundPaymentCard(params) {
318
323
  // 口座取引で確認する(2022-10-27~)
319
324
  const searchAccountTransactionsResult = yield accountTransactionService.search({
320
325
  limit: 100,
321
- project: { id: { $eq: action.project.id } },
326
+ project: { id: { $eq: params.project.id } },
322
327
  identifier: { $eq: accountTransactionIdentifier }
323
328
  });
324
329
  const existingAccountTransactions = searchAccountTransactionsResult.data;
@@ -381,9 +386,17 @@ function refundPaymentCard(params) {
381
386
  const result = {
382
387
  accountTransaction: { transactionNumber: accountTransactionNumber4refund }
383
388
  };
384
- action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result }));
385
- yield (0, onRefund_1.onRefund)(action)(repos);
386
- return action;
389
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
390
+ yield (0, onRefund_1.onRefund)({
391
+ actionStatus: factory.actionStatusType.CompletedActionStatus,
392
+ id: action.id,
393
+ object: params.object,
394
+ potentialActions: params.potentialActions,
395
+ project: params.project,
396
+ purpose: params.purpose,
397
+ typeOf: action.typeOf
398
+ })(repos);
399
+ // return action;
387
400
  });
388
401
  }
389
402
  exports.refundPaymentCard = refundPaymentCard;
@@ -29,7 +29,7 @@ export declare function fixOrderAsPurpose(params: {
29
29
  }, transaction: factory.assetTransaction.pay.ITransaction): (repos: {
30
30
  acceptedOffer: AcceptedOfferRepo;
31
31
  order: OrderRepo;
32
- }) => Promise<Pick<factory.order.IOrder, "typeOf" | "confirmationNumber" | "orderNumber"> & {
32
+ }) => Promise<Pick<factory.order.IOrder, "confirmationNumber" | "typeOf" | "orderNumber"> & {
33
33
  acceptedOffersMovieTicketUsed: IAcceptedOfferMovieTicketUsed[];
34
34
  }>;
35
35
  /**
@@ -21,5 +21,7 @@ export interface IOwnershipInfoReport {
21
21
  };
22
22
  }
23
23
  export declare function ownershipInfo2report(params: {
24
- ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>;
24
+ ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
25
+ id: string;
26
+ };
25
27
  }): IOwnershipInfoReport;
@@ -217,7 +217,7 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
217
217
  startThrough: measuredThrough
218
218
  });
219
219
  // 計測期間内に開始され、かつ、すでに終了している取引を検索
220
- const startedAndEndedTransactions = yield repos.transaction.search({
220
+ const startedAndEndedTransactions = yield repos.transaction.projectFields({
221
221
  typeOf: factory.transactionType.PlaceOrder,
222
222
  seller: { ids: [sellerId] },
223
223
  startFrom: measuredFrom,
@@ -227,7 +227,7 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
227
227
  });
228
228
  const numberOfStartedAndConfirmed = startedAndEndedTransactions.filter((transaction) => transaction.status === factory.transactionStatusType.Confirmed).length;
229
229
  const numberOfStartedAndExpired = startedAndEndedTransactions.filter((transaction) => transaction.status === factory.transactionStatusType.Expired).length;
230
- const endedTransactions = yield repos.transaction.search({
230
+ const endedTransactions = yield repos.transaction.projectFields({
231
231
  typeOf: factory.transactionType.PlaceOrder,
232
232
  seller: { ids: [sellerId] },
233
233
  endFrom: measuredFrom,
@@ -61,7 +61,7 @@ function cancelPengindIfNotYet(params) {
61
61
  id: { $in: [params.purpose.id] },
62
62
  typeOf: { $in: [params.purpose.typeOf] }
63
63
  }
64
- }, ['_id'], []);
64
+ }, ['id'], []);
65
65
  if (completedActions.length === 0) {
66
66
  const actionAttributes = (0, factory_1.createCancelPendingReservationAction)({ transaction: reserveTransaction });
67
67
  if (actionAttributes !== undefined) {
@@ -133,7 +133,7 @@ params, options) {
133
133
  id: { $in: [actionAttributes.purpose.id] },
134
134
  typeOf: { $in: [actionAttributes.purpose.typeOf] }
135
135
  }
136
- }, ['_id'], []);
136
+ }, ['id'], []);
137
137
  debug(completedActions.length, 'completed reserveAction found. byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
138
138
  if (completedActions.length === 0) {
139
139
  const action = yield repos.action.start(actionAttributes);
@@ -17,7 +17,6 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
17
17
  const authorization_1 = require("../../repo/authorization");
18
18
  const confirmationNumber_1 = require("../../repo/confirmationNumber");
19
19
  const event_1 = require("../../repo/event");
20
- const ownershipInfo_1 = require("../../repo/ownershipInfo");
21
20
  const paymentService_1 = require("../../repo/paymentService");
22
21
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
23
22
  const product_1 = require("../../repo/product");
@@ -55,7 +54,6 @@ function call(params) {
55
54
  authorization: new authorization_1.AuthorizationRepo(connection),
56
55
  confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
57
56
  event: new event_1.EventRepo(connection),
58
- ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
59
57
  paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
60
58
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
61
59
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
@@ -67,22 +67,26 @@ function onAuthorizationCreated(params) {
67
67
  }
68
68
  break;
69
69
  case 'OwnershipInfo':
70
- // 所有権検索
71
- const ownershipInfoId = authorization.object.id;
72
- if (typeof ownershipInfoId === 'string' && ownershipInfoId.length > 0) {
73
- const ownershipInfo = yield repos.ownershipInfo.findById({ id: ownershipInfoId });
74
- // 座席予約に対する所有権であれば発券
75
- if (ownershipInfo.typeOfGood.typeOf === factory.reservationType.EventReservation
76
- || ownershipInfo.typeOfGood.typeOf === factory.reservationType.BusReservation) {
77
- const reservationId = String(ownershipInfo.typeOfGood.id);
78
- reservationIds = [reservationId];
79
- const { reservationFor } = yield repos.reservation.projectFieldsById({
80
- id: reservationId,
81
- inclusion: ['reservationFor.id']
82
- });
83
- reservationForIds = [String(reservationFor.id)];
84
- }
85
- }
70
+ // 所有権に対する承認はいったん廃止したので、所有権のケースは処理不要(2024-08-21~)
71
+ reservationIds = [];
72
+ // const ownershipInfoId = authorization.object.id;
73
+ // if (typeof ownershipInfoId === 'string' && ownershipInfoId.length > 0) {
74
+ // const ownershipInfo = <Pick<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, 'id' | 'typeOfGood'>>
75
+ // await repos.ownershipInfo.projectFieldsById({ id: ownershipInfoId }, ['typeOfGood']);
76
+ // // 予約に対する所有権であれば発券
77
+ // if (ownershipInfo.typeOfGood.typeOf === factory.reservationType.EventReservation
78
+ // || ownershipInfo.typeOfGood.typeOf === factory.reservationType.BusReservation) {
79
+ // const reservationId = String(ownershipInfo.typeOfGood.id);
80
+ // reservationIds = [reservationId];
81
+ // const { reservationFor } = <{ reservationFor: { id: string } }>await repos.reservation.projectFieldsById<
82
+ // factory.reservationType.EventReservation | factory.reservationType.BusReservation
83
+ // >({
84
+ // id: reservationId,
85
+ // inclusion: ['reservationFor.id']
86
+ // });
87
+ // reservationForIds = [String(reservationFor.id)];
88
+ // }
89
+ // }
86
90
  break;
87
91
  default:
88
92
  // no op
@@ -343,10 +343,10 @@ function deleteResourcesByOfferCatalog(params) {
343
343
  const action = yield repos.action.start(deleteActionAttributes);
344
344
  try {
345
345
  // カタログからプロダクト検索
346
- const productsWithCatalog = yield repos.product.searchProducts({
346
+ const productsWithCatalog = yield repos.product.projectFields({
347
347
  project: { id: { $eq: params.project.id } },
348
348
  hasOfferCatalog: { id: { $eq: catalogId } }
349
- }, ['_id'], []);
349
+ }, ['id'], []);
350
350
  let deleteEventResult;
351
351
  let updateOfferResult;
352
352
  if (productsWithCatalog.length > 0) {
@@ -29,7 +29,7 @@ function syncCategoryCode(params) {
29
29
  }
30
30
  else {
31
31
  for (const categoryCodeId of params.ids) {
32
- const syncingCategoryCode = (yield repos.categoryCode.search({
32
+ const syncingCategoryCode = (yield repos.categoryCode.projectFields({
33
33
  limit: 1,
34
34
  page: 1,
35
35
  project: { id: { $eq: params.project.id } },
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.call = void 0;
13
24
  const factory = require("../../factory");
@@ -275,7 +286,7 @@ function createInformMovieTasks(params) {
275
286
  }
276
287
  function createInformProductTasks(params) {
277
288
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
278
- const products4inform = yield repos.product.searchProducts({
289
+ const products4inform = yield repos.product.projectFields({
279
290
  typeOf: { $eq: params.typeOf },
280
291
  id: { $in: params.ids }
281
292
  }, ['additionalProperty', 'description', 'name', 'productID', 'project', 'typeOf', 'serviceType'], []);
@@ -322,7 +333,7 @@ function createInformProductTasks(params) {
322
333
  }
323
334
  function createInformCategoryCodeTasks(params) {
324
335
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
325
- const categoryCodes4inform = yield repos.categoryCode.search({
336
+ const categoryCodes4inform = yield repos.categoryCode.projectFields({
326
337
  id: { $in: params.ids },
327
338
  // ひとまずDistributorTypeのみ
328
339
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
@@ -484,10 +495,11 @@ function createInformAccountTitleTasks(params) {
484
495
  accountTitles4inform.forEach((accountTitle4inform) => {
485
496
  var _a;
486
497
  // _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
487
- delete accountTitle4inform._id;
498
+ // delete accountTitle4inform._id;
499
+ const { _id } = accountTitle4inform, informObject = __rest(accountTitle4inform, ["_id"]);
488
500
  const informActionAttributes = {
489
501
  // agent: accountTitle4inform.project,
490
- object: accountTitle4inform,
502
+ object: informObject,
491
503
  // project: accountTitle4inform.project,
492
504
  recipient: {
493
505
  id: '',
@@ -13,9 +13,11 @@ exports.call = void 0;
13
13
  const factory = require("../../factory");
14
14
  const action_1 = require("../../repo/action");
15
15
  const assetTransaction_1 = require("../../repo/assetTransaction");
16
+ const authorization_1 = require("../../repo/authorization");
16
17
  const paymentService_1 = require("../../repo/paymentService");
17
18
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
18
19
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
20
+ const ticket_1 = require("../../repo/ticket");
19
21
  const transaction_1 = require("../../repo/transaction");
20
22
  const transactionNumber_1 = require("../../repo/transactionNumber");
21
23
  const transactionProcess_1 = require("../../repo/transactionProcess");
@@ -38,9 +40,11 @@ function call(params) {
38
40
  yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
39
41
  action: actionRepo,
40
42
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
43
+ authorization: new authorization_1.AuthorizationRepo(connection),
41
44
  paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
42
45
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
43
46
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
47
+ ticket: new ticket_1.TicketRepo(connection),
44
48
  transaction: new transaction_1.TransactionRepo(connection),
45
49
  transactionNumber: new transactionNumber_1.TransactionNumberRepo(redisClient)
46
50
  }, settings);
@@ -76,7 +76,7 @@ function fixOrderAndTransaction(params) {
76
76
  }
77
77
  // const orderNumber = params.purpose.orderNumber;
78
78
  const orderNumber = orderByPaymentMethodId.orderNumber;
79
- const returnOrderTransaction = (yield repos.transaction.search({
79
+ const returnOrderTransaction = (yield repos.transaction.projectFields({
80
80
  limit: 1,
81
81
  page: 1,
82
82
  typeOf: factory.transactionType.ReturnOrder,
@@ -39,7 +39,7 @@ function createDeleteTransactionTasksByAgentId(params) {
39
39
  // agentIdによる全取引についてDeleteTransactionタスクを作成する
40
40
  if (typeof agentIdSpecified === 'string' && agentIdSpecified.length > 0) {
41
41
  const transactionTypeOf = params.object.typeOf;
42
- const transactions = yield repos.transaction.search({
42
+ const transactions = yield repos.transaction.projectFields({
43
43
  project: { id: { $eq: params.object.project.id } },
44
44
  agent: {
45
45
  ids: [agentIdSpecified],
@@ -128,7 +128,7 @@ function deleteTransactionById(params) {
128
128
  if (typeof deletingTransactionId !== 'string' || deletingTransactionId.length === 0) {
129
129
  throw new factory.errors.ArgumentNull('object.id');
130
130
  }
131
- const transaction = (yield repos.transaction.search({
131
+ const transaction = (yield repos.transaction.projectFields({
132
132
  ids: [deletingTransactionId],
133
133
  typeOf: params.object.typeOf,
134
134
  inclusion: ['typeOf', 'project', 'status', 'result']
@@ -28,7 +28,7 @@ const CodeService = require("../code");
28
28
  function start(params) {
29
29
  return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
30
30
  const { passport } = yield repos.passport.validatePassportTokenIfExist(params);
31
- const sellers = yield repos.seller.search({
31
+ const sellers = yield repos.seller.projectFields({
32
32
  limit: 1,
33
33
  page: 1,
34
34
  id: { $eq: params.seller.id }
@@ -162,7 +162,7 @@ function fixToLocation(params) {
162
162
  function processAuthorizePaymentCard(params) {
163
163
  return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
164
164
  var _a;
165
- const transaction = yield repos.transaction.findInProgressById({
165
+ const transaction = yield repos.transaction.projectFieldsInProgressById({
166
166
  typeOf: factory.transactionType.MoneyTransfer,
167
167
  id: params.purpose.id
168
168
  }, ['agent', 'project', 'recipient', 'seller', 'typeOf', 'object']);
@@ -504,7 +504,7 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
504
504
  function confirm(params) {
505
505
  return (repos) => __awaiter(this, void 0, void 0, function* () {
506
506
  const now = new Date();
507
- const transaction = yield repos.transaction.findById({
507
+ const transaction = yield repos.transaction.projectFieldsById({
508
508
  typeOf: factory.transactionType.MoneyTransfer,
509
509
  id: params.id
510
510
  }, ['typeOf', 'status', 'project']);
@@ -562,7 +562,7 @@ function searchAuthorizeActions(params) {
562
562
  */
563
563
  function exportTasksById(params) {
564
564
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
565
- const transaction = yield repos.transaction.findById({
565
+ const transaction = yield repos.transaction.projectFieldsById({
566
566
  typeOf: factory.transactionType.MoneyTransfer,
567
567
  id: params.id
568
568
  }, ['endDate', 'status', 'project', 'startDate', 'typeOf', 'object', 'potentialActions']);
@@ -41,7 +41,7 @@ export declare function validatePaymentMethods(params: {
41
41
  * 興行オファー適用条件確認
42
42
  */
43
43
  export declare function validateEventOffers(params: {
44
- order: factory.transaction.placeOrder.IOrderAsResult;
44
+ order: Pick<factory.transaction.placeOrder.IOrderAsResult, 'price'>;
45
45
  paymentMethods: factory.order.IReferencedInvoice[];
46
46
  authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'instrument' | 'object' | 'result'>[];
47
47
  }): void;
@@ -350,11 +350,12 @@ exports.validatePaymentMethods = validatePaymentMethods;
350
350
  // tslint:disable-next-line:max-func-body-length
351
351
  function validateEventOffers(params) {
352
352
  var _a, _b;
353
- const firstCreditCardPaymentMethodIdentifier = (_b = (_a = params.paymentMethods.find((referenceInvoice) => {
353
+ const { paymentMethods } = params;
354
+ const firstCreditCardPaymentMethodIdentifier = (_b = (_a = paymentMethods.find((referenceInvoice) => {
354
355
  return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
355
356
  || referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
356
357
  })) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
357
- const numCreditCardOrFaceToFacePaymentMethod = params.paymentMethods.filter((referenceInvoice) => {
358
+ const numCreditCardOrFaceToFacePaymentMethod = paymentMethods.filter((referenceInvoice) => {
358
359
  return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
359
360
  || referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
360
361
  }).length;
@@ -411,5 +412,38 @@ function validateEventOffers(params) {
411
412
  });
412
413
  }
413
414
  });
415
+ // check programMembershipUsed(2024-08-15~)
416
+ const programMembershipRequired = params.authorizeEventServiceOfferActions.reduce((a, b) => {
417
+ var _a, _b;
418
+ const programMembershipUsedfromResult = (_b = (_a = b.result) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.serviceOutput.programMembershipUsed;
419
+ if (Array.isArray(programMembershipUsedfromResult)) {
420
+ a.push(...programMembershipUsedfromResult);
421
+ }
422
+ return a;
423
+ }, []);
424
+ const satisfyProgramMembershipRequirement = programMembershipRequired.every(({ identifier, issuedThrough }) => {
425
+ let satisfyThisRequirement = false;
426
+ switch (issuedThrough.typeOf) {
427
+ case factory.product.ProductType.MembershipService:
428
+ // 検証の必要なし
429
+ satisfyThisRequirement = true;
430
+ break;
431
+ case factory.service.paymentService.PaymentServiceType.CreditCard:
432
+ satisfyThisRequirement = paymentMethods.some((paymentMethod) => paymentMethod.paymentMethodId === identifier
433
+ && paymentMethod.issuedThrough.id === issuedThrough.id
434
+ && paymentMethod.issuedThrough.typeOf === issuedThrough.typeOf);
435
+ break;
436
+ case factory.service.paymentService.PaymentServiceType.FaceToFace:
437
+ satisfyThisRequirement = paymentMethods.some((paymentMethod) => paymentMethod.paymentMethodId === identifier
438
+ && paymentMethod.issuedThrough.typeOf === issuedThrough.typeOf);
439
+ break;
440
+ default:
441
+ // no op
442
+ }
443
+ return satisfyThisRequirement;
444
+ });
445
+ if (!satisfyProgramMembershipRequirement) {
446
+ throw new factory.errors.Argument('Transaction', `programMembershipUsed requirement not satisfied`);
447
+ }
414
448
  }
415
449
  exports.validateEventOffers = validateEventOffers;
@@ -59,7 +59,7 @@ function confirm(params, options) {
59
59
  status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
60
60
  object: { orderDate: params.result.order.orderDate }
61
61
  })(repos);
62
- const transaction = yield repos.transaction.findById({ typeOf: factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
62
+ const transaction = yield repos.transaction.projectFieldsById({ typeOf: factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
63
63
  const confirmResult = yield processTransactionNotInProgress(transaction)(repos);
64
64
  if (confirmResult !== undefined) {
65
65
  return confirmResult;
@@ -293,7 +293,7 @@ function createResult(params, options) {
293
293
  price
294
294
  });
295
295
  (0, validation_1.validateEventOffers)({
296
- order: orderAsResult,
296
+ order: { price },
297
297
  paymentMethods,
298
298
  authorizeEventServiceOfferActions: params.authorizeEventServiceOfferActions
299
299
  });
@@ -18,7 +18,7 @@ const factory_1 = require("./exportTasks/factory");
18
18
  */
19
19
  function exportTasksById(params) {
20
20
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
21
- const transaction = yield repos.transaction.findById({
21
+ const transaction = yield repos.transaction.projectFieldsById({
22
22
  typeOf: factory.transactionType.PlaceOrder,
23
23
  id: params.id
24
24
  }, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
@@ -1,8 +1,8 @@
1
1
  import type { MemberRepo } from '../../../../repo/member';
2
2
  import type { ProjectMakesOfferRepo } from '../../../../repo/projectMakesOffer';
3
- import type { SellerRepo } from '../../../../repo/seller';
3
+ import type { ISellerWithId, SellerRepo } from '../../../../repo/seller';
4
4
  import * as factory from '../../../../factory';
5
- type ISeller = Pick<factory.seller.ISeller, 'id' | 'name' | 'project' | 'typeOf' | 'makesOffer' | 'additionalProperty'>;
5
+ type ISeller = Pick<ISellerWithId, 'id' | 'name' | 'project' | 'typeOf' | 'makesOffer' | 'additionalProperty'>;
6
6
  declare function validateStartRequest(params: {
7
7
  project: {
8
8
  id: string;
@@ -67,7 +67,7 @@ function validateStartRequest(params) {
67
67
  if (projectMakesOffer === undefined) {
68
68
  throw new factory.errors.Argument('project', 'project makes no offers');
69
69
  }
70
- const seller = (yield repos.seller.search({
70
+ const seller = (yield repos.seller.projectFields({
71
71
  limit: 1,
72
72
  page: 1,
73
73
  project: { id: { $eq: params.project.id } },
@@ -35,7 +35,7 @@ function start(params, options) {
35
35
  }
36
36
  catch (error) {
37
37
  // in case already locked
38
- const alreadyStartedTransaction = (yield repos.transaction.search({
38
+ const alreadyStartedTransaction = (yield repos.transaction.projectFields({
39
39
  limit: 1, page: 1,
40
40
  typeOf: factory.transactionType.PlaceOrder,
41
41
  project: { id: { $eq: startParams.project.id } },