@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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_FETCH_API = exports.USE_ORDER_PAYMENT_METHOD_TYPE_OF = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
3
+ exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_KANA_NAME_IN_ACCEPTED_OFFER = exports.USE_MINIMIZED_PAY_TASK = exports.USE_ACCEPTED_OFFERS_AS_TRANSACTION_RESULT = exports.USE_VERIFY_ACCEPTED_OFFERS = exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = exports.USE_INFORM_ORDER_IN_TRANSIT = exports.USE_FETCH_API = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const factory = require("./factory");
5
5
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
6
6
  ? process.env.INFORM_TRANSACTION_URL.split(' ')
@@ -59,12 +59,17 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSA
59
59
  exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
60
60
  exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
61
61
  exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
62
- exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = process.env.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT === '1';
63
62
  exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1';
64
- exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = process.env.USE_ORDER_PAYMENT_DUE_ON_PLACED === '1';
65
63
  exports.USE_OPTIMIZE_TICKET_OFFER = process.env.USE_OPTIMIZE_TICKET_OFFER === '1';
66
- exports.USE_ORDER_PAYMENT_METHOD_TYPE_OF = process.env.USE_ORDER_PAYMENT_METHOD_TYPE_OF === '1';
67
64
  exports.USE_FETCH_API = process.env.USE_FETCH_API === '1';
65
+ exports.USE_INFORM_ORDER_IN_TRANSIT = process.env.USE_INFORM_ORDER_IN_TRANSIT === '1';
66
+ exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = process.env.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING === '1';
67
+ exports.USE_VERIFY_ACCEPTED_OFFERS = process.env.USE_VERIFY_ACCEPTED_OFFERS === '1';
68
+ exports.USE_ACCEPTED_OFFERS_AS_TRANSACTION_RESULT = process.env.USE_ACCEPTED_OFFERS_AS_TRANSACTION_RESULT === '1';
69
+ exports.USE_MINIMIZED_PAY_TASK = process.env.USE_MINIMIZED_PAY_TASK === '1';
70
+ exports.USE_KANA_NAME_IN_ACCEPTED_OFFER = process.env.USE_KANA_NAME_IN_ACCEPTED_OFFER === '1';
71
+ // export const USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK = process.env.USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK === '1';
72
+ // export const USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY = process.env.USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY === '1';
68
73
  exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
69
74
  ? Number(process.env.MONGO_MAX_TIME_MS)
70
75
  // tslint:disable-next-line:no-magic-numbers
@@ -73,6 +78,10 @@ exports.MONGO_READ_PREFERENCE = (typeof process.env.MONGO_READ_PREFERENCE === 's
73
78
  ? process.env.MONGO_READ_PREFERENCE
74
79
  : 'primaryPreferred';
75
80
  exports.MONGO_AUTO_INDEX = process.env.MONGO_AUTO_INDEX === '1';
81
+ exports.DELIVER_ORDER_LIMIT = (typeof process.env.DELIVER_ORDER_LIMIT === 'string')
82
+ ? Number(process.env.DELIVER_ORDER_LIMIT)
83
+ // tslint:disable-next-line:no-magic-numbers
84
+ : 50;
76
85
  /**
77
86
  * グローバル設定
78
87
  */
package/package.json CHANGED
@@ -10,14 +10,13 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.351.0-alpha.5",
14
- "@cinerino/sdk": "5.8.0-alpha.1",
15
- "@motionpicture/coa-service": "9.2.0",
16
- "@motionpicture/gmo-service": "5.3.0-alpha.0",
13
+ "@chevre/factory": "4.353.0",
14
+ "@cinerino/sdk": "5.11.0-alpha.1",
15
+ "@motionpicture/coa-service": "9.3.0-alpha.5",
16
+ "@motionpicture/gmo-service": "5.3.0-alpha.4",
17
17
  "@sendgrid/mail": "6.4.0",
18
18
  "@surfrock/sdk": "1.2.0",
19
19
  "@waiter/domain": "6.4.0-alpha.4",
20
- "azure-storage": "^2.10.4",
21
20
  "cdigit": "2.6.7",
22
21
  "debug": "^3.2.7",
23
22
  "google-libphonenumber": "^3.2.18",
@@ -28,7 +27,6 @@
28
27
  "moment-timezone": "^0.5.33",
29
28
  "node-fpe": "1.0.0",
30
29
  "pug": "^2.0.4",
31
- "request": "^2.88.2",
32
30
  "uniqid": "^5.4.0",
33
31
  "uuid": "^3.4.0"
34
32
  },
@@ -46,8 +44,6 @@
46
44
  "@types/node": "18.19.2",
47
45
  "@types/power-assert": "^1.5.3",
48
46
  "@types/pug": "^2.0.4",
49
- "@types/request": "^2.48.5",
50
- "@types/request-promise-native": "^1.0.18",
51
47
  "@types/sinon": "^4.3.3",
52
48
  "@types/sinon-mongoose": "^1.3.11",
53
49
  "@types/uniqid": "^4.1.3",
@@ -115,5 +111,5 @@
115
111
  "postversion": "git push origin --tags",
116
112
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
113
  },
118
- "version": "21.20.0-alpha.8"
114
+ "version": "21.20.0"
119
115
  }
@@ -1,57 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- // const project = { id: '' };
8
- // const MASKED_PROFILE = '****';
9
-
10
- async function main() {
11
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
-
13
- const accountingReportRepo = await chevre.repository.AccountingReport.createInstance(mongoose.connection);
14
-
15
- const cursor = await accountingReportRepo.accountingReportModel.find(
16
- {
17
- 'mainEntity.orderDate': {
18
- $lt: moment()
19
- .add(-1, 'year')
20
- .toDate()
21
- }
22
- },
23
- {
24
- // _id: 1,
25
- }
26
- )
27
- // .limit(10)
28
- .sort({ 'mainEntity.orderDate': chevre.factory.sortType.Descending })
29
- .cursor();
30
- console.log('reports found');
31
-
32
- let i = 0;
33
- let updateCount = 0;
34
- await cursor.eachAsync(async (doc) => {
35
- i += 1;
36
- const accountingReport = doc.toObject();
37
-
38
- console.log(
39
- 'deleting report...',
40
- accountingReport.id, accountingReport.mainEntity.orderNumber, accountingReport.mainEntity.orderDate, i);
41
- await accountingReportRepo.accountingReportModel.findByIdAndDelete(
42
- accountingReport.id
43
- )
44
- .exec();
45
- updateCount += 1;
46
- console.log(
47
- 'report deleted',
48
- accountingReport.id, accountingReport.mainEntity.orderNumber, accountingReport.mainEntity.orderDate, i);
49
- });
50
-
51
- console.log(i, 'reports checked');
52
- console.log(updateCount, 'reports updated');
53
- }
54
-
55
- main()
56
- .then()
57
- .catch(console.error);
@@ -1,78 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as moment from 'moment';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- // const project = { id: String(process.env.PROJECT_ID) };
8
-
9
- // tslint:disable-next-line:max-func-body-length
10
- async function main() {
11
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
-
13
- const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
14
-
15
- const cursor = assetTransactionRepo.getCursor(
16
- {
17
- typeOf: { $eq: chevre.factory.assetTransactionType.Pay },
18
- // 'project.id': { $eq: project.id },
19
- startDate: {
20
- $gte: moment('2023-05-08T00:00:00Z')
21
- // tslint:disable-next-line:no-magic-numbers
22
- // .add(-12, 'months')
23
- .toDate(),
24
- $lte: moment('2023-08-30T21:00:00Z')
25
- .toDate()
26
- }
27
- },
28
- {
29
- typeOf: 1,
30
- project: 1,
31
- object: 1,
32
- transactionNumber: 1,
33
- startDate: 1
34
- }
35
- );
36
- console.log('transactions found');
37
-
38
- let i = 0;
39
- let updateCount = 0;
40
- await cursor.eachAsync(async (doc) => {
41
- i += 1;
42
- const payTransaction: Pick<
43
- chevre.factory.assetTransaction.pay.ITransaction,
44
- 'project' | 'object' | 'transactionNumber' | 'startDate' | 'typeOf'
45
- > = doc.toObject();
46
-
47
- const alreadyMigrated = payTransaction.object.paymentMethod.identifier
48
- === (<any>payTransaction.object.paymentMethod).typeOf;
49
-
50
- if (alreadyMigrated) {
51
- console.log(
52
- 'already exist.',
53
- payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate,
54
- i, updateCount);
55
- } else {
56
- const paymentMethodIdentifier = (<any>payTransaction.object.paymentMethod).typeOf;
57
- console.log(
58
- 'updating...',
59
- payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i,
60
- paymentMethodIdentifier);
61
- await assetTransactionRepo.migratePaymentMethodIdentifier({
62
- transactionNumber: payTransaction.transactionNumber,
63
- object: { paymentMethod: { identifier: paymentMethodIdentifier } }
64
- });
65
- updateCount += 1;
66
- console.log(
67
- 'updated.',
68
- payTransaction.project.id, payTransaction.typeOf, payTransaction.transactionNumber, payTransaction.startDate, i);
69
- }
70
- });
71
-
72
- console.log(i, 'transactions checked');
73
- console.log(updateCount, 'transactions updated');
74
- }
75
-
76
- main()
77
- .then()
78
- .catch(console.error);
@@ -1,11 +0,0 @@
1
- import * as factory from '../../../../factory';
2
- export declare function validateSeller(params: {
3
- seller: Pick<factory.seller.ISeller, 'makesOffer'>;
4
- clientUser?: factory.clientUser.IClientUser;
5
- /**
6
- * passportによって決定するカスタマータイプ
7
- */
8
- customerType?: string;
9
- }): {
10
- makesOfferFromClient: factory.seller.IMakesOffer;
11
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSeller = void 0;
4
- const factory = require("../../../../factory");
5
- function validateSeller(params) {
6
- var _a, _b;
7
- const clientId = (_a = params.clientUser) === null || _a === void 0 ? void 0 : _a.client_id;
8
- // tslint:disable-next-line:no-single-line-block-comment
9
- /* istanbul ignore if */
10
- if (typeof clientId !== 'string' || clientId.length === 0) {
11
- throw new factory.errors.ArgumentNull('client_id');
12
- }
13
- const makesOfferFromClient = (_b = params.seller.makesOffer) === null || _b === void 0 ? void 0 : _b.find((offer) => {
14
- var _a;
15
- return (_a = offer.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.some((availableApplication) => availableApplication.id === clientId);
16
- });
17
- if (makesOfferFromClient === undefined) {
18
- throw new factory.errors.Argument('seller', 'makes no offers');
19
- }
20
- // eligibleCustomerType検証(2023-11-20~)
21
- if (typeof params.customerType === 'string') {
22
- const isCustomerTypeEligible = Array.isArray(makesOfferFromClient.eligibleCustomerType)
23
- && makesOfferFromClient.eligibleCustomerType.some((categoryCode) => categoryCode.codeValue === params.customerType);
24
- if (!isCustomerTypeEligible) {
25
- throw new factory.errors.Argument('seller', 'cutomer type ineligible');
26
- }
27
- }
28
- return { makesOfferFromClient };
29
- }
30
- exports.validateSeller = validateSeller;
@@ -1,7 +0,0 @@
1
- import * as factory from '../../../../factory';
2
- export type WebAPIIdentifier = factory.service.webAPI.Identifier;
3
- export declare function createReturnMoneyTransferActions(params: {
4
- order: factory.order.IOrder;
5
- moneyTransferAcceptedOffers: Pick<factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>, 'itemOffered'>[];
6
- returnOrderActionParams?: factory.transaction.returnOrder.IReturnOrderActionParams;
7
- }): Promise<factory.task.IData<factory.taskName.ReturnMoneyTransfer>[]>;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createReturnMoneyTransferActions = void 0;
13
- const factory = require("../../../../factory");
14
- const order_1 = require("../../../../factory/order");
15
- function createReturnMoneyTransferActions(params) {
16
- var _a, _b;
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const order = params.order;
19
- const returnMoneyTransferActions = [];
20
- const maskedCustomer = (0, order_1.createMaskedCustomer)(order, { noProfile: true });
21
- const purpose = {
22
- typeOf: order.typeOf,
23
- seller: {
24
- id: order.seller.id,
25
- typeOf: order.seller.typeOf,
26
- name: order.seller.name
27
- },
28
- // mask
29
- customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
30
- orderNumber: order.orderNumber,
31
- price: order.price,
32
- priceCurrency: order.priceCurrency,
33
- orderDate: order.orderDate
34
- };
35
- // 注文オファーから返却アクションを作成する
36
- // const acceptedOffers = (Array.isArray(order.acceptedOffers)) ? order.acceptedOffers : [];
37
- for (const acceptedOffer of params.moneyTransferAcceptedOffers) {
38
- if (acceptedOffer.itemOffered.typeOf === factory.actionType.MoneyTransfer) {
39
- const moneyTransfer = acceptedOffer.itemOffered;
40
- const transactionNumber = String((_b = (_a = moneyTransfer.object) === null || _a === void 0 ? void 0 : _a.pendingTransaction) === null || _b === void 0 ? void 0 : _b.transactionNumber);
41
- const returnMoneyTransferAction = {
42
- project: order.project,
43
- typeOf: factory.actionType.ReturnAction,
44
- object: {
45
- project: order.project,
46
- typeOf: factory.actionType.MoneyTransfer,
47
- actionStatus: factory.actionStatusType.CompletedActionStatus,
48
- startDate: order.orderDate,
49
- id: '',
50
- amount: moneyTransfer.amount,
51
- object: {
52
- typeOf: factory.account.transactionType.Deposit,
53
- // いったんtransactionNumberさえあれば返却可能
54
- transactionNumber
55
- },
56
- agent: order.project,
57
- recipient: {
58
- typeOf: order.customer.typeOf,
59
- id: order.customer.id,
60
- name: String(order.customer.name)
61
- },
62
- fromLocation: {},
63
- toLocation: {},
64
- purpose: {}
65
- },
66
- agent: order.project,
67
- recipient: {
68
- typeOf: order.seller.typeOf,
69
- id: order.seller.id,
70
- name: order.seller.name
71
- },
72
- potentialActions: {},
73
- purpose,
74
- instrument: { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre }
75
- };
76
- returnMoneyTransferActions.push(returnMoneyTransferAction);
77
- }
78
- }
79
- return returnMoneyTransferActions;
80
- });
81
- }
82
- exports.createReturnMoneyTransferActions = createReturnMoneyTransferActions;
@@ -1,19 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Stream } from 'stream';
4
- /**
5
- * ファイルをアップロードする
6
- */
7
- export declare function uploadFile(params: {
8
- fileName: string;
9
- text: string | Buffer;
10
- expiryDate?: Date;
11
- }): () => Promise<string>;
12
- /**
13
- * ファイルをアップロードする
14
- */
15
- export declare function uploadFileFromStream(params: {
16
- fileName: string;
17
- text: Stream;
18
- expiryDate?: Date;
19
- }): () => Promise<string>;
@@ -1,126 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.uploadFileFromStream = exports.uploadFile = void 0;
13
- /**
14
- * ユーティリティサービス
15
- */
16
- const azureStorage = require("azure-storage");
17
- const createDebug = require("debug");
18
- const debug = createDebug('chevre-domain:service');
19
- const CONTAINER = 'files-from-chevre-domain-util-service';
20
- function createContainerIfNotExists() {
21
- return () => __awaiter(this, void 0, void 0, function* () {
22
- const blobService = azureStorage.createBlobService();
23
- // コンテナ作成
24
- yield new Promise((resolve, reject) => {
25
- blobService.createContainerIfNotExists(CONTAINER, {
26
- // publicAccessLevel: 'blob'
27
- }, (createContainerError) => __awaiter(this, void 0, void 0, function* () {
28
- if (createContainerError instanceof Error) {
29
- reject(createContainerError);
30
- return;
31
- }
32
- resolve();
33
- }));
34
- });
35
- });
36
- }
37
- /**
38
- * ファイルをアップロードする
39
- */
40
- function uploadFile(params) {
41
- return () => __awaiter(this, void 0, void 0, function* () {
42
- // コンテナ作成
43
- yield createContainerIfNotExists()();
44
- // ブロブ作成
45
- yield new Promise((resolve, reject) => {
46
- // save to blob
47
- const blobService = azureStorage.createBlobService();
48
- blobService.createBlockBlobFromText(CONTAINER, params.fileName, params.text, (createBlockBlobError, result, response) => {
49
- debug(createBlockBlobError, result, response);
50
- if (createBlockBlobError instanceof Error) {
51
- reject(createBlockBlobError);
52
- return;
53
- }
54
- resolve();
55
- });
56
- });
57
- return publishBlob(params);
58
- });
59
- }
60
- exports.uploadFile = uploadFile;
61
- /**
62
- * ファイルをアップロードする
63
- */
64
- function uploadFileFromStream(params) {
65
- return () => __awaiter(this, void 0, void 0, function* () {
66
- // コンテナ作成
67
- yield createContainerIfNotExists()();
68
- // ブロブ作成
69
- yield new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
70
- const blobService = azureStorage.createBlobService();
71
- const writeStream = blobService.createWriteStreamToBlockBlob(CONTAINER, params.fileName)
72
- .on('pipe', () => {
73
- // tslint:disable-next-line:no-console
74
- console.log('uploadFileFromStream: something is piping into the writer.');
75
- });
76
- let finished = false;
77
- params.text
78
- .on('error', (err) => {
79
- // tslint:disable-next-line:no-console
80
- console.error('uploadFileFromStream: readStream.on(error): ', err);
81
- reject(err);
82
- })
83
- .pipe(writeStream)
84
- .on('drain', () => {
85
- // tslint:disable-next-line:no-console
86
- console.log('uploadFileFromStream: writeStream.on(drain)');
87
- })
88
- .on('error', (err) => {
89
- // tslint:disable-next-line:no-console
90
- console.error('uploadFileFromStream: writeStream.on(error): ', err);
91
- reject(err);
92
- })
93
- .on('finish', () => {
94
- // tslint:disable-next-line:no-console
95
- console.log('uploadFileFromStream: writeStream.on(finish)');
96
- finished = true;
97
- resolve();
98
- })
99
- .on('close', () => {
100
- // tslint:disable-next-line:no-console
101
- console.log('uploadFileFromStream: writeStream.on(close)', 'finished:', finished);
102
- });
103
- }));
104
- return publishBlob(params);
105
- });
106
- }
107
- exports.uploadFileFromStream = uploadFileFromStream;
108
- function publishBlob(params) {
109
- const blobService = azureStorage.createBlobService();
110
- // 期限つきのURLを発行する
111
- const startDate = new Date();
112
- const expiryDate = (params.expiryDate instanceof Date) ? params.expiryDate : new Date(startDate);
113
- // tslint:disable-next-line:no-magic-numbers
114
- expiryDate.setMinutes(startDate.getMinutes() + 10);
115
- // tslint:disable-next-line:no-magic-numbers
116
- startDate.setMinutes(startDate.getMinutes() - 10);
117
- const sharedAccessPolicy = {
118
- AccessPolicy: {
119
- Permissions: azureStorage.BlobUtilities.SharedAccessPermissions.READ,
120
- Start: startDate,
121
- Expiry: expiryDate
122
- }
123
- };
124
- const token = blobService.generateSharedAccessSignature(CONTAINER, params.fileName, sharedAccessPolicy);
125
- return blobService.getUrl(CONTAINER, params.fileName, token);
126
- }