@chevre/domain 24.0.0-alpha.1 → 24.0.0-alpha.11

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 (184) hide show
  1. package/lib/chevre/repo/acceptedPaymentMethod.js +1 -1
  2. package/lib/chevre/repo/additionalProperty.js +1 -1
  3. package/lib/chevre/repo/aggregateOffer.js +1 -1
  4. package/lib/chevre/repo/confirmationNumber.js +2 -4
  5. package/lib/chevre/repo/creativeWork.js +1 -1
  6. package/lib/chevre/repo/eventOffer.js +1 -1
  7. package/lib/chevre/repo/eventSeries.js +1 -1
  8. package/lib/chevre/repo/identity.js +1 -2
  9. package/lib/chevre/repo/issuer.js +2 -4
  10. package/lib/chevre/repo/message.js +1 -1
  11. package/lib/chevre/repo/mongoose/schemas/transaction.js +31 -0
  12. package/lib/chevre/repo/note.js +1 -1
  13. package/lib/chevre/repo/noteAboutOrder.js +1 -1
  14. package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
  15. package/lib/chevre/repo/offerItemCondition.js +1 -1
  16. package/lib/chevre/repo/order.js +1 -1
  17. package/lib/chevre/repo/orderInTransaction.d.ts +8 -0
  18. package/lib/chevre/repo/orderInTransaction.js +17 -4
  19. package/lib/chevre/repo/orderNumber.d.ts +3 -2
  20. package/lib/chevre/repo/orderNumber.js +25 -32
  21. package/lib/chevre/repo/place/movieTheater.js +1 -1
  22. package/lib/chevre/repo/place/seat.js +1 -1
  23. package/lib/chevre/repo/product.js +1 -1
  24. package/lib/chevre/repo/productOffer.js +1 -1
  25. package/lib/chevre/repo/project.js +1 -1
  26. package/lib/chevre/repo/reservation.js +1 -1
  27. package/lib/chevre/repo/role.js +1 -2
  28. package/lib/chevre/repo/seller.js +1 -1
  29. package/lib/chevre/repo/serviceOutputIdentifier.js +2 -4
  30. package/lib/chevre/repo/transaction/placeOrder.d.ts +140 -0
  31. package/lib/chevre/repo/transaction/placeOrder.js +528 -0
  32. package/lib/chevre/repo/transaction/returnOrder.d.ts +23 -0
  33. package/lib/chevre/repo/transaction/returnOrder.js +213 -0
  34. package/lib/chevre/repo/transaction.d.ts +11 -84
  35. package/lib/chevre/repo/transaction.js +331 -270
  36. package/lib/chevre/repo/transactionNumber.js +2 -4
  37. package/lib/chevre/repo/trip.js +1 -2
  38. package/lib/chevre/repository.d.ts +12 -0
  39. package/lib/chevre/repository.js +26 -1
  40. package/lib/chevre/service/account.js +14 -21
  41. package/lib/chevre/service/accountTransaction/deposit.js +2 -8
  42. package/lib/chevre/service/accountTransaction/transfer.js +2 -8
  43. package/lib/chevre/service/accountTransaction/withdraw.js +2 -8
  44. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +24 -32
  45. package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +2 -4
  46. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -23
  47. package/lib/chevre/service/assetTransaction/pay/check.js +6 -11
  48. package/lib/chevre/service/assetTransaction/pay/confirm.js +1 -2
  49. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
  50. package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +51 -3
  51. package/lib/chevre/service/assetTransaction/pay/start/factory.js +58 -21
  52. package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.d.ts +10 -0
  53. package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +88 -0
  54. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +53 -0
  55. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.js +56 -0
  56. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
  57. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +1 -11
  58. package/lib/chevre/service/assetTransaction/pay/start.js +8 -132
  59. package/lib/chevre/service/assetTransaction/refund.js +13 -20
  60. package/lib/chevre/service/assetTransaction/registerService.js +1 -7
  61. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +2 -4
  62. package/lib/chevre/service/assetTransaction/reserveCOA.js +2 -4
  63. package/lib/chevre/service/delivery/product/factory.js +1 -2
  64. package/lib/chevre/service/delivery/reservation/factory.js +1 -2
  65. package/lib/chevre/service/event/saveScreeningEvents.js +1 -0
  66. package/lib/chevre/service/event.js +0 -1
  67. package/lib/chevre/service/moneyTransfer.js +2 -2
  68. package/lib/chevre/service/notification/factory.js +1 -1
  69. package/lib/chevre/service/notification/notifyByEmail.js +50 -56
  70. package/lib/chevre/service/notification/sendEmailMessage.js +2 -3
  71. package/lib/chevre/service/notification/triggerWebhook.js +32 -37
  72. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +1 -2
  73. package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
  74. package/lib/chevre/service/offer/event/authorize.js +4 -4
  75. package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +2 -2
  76. package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
  77. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +0 -2
  78. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -0
  79. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -2
  80. package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
  81. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -2
  82. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
  83. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +1 -2
  84. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -2
  85. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +6 -6
  86. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +2 -2
  87. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -10
  88. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +2 -2
  89. package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +2 -2
  90. package/lib/chevre/service/offer/moneyTransfer/authorize.js +53 -57
  91. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +2 -2
  92. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +4 -1
  93. package/lib/chevre/service/offer/product.d.ts +3 -3
  94. package/lib/chevre/service/offer/product.js +4 -4
  95. package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
  96. package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
  97. package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +2 -2
  98. package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
  99. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +4 -4
  100. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +10 -19
  101. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
  102. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
  103. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
  104. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +2 -2
  105. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  106. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
  107. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -1
  108. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
  109. package/lib/chevre/service/order/onOrderUpdated.js +1 -2
  110. package/lib/chevre/service/order/payOrder.d.ts +2 -2
  111. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -2
  112. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -3
  113. package/lib/chevre/service/order/placeOrder.d.ts +2 -2
  114. package/lib/chevre/service/order/returnOrder.d.ts +2 -2
  115. package/lib/chevre/service/order/returnOrder.js +2 -2
  116. package/lib/chevre/service/order/sendOrder.d.ts +2 -2
  117. package/lib/chevre/service/order/sendOrder.js +1 -1
  118. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -3
  119. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +3 -3
  120. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
  121. package/lib/chevre/service/payment/any/fixOrderAsNeeded.d.ts +2 -2
  122. package/lib/chevre/service/payment/any/fixOrderAsNeeded.js +4 -8
  123. package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +2 -2
  124. package/lib/chevre/service/payment/any.d.ts +6 -6
  125. package/lib/chevre/service/payment/any.js +10 -11
  126. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -2
  127. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +1 -1
  128. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -2
  129. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3dsResult2recipe.d.ts +1 -1
  130. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCardResult2recipe.d.ts +1 -1
  131. package/lib/chevre/service/payment/creditCard/factory.d.ts +1 -1
  132. package/lib/chevre/service/payment/movieTicket/authorize.js +1 -1
  133. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -4
  134. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +4 -6
  135. package/lib/chevre/service/payment/movieTicket/voidTransaction.js +1 -2
  136. package/lib/chevre/service/payment/paymentCard.js +2 -4
  137. package/lib/chevre/service/report/telemetry.d.ts +4 -0
  138. package/lib/chevre/service/report/telemetry.js +7 -12
  139. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -6
  140. package/lib/chevre/service/task/acceptCOAOffer.js +6 -4
  141. package/lib/chevre/service/task/authorizePayment.js +4 -2
  142. package/lib/chevre/service/task/confirmPayTransaction.js +2 -2
  143. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -2
  144. package/lib/chevre/service/task/deleteTransaction.js +5 -1
  145. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -2
  146. package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -2
  147. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +3 -6
  148. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
  149. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
  150. package/lib/chevre/service/task/pay.js +1 -2
  151. package/lib/chevre/service/task/placeOrder.js +6 -4
  152. package/lib/chevre/service/task/publishPaymentUrl.js +4 -2
  153. package/lib/chevre/service/task/returnOrder.js +4 -4
  154. package/lib/chevre/service/task/returnPayTransaction.js +4 -3
  155. package/lib/chevre/service/task/sendOrder.js +2 -2
  156. package/lib/chevre/service/task/voidMoneyTransferTransaction.js +6 -3
  157. package/lib/chevre/service/task/voidPayTransaction.js +4 -2
  158. package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -3
  159. package/lib/chevre/service/task/voidReserveTransaction.js +5 -4
  160. package/lib/chevre/service/transaction/deleteTransaction.d.ts +4 -0
  161. package/lib/chevre/service/transaction/deleteTransaction.js +57 -15
  162. package/lib/chevre/service/transaction/moneyTransfer.js +15 -23
  163. package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
  164. package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -2
  165. package/lib/chevre/service/transaction/placeOrder/confirm.js +12 -13
  166. package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +2 -2
  167. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
  168. package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.d.ts → issueOrderNumberIfNotExist.d.ts} +4 -4
  169. package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.js → issueOrderNumberIfNotExist.js} +21 -13
  170. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +2 -2
  171. package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +3 -3
  172. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -2
  173. package/lib/chevre/service/transaction/placeOrder/start.d.ts +3 -3
  174. package/lib/chevre/service/transaction/placeOrder/start.js +2 -2
  175. package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +23 -0
  176. package/lib/chevre/service/transaction/placeOrder/updateAgent.js +126 -0
  177. package/lib/chevre/service/transaction/placeOrder.d.ts +2 -1
  178. package/lib/chevre/service/transaction/placeOrder.js +3 -1
  179. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -2
  180. package/lib/chevre/service/transaction/returnOrder/preStart/getReturnPolicyByProject.js +1 -1
  181. package/lib/chevre/service/transaction/returnOrder.js +4 -4
  182. package/lib/chevre/service/transaction.d.ts +5 -21
  183. package/lib/chevre/service/transaction.js +5 -111
  184. package/package.json +6 -18
@@ -9,7 +9,7 @@ const event_1 = require("../../repo/event");
9
9
  const order_1 = require("../../repo/order");
10
10
  const project_1 = require("../../repo/project");
11
11
  const task_1 = require("../../repo/task");
12
- const transaction_1 = require("../../repo/transaction");
12
+ // import { TransactionRepo } from '../../repo/transaction';
13
13
  const confirmPayTransaction_1 = require("../order/confirmPayTransaction");
14
14
  /**
15
15
  * タスク実行関数
@@ -29,7 +29,7 @@ function call(params) {
29
29
  event: new event_1.EventRepo(connection),
30
30
  project: new project_1.ProjectRepo(connection),
31
31
  task: new task_1.TaskRepo(connection),
32
- transaction: new transaction_1.TransactionRepo(connection)
32
+ // transaction: new TransactionRepo(connection)
33
33
  });
34
34
  };
35
35
  }
@@ -146,7 +146,6 @@ function createConfirmObject4COAByOrder(params) {
146
146
  }
147
147
  function fixOrderAsPurpose(params) {
148
148
  return async (repos) => {
149
- let order;
150
149
  const purposeOrderNumber = params.purpose.orderNumber;
151
150
  const orders = await repos.order.projectFields({
152
151
  limit: 1,
@@ -154,7 +153,7 @@ function fixOrderAsPurpose(params) {
154
153
  project: { id: { $eq: params.project.id } },
155
154
  orderNumbers: [purposeOrderNumber]
156
155
  }, { inclusion: ['customer', 'orderNumber', 'typeOf'] });
157
- order = orders.shift();
156
+ const order = orders.shift();
158
157
  if (order === undefined) {
159
158
  throw new factory.errors.NotFound('Order as purpose');
160
159
  }
@@ -37,6 +37,8 @@ const reservation_1 = require("../../repo/reservation");
37
37
  const setting_1 = require("../../repo/setting");
38
38
  const task_1 = require("../../repo/task");
39
39
  const transaction_1 = require("../../repo/transaction");
40
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
41
+ const returnOrder_1 = require("../../repo/transaction/returnOrder");
40
42
  const TransactionService = __importStar(require("../transaction"));
41
43
  /**
42
44
  * タスク実行関数
@@ -56,7 +58,9 @@ function call(data) {
56
58
  reservation: new reservation_1.ReservationRepo(connection),
57
59
  setting: new setting_1.SettingRepo(connection),
58
60
  task: new task_1.TaskRepo(connection),
59
- transaction: new transaction_1.TransactionRepo(connection)
61
+ transaction: new transaction_1.TransactionRepo(connection),
62
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
63
+ returnOrder: new returnOrder_1.ReturnOrderRepo(connection)
60
64
  });
61
65
  };
62
66
  }
@@ -6,7 +6,8 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
6
6
  const order_1 = require("../../repo/order");
7
7
  const setting_1 = require("../../repo/setting");
8
8
  const task_1 = require("../../repo/task");
9
- const transaction_1 = require("../../repo/transaction");
9
+ // import { TransactionRepo } from '../../repo/transaction';
10
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
10
11
  const onAssetTransactionStatusChanged_1 = require("../order/onAssetTransactionStatusChanged");
11
12
  /**
12
13
  * タスク実行関数
@@ -19,7 +20,8 @@ function call(data) {
19
20
  order: new order_1.OrderRepo(connection),
20
21
  setting: new setting_1.SettingRepo(connection),
21
22
  task: new task_1.TaskRepo(connection),
22
- transaction: new transaction_1.TransactionRepo(connection)
23
+ // transaction: new TransactionRepo(connection),
24
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
23
25
  }, settings);
24
26
  };
25
27
  }
@@ -5,7 +5,7 @@ const acceptedOffer_1 = require("../../repo/acceptedOffer");
5
5
  const order_1 = require("../../repo/order");
6
6
  const setting_1 = require("../../repo/setting");
7
7
  const task_1 = require("../../repo/task");
8
- const transaction_1 = require("../../repo/transaction");
8
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
9
9
  const payOrder_1 = require("../order/payOrder");
10
10
  /**
11
11
  * タスク実行関数
@@ -17,7 +17,7 @@ function call(data) {
17
17
  order: new order_1.OrderRepo(connection),
18
18
  setting: new setting_1.SettingRepo(connection),
19
19
  task: new task_1.TaskRepo(connection),
20
- transaction: new transaction_1.TransactionRepo(connection)
20
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
21
21
  }, settings);
22
22
  };
23
23
  }
@@ -40,21 +40,18 @@ function deleteResourcesByProduct(params) {
40
40
  let deleteResult;
41
41
  const action = await repos.action.start(deleteActionAttributes);
42
42
  try {
43
- let deleteEventResult;
44
- let updateOfferResult;
45
- let deleteNoteResult;
46
43
  // 興行を設定されたイベント削除
47
- deleteEventResult = await repos.event.deleteManyEventsByItemOfferedId({
44
+ const deleteEventResult = await repos.event.deleteManyEventsByItemOfferedId({
48
45
  project: { id: params.project.id },
49
46
  offers: { itemOffered: { id: { $in: [productId] } } }
50
47
  });
51
48
  // アドオンから除外
52
- updateOfferResult = await repos.aggregateOffer.pullAddOns({
49
+ const updateOfferResult = await repos.aggregateOffer.pullAddOns({
53
50
  project: { id: params.project.id },
54
51
  addOn: { itemOffered: { id: { $in: [productId] } } }
55
52
  });
56
53
  // メモを削除(2025-09-18~)
57
- deleteNoteResult = await repos.note.deleteNotesByAbout({
54
+ const deleteNoteResult = await repos.note.deleteNotesByAbout({
58
55
  about: { id: productId, typeOf: params.typeOf }
59
56
  });
60
57
  deleteResult = { deleteEventResult, updateOfferResult, deleteNoteResult };
@@ -34,7 +34,7 @@ function createInformOfferCatalogTasks(params, setting) {
34
34
  if (params.ids.length === 0) {
35
35
  return;
36
36
  }
37
- let offerCatalogs = [];
37
+ let offerCatalogs;
38
38
  if (params.isOfferCatalogItem) {
39
39
  offerCatalogs = await repos.offerCatalogItem.projectFields({ id: { $in: params.ids } }, ['identifier', 'name', 'numberOfItems', 'project', 'typeOf']);
40
40
  }
@@ -46,7 +46,7 @@ function syncOfferCatalog(params) {
46
46
  }
47
47
  else {
48
48
  for (const offerCatalogId of params.ids) {
49
- let offerCatalogs = [];
49
+ let offerCatalogs;
50
50
  if (params.isOfferCatalogItem) {
51
51
  offerCatalogs = await repos.offerCatalogItem.projectFields({ id: { $in: [offerCatalogId] } }, ['id', 'itemListElementTypeOf']);
52
52
  }
@@ -47,8 +47,7 @@ function call(params) {
47
47
  if (redisClient === undefined) {
48
48
  throw new factory.errors.Argument('settings', 'redisClient required');
49
49
  }
50
- let payActionAttributes;
51
- payActionAttributes = await (0, payByTask_1.payTask2payActionAttributes)({
50
+ const payActionAttributes = await (0, payByTask_1.payTask2payActionAttributes)({
52
51
  ...params.data,
53
52
  sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
54
53
  })({
@@ -8,14 +8,15 @@ const order_1 = require("../../repo/order");
8
8
  const orderInTransaction_1 = require("../../repo/orderInTransaction");
9
9
  const setting_1 = require("../../repo/setting");
10
10
  const task_1 = require("../../repo/task");
11
- const transaction_1 = require("../../repo/transaction");
12
- const placeOrder_1 = require("../order/placeOrder");
11
+ // import { TransactionRepo } from '../../repo/transaction';
12
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
13
+ const placeOrder_2 = require("../order/placeOrder");
13
14
  /**
14
15
  * タスク実行関数
15
16
  */
16
17
  function call(data) {
17
18
  return async ({ connection, settings }) => {
18
- await (0, placeOrder_1.placeOrder)({
19
+ await (0, placeOrder_2.placeOrder)({
19
20
  ...data,
20
21
  useOnOrderStatusChanged: true
21
22
  })({
@@ -26,7 +27,8 @@ function call(data) {
26
27
  orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
27
28
  setting: new setting_1.SettingRepo(connection),
28
29
  task: new task_1.TaskRepo(connection),
29
- transaction: new transaction_1.TransactionRepo(connection)
30
+ // transaction: new TransactionRepo(connection),
31
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
30
32
  }, settings);
31
33
  };
32
34
  }
@@ -37,7 +37,8 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
37
37
  const project_1 = require("../../repo/project");
38
38
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
39
39
  const ticket_1 = require("../../repo/ticket");
40
- const transaction_1 = require("../../repo/transaction");
40
+ // import { TransactionRepo } from '../../repo/transaction';
41
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
41
42
  const transactionNumber_1 = require("../../repo/transactionNumber");
42
43
  // import { TransactionProcessRepo } from '../../repo/transactionProcess';
43
44
  const any_1 = require("../payment/any");
@@ -73,7 +74,8 @@ function call(params) {
73
74
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
74
75
  project: new project_1.ProjectRepo(connection),
75
76
  ticket: new ticket_1.TicketRepo(connection),
76
- transaction: new transaction_1.TransactionRepo(connection),
77
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
78
+ // transaction: new TransactionRepo(connection),
77
79
  transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
78
80
  }, settings);
79
81
  }
@@ -7,14 +7,14 @@ const order_1 = require("../../repo/order");
7
7
  const ownershipInfo_1 = require("../../repo/ownershipInfo");
8
8
  const setting_1 = require("../../repo/setting");
9
9
  const task_1 = require("../../repo/task");
10
- const transaction_1 = require("../../repo/transaction");
11
- const returnOrder_1 = require("../order/returnOrder");
10
+ const returnOrder_1 = require("../../repo/transaction/returnOrder");
11
+ const returnOrder_2 = require("../order/returnOrder");
12
12
  /**
13
13
  * タスク実行関数
14
14
  */
15
15
  function call(data) {
16
16
  return async ({ connection }) => {
17
- await (0, returnOrder_1.returnOrder)({
17
+ await (0, returnOrder_2.returnOrder)({
18
18
  ...data,
19
19
  useOnOrderStatusChanged: true
20
20
  })({
@@ -24,7 +24,7 @@ function call(data) {
24
24
  ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
25
25
  setting: new setting_1.SettingRepo(connection),
26
26
  task: new task_1.TaskRepo(connection),
27
- transaction: new transaction_1.TransactionRepo(connection)
27
+ returnOrder: new returnOrder_1.ReturnOrderRepo(connection)
28
28
  }
29
29
  // settings
30
30
  );
@@ -36,7 +36,8 @@ const paymentService_1 = require("../../repo/paymentService");
36
36
  const potentialAction_1 = require("../../repo/potentialAction");
37
37
  const product_1 = require("../../repo/product");
38
38
  const task_1 = require("../../repo/task");
39
- const transaction_1 = require("../../repo/transaction");
39
+ // import { TransactionRepo } from '../../repo/transaction';
40
+ const returnOrder_1 = require("../../repo/transaction/returnOrder");
40
41
  const transactionNumber_1 = require("../../repo/transactionNumber");
41
42
  const RefundTransactionService = __importStar(require("../assetTransaction/refund"));
42
43
  /**
@@ -58,7 +59,7 @@ function call(params) {
58
59
  potentialAction: new potentialAction_1.PotentialActionRepo(connection),
59
60
  product: new product_1.ProductRepo(connection),
60
61
  task: new task_1.TaskRepo(connection),
61
- transaction: new transaction_1.TransactionRepo(connection),
62
+ returnOrder: new returnOrder_1.ReturnOrderRepo(connection),
62
63
  transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
63
64
  });
64
65
  };
@@ -104,7 +105,7 @@ function fixOrderAndTransaction(params) {
104
105
  }
105
106
  // const orderNumber = params.purpose.orderNumber;
106
107
  const orderNumber = orderByPaymentMethodId.orderNumber;
107
- const returnOrderTransaction = (await repos.transaction.projectFields({
108
+ const returnOrderTransaction = (await repos.returnOrder.findReturnOrderTransactions({
108
109
  limit: 1,
109
110
  page: 1,
110
111
  typeOf: factory.transactionType.ReturnOrder,
@@ -31,7 +31,7 @@ const order_1 = require("../../repo/order");
31
31
  const ownershipInfo_1 = require("../../repo/ownershipInfo");
32
32
  const setting_1 = require("../../repo/setting");
33
33
  const task_1 = require("../../repo/task");
34
- const transaction_1 = require("../../repo/transaction");
34
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
35
35
  const sendOrder_1 = require("../order/sendOrder");
36
36
  /**
37
37
  * タスク実行関数
@@ -57,7 +57,7 @@ function call(data) {
57
57
  ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
58
58
  setting: new setting_1.SettingRepo(connection),
59
59
  task: new task_1.TaskRepo(connection),
60
- transaction: new transaction_1.TransactionRepo(connection)
60
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
61
61
  }, settings);
62
62
  };
63
63
  }
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const action_1 = require("../../repo/action");
5
5
  const assetTransaction_1 = require("../../repo/assetTransaction");
6
- const transaction_1 = require("../../repo/transaction");
6
+ // import { TransactionRepo } from '../../repo/transaction';
7
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
7
8
  const voidTransaction_1 = require("../offer/moneyTransfer/voidTransaction");
8
9
  /**
9
10
  * タスク実行関数
@@ -12,11 +13,13 @@ function call(data) {
12
13
  return async ({ connection }) => {
13
14
  const actionRepo = new action_1.ActionRepo(connection);
14
15
  const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
15
- const transactionRepo = new transaction_1.TransactionRepo(connection);
16
+ const placeOrderRepo = new placeOrder_1.PlaceOrderRepo(connection);
17
+ // const transactionRepo = new TransactionRepo(connection);
16
18
  await (0, voidTransaction_1.voidTransaction)(data)({
17
19
  action: actionRepo,
18
20
  assetTransaction: assetTransactionRepo,
19
- transaction: transactionRepo
21
+ placeOrder: placeOrderRepo
22
+ // transaction: transactionRepo
20
23
  });
21
24
  };
22
25
  }
@@ -8,7 +8,8 @@ const paymentService_1 = require("../../repo/paymentService");
8
8
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
9
9
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
10
10
  const task_1 = require("../../repo/task");
11
- const transaction_1 = require("../../repo/transaction");
11
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
12
+ // import { TransactionRepo } from '../../repo/transaction';
12
13
  const any_1 = require("../payment/any");
13
14
  /**
14
15
  * タスク実行関数
@@ -27,7 +28,8 @@ function call(params) {
27
28
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
28
29
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
29
30
  task: new task_1.TaskRepo(connection),
30
- transaction: new transaction_1.TransactionRepo(connection)
31
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
32
+ // transaction: new TransactionRepo(connection)
31
33
  }
32
34
  // settings
33
35
  );
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const action_1 = require("../../repo/action");
5
5
  const assetTransaction_1 = require("../../repo/assetTransaction");
6
- const transaction_1 = require("../../repo/transaction");
6
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
7
7
  const product_1 = require("../offer/product");
8
8
  /**
9
9
  * タスク実行関数
@@ -12,11 +12,11 @@ function call(data) {
12
12
  return async ({ connection }) => {
13
13
  const actionRepo = new action_1.ActionRepo(connection);
14
14
  const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
15
- const transactionRepo = new transaction_1.TransactionRepo(connection);
15
+ const placeOrderRepo = new placeOrder_1.PlaceOrderRepo(connection);
16
16
  await (0, product_1.voidTransaction)(data)({
17
17
  action: actionRepo,
18
18
  assetTransaction: assetTransactionRepo,
19
- transaction: transactionRepo
19
+ placeOrder: placeOrderRepo
20
20
  });
21
21
  };
22
22
  }
@@ -36,8 +36,8 @@ const reserveInterface_1 = require("../../repo/reserveInterface");
36
36
  const setting_1 = require("../../repo/setting");
37
37
  const stockHolder_1 = require("../../repo/stockHolder");
38
38
  const task_1 = require("../../repo/task");
39
- const transaction_1 = require("../../repo/transaction");
40
- // import { TransactionProcessRepo } from '../../repo/transactionProcess';
39
+ // import { TransactionRepo } from '../../repo/transaction';
40
+ const placeOrder_1 = require("../../repo/transaction/placeOrder");
41
41
  let coaAuthClientCreated = false;
42
42
  let coaAuthClient = new COA.auth.RefreshToken({
43
43
  endpoint: '', // 使用されないので空文字でok
@@ -87,11 +87,12 @@ function call(params) {
87
87
  reservation: new reservation_1.ReservationRepo(connection),
88
88
  setting: new setting_1.SettingRepo(connection),
89
89
  task: new task_1.TaskRepo(connection),
90
- transaction: new transaction_1.TransactionRepo(connection),
90
+ placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
91
+ // transaction: new TransactionRepo(connection),
91
92
  reserveService
92
93
  }, settings);
93
94
  }
94
- catch (error) {
95
+ catch (error) { // eslint-disable-line no-useless-catch
95
96
  throw error;
96
97
  }
97
98
  finally {
@@ -12,6 +12,8 @@ import type { ReservationRepo } from '../../repo/reservation';
12
12
  import type { SettingRepo } from '../../repo/setting';
13
13
  import type { TaskRepo } from '../../repo/task';
14
14
  import type { TransactionRepo } from '../../repo/transaction';
15
+ import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
16
+ import type { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
15
17
  /**
16
18
  * 取引に関わるリソースを削除する
17
19
  * 冪等性を確保すること
@@ -30,4 +32,6 @@ export declare function deleteTransaction(params: factory.task.IData<factory.tas
30
32
  setting: SettingRepo;
31
33
  task: TaskRepo;
32
34
  transaction: TransactionRepo;
35
+ placeOrder: PlaceOrderRepo;
36
+ returnOrder: ReturnOrderRepo;
33
37
  }) => Promise<void>;
@@ -50,17 +50,42 @@ function createDeleteTransactionTasksByAgentId(params) {
50
50
  // agentIdによる全取引についてDeleteTransactionタスクを作成する
51
51
  if (typeof agentIdSpecified === 'string' && agentIdSpecified.length > 0) {
52
52
  const transactionTypeOf = params.object.typeOf;
53
- const transactions = await repos.transaction.projectFields({
54
- project: { id: { $eq: params.object.project.id } },
55
- agent: {
56
- ids: [agentIdSpecified],
57
- typeOf: factory.personType.Person
58
- },
59
- typeOf: transactionTypeOf,
60
- inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
61
- });
53
+ let transactions;
54
+ if (transactionTypeOf === factory.transactionType.PlaceOrder) {
55
+ transactions = await repos.placeOrder.findPlaceOrderTransactions({
56
+ project: { id: { $eq: params.object.project.id } },
57
+ agent: {
58
+ ids: [agentIdSpecified],
59
+ typeOf: factory.personType.Person
60
+ },
61
+ typeOf: transactionTypeOf,
62
+ inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
63
+ });
64
+ }
65
+ else if (transactionTypeOf === factory.transactionType.ReturnOrder) {
66
+ transactions = await repos.returnOrder.findReturnOrderTransactions({
67
+ project: { id: { $eq: params.object.project.id } },
68
+ agent: {
69
+ ids: [agentIdSpecified],
70
+ typeOf: factory.personType.Person
71
+ },
72
+ typeOf: transactionTypeOf,
73
+ inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
74
+ });
75
+ }
76
+ else {
77
+ transactions = await repos.transaction.findMoneyTransferTransactions({
78
+ project: { id: { $eq: params.object.project.id } },
79
+ agent: {
80
+ ids: [agentIdSpecified],
81
+ typeOf: factory.personType.Person
82
+ },
83
+ typeOf: transactionTypeOf,
84
+ inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
85
+ });
86
+ }
62
87
  const deleteAt = new Date();
63
- let deleteTransactionTasks = [];
88
+ let deleteTransactionTasks;
64
89
  switch (transactionTypeOf) {
65
90
  case factory.transactionType.PlaceOrder:
66
91
  deleteTransactionTasks = transactions.map((transaction) => {
@@ -166,11 +191,28 @@ function deleteTransactionById(params) {
166
191
  if (typeof deletingTransactionId !== 'string' || deletingTransactionId.length === 0) {
167
192
  throw new factory.errors.ArgumentNull('object.id');
168
193
  }
169
- const transaction = (await repos.transaction.projectFields({
170
- ids: [deletingTransactionId],
171
- typeOf: params.object.typeOf,
172
- inclusion: ['typeOf', 'project', 'status', 'result']
173
- })).shift();
194
+ let transaction;
195
+ if (params.object.typeOf === factory.transactionType.PlaceOrder) {
196
+ transaction = (await repos.placeOrder.findPlaceOrderTransactions({
197
+ ids: [deletingTransactionId],
198
+ typeOf: params.object.typeOf,
199
+ inclusion: ['typeOf', 'project', 'status', 'result']
200
+ })).shift();
201
+ }
202
+ else if (params.object.typeOf === factory.transactionType.ReturnOrder) {
203
+ transaction = (await repos.returnOrder.findReturnOrderTransactions({
204
+ ids: [deletingTransactionId],
205
+ typeOf: params.object.typeOf,
206
+ inclusion: ['typeOf', 'project', 'status', 'result']
207
+ })).shift();
208
+ }
209
+ else {
210
+ transaction = (await repos.transaction.findMoneyTransferTransactions({
211
+ ids: [deletingTransactionId],
212
+ typeOf: params.object.typeOf,
213
+ inclusion: ['typeOf', 'project', 'status', 'result']
214
+ })).shift();
215
+ }
174
216
  if (transaction === undefined) {
175
217
  // すでに削除済
176
218
  return;
@@ -72,23 +72,17 @@ function start(params) {
72
72
  const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
73
73
  // 取引開始
74
74
  const startParams = (0, factory_2.createStartParams)(params, passport, seller, amount, fromLocation, toLocation, transactionNumber);
75
- let transaction;
76
- try {
77
- transaction = await repos.transaction.start(startParams);
78
- await authorizePaymentCard({
79
- transaction: {
80
- ...transaction,
81
- object: startParams.object,
82
- seller: startParams.seller,
83
- agent: startParams.agent,
84
- project: startParams.project,
85
- typeOf: startParams.typeOf
86
- }
87
- })(repos);
88
- }
89
- catch (error) {
90
- throw error;
91
- }
75
+ const transaction = await repos.transaction.startNoPlaceOrder(startParams);
76
+ await authorizePaymentCard({
77
+ transaction: {
78
+ ...transaction,
79
+ object: startParams.object,
80
+ seller: startParams.seller,
81
+ agent: startParams.agent,
82
+ project: startParams.project,
83
+ typeOf: startParams.typeOf
84
+ }
85
+ })(repos);
92
86
  return transaction;
93
87
  };
94
88
  }
@@ -208,7 +202,7 @@ function processAuthorizePaymentCard(params) {
208
202
  // jwt: JWTCredentials;
209
203
  // }
210
204
  ) => {
211
- const transaction = await repos.transaction.projectFieldsInProgressById({
205
+ const transaction = await repos.transaction.findMoneyTransferInProgressById({
212
206
  typeOf: factory.transactionType.MoneyTransfer,
213
207
  id: params.purpose.id
214
208
  }, ['agent', 'project', 'recipient', 'seller', 'typeOf', 'object']);
@@ -467,7 +461,6 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
467
461
  else {
468
462
  // fromLocationが注文の場合に対応
469
463
  if (fromLocation.typeOf === factory.order.OrderType.Order) {
470
- fromLocation = fromLocation;
471
464
  // 注文検索
472
465
  const orders = await repos.order.projectFields({
473
466
  limit: 1,
@@ -523,7 +516,6 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
523
516
  else {
524
517
  // fromLocationが注文の場合に対応
525
518
  if (toLocation.typeOf === factory.order.OrderType.Order) {
526
- toLocation = toLocation;
527
519
  // 注文検索
528
520
  const orders = await repos.order.projectFields({
529
521
  limit: 1,
@@ -574,7 +566,7 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
574
566
  function confirm(params) {
575
567
  return async (repos) => {
576
568
  const now = new Date();
577
- const transaction = await repos.transaction.projectFieldsById({
569
+ const transaction = await repos.transaction.projectFieldsByIdNoPlaceOrder({
578
570
  typeOf: factory.transactionType.MoneyTransfer,
579
571
  id: params.id
580
572
  }, ['typeOf', 'status', 'project']);
@@ -599,7 +591,7 @@ function confirm(params) {
599
591
  // ポストアクションを作成
600
592
  const potentialActions = await (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
601
593
  // 取引確定
602
- await repos.transaction.confirm({
594
+ await repos.transaction.confirmNoPlaceOrder({
603
595
  typeOf: factory.transactionType.MoneyTransfer,
604
596
  id: transaction.id,
605
597
  result: {},
@@ -633,7 +625,7 @@ function exportTasksById(params) {
633
625
  return async (repos
634
626
  // settings: Settings
635
627
  ) => {
636
- const transaction = await repos.transaction.projectFieldsById({
628
+ const transaction = await repos.transaction.projectFieldsByIdNoPlaceOrder({
637
629
  typeOf: factory.transactionType.MoneyTransfer,
638
630
  id: params.id
639
631
  }, ['endDate', 'status', 'project', 'startDate', 'typeOf', 'object', 'potentialActions']);
@@ -33,7 +33,7 @@ function publishCode(params) {
33
33
  };
34
34
  const issuedBy = { id: params.object.seller.id, typeOf: factory.organizationType.Corporation };
35
35
  let authorizations;
36
- try {
36
+ try { // eslint-disable-line no-useless-catch
37
37
  authorizations = await repos.authorization.issueAuthorization([{
38
38
  project: { id: params.project.id, typeOf: factory.organizationType.Project },
39
39
  object: authorizationObject,
@@ -8,7 +8,7 @@ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
8
8
  import type { OrderNumberRepo } from '../../../repo/orderNumber';
9
9
  import type { ProjectRepo } from '../../../repo/project';
10
10
  import type { SettingRepo } from '../../../repo/setting';
11
- import type { TransactionRepo } from '../../../repo/transaction';
11
+ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
12
12
  import * as factory from '../../../factory';
13
13
  import { placeOrder as PlaceOrderFactory } from '../../../factory/transaction';
14
14
  interface IConfirmOperationRepos {
@@ -18,7 +18,7 @@ interface IConfirmOperationRepos {
18
18
  emailMessage?: EmailMessageRepo;
19
19
  message: MessageRepo;
20
20
  project: ProjectRepo;
21
- transaction: TransactionRepo;
21
+ placeOrder: PlaceOrderRepo;
22
22
  orderInTransaction: OrderInTransactionRepo;
23
23
  orderNumber: OrderNumberRepo;
24
24
  confirmationNumber: ConfirmationNumberRepo;