@unchainedshop/core 3.0.0-alpha7 → 3.0.0-rc2

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 (530) hide show
  1. package/lib/core-index.d.ts +8 -61
  2. package/lib/core-index.d.ts.map +1 -1
  3. package/lib/core-index.js +9 -140
  4. package/lib/core-index.js.map +1 -1
  5. package/lib/core-index_BACKUP_57582.d.ts +26 -0
  6. package/lib/core-index_BACKUP_57582.d.ts.map +1 -0
  7. package/lib/core-index_BACKUP_57582.js +30 -0
  8. package/lib/core-index_BACKUP_57582.js.map +1 -0
  9. package/lib/core-index_BASE_57582.d.ts +74 -0
  10. package/lib/core-index_BASE_57582.d.ts.map +1 -0
  11. package/lib/core-index_BASE_57582.js +145 -0
  12. package/lib/core-index_BASE_57582.js.map +1 -0
  13. package/lib/core-index_LOCAL_57582.d.ts +26 -0
  14. package/lib/core-index_LOCAL_57582.d.ts.map +1 -0
  15. package/lib/core-index_LOCAL_57582.js +31 -0
  16. package/lib/core-index_LOCAL_57582.js.map +1 -0
  17. package/lib/core-index_REMOTE_57582.d.ts +74 -0
  18. package/lib/core-index_REMOTE_57582.d.ts.map +1 -0
  19. package/lib/core-index_REMOTE_57582.js +146 -0
  20. package/lib/core-index_REMOTE_57582.js.map +1 -0
  21. package/lib/directors/BaseDiscountAdapter.d.ts +38 -0
  22. package/lib/directors/BaseDiscountAdapter.d.ts.map +1 -0
  23. package/lib/directors/BaseDiscountAdapter.js +48 -0
  24. package/lib/directors/BaseDiscountAdapter.js.map +1 -0
  25. package/lib/directors/BaseDiscountDirector.d.ts +12 -0
  26. package/lib/directors/BaseDiscountDirector.d.ts.map +1 -0
  27. package/lib/directors/BaseDiscountDirector.js +45 -0
  28. package/lib/directors/BaseDiscountDirector.js.map +1 -0
  29. package/lib/directors/BasePricingAdapter.d.ts +39 -0
  30. package/lib/directors/BasePricingAdapter.d.ts.map +1 -0
  31. package/lib/directors/BasePricingAdapter.js +25 -0
  32. package/lib/directors/BasePricingAdapter.js.map +1 -0
  33. package/lib/directors/BasePricingDirector.d.ts +17 -0
  34. package/lib/directors/BasePricingDirector.d.ts.map +1 -0
  35. package/lib/directors/BasePricingDirector.js +70 -0
  36. package/lib/directors/BasePricingDirector.js.map +1 -0
  37. package/lib/directors/BasePricingSheet.d.ts +46 -0
  38. package/lib/directors/BasePricingSheet.d.ts.map +1 -0
  39. package/lib/directors/BasePricingSheet.js +74 -0
  40. package/lib/directors/BasePricingSheet.js.map +1 -0
  41. package/lib/directors/DeliveryAdapter.d.ts +46 -0
  42. package/lib/directors/DeliveryAdapter.d.ts.map +1 -0
  43. package/lib/directors/DeliveryAdapter.js +50 -0
  44. package/lib/directors/DeliveryAdapter.js.map +1 -0
  45. package/lib/directors/DeliveryDirector.d.ts +15 -0
  46. package/lib/directors/DeliveryDirector.d.ts.map +1 -0
  47. package/lib/directors/DeliveryDirector.js +96 -0
  48. package/lib/directors/DeliveryDirector.js.map +1 -0
  49. package/lib/directors/DeliveryPricingAdapter.d.ts +49 -0
  50. package/lib/directors/DeliveryPricingAdapter.d.ts.map +1 -0
  51. package/lib/directors/DeliveryPricingAdapter.js +25 -0
  52. package/lib/directors/DeliveryPricingAdapter.js.map +1 -0
  53. package/lib/directors/DeliveryPricingDirector.d.ts +20 -0
  54. package/lib/directors/DeliveryPricingDirector.d.ts.map +1 -0
  55. package/lib/directors/DeliveryPricingDirector.js +50 -0
  56. package/lib/directors/DeliveryPricingDirector.js.map +1 -0
  57. package/lib/directors/DeliveryPricingSheet.d.ts +10 -0
  58. package/lib/directors/DeliveryPricingSheet.d.ts.map +1 -0
  59. package/lib/directors/DeliveryPricingSheet.js +75 -0
  60. package/lib/directors/DeliveryPricingSheet.js.map +1 -0
  61. package/lib/directors/EnrollmentAdapter.d.ts +27 -0
  62. package/lib/directors/EnrollmentAdapter.d.ts.map +1 -0
  63. package/lib/directors/EnrollmentAdapter.js +73 -0
  64. package/lib/directors/EnrollmentAdapter.js.map +1 -0
  65. package/lib/directors/EnrollmentDirector.d.ts +14 -0
  66. package/lib/directors/EnrollmentDirector.d.ts.map +1 -0
  67. package/lib/directors/EnrollmentDirector.js +44 -0
  68. package/lib/directors/EnrollmentDirector.js.map +1 -0
  69. package/lib/directors/FilterAdapter.d.ts +54 -0
  70. package/lib/directors/FilterAdapter.d.ts.map +1 -0
  71. package/lib/directors/FilterAdapter.js +38 -0
  72. package/lib/directors/FilterAdapter.js.map +1 -0
  73. package/lib/directors/FilterDirector.d.ts +40 -0
  74. package/lib/directors/FilterDirector.d.ts.map +1 -0
  75. package/lib/directors/FilterDirector.js +173 -0
  76. package/lib/directors/FilterDirector.js.map +1 -0
  77. package/lib/directors/MessagingDirector.d.ts +46 -0
  78. package/lib/directors/MessagingDirector.d.ts.map +1 -0
  79. package/lib/directors/MessagingDirector.js +10 -0
  80. package/lib/directors/MessagingDirector.js.map +1 -0
  81. package/lib/directors/OrderDiscountAdapter.d.ts +3 -0
  82. package/lib/directors/OrderDiscountAdapter.d.ts.map +1 -0
  83. package/lib/directors/OrderDiscountAdapter.js +3 -0
  84. package/lib/directors/OrderDiscountAdapter.js.map +1 -0
  85. package/lib/directors/OrderDiscountConfiguration.d.ts +6 -0
  86. package/lib/directors/OrderDiscountConfiguration.d.ts.map +1 -0
  87. package/lib/directors/OrderDiscountConfiguration.js +2 -0
  88. package/lib/directors/OrderDiscountConfiguration.js.map +1 -0
  89. package/lib/directors/OrderDiscountDirector.d.ts +3 -0
  90. package/lib/directors/OrderDiscountDirector.d.ts.map +1 -0
  91. package/lib/directors/OrderDiscountDirector.js +3 -0
  92. package/lib/directors/OrderDiscountDirector.js.map +1 -0
  93. package/lib/directors/OrderPricingAdapter.d.ts +18 -0
  94. package/lib/directors/OrderPricingAdapter.d.ts.map +1 -0
  95. package/lib/directors/OrderPricingAdapter.js +24 -0
  96. package/lib/directors/OrderPricingAdapter.js.map +1 -0
  97. package/lib/directors/OrderPricingDirector.d.ts +18 -0
  98. package/lib/directors/OrderPricingDirector.d.ts.map +1 -0
  99. package/lib/directors/OrderPricingDirector.js +31 -0
  100. package/lib/directors/OrderPricingDirector.js.map +1 -0
  101. package/lib/directors/OrderPricingSheet.d.ts +37 -0
  102. package/lib/directors/OrderPricingSheet.d.ts.map +1 -0
  103. package/lib/directors/OrderPricingSheet.js +108 -0
  104. package/lib/directors/OrderPricingSheet.js.map +1 -0
  105. package/lib/directors/PaymentAdapter.d.ts +50 -0
  106. package/lib/directors/PaymentAdapter.d.ts.map +1 -0
  107. package/lib/directors/PaymentAdapter.js +55 -0
  108. package/lib/directors/PaymentAdapter.js.map +1 -0
  109. package/lib/directors/PaymentDirector.d.ts +21 -0
  110. package/lib/directors/PaymentDirector.d.ts.map +1 -0
  111. package/lib/directors/PaymentDirector.js +172 -0
  112. package/lib/directors/PaymentDirector.js.map +1 -0
  113. package/lib/directors/PaymentPricingAdapter.d.ts +48 -0
  114. package/lib/directors/PaymentPricingAdapter.d.ts.map +1 -0
  115. package/lib/directors/PaymentPricingAdapter.js +25 -0
  116. package/lib/directors/PaymentPricingAdapter.js.map +1 -0
  117. package/lib/directors/PaymentPricingDirector.d.ts +18 -0
  118. package/lib/directors/PaymentPricingDirector.d.ts.map +1 -0
  119. package/lib/directors/PaymentPricingDirector.js +51 -0
  120. package/lib/directors/PaymentPricingDirector.js.map +1 -0
  121. package/lib/directors/PaymentPricingSheet.d.ts +9 -0
  122. package/lib/directors/PaymentPricingSheet.d.ts.map +1 -0
  123. package/lib/directors/PaymentPricingSheet.js +75 -0
  124. package/lib/directors/PaymentPricingSheet.js.map +1 -0
  125. package/lib/directors/ProductDiscountAdapter.d.ts +3 -0
  126. package/lib/directors/ProductDiscountAdapter.d.ts.map +1 -0
  127. package/lib/directors/ProductDiscountAdapter.js +3 -0
  128. package/lib/directors/ProductDiscountAdapter.js.map +1 -0
  129. package/lib/directors/ProductDiscountConfiguration.d.ts +13 -0
  130. package/lib/directors/ProductDiscountConfiguration.d.ts.map +1 -0
  131. package/lib/directors/ProductDiscountConfiguration.js +2 -0
  132. package/lib/directors/ProductDiscountConfiguration.js.map +1 -0
  133. package/lib/directors/ProductDiscountDirector.d.ts +3 -0
  134. package/lib/directors/ProductDiscountDirector.d.ts.map +1 -0
  135. package/lib/directors/ProductDiscountDirector.js +3 -0
  136. package/lib/directors/ProductDiscountDirector.js.map +1 -0
  137. package/lib/directors/ProductPricingAdapter.d.ts +17 -0
  138. package/lib/directors/ProductPricingAdapter.d.ts.map +1 -0
  139. package/lib/directors/ProductPricingAdapter.js +24 -0
  140. package/lib/directors/ProductPricingAdapter.js.map +1 -0
  141. package/lib/directors/ProductPricingDirector.d.ts +21 -0
  142. package/lib/directors/ProductPricingDirector.d.ts.map +1 -0
  143. package/lib/directors/ProductPricingDirector.js +52 -0
  144. package/lib/directors/ProductPricingDirector.js.map +1 -0
  145. package/lib/directors/ProductPricingSheet.d.ts +38 -0
  146. package/lib/directors/ProductPricingSheet.d.ts.map +1 -0
  147. package/lib/directors/ProductPricingSheet.js +83 -0
  148. package/lib/directors/ProductPricingSheet.js.map +1 -0
  149. package/lib/directors/QuotationAdapter.d.ts +28 -0
  150. package/lib/directors/QuotationAdapter.d.ts.map +1 -0
  151. package/lib/directors/QuotationAdapter.js +46 -0
  152. package/lib/directors/QuotationAdapter.js.map +1 -0
  153. package/lib/directors/QuotationDirector.d.ts +7 -0
  154. package/lib/directors/QuotationDirector.d.ts.map +1 -0
  155. package/lib/directors/QuotationDirector.js +84 -0
  156. package/lib/directors/QuotationDirector.js.map +1 -0
  157. package/lib/directors/WarehousingAdapter.d.ts +40 -0
  158. package/lib/directors/WarehousingAdapter.d.ts.map +1 -0
  159. package/lib/directors/WarehousingAdapter.js +32 -0
  160. package/lib/directors/WarehousingAdapter.js.map +1 -0
  161. package/lib/directors/WarehousingDirector.d.ts +38 -0
  162. package/lib/directors/WarehousingDirector.d.ts.map +1 -0
  163. package/lib/directors/WarehousingDirector.js +169 -0
  164. package/lib/directors/WarehousingDirector.js.map +1 -0
  165. package/lib/directors/WorkerAdapter.d.ts +17 -0
  166. package/lib/directors/WorkerAdapter.d.ts.map +1 -0
  167. package/lib/directors/WorkerAdapter.js +11 -0
  168. package/lib/directors/WorkerAdapter.js.map +1 -0
  169. package/lib/directors/WorkerDirector.d.ts +26 -0
  170. package/lib/directors/WorkerDirector.d.ts.map +1 -0
  171. package/lib/directors/WorkerDirector.js +102 -0
  172. package/lib/directors/WorkerDirector.js.map +1 -0
  173. package/lib/directors/index.d.ts +39 -0
  174. package/lib/directors/index.d.ts.map +1 -0
  175. package/lib/directors/index.js +39 -0
  176. package/lib/directors/index.js.map +1 -0
  177. package/lib/modules.d.ts +61 -0
  178. package/lib/modules.d.ts.map +1 -0
  179. package/lib/modules.js +132 -0
  180. package/lib/modules.js.map +1 -0
  181. package/lib/services/activateEnrollment.d.ts +4 -0
  182. package/lib/services/activateEnrollment.d.ts.map +1 -0
  183. package/lib/services/activateEnrollment.js +25 -0
  184. package/lib/services/activateEnrollment.js.map +1 -0
  185. package/lib/services/calculateDiscountTotal.d.ts +7 -0
  186. package/lib/services/calculateDiscountTotal.d.ts.map +1 -0
  187. package/lib/services/calculateDiscountTotal.js +49 -0
  188. package/lib/services/calculateDiscountTotal.js.map +1 -0
  189. package/lib/services/checkoutOrder.d.ts +9 -0
  190. package/lib/services/checkoutOrder.d.ts.map +1 -0
  191. package/lib/services/checkoutOrder.js +28 -0
  192. package/lib/services/checkoutOrder.js.map +1 -0
  193. package/lib/services/confirmOrder.d.ts +9 -0
  194. package/lib/services/confirmOrder.d.ts.map +1 -0
  195. package/lib/services/confirmOrder.js +17 -0
  196. package/lib/services/confirmOrder.js.map +1 -0
  197. package/lib/services/createDownloadStream.d.ts +5 -0
  198. package/lib/services/createDownloadStream.d.ts.map +1 -0
  199. package/lib/services/createDownloadStream.js +8 -0
  200. package/lib/services/createDownloadStream.js.map +1 -0
  201. package/lib/services/createDownloadStreamService.d.ts +11 -0
  202. package/lib/services/createDownloadStreamService.d.ts.map +1 -0
  203. package/lib/services/createDownloadStreamService.js +9 -0
  204. package/lib/services/createDownloadStreamService.js.map +1 -0
  205. package/lib/services/createEnrollmentFromCheckout.d.ts +15 -0
  206. package/lib/services/createEnrollmentFromCheckout.d.ts.map +1 -0
  207. package/lib/services/createEnrollmentFromCheckout.js +40 -0
  208. package/lib/services/createEnrollmentFromCheckout.js.map +1 -0
  209. package/lib/services/createManualOrderDiscount.d.ts +7 -0
  210. package/lib/services/createManualOrderDiscount.d.ts.map +1 -0
  211. package/lib/services/createManualOrderDiscount.js +47 -0
  212. package/lib/services/createManualOrderDiscount.js.map +1 -0
  213. package/lib/services/createSignedURL.d.ts +8 -0
  214. package/lib/services/createSignedURL.d.ts.map +1 -0
  215. package/lib/services/createSignedURL.js +15 -0
  216. package/lib/services/createSignedURL.js.map +1 -0
  217. package/lib/services/createSignedURLService.d.ts +13 -0
  218. package/lib/services/createSignedURLService.d.ts.map +1 -0
  219. package/lib/services/createSignedURLService.js +14 -0
  220. package/lib/services/createSignedURLService.js.map +1 -0
  221. package/lib/services/deleteUser.d.ts +5 -0
  222. package/lib/services/deleteUser.d.ts.map +1 -0
  223. package/lib/services/deleteUser.js +26 -0
  224. package/lib/services/deleteUser.js.map +1 -0
  225. package/lib/services/deleteUserCartService.d.ts +6 -0
  226. package/lib/services/deleteUserCartService.d.ts.map +1 -0
  227. package/lib/services/deleteUserCartService.js +20 -0
  228. package/lib/services/deleteUserCartService.js.map +1 -0
  229. package/lib/services/deleteUserCarts.d.ts +5 -0
  230. package/lib/services/deleteUserCarts.d.ts.map +1 -0
  231. package/lib/services/deleteUserCarts.js +18 -0
  232. package/lib/services/deleteUserCarts.js.map +1 -0
  233. package/lib/services/deleteUserCartsService.d.ts +5 -0
  234. package/lib/services/deleteUserCartsService.d.ts.map +1 -0
  235. package/lib/services/deleteUserCartsService.js +18 -0
  236. package/lib/services/deleteUserCartsService.js.map +1 -0
  237. package/lib/services/discountedEntities.d.ts +5 -0
  238. package/lib/services/discountedEntities.d.ts.map +1 -0
  239. package/lib/services/discountedEntities.js +61 -0
  240. package/lib/services/discountedEntities.js.map +1 -0
  241. package/lib/services/ercMetadata.d.ts +7 -0
  242. package/lib/services/ercMetadata.d.ts.map +1 -0
  243. package/lib/services/ercMetadata.js +22 -0
  244. package/lib/services/ercMetadata.js.map +1 -0
  245. package/lib/services/fullfillQuotation.d.ts +4 -0
  246. package/lib/services/fullfillQuotation.d.ts.map +1 -0
  247. package/lib/services/fullfillQuotation.js +12 -0
  248. package/lib/services/fullfillQuotation.js.map +1 -0
  249. package/lib/services/index.d.ts +110 -0
  250. package/lib/services/index.d.ts.map +1 -0
  251. package/lib/services/index.js +124 -0
  252. package/lib/services/index.js.map +1 -0
  253. package/lib/services/index_BACKUP_58089.d.ts +246 -0
  254. package/lib/services/index_BACKUP_58089.d.ts.map +1 -0
  255. package/lib/services/index_BACKUP_58089.js +103 -0
  256. package/lib/services/index_BACKUP_58089.js.map +1 -0
  257. package/lib/services/index_BASE_58089.d.ts +31 -0
  258. package/lib/services/index_BASE_58089.d.ts.map +1 -0
  259. package/lib/services/index_BASE_58089.js +42 -0
  260. package/lib/services/index_BASE_58089.js.map +1 -0
  261. package/lib/services/index_LOCAL_58089.d.ts +246 -0
  262. package/lib/services/index_LOCAL_58089.d.ts.map +1 -0
  263. package/lib/services/index_LOCAL_58089.js +103 -0
  264. package/lib/services/index_LOCAL_58089.js.map +1 -0
  265. package/lib/services/index_REMOTE_58089.d.ts +34 -0
  266. package/lib/services/index_REMOTE_58089.d.ts.map +1 -0
  267. package/lib/services/index_REMOTE_58089.js +44 -0
  268. package/lib/services/index_REMOTE_58089.js.map +1 -0
  269. package/lib/services/initCartProviders.d.ts +4 -0
  270. package/lib/services/initCartProviders.d.ts.map +1 -0
  271. package/lib/services/initCartProviders.js +55 -0
  272. package/lib/services/initCartProviders.js.map +1 -0
  273. package/lib/services/initializeEnrollment.d.ts +7 -0
  274. package/lib/services/initializeEnrollment.d.ts.map +1 -0
  275. package/lib/services/initializeEnrollment.js +28 -0
  276. package/lib/services/initializeEnrollment.js.map +1 -0
  277. package/lib/services/invalidateFilterCache.d.ts +3 -0
  278. package/lib/services/invalidateFilterCache.d.ts.map +1 -0
  279. package/lib/services/invalidateFilterCache.js +12 -0
  280. package/lib/services/invalidateFilterCache.js.map +1 -0
  281. package/lib/services/linkFileService.d.ts +7 -0
  282. package/lib/services/linkFileService.d.ts.map +1 -0
  283. package/lib/services/linkFileService.js +18 -0
  284. package/lib/services/linkFileService.js.map +1 -0
  285. package/lib/services/loadFilterOptions.d.ts +14 -0
  286. package/lib/services/loadFilterOptions.d.ts.map +1 -0
  287. package/lib/services/loadFilterOptions.js +30 -0
  288. package/lib/services/loadFilterOptions.js.map +1 -0
  289. package/lib/services/loadFilters.d.ts +14 -0
  290. package/lib/services/loadFilters.d.ts.map +1 -0
  291. package/lib/services/loadFilters.js +36 -0
  292. package/lib/services/loadFilters.js.map +1 -0
  293. package/lib/services/migrateBookmarks.d.ts +8 -0
  294. package/lib/services/migrateBookmarks.d.ts.map +1 -0
  295. package/lib/services/migrateBookmarks.js +26 -0
  296. package/lib/services/migrateBookmarks.js.map +1 -0
  297. package/lib/services/migrateBookmarksService.d.ts +13 -0
  298. package/lib/services/migrateBookmarksService.d.ts.map +1 -0
  299. package/lib/services/migrateBookmarksService.js +26 -0
  300. package/lib/services/migrateBookmarksService.js.map +1 -0
  301. package/lib/services/migrateOrderCart.d.ts +8 -0
  302. package/lib/services/migrateOrderCart.d.ts.map +1 -0
  303. package/lib/services/migrateOrderCart.js +32 -0
  304. package/lib/services/migrateOrderCart.js.map +1 -0
  305. package/lib/services/migrateOrderCartService.d.ts +23 -0
  306. package/lib/services/migrateOrderCartService.d.ts.map +1 -0
  307. package/lib/services/migrateOrderCartService.js +32 -0
  308. package/lib/services/migrateOrderCartService.js.map +1 -0
  309. package/lib/services/migrateUserData.d.ts +2 -0
  310. package/lib/services/migrateUserData.d.ts.map +1 -0
  311. package/lib/services/migrateUserData.js +20 -0
  312. package/lib/services/migrateUserData.js.map +1 -0
  313. package/lib/services/migrateUserDataService.d.ts +19 -0
  314. package/lib/services/migrateUserDataService.d.ts.map +1 -0
  315. package/lib/services/migrateUserDataService.js +18 -0
  316. package/lib/services/migrateUserDataService.js.map +1 -0
  317. package/lib/services/nextUserCart.d.ts +9 -0
  318. package/lib/services/nextUserCart.d.ts.map +1 -0
  319. package/lib/services/nextUserCart.js +34 -0
  320. package/lib/services/nextUserCart.js.map +1 -0
  321. package/lib/services/nextUserCartService.d.ts +22 -0
  322. package/lib/services/nextUserCartService.d.ts.map +1 -0
  323. package/lib/services/nextUserCartService.js +35 -0
  324. package/lib/services/nextUserCartService.js.map +1 -0
  325. package/lib/services/processEnrollment.d.ts +4 -0
  326. package/lib/services/processEnrollment.d.ts.map +1 -0
  327. package/lib/services/processEnrollment.js +33 -0
  328. package/lib/services/processEnrollment.js.map +1 -0
  329. package/lib/services/processOrder.d.ts +9 -0
  330. package/lib/services/processOrder.d.ts.map +1 -0
  331. package/lib/services/processOrder.js +161 -0
  332. package/lib/services/processOrder.js.map +1 -0
  333. package/lib/services/processQuotation.d.ts +6 -0
  334. package/lib/services/processQuotation.d.ts.map +1 -0
  335. package/lib/services/processQuotation.js +60 -0
  336. package/lib/services/processQuotation.js.map +1 -0
  337. package/lib/services/proposeQuotation.d.ts +6 -0
  338. package/lib/services/proposeQuotation.d.ts.map +1 -0
  339. package/lib/services/proposeQuotation.js +12 -0
  340. package/lib/services/proposeQuotation.js.map +1 -0
  341. package/lib/services/registerPaymentCredentials.d.ts +5 -0
  342. package/lib/services/registerPaymentCredentials.d.ts.map +1 -0
  343. package/lib/services/registerPaymentCredentials.js +21 -0
  344. package/lib/services/registerPaymentCredentials.js.map +1 -0
  345. package/lib/services/rejectOrder.d.ts +9 -0
  346. package/lib/services/rejectOrder.d.ts.map +1 -0
  347. package/lib/services/rejectOrder.js +17 -0
  348. package/lib/services/rejectOrder.js.map +1 -0
  349. package/lib/services/rejectQuotation.d.ts +6 -0
  350. package/lib/services/rejectQuotation.d.ts.map +1 -0
  351. package/lib/services/rejectQuotation.js +12 -0
  352. package/lib/services/rejectQuotation.js.map +1 -0
  353. package/lib/services/removeFiles.d.ts +5 -0
  354. package/lib/services/removeFiles.d.ts.map +1 -0
  355. package/lib/services/removeFiles.js +19 -0
  356. package/lib/services/removeFiles.js.map +1 -0
  357. package/lib/services/removeFilesService.d.ts +10 -0
  358. package/lib/services/removeFilesService.d.ts.map +1 -0
  359. package/lib/services/removeFilesService.js +20 -0
  360. package/lib/services/removeFilesService.js.map +1 -0
  361. package/lib/services/removeProduct.d.ts +5 -0
  362. package/lib/services/removeProduct.d.ts.map +1 -0
  363. package/lib/services/removeProduct.js +26 -0
  364. package/lib/services/removeProduct.js.map +1 -0
  365. package/lib/services/removeProductService.d.ts +20 -0
  366. package/lib/services/removeProductService.d.ts.map +1 -0
  367. package/lib/services/removeProductService.js +27 -0
  368. package/lib/services/removeProductService.js.map +1 -0
  369. package/lib/services/searchAssortments.d.ts +19 -0
  370. package/lib/services/searchAssortments.d.ts.map +1 -0
  371. package/lib/services/searchAssortments.js +33 -0
  372. package/lib/services/searchAssortments.js.map +1 -0
  373. package/lib/services/searchProducts.d.ts +16 -0
  374. package/lib/services/searchProducts.d.ts.map +1 -0
  375. package/lib/services/searchProducts.js +41 -0
  376. package/lib/services/searchProducts.js.map +1 -0
  377. package/lib/services/supportedDeliveryProviders.d.ts +5 -0
  378. package/lib/services/supportedDeliveryProviders.d.ts.map +1 -0
  379. package/lib/services/supportedDeliveryProviders.js +14 -0
  380. package/lib/services/supportedDeliveryProviders.js.map +1 -0
  381. package/lib/services/supportedPaymentProviders.d.ts +5 -0
  382. package/lib/services/supportedPaymentProviders.d.ts.map +1 -0
  383. package/lib/services/supportedPaymentProviders.js +14 -0
  384. package/lib/services/supportedPaymentProviders.js.map +1 -0
  385. package/lib/services/supportedWarehousingProviders.d.ts +5 -0
  386. package/lib/services/supportedWarehousingProviders.d.ts.map +1 -0
  387. package/lib/services/supportedWarehousingProviders.js +10 -0
  388. package/lib/services/supportedWarehousingProviders.js.map +1 -0
  389. package/lib/services/terminateEnrollment.d.ts +3 -0
  390. package/lib/services/terminateEnrollment.d.ts.map +1 -0
  391. package/lib/services/terminateEnrollment.js +25 -0
  392. package/lib/services/terminateEnrollment.js.map +1 -0
  393. package/lib/services/updateCalculation.d.ts +3 -0
  394. package/lib/services/updateCalculation.d.ts.map +1 -0
  395. package/lib/services/updateCalculation.js +101 -0
  396. package/lib/services/updateCalculation.js.map +1 -0
  397. package/lib/services/updateCalculationService.d.ts +17 -0
  398. package/lib/services/updateCalculationService.d.ts.map +1 -0
  399. package/lib/services/updateCalculationService.js +68 -0
  400. package/lib/services/updateCalculationService.js.map +1 -0
  401. package/lib/services/updateScheduling.d.ts +8 -0
  402. package/lib/services/updateScheduling.d.ts.map +1 -0
  403. package/lib/services/updateScheduling.js +42 -0
  404. package/lib/services/updateScheduling.js.map +1 -0
  405. package/lib/services/updateUserAvatarAfterUpload.d.ts +6 -0
  406. package/lib/services/updateUserAvatarAfterUpload.d.ts.map +1 -0
  407. package/lib/services/updateUserAvatarAfterUpload.js +25 -0
  408. package/lib/services/updateUserAvatarAfterUpload.js.map +1 -0
  409. package/lib/services/updateUserAvatarAfterUploadService.d.ts +18 -0
  410. package/lib/services/updateUserAvatarAfterUploadService.d.ts.map +1 -0
  411. package/lib/services/updateUserAvatarAfterUploadService.js +25 -0
  412. package/lib/services/updateUserAvatarAfterUploadService.js.map +1 -0
  413. package/lib/services/uploadFileFromStream.d.ts +8 -0
  414. package/lib/services/uploadFileFromStream.d.ts.map +1 -0
  415. package/lib/services/uploadFileFromStream.js +11 -0
  416. package/lib/services/uploadFileFromStream.js.map +1 -0
  417. package/lib/services/uploadFileFromStreamService.d.ts +12 -0
  418. package/lib/services/uploadFileFromStreamService.d.ts.map +1 -0
  419. package/lib/services/uploadFileFromStreamService.js +10 -0
  420. package/lib/services/uploadFileFromStreamService.js.map +1 -0
  421. package/lib/services/uploadFileFromURL.d.ts +13 -0
  422. package/lib/services/uploadFileFromURL.d.ts.map +1 -0
  423. package/lib/services/uploadFileFromURL.js +11 -0
  424. package/lib/services/uploadFileFromURL.js.map +1 -0
  425. package/lib/services/uploadFileFromURLService.d.ts +17 -0
  426. package/lib/services/uploadFileFromURLService.d.ts.map +1 -0
  427. package/lib/services/uploadFileFromURLService.js +10 -0
  428. package/lib/services/uploadFileFromURLService.js.map +1 -0
  429. package/lib/services/validateOrder.d.ts +4 -0
  430. package/lib/services/validateOrder.d.ts.map +1 -0
  431. package/lib/services/validateOrder.js +45 -0
  432. package/lib/services/validateOrder.js.map +1 -0
  433. package/lib/services/verifyQuotation.d.ts +6 -0
  434. package/lib/services/verifyQuotation.d.ts.map +1 -0
  435. package/lib/services/verifyQuotation.js +12 -0
  436. package/lib/services/verifyQuotation.js.map +1 -0
  437. package/package.json +28 -28
  438. package/src/core-index.ts +14 -241
  439. package/src/directors/BaseDiscountAdapter.test.ts +49 -0
  440. package/src/directors/BaseDiscountAdapter.ts +91 -0
  441. package/src/directors/BaseDiscountDirector.ts +72 -0
  442. package/src/directors/BasePricingAdapter.ts +82 -0
  443. package/src/directors/BasePricingDirector.ts +136 -0
  444. package/src/directors/BasePricingSheet.test.ts +43 -0
  445. package/src/directors/BasePricingSheet.ts +140 -0
  446. package/src/directors/DeliveryAdapter.ts +110 -0
  447. package/src/directors/DeliveryDirector.ts +135 -0
  448. package/src/directors/DeliveryPricingAdapter.ts +87 -0
  449. package/src/directors/DeliveryPricingDirector.ts +92 -0
  450. package/src/directors/DeliveryPricingSheet.ts +86 -0
  451. package/src/directors/EnrollmentAdapter.ts +109 -0
  452. package/src/directors/EnrollmentDirector.ts +70 -0
  453. package/src/directors/FilterAdapter.ts +103 -0
  454. package/src/directors/FilterDirector.ts +309 -0
  455. package/src/directors/MessagingDirector.test.ts +5 -0
  456. package/src/directors/MessagingDirector.ts +59 -0
  457. package/src/directors/OrderDiscountAdapter.ts +10 -0
  458. package/src/directors/OrderDiscountConfiguration.ts +5 -0
  459. package/src/directors/OrderDiscountDirector.ts +6 -0
  460. package/src/directors/OrderPricingAdapter.ts +63 -0
  461. package/src/directors/OrderPricingDirector.ts +74 -0
  462. package/src/directors/OrderPricingSheet.ts +147 -0
  463. package/src/directors/PaymentAdapter.ts +118 -0
  464. package/src/directors/PaymentDirector.ts +275 -0
  465. package/src/directors/PaymentPricingAdapter.ts +86 -0
  466. package/src/directors/PaymentPricingDirector.ts +94 -0
  467. package/src/directors/PaymentPricingSheet.ts +91 -0
  468. package/src/directors/ProductDiscountAdapter.ts +10 -0
  469. package/src/directors/ProductDiscountConfiguration.ts +18 -0
  470. package/src/directors/ProductDiscountDirector.ts +5 -0
  471. package/src/directors/ProductPricingAdapter.ts +56 -0
  472. package/src/directors/ProductPricingDirector.ts +100 -0
  473. package/src/directors/ProductPricingSheet.test.ts +129 -0
  474. package/src/directors/ProductPricingSheet.ts +127 -0
  475. package/src/directors/QuotationAdapter.ts +86 -0
  476. package/src/directors/QuotationDirector.ts +105 -0
  477. package/src/directors/WarehousingAdapter.ts +83 -0
  478. package/src/directors/WarehousingDirector.ts +235 -0
  479. package/src/directors/WorkerAdapter.ts +30 -0
  480. package/src/directors/WorkerDirector.ts +154 -0
  481. package/src/directors/index.ts +49 -0
  482. package/src/directors/periodForReferenceDate.test.ts +23 -0
  483. package/src/modules.ts +215 -0
  484. package/src/services/activateEnrollment.ts +30 -0
  485. package/src/services/calculateDiscountTotal.ts +71 -0
  486. package/src/services/checkoutOrder.ts +43 -0
  487. package/src/services/confirmOrder.ts +26 -0
  488. package/src/services/createDownloadStream.ts +16 -0
  489. package/src/services/createEnrollmentFromCheckout.ts +66 -0
  490. package/src/services/createManualOrderDiscount.ts +56 -0
  491. package/src/services/createSignedURL.ts +20 -0
  492. package/src/services/deleteUser.ts +33 -0
  493. package/src/services/discountedEntities.ts +81 -0
  494. package/src/services/ercMetadata.ts +33 -0
  495. package/src/services/fullfillQuotation.ts +14 -0
  496. package/src/services/index.ts +154 -0
  497. package/src/services/initCartProviders.ts +86 -0
  498. package/src/services/initializeEnrollment.ts +38 -0
  499. package/src/services/invalidateFilterCache.ts +16 -0
  500. package/src/services/linkFileService.ts +22 -0
  501. package/src/services/loadFilterOptions.ts +50 -0
  502. package/src/services/loadFilters.ts +52 -0
  503. package/src/services/migrateBookmarks.ts +39 -0
  504. package/src/services/migrateOrderCart.ts +52 -0
  505. package/src/services/migrateUserData.ts +22 -0
  506. package/src/services/nextUserCart.ts +52 -0
  507. package/src/services/processEnrollment.ts +37 -0
  508. package/src/services/processOrder.ts +241 -0
  509. package/src/services/processQuotation.ts +75 -0
  510. package/src/services/proposeQuotation.ts +18 -0
  511. package/src/services/registerPaymentCredentials.ts +30 -0
  512. package/src/services/rejectOrder.ts +26 -0
  513. package/src/services/rejectQuotation.ts +18 -0
  514. package/src/services/removeFiles.ts +25 -0
  515. package/src/services/removeProduct.ts +34 -0
  516. package/src/services/searchAssortments.ts +58 -0
  517. package/src/services/searchProducts.ts +73 -0
  518. package/src/services/supportedDeliveryProviders.ts +24 -0
  519. package/src/services/supportedPaymentProviders.ts +25 -0
  520. package/src/services/supportedWarehousingProviders.ts +18 -0
  521. package/src/services/terminateEnrollment.ts +29 -0
  522. package/src/services/updateCalculation.ts +143 -0
  523. package/src/services/updateScheduling.ts +64 -0
  524. package/src/services/updateUserAvatarAfterUpload.ts +30 -0
  525. package/src/services/uploadFileFromStream.ts +15 -0
  526. package/src/services/uploadFileFromURL.ts +29 -0
  527. package/src/services/validateOrder.ts +53 -0
  528. package/src/services/verifyQuotation.ts +18 -0
  529. package/tsconfig.json +5 -7
  530. package/src/types.ts +0 -7
@@ -0,0 +1,241 @@
1
+ import {
2
+ Order,
3
+ OrderDelivery,
4
+ OrderDeliveryStatus,
5
+ OrderPayment,
6
+ OrderPaymentStatus,
7
+ OrderStatus,
8
+ } from '@unchainedshop/core-orders';
9
+ import { Modules } from '../modules.js';
10
+ import { createEnrollmentFromCheckoutService } from './createEnrollmentFromCheckout.js';
11
+ import { ProductTypes } from '@unchainedshop/core-products';
12
+ import { WarehousingProviderType } from '@unchainedshop/core-warehousing';
13
+ import { WarehousingDirector, DeliveryDirector, PaymentDirector } from '../directors/index.js';
14
+ import { fullfillQuotationService } from './fullfillQuotation.js';
15
+
16
+ const isAutoConfirmationEnabled = async (
17
+ {
18
+ orderPayment,
19
+ orderDelivery,
20
+ }: {
21
+ orderPayment: OrderPayment;
22
+ orderDelivery: OrderDelivery;
23
+ },
24
+ modules: Modules,
25
+ ) => {
26
+ if (orderPayment.status !== OrderPaymentStatus.PAID) {
27
+ const provider = await modules.payment.paymentProviders.findProvider({
28
+ paymentProviderId: orderPayment.paymentProviderId,
29
+ });
30
+ const actions = await PaymentDirector.actions(provider, {}, { modules });
31
+ if (!actions.isPayLaterAllowed()) return false;
32
+ }
33
+
34
+ if (orderDelivery.status !== OrderDeliveryStatus.DELIVERED) {
35
+ const deliveryProvider = await modules.delivery.findProvider({
36
+ deliveryProviderId: orderDelivery.deliveryProviderId,
37
+ });
38
+ const director = await DeliveryDirector.actions(deliveryProvider, {}, { modules });
39
+ if (!director.isAutoReleaseAllowed()) return false;
40
+ }
41
+
42
+ return true;
43
+ };
44
+
45
+ const findNextStatus = async (
46
+ status: OrderStatus | null,
47
+ order: Order,
48
+ modules: Modules,
49
+ ): Promise<OrderStatus | null> => {
50
+ if (status === null) {
51
+ return OrderStatus.PENDING;
52
+ }
53
+
54
+ if (status === OrderStatus.FULLFILLED || status === OrderStatus.REJECTED) {
55
+ // Final!
56
+ return status;
57
+ }
58
+
59
+ const orderPayment = await modules.orders.payments.findOrderPayment({
60
+ orderPaymentId: order.paymentId,
61
+ });
62
+ if (!orderPayment) return status;
63
+
64
+ const orderDelivery = await modules.orders.deliveries.findDelivery({
65
+ orderDeliveryId: order.deliveryId,
66
+ });
67
+ if (!orderDelivery) return status;
68
+
69
+ // Ok, we have a payment and a delivery and the correct status,
70
+ // let's check if we can auto-confirm or auto-fulfill
71
+ if (status === OrderStatus.PENDING) {
72
+ if (await isAutoConfirmationEnabled({ orderPayment, orderDelivery }, modules)) {
73
+ return OrderStatus.CONFIRMED;
74
+ }
75
+ }
76
+ if (status === OrderStatus.CONFIRMED) {
77
+ const readyForFullfillment =
78
+ orderDelivery.status === OrderDeliveryStatus.DELIVERED &&
79
+ orderPayment.status === OrderPaymentStatus.PAID;
80
+ if (readyForFullfillment) {
81
+ return OrderStatus.FULLFILLED;
82
+ }
83
+ }
84
+
85
+ return status;
86
+ };
87
+
88
+ export async function processOrderService(
89
+ this: Modules,
90
+ initialOrder: Order,
91
+ orderTransactionContext: {
92
+ paymentContext?: any;
93
+ deliveryContext?: any;
94
+ comment?: string;
95
+ nextStatus?: OrderStatus;
96
+ },
97
+ ) {
98
+ const {
99
+ paymentContext,
100
+ deliveryContext,
101
+ nextStatus: forceNextStatus,
102
+ comment,
103
+ } = orderTransactionContext;
104
+
105
+ const orderId = initialOrder._id;
106
+ let order = initialOrder;
107
+ let nextStatus = forceNextStatus || (await findNextStatus(initialOrder.status, order, this));
108
+
109
+ if (nextStatus === OrderStatus.PENDING) {
110
+ // auto charge during transition to pending
111
+ const orderPayment = await this.orders.payments.findOrderPayment({
112
+ orderPaymentId: order.paymentId,
113
+ });
114
+
115
+ await PaymentDirector.chargeOrderPayment(
116
+ orderPayment,
117
+ { userId: order.userId, transactionContext: paymentContext },
118
+ { modules: this },
119
+ );
120
+
121
+ nextStatus = await findNextStatus(nextStatus, order, this);
122
+ }
123
+
124
+ if (nextStatus === OrderStatus.REJECTED) {
125
+ // auto cancel during transition to rejected
126
+ const orderPayment = await this.orders.payments.findOrderPayment({
127
+ orderPaymentId: order.paymentId,
128
+ });
129
+ await PaymentDirector.cancelOrderPayment(
130
+ orderPayment,
131
+ { userId: order.userId, transactionContext: paymentContext },
132
+ { modules: this },
133
+ );
134
+ }
135
+
136
+ if (nextStatus === OrderStatus.CONFIRMED) {
137
+ // confirm pre-authorized payments
138
+ const orderPayment = await this.orders.payments.findOrderPayment({
139
+ orderPaymentId: order.paymentId,
140
+ });
141
+ await PaymentDirector.confirmOrderPayment(
142
+ orderPayment,
143
+ { userId: order.userId, transactionContext: paymentContext },
144
+ { modules: this },
145
+ );
146
+ if (order.status !== OrderStatus.CONFIRMED) {
147
+ // we have to stop here shortly to complete the confirmation
148
+ // before auto delivery is started, else we have no chance to create
149
+ // numbers that are needed for delivery
150
+ order = await this.orders.updateStatus(orderId, {
151
+ status: OrderStatus.CONFIRMED,
152
+ info: comment,
153
+ });
154
+
155
+ const orderDelivery = await this.orders.deliveries.findDelivery({
156
+ orderDeliveryId: order.deliveryId,
157
+ });
158
+
159
+ await DeliveryDirector.sendOrderDelivery(orderDelivery, deliveryContext, { modules: this });
160
+
161
+ const orderPositions = await this.orders.positions.findOrderPositions({ orderId });
162
+ const mappedProductOrderPositions = await Promise.all(
163
+ orderPositions.map(async (orderPosition) => {
164
+ const product = await this.products.findProduct({
165
+ productId: orderPosition.productId,
166
+ });
167
+ return {
168
+ orderPosition,
169
+ product,
170
+ };
171
+ }),
172
+ );
173
+ const tokenizedItems = mappedProductOrderPositions.filter(
174
+ (item) => item.product?.type === ProductTypes.TokenizedProduct,
175
+ );
176
+ if (tokenizedItems.length > 0) {
177
+ // Give virtual warehouse a chance to instantiate new virtual objects
178
+ const virtualProviders = await this.warehousing.findProviders({
179
+ type: WarehousingProviderType.VIRTUAL,
180
+ });
181
+ // It's very important to do this in a series and not in Promise.all
182
+ // TODO: Actually, only createTokens should decide on the unique chainTokenId
183
+ // and the tokens should be created with a distributed Lock to not assign the same id multiple times!
184
+ for (const { orderPosition, product } of tokenizedItems) {
185
+ for (const virtualProvider of virtualProviders) {
186
+ const adapterActions = await WarehousingDirector.actions(
187
+ virtualProvider,
188
+ {
189
+ order,
190
+ orderPosition,
191
+ product,
192
+ quantity: orderPosition.quantity,
193
+ referenceDate: order.ordered,
194
+ },
195
+ { modules: this },
196
+ );
197
+ const isActive = await adapterActions.isActive();
198
+ if (isActive) {
199
+ const tokens = await adapterActions.tokenize();
200
+ await this.warehousing.createTokens(tokens);
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ // Enrollments: Generate enrollments for plan products
207
+ const planItems = mappedProductOrderPositions.filter(
208
+ (item) => item.product?.type === ProductTypes.PlanProduct && !order.originEnrollmentId,
209
+ );
210
+ if (planItems.length > 0) {
211
+ await createEnrollmentFromCheckoutService.bind(this)(order, {
212
+ items: planItems,
213
+ context: {
214
+ paymentContext,
215
+ deliveryContext,
216
+ },
217
+ });
218
+ }
219
+
220
+ // Quotations: If we came here, the checkout succeeded, so we can fullfill underlying quotations
221
+ const quotationItems = mappedProductOrderPositions.filter(
222
+ (item) => item.orderPosition.quotationId,
223
+ );
224
+ await Promise.all(
225
+ quotationItems.map(async ({ orderPosition }) => {
226
+ const quotation = await this.quotations.findQuotation({
227
+ quotationId: orderPosition.quotationId,
228
+ });
229
+ await fullfillQuotationService.bind(this)(quotation, {
230
+ orderId,
231
+ orderPositionId: orderPosition._id,
232
+ });
233
+ }),
234
+ );
235
+ }
236
+
237
+ nextStatus = await findNextStatus(nextStatus, order, this);
238
+ }
239
+
240
+ return this.orders.updateStatus(order._id, { status: nextStatus, info: comment });
241
+ }
@@ -0,0 +1,75 @@
1
+ import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
2
+ import { Modules } from '../modules.js';
3
+ import { QuotationDirector } from '../core-index.js';
4
+
5
+ const findNextStatus = async (quotation: Quotation, modules: Modules): Promise<QuotationStatus> => {
6
+ let status = quotation.status as QuotationStatus;
7
+ const director = await QuotationDirector.actions({ quotation }, { modules });
8
+
9
+ if (status === QuotationStatus.REQUESTED) {
10
+ if (!(await director.isManualRequestVerificationRequired())) {
11
+ status = QuotationStatus.PROCESSING;
12
+ }
13
+ }
14
+ if (status === QuotationStatus.PROCESSING) {
15
+ if (!(await director.isManualProposalRequired())) {
16
+ status = QuotationStatus.PROPOSED;
17
+ }
18
+ }
19
+ return status;
20
+ };
21
+
22
+ export async function processQuotationService(
23
+ this: Modules,
24
+ initialQuotation: Quotation,
25
+ params: { quotationContext?: any },
26
+ ) {
27
+ const quotationId = initialQuotation._id;
28
+ let quotation = initialQuotation;
29
+ let nextStatus = await findNextStatus(quotation, this);
30
+ const director = await QuotationDirector.actions({ quotation }, { modules: this });
31
+
32
+ if (quotation.status === QuotationStatus.REQUESTED && nextStatus !== QuotationStatus.REQUESTED) {
33
+ await director.submitRequest(params.quotationContext);
34
+ }
35
+
36
+ quotation = await this.quotations.findQuotation({ quotationId });
37
+ nextStatus = await findNextStatus(quotation, this);
38
+ if (nextStatus !== QuotationStatus.PROCESSING) {
39
+ await director.verifyRequest(params.quotationContext);
40
+ }
41
+
42
+ quotation = await this.quotations.findQuotation({ quotationId });
43
+ nextStatus = await findNextStatus(quotation, this);
44
+ if (nextStatus === QuotationStatus.REJECTED) {
45
+ await director.rejectRequest(params.quotationContext);
46
+ }
47
+
48
+ quotation = await this.quotations.findQuotation({ quotationId });
49
+ nextStatus = await findNextStatus(quotation, this);
50
+ if (nextStatus === QuotationStatus.PROPOSED) {
51
+ const proposal = await director.quote();
52
+ quotation = await this.quotations.updateProposal(quotation._id, proposal);
53
+ nextStatus = await findNextStatus(quotation, this);
54
+ }
55
+
56
+ const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
57
+ status: nextStatus,
58
+ info: 'quotation processed',
59
+ });
60
+
61
+ const user = await this.users.findUserById(updatedQuotation.userId);
62
+ const locale = this.users.userLocale(user);
63
+
64
+ await this.worker.addWork({
65
+ type: 'MESSAGE',
66
+ retries: 0,
67
+ input: {
68
+ locale,
69
+ template: 'QUOTATION_STATUS',
70
+ quotationId: updatedQuotation._id,
71
+ },
72
+ });
73
+
74
+ return updatedQuotation;
75
+ }
@@ -0,0 +1,18 @@
1
+ import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
2
+ import { Modules } from '../modules.js';
3
+ import { processQuotationService } from './processQuotation.js';
4
+
5
+ export async function proposeQuotationService(
6
+ this: Modules,
7
+ quotation: Quotation,
8
+ { quotationContext }: { quotationContext?: any },
9
+ ) {
10
+ if (quotation.status !== QuotationStatus.PROCESSING) return quotation;
11
+
12
+ const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
13
+ status: QuotationStatus.PROPOSED,
14
+ info: 'proposed manually',
15
+ });
16
+
17
+ return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
18
+ }
@@ -0,0 +1,30 @@
1
+ import { PaymentCredentials } from '@unchainedshop/core-payment';
2
+ import { PaymentContext } from '../directors/PaymentAdapter.js';
3
+ import { PaymentDirector } from '../directors/PaymentDirector.js';
4
+ import { Modules } from '../modules.js';
5
+
6
+ export async function registerPaymentCredentialsService(
7
+ this: Modules,
8
+ paymentProviderId: string,
9
+ paymentContext: PaymentContext,
10
+ ): Promise<PaymentCredentials> {
11
+ const paymentProvider = await this.payment.paymentProviders.findProvider({
12
+ paymentProviderId,
13
+ });
14
+ const actions = await PaymentDirector.actions(paymentProvider, paymentContext, { modules: this });
15
+ const registration = await actions.register();
16
+
17
+ if (!registration) return null;
18
+
19
+ const paymentCredentialsId = await this.payment.paymentCredentials.upsertCredentials({
20
+ userId: paymentContext.userId,
21
+ paymentProviderId,
22
+ ...registration,
23
+ });
24
+
25
+ return this.payment.paymentCredentials.findPaymentCredential({
26
+ paymentCredentialsId,
27
+ userId: paymentContext.userId,
28
+ paymentProviderId,
29
+ });
30
+ }
@@ -0,0 +1,26 @@
1
+ import { Order, OrderStatus } from '@unchainedshop/core-orders';
2
+ import { Modules } from '../modules.js';
3
+ import { processOrderService } from './processOrder.js';
4
+
5
+ export async function rejectOrderService(
6
+ this: Modules,
7
+ order: Order,
8
+ transactionContext: {
9
+ paymentContext?: any;
10
+ deliveryContext?: any;
11
+ comment?: string;
12
+ nextStatus?: OrderStatus;
13
+ },
14
+ ) {
15
+ if (order.status !== OrderStatus.PENDING) return order;
16
+
17
+ const lock = await this.orders.acquireLock(order._id, 'confirm-reject', 1500);
18
+ try {
19
+ return await processOrderService.bind(this)(order, {
20
+ ...transactionContext,
21
+ nextStatus: OrderStatus.REJECTED,
22
+ });
23
+ } finally {
24
+ await lock.release();
25
+ }
26
+ }
@@ -0,0 +1,18 @@
1
+ import { Quotation, QuotationStatus } from '@unchainedshop/core-quotations';
2
+ import { Modules } from '../modules.js';
3
+ import { processQuotationService } from './processQuotation.js';
4
+
5
+ export async function rejectQuotationService(
6
+ this: Modules,
7
+ quotation: Quotation,
8
+ { quotationContext }: { quotationContext?: any },
9
+ ) {
10
+ if (quotation.status === QuotationStatus.FULLFILLED) return quotation;
11
+
12
+ const updatedQuotation = await this.quotations.updateStatus(quotation._id, {
13
+ status: QuotationStatus.REJECTED,
14
+ info: 'rejected manually',
15
+ });
16
+
17
+ return processQuotationService.bind(this)(updatedQuotation, { quotationContext });
18
+ }
@@ -0,0 +1,25 @@
1
+ import { getFileAdapter } from '@unchainedshop/core-files';
2
+ import { Modules } from '../modules.js';
3
+
4
+ export async function removeFilesService(this: Modules, { fileIds }: { fileIds: Array<string> }) {
5
+ if (fileIds && typeof fileIds !== 'string' && !Array.isArray(fileIds))
6
+ throw Error('Media id/s to be removed not provided as a string or array');
7
+
8
+ const fileUploadAdapter = getFileAdapter();
9
+
10
+ const fileObjects = await this.files.findFiles({
11
+ _id: { $in: fileIds },
12
+ });
13
+
14
+ try {
15
+ await fileUploadAdapter.removeFiles(fileObjects, { modules: this });
16
+ } catch (e) {
17
+ console.warn(e); // eslint-disable-line
18
+ }
19
+
20
+ const fileIdsToDelete = fileObjects.map((f) => f._id).filter(Boolean);
21
+
22
+ await this.files.deleteMany(fileIdsToDelete);
23
+
24
+ return fileIdsToDelete.length;
25
+ }
@@ -0,0 +1,34 @@
1
+ import { ProductStatus } from '@unchainedshop/core-products';
2
+ import { updateCalculationService } from './updateCalculation.js';
3
+ import { Modules } from '../modules.js';
4
+
5
+ export async function removeProductService(
6
+ this: Modules,
7
+ { productId }: { productId: string },
8
+ ): Promise<boolean> {
9
+ const product = await this.products.findProduct({ productId });
10
+ switch (product.status) {
11
+ case ProductStatus.ACTIVE:
12
+ await this.products.unpublish(product);
13
+ // falls through
14
+ case null:
15
+ case ProductStatus.DRAFT:
16
+ {
17
+ await this.bookmarks.deleteByProductId(productId);
18
+ await this.assortments.products.delete(productId);
19
+ const orderIdsToRecalculate =
20
+ await this.orders.positions.removeProductByIdFromAllOpenPositions(productId);
21
+ await Promise.all(
22
+ [...new Set(orderIdsToRecalculate)].map(async (orderIdToRecalculate) => {
23
+ await updateCalculationService.bind(this)(orderIdToRecalculate);
24
+ }),
25
+ );
26
+ await this.products.delete(productId);
27
+ }
28
+ break;
29
+ default:
30
+ throw new Error(`Invalid status', ${product.status}`);
31
+ }
32
+
33
+ return true;
34
+ }
@@ -0,0 +1,58 @@
1
+ import { Assortment } from '@unchainedshop/core-assortments';
2
+ import {
3
+ defaultAssortmentSelector,
4
+ defaultFilterSelector,
5
+ defaultSortStage,
6
+ SearchConfiguration,
7
+ SearchQuery,
8
+ } from '@unchainedshop/core-filters';
9
+ import { mongodb } from '@unchainedshop/mongodb';
10
+ import { Modules } from '../modules.js';
11
+ import { FilterDirector } from '../directors/index.js';
12
+ export interface SearchAssortmentConfiguration extends SearchConfiguration {
13
+ assortmentSelector: mongodb.Filter<Assortment>;
14
+ }
15
+
16
+ export async function searchAssortmentsService(
17
+ this: Modules,
18
+ searchQuery: SearchQuery,
19
+ { forceLiveCollection }: { forceLiveCollection?: boolean },
20
+ ) {
21
+ const filterActions = await FilterDirector.actions({ searchQuery }, { modules: this });
22
+
23
+ const filterSelector = await filterActions.transformFilterSelector(defaultFilterSelector(searchQuery));
24
+ const assortmentSelector = defaultAssortmentSelector(searchQuery);
25
+ const sortStage = await filterActions.transformSortStage(defaultSortStage(searchQuery));
26
+
27
+ const searchConfiguration: SearchAssortmentConfiguration = {
28
+ searchQuery,
29
+ filterSelector,
30
+ assortmentSelector,
31
+ sortStage,
32
+ forceLiveCollection,
33
+ };
34
+
35
+ const assortmentIds = await searchQuery.assortmentIds;
36
+
37
+ const totalAssortmentIds =
38
+ (await filterActions.searchAssortments({ assortmentIds }, searchConfiguration)) || [];
39
+
40
+ return {
41
+ searchConfiguration,
42
+ totalAssortmentIds,
43
+
44
+ assortmentsCount: async () =>
45
+ this.assortments.count({
46
+ assortmentSelector,
47
+ assortmentIds: totalAssortmentIds,
48
+ }),
49
+ assortments: async ({ offset, limit }) =>
50
+ this.assortments.search.findFilteredAssortments({
51
+ limit,
52
+ offset,
53
+ assortmentIds: totalAssortmentIds,
54
+ assortmentSelector,
55
+ sort: sortStage,
56
+ }),
57
+ };
58
+ }
@@ -0,0 +1,73 @@
1
+ import {
2
+ defaultFilterSelector,
3
+ defaultProductSelector,
4
+ defaultSortStage,
5
+ SearchConfiguration,
6
+ SearchQuery,
7
+ } from '@unchainedshop/core-filters';
8
+ import { Product } from '@unchainedshop/core-products';
9
+ import { mongodb } from '@unchainedshop/mongodb';
10
+ import { Modules } from '../modules.js';
11
+ import { FilterDirector } from '../directors/index.js';
12
+ export interface SearchProductConfiguration extends SearchConfiguration {
13
+ productSelector: mongodb.Filter<Product>;
14
+ }
15
+
16
+ export async function searchProductsService(
17
+ this: Modules,
18
+ searchQuery: SearchQuery,
19
+ { forceLiveCollection }: { forceLiveCollection?: boolean },
20
+ ) {
21
+ const filterActions = await FilterDirector.actions({ searchQuery }, { modules: this });
22
+
23
+ const filterSelector = await filterActions.transformFilterSelector(defaultFilterSelector(searchQuery));
24
+ const productSelector = await filterActions.transformProductSelector(
25
+ defaultProductSelector(searchQuery, { modules: this }),
26
+ {},
27
+ );
28
+ const sortStage = await filterActions.transformSortStage(defaultSortStage(searchQuery));
29
+
30
+ const searchConfiguration: SearchProductConfiguration = {
31
+ searchQuery,
32
+ filterSelector,
33
+ productSelector,
34
+ sortStage,
35
+ forceLiveCollection,
36
+ };
37
+
38
+ if (searchQuery.productIds?.length === 0) {
39
+ // Restricted to an empty array of products
40
+ // will always lead to an empty result
41
+ return {
42
+ searchConfiguration,
43
+ aggregatedTotalProductIds: [],
44
+ aggregatedFilteredProductIds: [],
45
+ totalProductIds: [],
46
+ };
47
+ }
48
+
49
+ const productIds = await searchQuery.productIds;
50
+ const totalProductIds =
51
+ (await filterActions.searchProducts({ productIds }, searchConfiguration)) || [];
52
+
53
+ const filteredProductIds = await FilterDirector.productFacetedSearch(
54
+ totalProductIds,
55
+ searchConfiguration,
56
+ { modules: this },
57
+ );
58
+
59
+ const aggregatedTotalProductIds = filterActions.aggregateProductIds({
60
+ productIds: totalProductIds,
61
+ });
62
+
63
+ const aggregatedFilteredProductIds = filterActions.aggregateProductIds({
64
+ productIds: filteredProductIds,
65
+ });
66
+
67
+ return {
68
+ searchConfiguration,
69
+ totalProductIds,
70
+ aggregatedTotalProductIds,
71
+ aggregatedFilteredProductIds,
72
+ };
73
+ }
@@ -0,0 +1,24 @@
1
+ import { DeliveryProvider, deliverySettings } from '@unchainedshop/core-delivery';
2
+ import { Modules } from '../modules.js';
3
+ import { DeliveryContext, DeliveryDirector } from '../directors/index.js';
4
+
5
+ export async function supportedDeliveryProvidersService(this: Modules, params: DeliveryContext) {
6
+ const allProviders = await this.delivery.findProviders({});
7
+
8
+ const providers = (
9
+ await Promise.all(
10
+ allProviders.map(async (provider: DeliveryProvider) => {
11
+ const adapter = await DeliveryDirector.actions(provider, params, { modules: this });
12
+ return adapter.isActive() ? [provider] : [];
13
+ }),
14
+ )
15
+ ).flat();
16
+
17
+ return deliverySettings.filterSupportedProviders(
18
+ {
19
+ providers,
20
+ order: params.order,
21
+ },
22
+ { modules: this },
23
+ );
24
+ }
@@ -0,0 +1,25 @@
1
+ import { PaymentProvider, paymentSettings } from '@unchainedshop/core-payment';
2
+ import { PaymentDirector } from '../directors/PaymentDirector.js';
3
+ import { PaymentContext } from '../directors/PaymentAdapter.js';
4
+ import { Modules } from '../modules.js';
5
+
6
+ export async function supportedPaymentProvidersService(this: Modules, params: PaymentContext) {
7
+ const allProviders = await this.payment.paymentProviders.findProviders({});
8
+
9
+ const providers = (
10
+ await Promise.all(
11
+ allProviders.map(async (provider: PaymentProvider) => {
12
+ const adapter = await PaymentDirector.actions(provider, params, { modules: this });
13
+ return adapter.isActive() ? [provider] : [];
14
+ }),
15
+ )
16
+ ).flat();
17
+
18
+ return paymentSettings.filterSupportedProviders(
19
+ {
20
+ providers,
21
+ order: params.order,
22
+ },
23
+ { modules: this },
24
+ );
25
+ }
@@ -0,0 +1,18 @@
1
+ import { WarehousingProvider } from '@unchainedshop/core-warehousing';
2
+ import { WarehousingContext, WarehousingDirector } from '../directors/index.js';
3
+ import { Modules } from '../modules.js';
4
+
5
+ export async function supportedWarehousingProvidersService(this: Modules, params: WarehousingContext) {
6
+ const allProviders = await this.warehousing.findProviders({});
7
+
8
+ const providers = (
9
+ await Promise.all(
10
+ allProviders.map(async (provider: WarehousingProvider) => {
11
+ const adapter = await WarehousingDirector.actions(provider, params, { modules: this });
12
+ return adapter.isActive() ? [provider] : [];
13
+ }),
14
+ )
15
+ ).flat();
16
+
17
+ return providers;
18
+ }