@chevre/domain 21.20.0-alpha.8 → 21.20.0

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 (230) hide show
  1. package/example/src/chevre/findTransactionById.ts +21 -0
  2. package/example/src/chevre/importCategoryCodesFromCOA.ts +2 -1
  3. package/example/src/chevre/importOffersFromCOA.ts +2 -1
  4. package/example/src/chevre/migrateActionInstrumentTransactionNumber.ts +93 -0
  5. package/example/src/chevre/migrateDeleteTransactionTasks.ts +119 -0
  6. package/example/src/chevre/migrateEventMakesOfferAvailableAtOrFrom.ts +87 -0
  7. package/example/src/chevre/migrateIAMMemberPOSRoles.ts +3 -2
  8. package/example/src/chevre/migrateOfferAvailableAtOrFrom.ts +63 -0
  9. package/example/src/chevre/{migrateOrderPaymentMethodIdentifier.ts → migrateOrderAcceptedOfferSerialNumber.ts} +18 -19
  10. package/example/src/chevre/onAssetTransactionStatusChanged.ts +36 -0
  11. package/example/src/chevre/retryTasks.ts +39 -0
  12. package/example/src/chevre/searchActions.ts +13 -7
  13. package/example/src/chevre/searchOrderAcceptedOffers.ts +13 -3
  14. package/example/src/chevre/searchOrders.ts +13 -15
  15. package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +28 -0
  16. package/example/src/chevre/sendOrder.ts +37 -0
  17. package/example/src/chevre/transaction/processPlaceOrder.ts +2 -3
  18. package/example/src/verifyToken.ts +44 -0
  19. package/lib/chevre/credentials.d.ts +2 -0
  20. package/lib/chevre/credentials.js +4 -2
  21. package/lib/chevre/errorHandler.js +3 -0
  22. package/lib/chevre/factory/order.d.ts +1 -0
  23. package/lib/chevre/factory/order.js +2 -1
  24. package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
  25. package/lib/chevre/factory/transaction.d.ts +10 -1
  26. package/lib/chevre/repo/acceptedOffer.d.ts +58 -2
  27. package/lib/chevre/repo/acceptedOffer.js +100 -4
  28. package/lib/chevre/repo/accountingReport.d.ts +33 -7
  29. package/lib/chevre/repo/accountingReport.js +157 -5
  30. package/lib/chevre/repo/action.d.ts +32 -8
  31. package/lib/chevre/repo/action.js +114 -54
  32. package/lib/chevre/repo/event.d.ts +20 -0
  33. package/lib/chevre/repo/event.js +22 -0
  34. package/lib/chevre/repo/member.d.ts +8 -1
  35. package/lib/chevre/repo/member.js +7 -1
  36. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +2 -1
  37. package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
  38. package/lib/chevre/repo/mongoose/schemas/action.js +25 -11
  39. package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
  40. package/lib/chevre/repo/mongoose/schemas/order.js +38 -11
  41. package/lib/chevre/repo/offer.d.ts +42 -0
  42. package/lib/chevre/repo/offer.js +35 -0
  43. package/lib/chevre/repo/order.js +43 -20
  44. package/lib/chevre/repo/orderInTransaction.d.ts +44 -0
  45. package/lib/chevre/repo/orderInTransaction.js +164 -0
  46. package/lib/chevre/repo/paymentServiceProvider.js +2 -1
  47. package/lib/chevre/repo/person.js +1 -4
  48. package/lib/chevre/repo/task.d.ts +26 -3
  49. package/lib/chevre/repo/task.js +61 -46
  50. package/lib/chevre/repo/transaction.d.ts +2 -2
  51. package/lib/chevre/repo/transaction.js +13 -36
  52. package/lib/chevre/repository.d.ts +5 -0
  53. package/lib/chevre/repository.js +15 -2
  54. package/lib/chevre/service/aggregation/event/importFromCOA.js +5 -5
  55. package/lib/chevre/service/assetTransaction/pay/factory.js +1 -6
  56. package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.d.ts +9 -0
  57. package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.js +143 -0
  58. package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +11 -3
  59. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +4 -165
  60. package/lib/chevre/service/assetTransaction/pay.d.ts +21 -6
  61. package/lib/chevre/service/assetTransaction/pay.js +64 -23
  62. package/lib/chevre/service/assetTransaction/reserve/factory.js +11 -14
  63. package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +19 -0
  64. package/lib/chevre/service/assetTransaction/reserveCOA.js +46 -0
  65. package/lib/chevre/service/code.js +1 -1
  66. package/lib/chevre/service/delivery.js +2 -2
  67. package/lib/chevre/service/event/createEvent.js +1 -1
  68. package/lib/chevre/service/event.js +16 -24
  69. package/lib/chevre/service/moneyTransfer.js +1 -1
  70. package/lib/chevre/service/notification.js +71 -66
  71. package/lib/chevre/service/offer/any.d.ts +35 -0
  72. package/lib/chevre/service/offer/any.js +67 -0
  73. package/lib/chevre/service/offer/event/authorize.d.ts +7 -0
  74. package/lib/chevre/service/offer/event/authorize.js +27 -17
  75. package/lib/chevre/service/offer/event/cancel.d.ts +2 -0
  76. package/lib/chevre/service/offer/event/cancel.js +13 -1
  77. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  78. package/lib/chevre/service/offer/event/factory.js +11 -22
  79. package/lib/chevre/service/offer/event/importFromCOA.js +6 -8
  80. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  81. package/lib/chevre/service/offer/event/voidTransaction.js +24 -7
  82. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +54 -0
  83. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +138 -0
  84. package/lib/chevre/service/offer/eventServiceByCOA/cancel.d.ts +39 -0
  85. package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +59 -0
  86. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +25 -0
  87. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +165 -0
  88. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +10 -23
  89. package/lib/chevre/service/offer/eventServiceByCOA.d.ts +4 -89
  90. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -292
  91. package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +10 -1
  92. package/lib/chevre/service/offer/moneyTransfer/authorize.js +49 -3
  93. package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -1
  94. package/lib/chevre/service/offer/moneyTransfer/settleTransaction.d.ts +2 -0
  95. package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +47 -2
  96. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
  97. package/lib/chevre/service/offer/product/factory.js +2 -5
  98. package/lib/chevre/service/offer/product.d.ts +2 -0
  99. package/lib/chevre/service/offer/product.js +11 -23
  100. package/lib/chevre/service/order/confirmPayTransaction.d.ts +3 -1
  101. package/lib/chevre/service/order/confirmPayTransaction.js +5 -5
  102. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +1 -1
  103. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +12 -1
  104. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +206 -7
  105. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  106. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +1 -1
  107. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +51 -53
  108. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +1 -1
  109. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +10 -25
  110. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +16 -0
  111. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +91 -0
  112. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +8 -0
  113. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +37 -0
  114. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +12 -0
  115. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +115 -0
  116. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +19 -1
  117. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +8 -0
  118. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +41 -0
  119. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +6 -10
  120. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +116 -92
  121. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -1
  122. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +81 -84
  123. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  124. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
  125. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +62 -1
  126. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +3 -1
  127. package/lib/chevre/service/order/onOrderStatusChanged.js +5 -1
  128. package/lib/chevre/service/order/placeOrder.d.ts +3 -1
  129. package/lib/chevre/service/order/placeOrder.js +157 -50
  130. package/lib/chevre/service/order/returnOrder.js +25 -16
  131. package/lib/chevre/service/order/sendOrder.d.ts +5 -0
  132. package/lib/chevre/service/order/sendOrder.js +67 -33
  133. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  134. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +3 -1
  135. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.js +15 -9
  136. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +3 -1
  137. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.js +8 -5
  138. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
  139. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  140. package/lib/chevre/service/payment/any.d.ts +6 -5
  141. package/lib/chevre/service/payment/any.js +3 -2
  142. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  143. package/lib/chevre/service/payment/creditCard.js +62 -68
  144. package/lib/chevre/service/payment/faceToFace.d.ts +1 -5
  145. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +0 -2
  146. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -0
  147. package/lib/chevre/service/payment/movieTicket/validation.d.ts +0 -2
  148. package/lib/chevre/service/payment/movieTicket.d.ts +1 -7
  149. package/lib/chevre/service/payment/movieTicket.js +1 -1
  150. package/lib/chevre/service/payment/paymentCard.d.ts +1 -3
  151. package/lib/chevre/service/payment/paymentCard.js +6 -6
  152. package/lib/chevre/service/payment.d.ts +5 -0
  153. package/lib/chevre/service/payment.js +40 -5
  154. package/lib/chevre/service/product.js +1 -1
  155. package/lib/chevre/service/reserve/cancelReservation.js +2 -2
  156. package/lib/chevre/service/reserve/checkInReservation.d.ts +1 -3
  157. package/lib/chevre/service/reserve/checkInReservation.js +6 -5
  158. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  159. package/lib/chevre/service/reserve/factory.js +0 -8
  160. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +1 -1
  161. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +4 -4
  162. package/lib/chevre/service/reserve/searchByOrder.js +2 -1
  163. package/lib/chevre/service/reserve/useReservation.d.ts +1 -3
  164. package/lib/chevre/service/reserve/useReservation.js +10 -9
  165. package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -0
  166. package/lib/chevre/service/task/confirmMoneyTransfer.js +4 -4
  167. package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
  168. package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
  169. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +30 -8
  170. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -1
  171. package/lib/chevre/service/task/confirmReserveTransaction.js +176 -29
  172. package/lib/chevre/service/task/createAccountingReport.d.ts +6 -0
  173. package/lib/chevre/service/task/createAccountingReport.js +80 -0
  174. package/lib/chevre/service/task/importOffersFromCOA.js +2 -1
  175. package/lib/chevre/service/task/onAuthorizationCreated.js +0 -1
  176. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -7
  177. package/lib/chevre/service/task/pay.js +6 -0
  178. package/lib/chevre/service/task/placeOrder.js +9 -10
  179. package/lib/chevre/service/task/returnOrder.js +0 -3
  180. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  181. package/lib/chevre/service/task/returnReserveTransaction.js +3 -2
  182. package/lib/chevre/service/task/sendOrder.js +8 -4
  183. package/lib/chevre/service/task/useReservation.js +1 -1
  184. package/lib/chevre/service/task/voidReserveTransaction.js +8 -12
  185. package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
  186. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +2 -18
  187. package/lib/chevre/service/transaction/moneyTransfer.js +7 -6
  188. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
  189. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +17 -20
  190. package/lib/chevre/service/transaction/placeOrder.js +2 -1
  191. package/lib/chevre/service/transaction/placeOrderInProgress/confirm.d.ts +51 -0
  192. package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +268 -0
  193. package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
  194. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +3 -2
  195. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  196. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +22 -44
  197. package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.d.ts +14 -0
  198. package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.js +41 -0
  199. package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.d.ts +18 -0
  200. package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.js +42 -0
  201. package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.d.ts +23 -0
  202. package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.js +46 -0
  203. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +34 -37
  204. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +3 -1
  205. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +13 -4
  206. package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +19 -0
  207. package/lib/chevre/service/transaction/placeOrderInProgress/start.js +46 -0
  208. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.d.ts +26 -0
  209. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js +109 -0
  210. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +10 -23
  211. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +20 -1
  212. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +11 -73
  213. package/lib/chevre/service/transaction/placeOrderInProgress.js +13 -286
  214. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +1 -2
  215. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
  216. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +8 -3
  217. package/lib/chevre/service/transaction/returnOrder/preStart.js +78 -50
  218. package/lib/chevre/service/transaction/returnOrder.js +3 -10
  219. package/lib/chevre/service.js +0 -10
  220. package/lib/chevre/settings.d.ts +7 -3
  221. package/lib/chevre/settings.js +13 -4
  222. package/package.json +5 -9
  223. package/example/src/chevre/cleanAccountingReports.ts +0 -57
  224. package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +0 -78
  225. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +0 -11
  226. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +0 -30
  227. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +0 -7
  228. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +0 -82
  229. package/lib/chevre/service/util.d.ts +0 -19
  230. package/lib/chevre/service/util.js +0 -126
@@ -15,23 +15,23 @@ exports.onPaid = void 0;
15
15
  */
16
16
  const moment = require("moment-timezone");
17
17
  const factory = require("../../../../factory");
18
- function onPaid(params) {
18
+ function onPaid(params, project) {
19
19
  return (repos) => __awaiter(this, void 0, void 0, function* () {
20
20
  switch (params.purpose.typeOf) {
21
21
  // 返品手数料決済であれば
22
22
  case factory.actionType.ReturnAction:
23
- yield onReturnFeePaid(params)(repos);
23
+ yield onReturnFeePaid(params, project)(repos);
24
24
  break;
25
25
  // 注文決済であれば
26
26
  case factory.order.OrderType.Order:
27
- yield onOrderPaid(params)(repos);
27
+ yield onOrderPaid(params, project)(repos);
28
28
  break;
29
29
  default:
30
30
  }
31
31
  });
32
32
  }
33
33
  exports.onPaid = onPaid;
34
- function onReturnFeePaid(params) {
34
+ function onReturnFeePaid(params, project) {
35
35
  return (repos) => __awaiter(this, void 0, void 0, function* () {
36
36
  var _a, _b;
37
37
  const orderNumber = (_b = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.orderNumber;
@@ -47,11 +47,14 @@ function onReturnFeePaid(params) {
47
47
  }
48
48
  : undefined);
49
49
  const childReport = { typeOf: 'Report', mainEntity: action4save };
50
- yield repos.accountingReport.accountingReportModel.findOneAndUpdate({ 'mainEntity.orderNumber': orderNumber }, { $addToSet: { hasPart: childReport } })
51
- .exec();
50
+ yield repos.accountingReport.addChildReport({
51
+ project: { id: project.id },
52
+ mainEntity: { orderNumber },
53
+ hasPart: childReport
54
+ });
52
55
  });
53
56
  }
54
- function onOrderPaid(params) {
57
+ function onOrderPaid(params, project) {
55
58
  return (repos) => __awaiter(this, void 0, void 0, function* () {
56
59
  var _a;
57
60
  const orderNumber = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.orderNumber;
@@ -67,7 +70,10 @@ function onOrderPaid(params) {
67
70
  }
68
71
  : undefined);
69
72
  const childReport = { typeOf: 'Report', mainEntity: action4save };
70
- yield repos.accountingReport.accountingReportModel.findOneAndUpdate({ 'mainEntity.orderNumber': orderNumber }, { $addToSet: { hasPart: childReport } })
71
- .exec();
73
+ yield repos.accountingReport.addChildReport({
74
+ project: { id: project.id },
75
+ mainEntity: { orderNumber },
76
+ hasPart: childReport
77
+ });
72
78
  });
73
79
  }
@@ -1,6 +1,8 @@
1
1
  import type { MongoRepository as AccountingReportRepo } from '../../../../repo/accountingReport';
2
2
  import * as factory from '../../../../factory';
3
3
  export type IOptimizedRefundAction = factory.report.accountingReport.IOptimizedRefundAction;
4
- export declare function onRefunded(params: IOptimizedRefundAction): (repos: {
4
+ export declare function onRefunded(params: IOptimizedRefundAction, project: {
5
+ id: string;
6
+ }): (repos: {
5
7
  accountingReport: AccountingReportRepo;
6
8
  }) => Promise<void>;
@@ -15,19 +15,19 @@ exports.onRefunded = void 0;
15
15
  */
16
16
  const moment = require("moment-timezone");
17
17
  const factory = require("../../../../factory");
18
- function onRefunded(params) {
18
+ function onRefunded(params, project) {
19
19
  return (repos) => __awaiter(this, void 0, void 0, function* () {
20
20
  switch (params.purpose.typeOf) {
21
21
  // 返品手数料決済であれば
22
22
  case factory.actionType.ReturnAction:
23
- yield onOrderRefunded(params)(repos);
23
+ yield onOrderRefunded(params, project)(repos);
24
24
  break;
25
25
  default:
26
26
  }
27
27
  });
28
28
  }
29
29
  exports.onRefunded = onRefunded;
30
- function onOrderRefunded(params) {
30
+ function onOrderRefunded(params, project) {
31
31
  return (repos) => __awaiter(this, void 0, void 0, function* () {
32
32
  var _a, _b;
33
33
  const orderNumber = (_b = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.orderNumber;
@@ -43,7 +43,10 @@ function onOrderRefunded(params) {
43
43
  }
44
44
  : undefined);
45
45
  const childReport = { typeOf: 'Report', mainEntity: action4save };
46
- yield repos.accountingReport.accountingReportModel.findOneAndUpdate({ 'mainEntity.orderNumber': orderNumber }, { $addToSet: { hasPart: childReport } })
47
- .exec();
46
+ yield repos.accountingReport.addChildReport({
47
+ project: { id: project.id },
48
+ mainEntity: { orderNumber },
49
+ hasPart: childReport
50
+ });
48
51
  });
49
52
  }
@@ -24,10 +24,10 @@ function onPaymentStatusChanged(params) {
24
24
  const optimizedAction = optimizeAction4report(action);
25
25
  switch (optimizedAction.typeOf) {
26
26
  case factory.actionType.PayAction:
27
- yield (0, onPaid_1.onPaid)(optimizedAction)(repos);
27
+ yield (0, onPaid_1.onPaid)(optimizedAction, { id: action.project.id })(repos);
28
28
  break;
29
29
  case factory.actionType.RefundAction:
30
- yield (0, onRefunded_1.onRefunded)(optimizedAction)(repos);
30
+ yield (0, onRefunded_1.onRefunded)(optimizedAction, { id: action.project.id })(repos);
31
31
  break;
32
32
  default:
33
33
  // no op
@@ -88,7 +88,7 @@ function onRefund(refundAction) {
88
88
  name: factory.taskName.TriggerWebhook,
89
89
  status: factory.taskStatus.Ready,
90
90
  runsAt: now,
91
- remainingNumberOfTries: 10,
91
+ remainingNumberOfTries: 30,
92
92
  numberOfTried: 0,
93
93
  executionResults: [],
94
94
  data: Object.assign(Object.assign({}, a), { object: aciton4inform })
@@ -10,7 +10,6 @@ import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentSe
10
10
  import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
11
11
  import type { CognitoRepository as PersonRepo } from '../../repo/person';
12
12
  import type { MongoRepository as ProductRepo } from '../../repo/product';
13
- import type { MongoRepository as ProjectRepo } from '../../repo/project';
14
13
  import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
15
14
  import type { MongoRepository as TaskRepo } from '../../repo/task';
16
15
  import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
@@ -18,7 +17,6 @@ import type { RedisRepository as TransactionNumberRepo } from '../../repo/transa
18
17
  import * as PayTransactionService from '../assetTransaction/pay';
19
18
  import { onPaymentStatusChanged } from './any/onPaymentStatusChanged';
20
19
  import { person2username } from './any/person2username';
21
- type IAuthorizePaymentAction = factory.action.authorize.paymentMethod.any.IAction;
22
20
  /**
23
21
  * 決済承認中止
24
22
  * タスクから決済承認を取り消す
@@ -64,7 +62,6 @@ interface IAuthorizeRepos {
64
62
  paymentServiceProvider: PaymentServiceProviderRepo;
65
63
  person: PersonRepo;
66
64
  product: ProductRepo;
67
- project: ProjectRepo;
68
65
  task: TaskRepo;
69
66
  transaction: TransactionRepo;
70
67
  transactionNumber: TransactionNumberRepo;
@@ -76,7 +73,6 @@ interface IPublishPaymentUrlRepos {
76
73
  paymentService: PaymentServiceRepo;
77
74
  paymentServiceProvider: PaymentServiceProviderRepo;
78
75
  person: PersonRepo;
79
- project: ProjectRepo;
80
76
  transaction: TransactionRepo;
81
77
  transactionNumber: TransactionNumberRepo;
82
78
  }
@@ -119,5 +115,10 @@ declare function authorize(params: {
119
115
  useCheckByIdentifierIfNotYet: boolean;
120
116
  useSearchTrade4accountId: boolean;
121
117
  };
122
- }): IAuthorizeOperation<IAuthorizePaymentAction>;
118
+ }): IAuthorizeOperation<{
119
+ /**
120
+ * 承認アクションID
121
+ */
122
+ id: string;
123
+ }>;
123
124
  export { onPaymentStatusChanged, authorize, invalidatePaymentUrl, voidPayTransaction, person2username, processVoidPayTransaction, publishPaymentUrl };
@@ -197,7 +197,7 @@ function processVoidPayTransaction(params) {
197
197
  }
198
198
  }
199
199
  }
200
- yield repos.action.cancel({ typeOf: action.typeOf, id: action.id });
200
+ yield repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
201
201
  }
202
202
  catch (error) {
203
203
  errors.push(error);
@@ -378,7 +378,8 @@ function authorize(params) {
378
378
  }
379
379
  // アクションを完了
380
380
  const result = (0, factory_1.createAuthorizeResult)({ payTransaction, object: authorizeObject });
381
- return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
381
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
382
+ return { id: action.id };
382
383
  });
383
384
  }
384
385
  exports.authorize = authorize;
@@ -46,7 +46,7 @@ declare function voidTransaction(params: factory.task.voidPayment.IData): (repos
46
46
  /**
47
47
  * クレジットカード決済
48
48
  */
49
- declare function payCreditCard(params: factory.task.pay.IData): (repos: {
49
+ declare function payCreditCard(params: factory.task.pay.IPayActionData): (repos: {
50
50
  action: ActionRepo;
51
51
  accountingReport: AccountingReportRepo;
52
52
  paymentAccepted: PaymentAcceptedRepo;
@@ -87,7 +87,10 @@ function authorize(params, paymentServiceId, options) {
87
87
  const searchTrade4accountId = (options === null || options === void 0 ? void 0 : options.searchTrade4accountId) === true;
88
88
  if (searchTrade4accountId) {
89
89
  try {
90
- const creditCardService = new GMO.service.Credit({ endpoint: String(availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
90
+ const creditCardService = new GMO.service.Credit({
91
+ endpoint: String(availableChannel.serviceUrl),
92
+ useFetch: credentials_1.credentials.gmo.useFetch
93
+ }, { timeout: credentials_1.credentials.gmo.timeout });
91
94
  // ベストエフォートでクレジットカード詳細情報を取得
92
95
  const startSearchTradeDate = Date.now();
93
96
  debug('searchTrade processing...orderId:', orderId, startSearchTradeDate);
@@ -110,7 +113,7 @@ function authorize(params, paymentServiceId, options) {
110
113
  }
111
114
  exports.authorize = authorize;
112
115
  function processAuthorizeCreditCard(params) {
113
- // tslint:disable-next-line:max-func-body-length
116
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
114
117
  return () => __awaiter(this, void 0, void 0, function* () {
115
118
  var _a, _b, _c, _d, _e, _f;
116
119
  // GMOオーソリ取得
@@ -118,24 +121,17 @@ function processAuthorizeCreditCard(params) {
118
121
  let entryTranResult;
119
122
  let execTranArgs;
120
123
  let execTranResult;
121
- const creditCardService = new GMO.service.Credit({ endpoint: String(params.availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
124
+ const creditCardService = new GMO.service.Credit({
125
+ endpoint: String(params.availableChannel.serviceUrl),
126
+ useFetch: credentials_1.credentials.gmo.useFetch
127
+ }, { timeout: credentials_1.credentials.gmo.timeout });
122
128
  const creditCard = params.object.creditCard;
123
- const memberId = creditCard.memberId;
124
- const cardSeq = creditCard.cardSeq;
129
+ const { cardSeq, memberId } = creditCard;
125
130
  if (typeof memberId === 'string' && memberId.length > 0 && typeof cardSeq === 'number') {
126
131
  // 決済承認時のuseUsernameAsGMOMemberId判定を廃止(2024-01-04~)
127
- // 特殊なプロジェクトのみユーザーネームに自動変換(新旧会員互換性維持対応)
128
- // memberIdはPersonIDが指定されてくる想定
129
- // const useUsernameAsGMOMemberId = params.projectSettings?.useUsernameAsGMOMemberId === true;
130
- // if (useUsernameAsGMOMemberId) {
131
- // try {
132
- // const customer = await repos.person.findById({ userId: memberId });
133
- // memberId = await person2username(customer);
134
- // } catch (error) {
135
- // throw error;
136
- // }
137
- // }
138
132
  }
133
+ const { cardNo, cardPass, expire } = creditCard;
134
+ const { token } = creditCard;
139
135
  const retUrl = creditCard === null || creditCard === void 0 ? void 0 : creditCard.retUrl;
140
136
  // 3DS拡張(2024-01-02~)
141
137
  if (params.processPublishPaymentUrl === true && typeof retUrl === 'string' && retUrl.length > 0) {
@@ -165,23 +161,7 @@ function processAuthorizeCreditCard(params) {
165
161
  tds2Type: GMO.utils.util.Tds2Type.Error
166
162
  };
167
163
  entryTranResult = yield creditCardService.entryTran(entryTranArgs);
168
- execTranArgs = {
169
- accessId: entryTranResult.accessId,
170
- accessPass: entryTranResult.accessPass,
171
- orderId: params.orderId,
172
- method: params.object.method,
173
- siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId,
174
- sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass,
175
- cardNo: creditCard.cardNo,
176
- cardPass: creditCard.cardPass,
177
- expire: creditCard.expire,
178
- token: creditCard.token,
179
- memberId: memberId,
180
- cardSeq: cardSeq,
181
- seqMode: GMO.utils.util.SeqMode.Physics,
182
- retUrl,
183
- callbackType: (params.callbackType3ds === 'GET') ? GMO.utils.util.CallbackType.Get : GMO.utils.util.CallbackType.Post
184
- };
164
+ execTranArgs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ accessId: entryTranResult.accessId, accessPass: entryTranResult.accessPass, orderId: params.orderId, method: params.object.method, siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId, sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass, seqMode: GMO.utils.util.SeqMode.Physics, retUrl, callbackType: (params.callbackType3ds === 'GET') ? GMO.utils.util.CallbackType.Get : GMO.utils.util.CallbackType.Post }, (typeof cardNo === 'string') ? { cardNo } : undefined), (typeof cardPass === 'string') ? { cardPass } : undefined), (typeof expire === 'string') ? { expire } : undefined), (typeof token === 'string') ? { token } : undefined), (typeof memberId === 'string') ? { memberId } : undefined), (typeof cardSeq === 'number') ? { cardSeq } : undefined);
185
165
  execTranResult = yield creditCardService.execTran3ds(execTranArgs);
186
166
  }
187
167
  else {
@@ -197,21 +177,7 @@ function processAuthorizeCreditCard(params) {
197
177
  sitePass: (_d = params.availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
198
178
  };
199
179
  entryTranResult = yield creditCardService.entryTran(entryTranArgs);
200
- execTranArgs = {
201
- accessId: entryTranResult.accessId,
202
- accessPass: entryTranResult.accessPass,
203
- orderId: params.orderId,
204
- method: params.object.method,
205
- siteId: (_e = params.availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
206
- sitePass: (_f = params.availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass,
207
- cardNo: creditCard.cardNo,
208
- cardPass: creditCard.cardPass,
209
- expire: creditCard.expire,
210
- token: creditCard.token,
211
- memberId: memberId,
212
- cardSeq: cardSeq,
213
- seqMode: GMO.utils.util.SeqMode.Physics
214
- };
180
+ execTranArgs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ accessId: entryTranResult.accessId, accessPass: entryTranResult.accessPass, orderId: params.orderId, method: params.object.method, siteId: (_e = params.availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId, sitePass: (_f = params.availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass, seqMode: GMO.utils.util.SeqMode.Physics }, (typeof cardNo === 'string') ? { cardNo } : undefined), (typeof cardPass === 'string') ? { cardPass } : undefined), (typeof expire === 'string') ? { expire } : undefined), (typeof token === 'string') ? { token } : undefined), (typeof memberId === 'string') ? { memberId } : undefined), (typeof cardSeq === 'number') ? { cardSeq } : undefined);
215
181
  execTranResult = yield creditCardService.execTran(execTranArgs);
216
182
  }
217
183
  return { entryTranArgs, entryTranResult, execTranArgs, execTranResult };
@@ -219,7 +185,10 @@ function processAuthorizeCreditCard(params) {
219
185
  }
220
186
  function processAuthorizeCreditCard3ds(params) {
221
187
  return () => __awaiter(this, void 0, void 0, function* () {
222
- const creditCardService = new GMO.service.Credit({ endpoint: String(params.availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
188
+ const creditCardService = new GMO.service.Credit({
189
+ endpoint: String(params.availableChannel.serviceUrl),
190
+ useFetch: credentials_1.credentials.gmo.useFetch
191
+ }, { timeout: credentials_1.credentials.gmo.timeout });
223
192
  const { entryTranArgs, entryTranResult, execTranArgs, execTranResult } = params.pendingPaymentAgencyTransaction;
224
193
  const { accessId, accessPass } = entryTranResult;
225
194
  const secureTran2Result = yield creditCardService.secureTran2({ accessId, accessPass });
@@ -291,23 +260,39 @@ function voidTransaction(params) {
291
260
  throw new factory.errors.ArgumentNull('object.recipient.id');
292
261
  }
293
262
  const { shopId, shopPass } = yield getGMOInfoFromSeller({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
294
- const creditCardService = new GMO.service.Credit({ endpoint: String(availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
295
- // オーソリ取消
296
- // 現時点では、ここで失敗したらオーソリ取消をあきらめる
297
- // GMO混雑エラーはここでも発生する(取消処理でも混雑エラーが発生することは確認済)
298
- // try {
299
- // } catch (error) {
300
- // // no op
301
- // }
302
- const searchTradeResult = yield creditCardService.searchTrade({
303
- shopId: shopId,
304
- shopPass: shopPass,
305
- orderId: paymentMethodId,
306
- siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
307
- sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
308
- });
263
+ const creditCardService = new GMO.service.Credit({
264
+ endpoint: String(availableChannel.serviceUrl),
265
+ useFetch: credentials_1.credentials.gmo.useFetch
266
+ }, { timeout: credentials_1.credentials.gmo.timeout });
267
+ let searchTradeResult;
268
+ try {
269
+ searchTradeResult = yield creditCardService.searchTrade({
270
+ shopId: shopId,
271
+ shopPass: shopPass,
272
+ orderId: paymentMethodId,
273
+ siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
274
+ sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
275
+ });
276
+ }
277
+ catch (error) {
278
+ // searchTradeでのエラーをハンドリング(2024-01-27~)
279
+ let throwsError = true;
280
+ if (error.name === 'GMOServiceBadRequestError') {
281
+ if (Array.isArray(error.errors) && error.errors.length > 0) {
282
+ const gmoErrors = error.errors;
283
+ // 指定されたIDとパスワードの取引が存在しません。
284
+ const notFoundErrorExists = gmoErrors.some(({ info }) => info === 'E01110002');
285
+ if (notFoundErrorExists) {
286
+ throwsError = false;
287
+ }
288
+ }
289
+ }
290
+ if (throwsError) {
291
+ throw error;
292
+ }
293
+ }
309
294
  // 仮売上であれば取消
310
- if (searchTradeResult.status === GMO.utils.util.JobCd.Auth) {
295
+ if ((searchTradeResult === null || searchTradeResult === void 0 ? void 0 : searchTradeResult.status) === GMO.utils.util.JobCd.Auth) {
311
296
  yield creditCardService.alterTran({
312
297
  shopId: shopId,
313
298
  shopPass: shopPass,
@@ -348,7 +333,10 @@ function payCreditCard(params) {
348
333
  let action = yield repos.action.start(params);
349
334
  const alterTranResults = [];
350
335
  try {
351
- const creditCardService = new GMO.service.Credit({ endpoint: String(availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
336
+ const creditCardService = new GMO.service.Credit({
337
+ endpoint: String(availableChannel.serviceUrl),
338
+ useFetch: credentials_1.credentials.gmo.useFetch
339
+ }, { timeout: credentials_1.credentials.gmo.timeout });
352
340
  yield Promise.all(payObject.map((paymentMethod) => __awaiter(this, void 0, void 0, function* () {
353
341
  alterTranResults.push(...yield processAlterTran({ shopId, shopPass, availableChannel, paymentMethod })({ creditCardService }));
354
342
  })));
@@ -500,7 +488,10 @@ function processChangeTransaction(params) {
500
488
  var _a, _b, _c, _d, _e, _f, _g, _h;
501
489
  return __awaiter(this, void 0, void 0, function* () {
502
490
  const alterTranResult = [];
503
- const creditCardService = new GMO.service.Credit({ endpoint: String(params.availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
491
+ const creditCardService = new GMO.service.Credit({
492
+ endpoint: String(params.availableChannel.serviceUrl),
493
+ useFetch: credentials_1.credentials.gmo.useFetch
494
+ }, { timeout: credentials_1.credentials.gmo.timeout });
504
495
  // 取引状態参照
505
496
  const searchTradeResult = yield creditCardService.searchTrade({
506
497
  shopId: params.shopId,
@@ -604,7 +595,10 @@ exports.getGMOInfoFromSeller = getGMOInfoFromSeller;
604
595
  function searchGMOTrade(params) {
605
596
  var _a, _b;
606
597
  return __awaiter(this, void 0, void 0, function* () {
607
- const creditCardService = new GMO.service.Credit({ endpoint: String(params.availableChannel.serviceUrl) }, { timeout: credentials_1.credentials.gmo.timeout });
598
+ const creditCardService = new GMO.service.Credit({
599
+ endpoint: String(params.availableChannel.serviceUrl),
600
+ useFetch: credentials_1.credentials.gmo.useFetch
601
+ }, { timeout: credentials_1.credentials.gmo.timeout });
608
602
  // 取引状態参照
609
603
  debug('searching trade...', params.paymentMethodId);
610
604
  const searchTradeResult = yield creditCardService.searchTrade({
@@ -5,24 +5,20 @@ import * as factory from '../../factory';
5
5
  import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
6
6
  import type { MongoRepository as ActionRepo } from '../../repo/action';
7
7
  import type { MongoRepository as ProductRepo } from '../../repo/product';
8
- import type { MongoRepository as ProjectRepo } from '../../repo/project';
9
8
  import type { MongoRepository as TaskRepo } from '../../repo/task';
10
9
  declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
11
10
  product: ProductRepo;
12
- project: ProjectRepo;
13
11
  }) => Promise<void>;
14
- declare function payFaceToFace(params: factory.task.pay.IData): (repos: {
12
+ declare function payFaceToFace(params: factory.task.pay.IPayActionData): (repos: {
15
13
  action: ActionRepo;
16
14
  accountingReport: AccountingReportRepo;
17
15
  product: ProductRepo;
18
- project: ProjectRepo;
19
16
  task: TaskRepo;
20
17
  }) => Promise<import("@chevre/factory/lib/action/trade/pay").IAction>;
21
18
  declare function refundFaceToFace(params: factory.task.refund.IData): (repos: {
22
19
  action: ActionRepo;
23
20
  accountingReport: AccountingReportRepo;
24
21
  product: ProductRepo;
25
- project: ProjectRepo;
26
22
  task: TaskRepo;
27
23
  }) => Promise<import("@chevre/factory/lib/action/trade/refund").IAction>;
28
24
  export { payFaceToFace, refundFaceToFace, voidTransaction };
@@ -1,7 +1,6 @@
1
1
  import type { IMinimizedIndividualEvent } from '../../../repo/event';
2
2
  import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
3
3
  import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
4
- import type { MongoRepository as ProjectRepo } from '../../../repo/project';
5
4
  import * as factory from '../../../factory';
6
5
  interface ICheckResult {
7
6
  purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
@@ -19,6 +18,5 @@ interface ICheckByIdentifierParams {
19
18
  declare function checkByIdentifier(params: ICheckByIdentifierParams): (repos: {
20
19
  paymentService: PaymentServiceRepo;
21
20
  paymentServiceProvider: PaymentServiceProviderRepo;
22
- project: ProjectRepo;
23
21
  }) => Promise<ICheckResult>;
24
22
  export { ICheckByIdentifierParams, ICheckResult, checkByIdentifier };
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.checkByIdentifier = void 0;
13
13
  const surfrock = require("@surfrock/sdk");
14
14
  const moment = require("moment-timezone");
15
+ // import type { MongoRepository as ProjectRepo } from '../../../repo/project';
15
16
  const credentials_1 = require("../../../credentials");
16
17
  const factory = require("../../../factory");
17
18
  const getCredentials_1 = require("./getCredentials");
@@ -3,7 +3,6 @@ import type { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import type { MongoRepository as EventRepo } from '../../../repo/event';
4
4
  import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
5
5
  import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
6
- import type { MongoRepository as ProjectRepo } from '../../../repo/project';
7
6
  import type { MongoRepository as PaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
8
7
  export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckMovieTicketBeforePay: boolean, useCheckByIdentifierIfNotYet: boolean): (repos: {
9
8
  action: ActionRepo;
@@ -11,7 +10,6 @@ export declare function validateMovieTicket(params: factory.assetTransaction.pay
11
10
  paymentAccepted: PaymentAcceptedRepo;
12
11
  paymentService: PaymentServiceRepo;
13
12
  paymentServiceProvider: PaymentServiceProviderRepo;
14
- project: ProjectRepo;
15
13
  }) => Promise<{
16
14
  accountsReceivablesByServiceType: factory.assetTransaction.pay.IAccountsReceivableByServiceType[];
17
15
  }>;
@@ -3,7 +3,6 @@ import type { MongoRepository as ActionRepo } from '../../repo/action';
3
3
  import type { MongoRepository as EventRepo } from '../../repo/event';
4
4
  import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentService';
5
5
  import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
6
- import type { MongoRepository as ProjectRepo } from '../../repo/project';
7
6
  import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
8
7
  import type { MongoRepository as TaskRepo } from '../../repo/task';
9
8
  import * as factory from '../../factory';
@@ -14,7 +13,6 @@ interface ICheckOperationRepos {
14
13
  paymentAccepted: PaymentAcceptedRepo;
15
14
  paymentService: PaymentServiceRepo;
16
15
  paymentServiceProvider: PaymentServiceProviderRepo;
17
- project: ProjectRepo;
18
16
  }
19
17
  type ICheckOperation<T> = (repos: ICheckOperationRepos) => Promise<T>;
20
18
  interface IPayOperationRepos {
@@ -24,7 +22,6 @@ interface IPayOperationRepos {
24
22
  paymentAccepted: PaymentAcceptedRepo;
25
23
  paymentService: PaymentServiceRepo;
26
24
  paymentServiceProvider: PaymentServiceProviderRepo;
27
- project: ProjectRepo;
28
25
  task: TaskRepo;
29
26
  }
30
27
  type IPayOperation<T> = (repos: IPayOperationRepos) => Promise<T>;
@@ -32,7 +29,6 @@ interface IRefundOperationRepos {
32
29
  action: ActionRepo;
33
30
  accountingReport: AccountingReportRepo;
34
31
  paymentService: PaymentServiceRepo;
35
- project: ProjectRepo;
36
32
  task: TaskRepo;
37
33
  }
38
34
  type IRefundOperation<T> = (repos: IRefundOperationRepos) => Promise<T>;
@@ -58,21 +54,19 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
58
54
  paymentAccepted: PaymentAcceptedRepo;
59
55
  paymentService: PaymentServiceRepo;
60
56
  paymentServiceProvider: PaymentServiceProviderRepo;
61
- project: ProjectRepo;
62
57
  task: TaskRepo;
63
58
  }) => Promise<IAuthorizeResult>;
64
59
  declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
65
60
  action: ActionRepo;
66
61
  accountingReport: AccountingReportRepo;
67
62
  paymentService: PaymentServiceRepo;
68
- project: ProjectRepo;
69
63
  task: TaskRepo;
70
64
  }) => Promise<void>;
71
65
  type IPayAction = factory.action.trade.pay.IAction;
72
66
  /**
73
67
  * MovieTicket着券
74
68
  */
75
- declare function payMovieTicket(params: factory.task.pay.IData): IPayOperation<IPayAction>;
69
+ declare function payMovieTicket(params: factory.task.pay.IPayActionData): IPayOperation<IPayAction>;
76
70
  /**
77
71
  * MovieTicket着券取消
78
72
  */
@@ -85,7 +85,7 @@ function checkMovieTicket(params) {
85
85
  // action.resultへの保管を廃止(2023-03-24~)
86
86
  // movieTickets: []
87
87
  };
88
- yield repos.action.complete({ typeOf: actionAttributes.typeOf, id: action.id, result });
88
+ yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result });
89
89
  return {
90
90
  result: checkResult
91
91
  };
@@ -3,13 +3,11 @@ import type { MongoRepository as AccountingReportRepo } from '../../repo/account
3
3
  import type { MongoRepository as ActionRepo } from '../../repo/action';
4
4
  import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
5
5
  import type { MongoRepository as ProductRepo } from '../../repo/product';
6
- import type { MongoRepository as ProjectRepo } from '../../repo/project';
7
6
  import type { MongoRepository as TaskRepo } from '../../repo/task';
8
7
  import type { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
9
8
  type IPendingTransaction = Pick<factory.account.transaction.withdraw.ITransaction, 'id' | 'transactionNumber' | 'typeOf'>;
10
9
  declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
11
10
  product: ProductRepo;
12
- project: ProjectRepo;
13
11
  }) => Promise<{
14
12
  pendingTransaction: IPendingTransaction;
15
13
  currency: string;
@@ -18,7 +16,7 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
18
16
  declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
19
17
  product: ProductRepo;
20
18
  }) => Promise<void>;
21
- declare function payPaymentCard(params: factory.task.pay.IData): (repos: {
19
+ declare function payPaymentCard(params: factory.task.pay.IPayActionData): (repos: {
22
20
  action: ActionRepo;
23
21
  accountingReport: AccountingReportRepo;
24
22
  product: ProductRepo;
@@ -22,12 +22,12 @@ const onRefund_1 = require("./any/onRefund");
22
22
  const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
23
23
  function authorize(params, paymentServiceId) {
24
24
  return (repos) => __awaiter(this, void 0, void 0, function* () {
25
+ // const project = <Pick<factory.project.IProject, 'id' | 'typeOf'>>await repos.project.findById({
26
+ // id: params.project.id,
27
+ // inclusion: ['_id', 'typeOf'],
28
+ // exclusion: []
29
+ // });
25
30
  var _a;
26
- const project = yield repos.project.findById({
27
- id: params.project.id,
28
- inclusion: ['_id', 'typeOf'],
29
- exclusion: []
30
- });
31
31
  const transactionNumber = params.transactionNumber;
32
32
  if (typeof transactionNumber !== 'string') {
33
33
  throw new factory.errors.ArgumentNull('transactionNumber');
@@ -46,7 +46,7 @@ function authorize(params, paymentServiceId) {
46
46
  .toDate();
47
47
  pendingTransaction = yield processAccountTransaction({
48
48
  transactionNumber,
49
- project: project,
49
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
50
50
  paymentMethod: params.object.paymentMethod,
51
51
  agent: params.agent,
52
52
  recipient: params.recipient,
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * 決済サービス
3
3
  */
4
+ import type { MongoRepository as AcceptedOfferRepo } from '../repo/acceptedOffer';
4
5
  import type { MongoRepository as AccountingReportRepo } from '../repo/accountingReport';
5
6
  import type { MongoRepository as ActionRepo } from '../repo/action';
6
7
  import type { MongoRepository as AssetTransactionRepo } from '../repo/assetTransaction';
7
8
  import type { MongoRepository as EventRepo } from '../repo/event';
9
+ import type { MongoRepository as OrderRepo } from '../repo/order';
8
10
  import type { MongoRepository as PaymentServiceRepo } from '../repo/paymentService';
9
11
  import type { MongoRepository as PaymentServiceProviderRepo } from '../repo/paymentServiceProvider';
10
12
  import type { MongoRepository as ProductRepo } from '../repo/product';
@@ -17,9 +19,12 @@ import * as factory from '../factory';
17
19
  * 決済確定
18
20
  */
19
21
  export declare function pay(params: factory.task.pay.IData): (repos: {
22
+ acceptedOffer: AcceptedOfferRepo;
20
23
  action: ActionRepo;
21
24
  accountingReport: AccountingReportRepo;
25
+ assetTransaction: AssetTransactionRepo;
22
26
  event: EventRepo;
27
+ order: OrderRepo;
23
28
  paymentAccepted: PaymentAcceptedRepo;
24
29
  paymentService: PaymentServiceRepo;
25
30
  paymentServiceProvider: PaymentServiceProviderRepo;