@unchainedshop/plugins 3.0.0-alpha7 → 3.0.0-rc1

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 (385) hide show
  1. package/lib/delivery/pick-mup.js +1 -2
  2. package/lib/delivery/pick-mup.js.map +1 -1
  3. package/lib/delivery/post.js +2 -1
  4. package/lib/delivery/post.js.map +1 -1
  5. package/lib/delivery/send-message.js +2 -1
  6. package/lib/delivery/send-message.js.map +1 -1
  7. package/lib/delivery/stores.js +2 -1
  8. package/lib/delivery/stores.js.map +1 -1
  9. package/lib/enrollments/licensed.d.ts.map +1 -1
  10. package/lib/enrollments/licensed.js +1 -1
  11. package/lib/enrollments/licensed.js.map +1 -1
  12. package/lib/events/aws-eventbridge.d.ts +2 -0
  13. package/lib/events/aws-eventbridge.d.ts.map +1 -0
  14. package/lib/events/aws-eventbridge.js +36 -0
  15. package/lib/events/aws-eventbridge.js.map +1 -0
  16. package/lib/events/node-event-emitter.js +1 -2
  17. package/lib/events/node-event-emitter.js.map +1 -1
  18. package/lib/events/redis.js +4 -2
  19. package/lib/events/redis.js.map +1 -1
  20. package/lib/files/gridfs/gridfs-adapter.d.ts.map +1 -1
  21. package/lib/files/gridfs/gridfs-adapter.js +14 -5
  22. package/lib/files/gridfs/gridfs-adapter.js.map +1 -1
  23. package/lib/files/gridfs/gridfs-webhook.d.ts +1 -1
  24. package/lib/files/gridfs/gridfs-webhook.d.ts.map +1 -1
  25. package/lib/files/gridfs/gridfs-webhook.js +25 -6
  26. package/lib/files/gridfs/gridfs-webhook.js.map +1 -1
  27. package/lib/files/gridfs/sign.d.ts +1 -1
  28. package/lib/files/gridfs/sign.d.ts.map +1 -1
  29. package/lib/files/gridfs/sign.js +8 -7
  30. package/lib/files/gridfs/sign.js.map +1 -1
  31. package/lib/files/minio/minio-adapter.d.ts.map +1 -1
  32. package/lib/files/minio/minio-adapter.js +13 -9
  33. package/lib/files/minio/minio-adapter.js.map +1 -1
  34. package/lib/files/minio/minio-webhook.d.ts.map +1 -1
  35. package/lib/files/minio/minio-webhook.js +4 -3
  36. package/lib/files/minio/minio-webhook.js.map +1 -1
  37. package/lib/filters/local-search.d.ts +1 -1
  38. package/lib/filters/local-search.d.ts.map +1 -1
  39. package/lib/filters/local-search.js +1 -1
  40. package/lib/filters/local-search.js.map +1 -1
  41. package/lib/filters/strict-equal.js +1 -1
  42. package/lib/filters/strict-equal.js.map +1 -1
  43. package/lib/payment/apple-iap/adapter.d.ts.map +1 -1
  44. package/lib/payment/apple-iap/adapter.js +15 -20
  45. package/lib/payment/apple-iap/adapter.js.map +1 -1
  46. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -1
  47. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +1 -1
  48. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +1 -1
  49. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts.map +1 -1
  50. package/lib/payment/braintree.js +10 -8
  51. package/lib/payment/braintree.js.map +1 -1
  52. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -1
  53. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +1 -1
  54. package/lib/payment/cryptopay/middleware.d.ts.map +1 -1
  55. package/lib/payment/cryptopay/middleware.js +4 -4
  56. package/lib/payment/cryptopay/middleware.js.map +1 -1
  57. package/lib/payment/cryptopay/plugin.d.ts +1 -1
  58. package/lib/payment/cryptopay/plugin.d.ts.map +1 -1
  59. package/lib/payment/cryptopay/plugin.js +8 -9
  60. package/lib/payment/cryptopay/plugin.js.map +1 -1
  61. package/lib/payment/datatrans-v2/api/authorize.d.ts +1 -1
  62. package/lib/payment/datatrans-v2/api/authorize.d.ts.map +1 -1
  63. package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +1 -1
  64. package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts.map +1 -1
  65. package/lib/payment/datatrans-v2/api/cancel.d.ts +1 -1
  66. package/lib/payment/datatrans-v2/api/cancel.d.ts.map +1 -1
  67. package/lib/payment/datatrans-v2/api/init.d.ts +1 -1
  68. package/lib/payment/datatrans-v2/api/init.d.ts.map +1 -1
  69. package/lib/payment/datatrans-v2/api/makeFetcher.d.ts.map +1 -1
  70. package/lib/payment/datatrans-v2/api/makeFetcher.js +0 -1
  71. package/lib/payment/datatrans-v2/api/makeFetcher.js.map +1 -1
  72. package/lib/payment/datatrans-v2/api/secureFields.d.ts +1 -1
  73. package/lib/payment/datatrans-v2/api/secureFields.d.ts.map +1 -1
  74. package/lib/payment/datatrans-v2/api/settle.d.ts +1 -1
  75. package/lib/payment/datatrans-v2/api/settle.d.ts.map +1 -1
  76. package/lib/payment/datatrans-v2/api/status.d.ts +1 -1
  77. package/lib/payment/datatrans-v2/api/status.d.ts.map +1 -1
  78. package/lib/payment/datatrans-v2/api/types.d.ts +260 -0
  79. package/lib/payment/datatrans-v2/api/types.d.ts.map +1 -0
  80. package/lib/payment/datatrans-v2/api/types.js +2 -0
  81. package/lib/payment/datatrans-v2/api/types.js.map +1 -0
  82. package/lib/payment/datatrans-v2/api/validate.d.ts +1 -1
  83. package/lib/payment/datatrans-v2/api/validate.d.ts.map +1 -1
  84. package/lib/payment/datatrans-v2/generateSignature copy.d.ts +11 -0
  85. package/lib/payment/datatrans-v2/generateSignature copy.d.ts.map +1 -0
  86. package/lib/payment/datatrans-v2/generateSignature copy.js +19 -0
  87. package/lib/payment/datatrans-v2/generateSignature copy.js.map +1 -0
  88. package/lib/payment/datatrans-v2/generateSignature.d.ts +1 -1
  89. package/lib/payment/datatrans-v2/generateSignature.d.ts.map +1 -1
  90. package/lib/payment/datatrans-v2/generateSignature.js +7 -4
  91. package/lib/payment/datatrans-v2/generateSignature.js.map +1 -1
  92. package/lib/payment/datatrans-v2/index.d.ts.map +1 -1
  93. package/lib/payment/datatrans-v2/index.js +31 -29
  94. package/lib/payment/datatrans-v2/index.js.map +1 -1
  95. package/lib/payment/datatrans-v2/middleware.d.ts.map +1 -1
  96. package/lib/payment/datatrans-v2/middleware.js +7 -5
  97. package/lib/payment/datatrans-v2/middleware.js.map +1 -1
  98. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +4 -4
  99. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +1 -1
  100. package/lib/payment/datatrans-v2/parseRegistrationData.js +5 -3
  101. package/lib/payment/datatrans-v2/parseRegistrationData.js.map +1 -1
  102. package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +1 -2
  103. package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts.map +1 -1
  104. package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +6 -2
  105. package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +1 -1
  106. package/lib/payment/datatrans-v2/splitProperties.d.ts +0 -1
  107. package/lib/payment/datatrans-v2/splitProperties.d.ts.map +1 -1
  108. package/lib/payment/datatrans-v2/splitProperties.js +0 -3
  109. package/lib/payment/datatrans-v2/splitProperties.js.map +1 -1
  110. package/lib/payment/invoice-prepaid.js +4 -3
  111. package/lib/payment/invoice-prepaid.js.map +1 -1
  112. package/lib/payment/invoice.js +4 -3
  113. package/lib/payment/invoice.js.map +1 -1
  114. package/lib/payment/paypal-checkout.js +8 -6
  115. package/lib/payment/paypal-checkout.js.map +1 -1
  116. package/lib/payment/payrexx/api/makeFetcher.d.ts.map +1 -1
  117. package/lib/payment/payrexx/api/makeFetcher.js +2 -3
  118. package/lib/payment/payrexx/api/makeFetcher.js.map +1 -1
  119. package/lib/payment/payrexx/index.d.ts.map +1 -1
  120. package/lib/payment/payrexx/index.js +20 -14
  121. package/lib/payment/payrexx/index.js.map +1 -1
  122. package/lib/payment/payrexx/middleware.d.ts.map +1 -1
  123. package/lib/payment/payrexx/middleware.js +12 -9
  124. package/lib/payment/payrexx/middleware.js.map +1 -1
  125. package/lib/payment/postfinance-checkout/index.d.ts.map +1 -1
  126. package/lib/payment/postfinance-checkout/index.js +18 -13
  127. package/lib/payment/postfinance-checkout/index.js.map +1 -1
  128. package/lib/payment/postfinance-checkout/middleware.d.ts.map +1 -1
  129. package/lib/payment/postfinance-checkout/middleware.js +4 -3
  130. package/lib/payment/postfinance-checkout/middleware.js.map +1 -1
  131. package/lib/payment/postfinance-checkout/utils.d.ts +2 -2
  132. package/lib/payment/postfinance-checkout/utils.d.ts.map +1 -1
  133. package/lib/payment/postfinance-checkout/utils.js +6 -2
  134. package/lib/payment/postfinance-checkout/utils.js.map +1 -1
  135. package/lib/payment/saferpay/adapter.d.ts +1 -1
  136. package/lib/payment/saferpay/adapter.d.ts.map +1 -1
  137. package/lib/payment/saferpay/adapter.js +17 -11
  138. package/lib/payment/saferpay/adapter.js.map +1 -1
  139. package/lib/payment/saferpay/api/api/SaferpayConnection.d.ts.map +1 -1
  140. package/lib/payment/saferpay/api/api/SaferpayConnection.js +0 -1
  141. package/lib/payment/saferpay/api/api/SaferpayConnection.js.map +1 -1
  142. package/lib/payment/saferpay/api/models/TransactionCapture.d.ts +1 -1
  143. package/lib/payment/saferpay/api/models/TransactionCapture.d.ts.map +1 -1
  144. package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts +1 -1
  145. package/lib/payment/saferpay/db/SaferpayTransactionsCollection.d.ts.map +1 -1
  146. package/lib/payment/saferpay/middleware.d.ts.map +1 -1
  147. package/lib/payment/saferpay/middleware.js +4 -4
  148. package/lib/payment/saferpay/middleware.js.map +1 -1
  149. package/lib/payment/stripe/index.d.ts.map +1 -1
  150. package/lib/payment/stripe/index.js +17 -11
  151. package/lib/payment/stripe/index.js.map +1 -1
  152. package/lib/payment/stripe/middleware.d.ts.map +1 -1
  153. package/lib/payment/stripe/middleware.js +10 -10
  154. package/lib/payment/stripe/middleware.js.map +1 -1
  155. package/lib/payment/stripe/stripe.d.ts +3 -4
  156. package/lib/payment/stripe/stripe.d.ts.map +1 -1
  157. package/lib/payment/stripe/stripe.js +1 -1
  158. package/lib/payment/stripe/stripe.js.map +1 -1
  159. package/lib/pricing/delivery-swiss-tax.d.ts +1 -1
  160. package/lib/pricing/delivery-swiss-tax.d.ts.map +1 -1
  161. package/lib/pricing/delivery-swiss-tax.js +1 -2
  162. package/lib/pricing/delivery-swiss-tax.js.map +1 -1
  163. package/lib/pricing/discount-100-off.d.ts +2 -3
  164. package/lib/pricing/discount-100-off.d.ts.map +1 -1
  165. package/lib/pricing/discount-100-off.js +1 -1
  166. package/lib/pricing/discount-100-off.js.map +1 -1
  167. package/lib/pricing/discount-half-price-manual.d.ts +2 -3
  168. package/lib/pricing/discount-half-price-manual.d.ts.map +1 -1
  169. package/lib/pricing/discount-half-price-manual.js +1 -1
  170. package/lib/pricing/discount-half-price-manual.js.map +1 -1
  171. package/lib/pricing/discount-half-price.d.ts +2 -3
  172. package/lib/pricing/discount-half-price.d.ts.map +1 -1
  173. package/lib/pricing/discount-half-price.js +1 -1
  174. package/lib/pricing/discount-half-price.js.map +1 -1
  175. package/lib/pricing/free-delivery.d.ts +1 -1
  176. package/lib/pricing/free-delivery.d.ts.map +1 -1
  177. package/lib/pricing/free-delivery.js +1 -1
  178. package/lib/pricing/free-delivery.js.map +1 -1
  179. package/lib/pricing/free-payment.d.ts +1 -1
  180. package/lib/pricing/free-payment.d.ts.map +1 -1
  181. package/lib/pricing/free-payment.js +1 -1
  182. package/lib/pricing/free-payment.js.map +1 -1
  183. package/lib/pricing/order-delivery.d.ts +1 -1
  184. package/lib/pricing/order-delivery.d.ts.map +1 -1
  185. package/lib/pricing/order-delivery.js +6 -3
  186. package/lib/pricing/order-delivery.js.map +1 -1
  187. package/lib/pricing/order-discount.d.ts +1 -2
  188. package/lib/pricing/order-discount.d.ts.map +1 -1
  189. package/lib/pricing/order-discount.js +15 -8
  190. package/lib/pricing/order-discount.js.map +1 -1
  191. package/lib/pricing/order-items-discount.js +7 -4
  192. package/lib/pricing/order-items-discount.js.map +1 -1
  193. package/lib/pricing/order-items.js +7 -3
  194. package/lib/pricing/order-items.js.map +1 -1
  195. package/lib/pricing/order-payment.js +6 -3
  196. package/lib/pricing/order-payment.js.map +1 -1
  197. package/lib/pricing/order-round.d.ts +1 -1
  198. package/lib/pricing/order-round.d.ts.map +1 -1
  199. package/lib/pricing/order-round.js +1 -2
  200. package/lib/pricing/order-round.js.map +1 -1
  201. package/lib/pricing/product-catalog-price.d.ts +2 -2
  202. package/lib/pricing/product-catalog-price.d.ts.map +1 -1
  203. package/lib/pricing/product-catalog-price.js +7 -6
  204. package/lib/pricing/product-catalog-price.js.map +1 -1
  205. package/lib/pricing/product-discount.js +1 -2
  206. package/lib/pricing/product-discount.js.map +1 -1
  207. package/lib/pricing/product-price-rateconversion.d.ts +1 -1
  208. package/lib/pricing/product-price-rateconversion.d.ts.map +1 -1
  209. package/lib/pricing/product-price-rateconversion.js +1 -1
  210. package/lib/pricing/product-price-rateconversion.js.map +1 -1
  211. package/lib/pricing/product-round.d.ts +1 -1
  212. package/lib/pricing/product-round.d.ts.map +1 -1
  213. package/lib/pricing/product-round.js +1 -1
  214. package/lib/pricing/product-round.js.map +1 -1
  215. package/lib/pricing/product-swiss-tax.d.ts +4 -3
  216. package/lib/pricing/product-swiss-tax.d.ts.map +1 -1
  217. package/lib/pricing/product-swiss-tax.js +1 -2
  218. package/lib/pricing/product-swiss-tax.js.map +1 -1
  219. package/lib/quotations/manual.js +1 -1
  220. package/lib/quotations/manual.js.map +1 -1
  221. package/lib/warehousing/eth-minter.js +7 -4
  222. package/lib/warehousing/eth-minter.js.map +1 -1
  223. package/lib/warehousing/store.js +2 -1
  224. package/lib/warehousing/store.js.map +1 -1
  225. package/lib/worker/BaseWorker.d.ts +30 -0
  226. package/lib/worker/BaseWorker.d.ts.map +1 -0
  227. package/lib/worker/BaseWorker.js +81 -0
  228. package/lib/worker/BaseWorker.js.map +1 -0
  229. package/lib/worker/EventListenerWorker.d.ts +6 -0
  230. package/lib/worker/EventListenerWorker.d.ts.map +1 -0
  231. package/lib/worker/EventListenerWorker.js +46 -0
  232. package/lib/worker/EventListenerWorker.js.map +1 -0
  233. package/lib/worker/FailedRescheduler.d.ts +15 -0
  234. package/lib/worker/FailedRescheduler.d.ts.map +1 -0
  235. package/lib/worker/FailedRescheduler.js +45 -0
  236. package/lib/worker/FailedRescheduler.js.map +1 -0
  237. package/lib/worker/IntervalWorker.d.ts +10 -0
  238. package/lib/worker/IntervalWorker.d.ts.map +1 -0
  239. package/lib/worker/IntervalWorker.js +37 -0
  240. package/lib/worker/IntervalWorker.js.map +1 -0
  241. package/lib/worker/bulk-import.d.ts +1 -1
  242. package/lib/worker/bulk-import.d.ts.map +1 -1
  243. package/lib/worker/bulk-import.js +7 -8
  244. package/lib/worker/bulk-import.js.map +1 -1
  245. package/lib/worker/email.d.ts.map +1 -1
  246. package/lib/worker/email.js +1 -5
  247. package/lib/worker/email.js.map +1 -1
  248. package/lib/worker/enrollment-order-generator.d.ts.map +1 -1
  249. package/lib/worker/enrollment-order-generator.js +17 -15
  250. package/lib/worker/enrollment-order-generator.js.map +1 -1
  251. package/lib/worker/error-notifications.d.ts +1 -1
  252. package/lib/worker/error-notifications.d.ts.map +1 -1
  253. package/lib/worker/error-notifications.js +1 -1
  254. package/lib/worker/error-notifications.js.map +1 -1
  255. package/lib/worker/export-token.d.ts +1 -2
  256. package/lib/worker/export-token.d.ts.map +1 -1
  257. package/lib/worker/export-token.js +2 -1
  258. package/lib/worker/export-token.js.map +1 -1
  259. package/lib/worker/external.d.ts +1 -1
  260. package/lib/worker/external.d.ts.map +1 -1
  261. package/lib/worker/external.js +1 -1
  262. package/lib/worker/external.js.map +1 -1
  263. package/lib/worker/heartbeat.js +1 -1
  264. package/lib/worker/heartbeat.js.map +1 -1
  265. package/lib/worker/http-request.d.ts +1 -1
  266. package/lib/worker/http-request.d.ts.map +1 -1
  267. package/lib/worker/http-request.js +1 -5
  268. package/lib/worker/http-request.js.map +1 -1
  269. package/lib/worker/message.d.ts +2 -2
  270. package/lib/worker/message.d.ts.map +1 -1
  271. package/lib/worker/message.js +1 -5
  272. package/lib/worker/message.js.map +1 -1
  273. package/lib/worker/push-notification.js +1 -4
  274. package/lib/worker/push-notification.js.map +1 -1
  275. package/lib/worker/sms.js +1 -4
  276. package/lib/worker/sms.js.map +1 -1
  277. package/lib/worker/update-coinbase-rates.js +1 -1
  278. package/lib/worker/update-coinbase-rates.js.map +1 -1
  279. package/lib/worker/update-ecb-rates.js +1 -1
  280. package/lib/worker/update-ecb-rates.js.map +1 -1
  281. package/lib/worker/update-token-ownership.d.ts +1 -1
  282. package/lib/worker/update-token-ownership.d.ts.map +1 -1
  283. package/lib/worker/update-token-ownership.js +1 -1
  284. package/lib/worker/update-token-ownership.js.map +1 -1
  285. package/lib/worker/zombie-killer.d.ts +8 -2
  286. package/lib/worker/zombie-killer.d.ts.map +1 -1
  287. package/lib/worker/zombie-killer.js +12 -9
  288. package/lib/worker/zombie-killer.js.map +1 -1
  289. package/package.json +37 -82
  290. package/src/delivery/pick-mup.ts +2 -3
  291. package/src/delivery/post.ts +2 -2
  292. package/src/delivery/send-message.ts +2 -2
  293. package/src/delivery/stores.ts +2 -2
  294. package/src/enrollments/licensed.ts +1 -2
  295. package/src/events/aws-eventbridge.ts +43 -0
  296. package/src/events/node-event-emitter.ts +1 -2
  297. package/src/events/redis.ts +4 -2
  298. package/src/files/gridfs/gridfs-adapter.ts +15 -5
  299. package/src/files/gridfs/gridfs-webhook.ts +29 -9
  300. package/src/files/gridfs/sign.ts +20 -8
  301. package/src/files/minio/minio-adapter.ts +14 -11
  302. package/src/files/minio/minio-webhook.ts +5 -3
  303. package/src/filters/local-search.ts +1 -2
  304. package/src/filters/strict-equal.ts +1 -2
  305. package/src/payment/apple-iap/adapter.ts +22 -40
  306. package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +1 -1
  307. package/src/payment/apple-iap/module/configureAppleTransactionsModule.ts +1 -1
  308. package/src/payment/braintree.ts +16 -9
  309. package/src/payment/cryptopay/db/CryptopayTransactions.ts +1 -1
  310. package/src/payment/cryptopay/middleware.ts +11 -8
  311. package/src/payment/cryptopay/plugin.ts +14 -11
  312. package/src/payment/datatrans-v2/api/authorize.ts +1 -1
  313. package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +1 -1
  314. package/src/payment/datatrans-v2/api/cancel.ts +1 -1
  315. package/src/payment/datatrans-v2/api/init.ts +1 -1
  316. package/src/payment/datatrans-v2/api/makeFetcher.ts +0 -1
  317. package/src/payment/datatrans-v2/api/secureFields.ts +1 -1
  318. package/src/payment/datatrans-v2/api/settle.ts +1 -1
  319. package/src/payment/datatrans-v2/api/status.ts +1 -1
  320. package/src/payment/datatrans-v2/api/validate.ts +1 -1
  321. package/src/payment/datatrans-v2/generateSignature.test.ts +15 -0
  322. package/src/payment/datatrans-v2/generateSignature.ts +18 -6
  323. package/src/payment/datatrans-v2/index.ts +41 -36
  324. package/src/payment/datatrans-v2/middleware.ts +8 -12
  325. package/src/payment/datatrans-v2/parseRegistrationData.ts +7 -5
  326. package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +6 -6
  327. package/src/payment/datatrans-v2/splitProperties.ts +0 -5
  328. package/src/payment/invoice-prepaid.ts +4 -4
  329. package/src/payment/invoice.ts +4 -4
  330. package/src/payment/paypal-checkout.ts +14 -7
  331. package/src/payment/payrexx/api/makeFetcher.ts +2 -3
  332. package/src/payment/payrexx/index.ts +26 -15
  333. package/src/payment/payrexx/middleware.ts +14 -19
  334. package/src/payment/postfinance-checkout/index.ts +26 -17
  335. package/src/payment/postfinance-checkout/middleware.ts +6 -9
  336. package/src/payment/postfinance-checkout/utils.ts +6 -3
  337. package/src/payment/saferpay/adapter.ts +23 -13
  338. package/src/payment/saferpay/api/api/SaferpayConnection.ts +0 -1
  339. package/src/payment/saferpay/api/models/TransactionCapture.ts +1 -1
  340. package/src/payment/saferpay/db/SaferpayTransactionsCollection.ts +1 -1
  341. package/src/payment/saferpay/middleware.ts +6 -10
  342. package/src/payment/stripe/index.ts +23 -12
  343. package/src/payment/stripe/middleware.ts +15 -23
  344. package/src/payment/stripe/stripe.ts +4 -5
  345. package/src/pricing/delivery-swiss-tax.ts +6 -2
  346. package/src/pricing/discount-100-off.ts +4 -3
  347. package/src/pricing/discount-half-price-manual.ts +9 -5
  348. package/src/pricing/discount-half-price.ts +9 -5
  349. package/src/pricing/free-delivery.ts +1 -1
  350. package/src/pricing/free-payment.ts +1 -1
  351. package/src/pricing/order-delivery.ts +11 -8
  352. package/src/pricing/order-discount.ts +26 -11
  353. package/src/pricing/order-items-discount.ts +12 -5
  354. package/src/pricing/order-items.ts +12 -8
  355. package/src/pricing/order-payment.ts +11 -8
  356. package/src/pricing/order-round.ts +6 -2
  357. package/src/pricing/product-catalog-price.ts +12 -7
  358. package/src/pricing/product-discount.ts +5 -4
  359. package/src/pricing/product-price-rateconversion.ts +5 -2
  360. package/src/pricing/product-round.ts +5 -2
  361. package/src/pricing/product-swiss-tax.ts +5 -3
  362. package/src/quotations/manual.ts +1 -2
  363. package/src/warehousing/eth-minter.ts +11 -10
  364. package/src/warehousing/store.ts +2 -6
  365. package/src/worker/BaseWorker.ts +119 -0
  366. package/src/worker/EventListenerWorker.ts +61 -0
  367. package/src/worker/FailedRescheduler.ts +80 -0
  368. package/src/worker/IntervalWorker.ts +54 -0
  369. package/src/worker/bulk-import.ts +12 -13
  370. package/src/worker/email.ts +1 -8
  371. package/src/worker/enrollment-order-generator.ts +25 -34
  372. package/src/worker/error-notifications.ts +2 -2
  373. package/src/worker/export-token.ts +2 -8
  374. package/src/worker/external.ts +1 -2
  375. package/src/worker/heartbeat.ts +1 -2
  376. package/src/worker/http-request.ts +1 -8
  377. package/src/worker/message.ts +2 -6
  378. package/src/worker/push-notification.ts +1 -6
  379. package/src/worker/sms.ts +1 -7
  380. package/src/worker/update-coinbase-rates.ts +1 -3
  381. package/src/worker/update-ecb-rates.ts +1 -3
  382. package/src/worker/update-token-ownership.ts +1 -2
  383. package/src/worker/zombie-killer.ts +23 -23
  384. package/tsconfig.json +4 -5
  385. /package/src/payment/datatrans-v2/api/{types.d.ts → types.ts} +0 -0
@@ -1,9 +1,6 @@
1
- import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
- import { PaymentAdapter, PaymentError, PaymentDirector } from '@unchainedshop/core-payment';
3
1
  import { createLogger } from '@unchainedshop/logger';
4
- import { PaymentPricingRowCategory } from '@unchainedshop/core-payment';
5
2
  import createDatatransAPI from './api/index.js';
6
- import type {
3
+ import {
7
4
  AuthorizeAuthenticatedResponseSuccess,
8
5
  AuthorizeResponseSuccess,
9
6
  InitResponseSuccess,
@@ -13,6 +10,15 @@ import type {
13
10
  } from './api/types.js';
14
11
  import parseRegistrationData from './parseRegistrationData.js';
15
12
  import roundedAmountFromOrder from './roundedAmountFromOrder.js';
13
+ import {
14
+ IPaymentAdapter,
15
+ PaymentAdapter,
16
+ PaymentDirector,
17
+ PaymentError,
18
+ PaymentPricingRowCategory,
19
+ PaymentPricingSheet,
20
+ OrderPricingSheet,
21
+ } from '@unchainedshop/core';
16
22
 
17
23
  export * from './middleware.js';
18
24
 
@@ -57,11 +63,9 @@ const Datatrans: IPaymentAdapter = {
57
63
  return type === 'GENERIC';
58
64
  },
59
65
 
60
- actions: (params) => {
61
- const { modules } = params.context;
62
-
66
+ actions: (config, context) => {
63
67
  const getMerchantId = (): string | undefined => {
64
- return params.config.find((item) => item.key === 'merchantId')?.value || DATATRANS_MERCHANT_ID;
68
+ return config.find((item) => item.key === 'merchantId')?.value || DATATRANS_MERCHANT_ID;
65
69
  };
66
70
 
67
71
  const api = () => {
@@ -70,7 +74,7 @@ const Datatrans: IPaymentAdapter = {
70
74
  };
71
75
 
72
76
  const shouldSettleInUnchained = () => {
73
- return params.config.reduce((current, item) => {
77
+ return config.reduce((current, item) => {
74
78
  if (item.key === 'settleInUnchained') return Boolean(item.value);
75
79
  return current;
76
80
  }, true);
@@ -83,18 +87,21 @@ const Datatrans: IPaymentAdapter = {
83
87
  commission: number;
84
88
  }[]
85
89
  > => {
86
- const { order, orderPayment } = params.paymentContext;
90
+ const { order, orderPayment } = context;
91
+
92
+ const pricingForOrderPayment = PaymentPricingSheet({
93
+ calculation: orderPayment.calculation,
94
+ currency: order.currency,
95
+ });
96
+ const pricing = OrderPricingSheet({
97
+ calculation: order.calculation,
98
+ currency: order.currency,
99
+ });
87
100
 
88
- const pricingForOrderPayment = modules.orders.payments.pricingSheet(
89
- orderPayment,
90
- order.currency,
91
- params.context,
92
- );
93
- const pricing = modules.orders.pricingSheet(order);
94
101
  const { amount: total } = pricing.total({ useNetPrice: false });
95
102
 
96
103
  return Promise.all(
97
- params.config
104
+ config
98
105
  .filter((item) => item.key === 'marketplaceSplit')
99
106
  .map((item) => {
100
107
  const [subMerchantId, staticDiscountId, sharePercentage] = item.value
@@ -119,11 +126,11 @@ const Datatrans: IPaymentAdapter = {
119
126
  };
120
127
 
121
128
  const authorize = async ({ paymentCredentials, ...arbitraryFields }): Promise<string> => {
122
- const { order, orderPayment } = params.paymentContext;
129
+ const { order, orderPayment } = context;
123
130
  const refno = Buffer.from(orderPayment._id, 'hex').toString('base64');
124
- const userId = order?.userId || params.paymentContext?.userId;
131
+ const userId = order?.userId || context?.userId;
125
132
  const refno2 = userId;
126
- const { currency, amount } = roundedAmountFromOrder(order, params.context);
133
+ const { currency, amount } = roundedAmountFromOrder(order);
127
134
  const splits = await getMarketplaceSplits();
128
135
  const result = await api().authorize({
129
136
  ...arbitraryFields,
@@ -152,8 +159,8 @@ const Datatrans: IPaymentAdapter = {
152
159
  refno2,
153
160
  ...arbitraryFields
154
161
  }): Promise<string> => {
155
- const { order } = params.paymentContext;
156
- const { currency, amount } = roundedAmountFromOrder(order, params.context);
162
+ const { order } = context;
163
+ const { currency, amount } = roundedAmountFromOrder(order);
157
164
  const result = await api().authorizeAuthenticated({
158
165
  ...arbitraryFields,
159
166
  transactionId,
@@ -168,13 +175,13 @@ const Datatrans: IPaymentAdapter = {
168
175
  };
169
176
 
170
177
  const isTransactionAmountValid = (transaction: StatusResponseSuccess): boolean => {
171
- const { order } = params.paymentContext;
172
- const { currency, amount } = roundedAmountFromOrder(order, params.context);
178
+ const { order } = context;
179
+ const { currency, amount } = roundedAmountFromOrder(order);
173
180
  if (
174
181
  transaction.currency !== currency ||
175
182
  (transaction.detail.authorize as any)?.amount !== amount
176
183
  ) {
177
- logger.verbose(
184
+ logger.info(
178
185
  `currency: ${transaction.currency} === ${currency} => ${
179
186
  transaction.currency === currency
180
187
  }, amount: ${(transaction.detail.authorize as any)?.amount} === ${amount} => ${
@@ -202,8 +209,8 @@ const Datatrans: IPaymentAdapter = {
202
209
  };
203
210
 
204
211
  const settle = async ({ transactionId, refno, refno2, extensions }): Promise<boolean> => {
205
- const { order } = params.paymentContext;
206
- const { currency, amount } = roundedAmountFromOrder(order, params.context);
212
+ const { order } = context;
213
+ const { currency, amount } = roundedAmountFromOrder(order);
207
214
  const splits = await getMarketplaceSplits();
208
215
  const result = await api().settle({
209
216
  transactionId,
@@ -232,7 +239,7 @@ const Datatrans: IPaymentAdapter = {
232
239
  };
233
240
 
234
241
  const adapterActions = {
235
- ...PaymentAdapter.actions(params),
242
+ ...PaymentAdapter.actions(config, context),
236
243
 
237
244
  configurationError() {
238
245
  if (!getMerchantId() || !DATATRANS_SECRET || !DATATRANS_SIGN_KEY) {
@@ -252,15 +259,13 @@ const Datatrans: IPaymentAdapter = {
252
259
 
253
260
  async sign(transactionContext: any = {}) {
254
261
  const { useSecureFields = false, ...arbitraryFields } = transactionContext || {};
255
- const { orderPayment, paymentProviderId, order } = params.paymentContext;
262
+ const { orderPayment, paymentProviderId, order } = context;
256
263
  const refno = Buffer.from(orderPayment ? orderPayment._id : paymentProviderId, 'hex').toString(
257
264
  'base64',
258
265
  );
259
- const userId = order?.userId || params.paymentContext?.userId;
266
+ const userId = order?.userId || context?.userId;
260
267
  const refno2 = userId;
261
- const price: { amount?: number; currency?: string } = order
262
- ? roundedAmountFromOrder(order, params.context)
263
- : {};
268
+ const price: { amount?: number; currency?: string } = order ? roundedAmountFromOrder(order) : {};
264
269
 
265
270
  if (useSecureFields) {
266
271
  const result = await api().secureFields({
@@ -314,7 +319,7 @@ const Datatrans: IPaymentAdapter = {
314
319
 
315
320
  async confirm() {
316
321
  if (!shouldSettleInUnchained()) return false;
317
- const { orderPayment, transactionContext } = params.paymentContext;
322
+ const { orderPayment, transactionContext } = context;
318
323
  const { transactionId } = orderPayment;
319
324
 
320
325
  const { extensions } = transactionContext || {};
@@ -344,7 +349,7 @@ const Datatrans: IPaymentAdapter = {
344
349
 
345
350
  async cancel() {
346
351
  if (!shouldSettleInUnchained()) return false;
347
- const { orderPayment } = params.paymentContext;
352
+ const { orderPayment } = context;
348
353
  const { transactionId } = orderPayment;
349
354
  if (!transactionId) {
350
355
  return false;
@@ -437,7 +442,7 @@ const Datatrans: IPaymentAdapter = {
437
442
  // at the dumbest possible moment
438
443
  try {
439
444
  checkIfTransactionAmountValid(transactionId, settledTransaction);
440
- credentials = parseRegistrationData(settledTransaction);
445
+ credentials = await parseRegistrationData(settledTransaction);
441
446
  const result = await api().status({
442
447
  transactionId,
443
448
  });
@@ -1,8 +1,7 @@
1
1
  import { createLogger } from '@unchainedshop/logger';
2
2
  import { Context } from '@unchainedshop/api';
3
3
  import generateSignature, { Security } from './generateSignature.js';
4
-
5
- import type { StatusResponseSuccess } from './api/types.js';
4
+ import { StatusResponseSuccess } from './api/types.js';
6
5
 
7
6
  const {
8
7
  DATATRANS_SIGN_KEY,
@@ -14,14 +13,14 @@ const logger = createLogger('unchained:core-payment:datatrans:webhook');
14
13
 
15
14
  export const datatransHandler = async (req, res) => {
16
15
  const resolvedContext = req.unchainedContext as Context;
17
- const { modules } = resolvedContext;
16
+ const { modules, services } = resolvedContext;
18
17
  const signature = req.headers['datatrans-signature'];
19
18
  if (req.method === 'POST' && signature) {
20
19
  const [rawTimestamp, rawHash] = signature.split(',');
21
20
  const [, hash] = rawHash.split('=');
22
21
  const [, timestamp] = rawTimestamp.split('=');
23
22
 
24
- const comparableSignature = generateSignature({
23
+ const comparableSignature = await generateSignature({
25
24
  security: DATATRANS_SECURITY as any,
26
25
  signKey: DATATRANS_SIGN2_KEY || DATATRANS_SIGN_KEY,
27
26
  })(timestamp, req.body);
@@ -35,7 +34,7 @@ export const datatransHandler = async (req, res) => {
35
34
 
36
35
  const transaction: StatusResponseSuccess = JSON.parse(req.body) as StatusResponseSuccess;
37
36
 
38
- logger.verbose(`received request`, {
37
+ logger.info(`received request`, {
39
38
  type: transaction.type,
40
39
  });
41
40
 
@@ -46,10 +45,9 @@ export const datatransHandler = async (req, res) => {
46
45
  try {
47
46
  if (transaction.type === 'card_check') {
48
47
  const paymentProviderId = referenceId;
49
- const paymentCredentials = await modules.payment.registerCredentials(
48
+ const paymentCredentials = await services.orders.registerPaymentCredentials(
50
49
  paymentProviderId,
51
50
  { userId, transactionContext: { transactionId: transaction.transactionId } },
52
- resolvedContext,
53
51
  );
54
52
  logger.info(`registered payment credentials for ${userId}`, {
55
53
  userId,
@@ -65,11 +63,9 @@ export const datatransHandler = async (req, res) => {
65
63
  });
66
64
  if (!orderPayment) throw new Error(`Order Payment with id ${orderPaymentId} not found`);
67
65
 
68
- const order = await modules.orders.checkout(
69
- orderPayment.orderId,
70
- { paymentContext: { userId, transactionId: transaction.transactionId } },
71
- resolvedContext,
72
- );
66
+ const order = await services.orders.checkoutOrder(orderPayment.orderId, {
67
+ paymentContext: { userId, transactionId: transaction.transactionId },
68
+ });
73
69
  res.writeHead(200);
74
70
  logger.info(`confirmed checkout for order ${order.orderNumber}`, {
75
71
  orderId: order._id,
@@ -1,12 +1,12 @@
1
1
  import splitProperties from './splitProperties.js';
2
- import type { StatusResponseSuccess } from './api/types.js';
2
+ import { StatusResponseSuccess } from './api/types.js';
3
+ import { sha256 } from '@unchainedshop/utils';
3
4
 
4
- export default function parseRegistrationData(transaction: StatusResponseSuccess) {
5
+ export default async function parseRegistrationData(transaction: StatusResponseSuccess) {
5
6
  const parsed = Object.entries(transaction).reduce((acc, [objectKey, payload]) => {
6
- const { token, info, _id } = splitProperties({ objectKey, payload });
7
+ const { token, info } = splitProperties({ objectKey, payload });
7
8
  if (token) {
8
9
  return {
9
- _id,
10
10
  token,
11
11
  info,
12
12
  objectKey,
@@ -14,14 +14,16 @@ export default function parseRegistrationData(transaction: StatusResponseSuccess
14
14
  }
15
15
  return acc;
16
16
  }, {}) as {
17
- _id?: string;
18
17
  token?: Record<string, unknown>;
19
18
  info?: Record<string, unknown>;
20
19
  objectKey?: string;
21
20
  };
22
21
  if (parsed.objectKey) {
22
+ const _id = await sha256(parsed.token);
23
+
23
24
  return {
24
25
  ...parsed,
26
+ _id,
25
27
  paymentMethod: transaction.paymentMethod,
26
28
  currency: transaction.currency,
27
29
  language: transaction.language,
@@ -1,11 +1,11 @@
1
- import { UnchainedCore } from '@unchainedshop/core';
1
+ import { OrderPricingSheet } from '@unchainedshop/core';
2
2
  import { Order } from '@unchainedshop/core-orders';
3
3
 
4
- const roundedAmountFromOrder = (
5
- order: Order,
6
- context: UnchainedCore,
7
- ): { currency: string; amount: number } => {
8
- const pricing = context.modules.orders.pricingSheet(order);
4
+ const roundedAmountFromOrder = (order: Order): { currency: string; amount: number } => {
5
+ const pricing = OrderPricingSheet({
6
+ calculation: order.calculation,
7
+ currency: order.currency,
8
+ });
9
9
  const { currency, amount } = pricing.total({ useNetPrice: false });
10
10
  return {
11
11
  currency,
@@ -1,10 +1,8 @@
1
1
  // This method splits the return data of alias registration to the important properties needed for validation and the additional data
2
- import crypto from 'crypto';
3
2
 
4
3
  export default function splitProperties({ objectKey, payload }: { objectKey?: string; payload: any }): {
5
4
  token?: string;
6
5
  info: any;
7
- _id?: string;
8
6
  } {
9
7
  if (!payload || !objectKey) return { info: {} };
10
8
 
@@ -21,12 +19,9 @@ export default function splitProperties({ objectKey, payload }: { objectKey?: st
21
19
  expiryYear,
22
20
  '3D': is3DActive ? payload['3D'] : undefined,
23
21
  });
24
- const _id = crypto.createHash('sha256').update(token).digest('hex');
25
-
26
22
  return {
27
23
  token,
28
24
  info,
29
- _id,
30
25
  };
31
26
  }
32
27
 
@@ -1,5 +1,5 @@
1
- import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
- import { PaymentDirector, PaymentAdapter, PaymentProviderType } from '@unchainedshop/core-payment';
1
+ import { IPaymentAdapter, PaymentAdapter, PaymentDirector } from '@unchainedshop/core';
2
+ import { PaymentProviderType } from '@unchainedshop/core-payment';
3
3
 
4
4
  const InvoicePrepaid: IPaymentAdapter = {
5
5
  ...PaymentAdapter,
@@ -14,9 +14,9 @@ const InvoicePrepaid: IPaymentAdapter = {
14
14
  return type === PaymentProviderType.INVOICE;
15
15
  },
16
16
 
17
- actions: (params) => {
17
+ actions: (config, context) => {
18
18
  return {
19
- ...PaymentAdapter.actions(params),
19
+ ...PaymentAdapter.actions(config, context),
20
20
 
21
21
  configurationError: () => {
22
22
  return null;
@@ -1,5 +1,5 @@
1
- import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
- import { PaymentDirector, PaymentAdapter, PaymentProviderType } from '@unchainedshop/core-payment';
1
+ import { IPaymentAdapter, PaymentAdapter, PaymentDirector } from '@unchainedshop/core';
2
+ import { PaymentProviderType } from '@unchainedshop/core-payment';
3
3
 
4
4
  const Invoice: IPaymentAdapter = {
5
5
  ...PaymentAdapter,
@@ -14,9 +14,9 @@ const Invoice: IPaymentAdapter = {
14
14
  return type === PaymentProviderType.INVOICE;
15
15
  },
16
16
 
17
- actions: (params) => {
17
+ actions: (config, context) => {
18
18
  return {
19
- ...PaymentAdapter.actions(params),
19
+ ...PaymentAdapter.actions(config, context),
20
20
 
21
21
  configurationError: () => {
22
22
  return null;
@@ -1,5 +1,10 @@
1
- import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
- import { PaymentDirector, PaymentAdapter, PaymentError } from '@unchainedshop/core-payment';
1
+ import {
2
+ OrderPricingSheet,
3
+ IPaymentAdapter,
4
+ PaymentAdapter,
5
+ PaymentDirector,
6
+ PaymentError,
7
+ } from '@unchainedshop/core';
3
8
  import { createLogger } from '@unchainedshop/logger';
4
9
 
5
10
  let checkoutNodeJssdk;
@@ -41,9 +46,9 @@ const PaypalCheckout: IPaymentAdapter = {
41
46
  return type === 'GENERIC';
42
47
  },
43
48
 
44
- actions: (params) => {
49
+ actions: (config, context) => {
45
50
  const adapter = {
46
- ...PaymentAdapter.actions(params),
51
+ ...PaymentAdapter.actions(config, context),
47
52
 
48
53
  configurationError: () => {
49
54
  const publicCredentialsValid = PAYPAL_CLIENT_ID && PAYPAL_SECRET;
@@ -68,8 +73,7 @@ const PaypalCheckout: IPaymentAdapter = {
68
73
  },
69
74
 
70
75
  charge: async ({ orderID }) => {
71
- const { modules } = params.context;
72
- const { order } = params.paymentContext;
76
+ const { order } = context;
73
77
 
74
78
  if (!orderID) {
75
79
  logger.warn('Paypal Native Plugin: PRICE MATCH');
@@ -81,7 +85,10 @@ const PaypalCheckout: IPaymentAdapter = {
81
85
  const client = new checkoutNodeJssdk.core.PayPalHttpClient(environment());
82
86
  const paypalOrder = await client.execute(request);
83
87
 
84
- const pricing = modules.orders.pricingSheet(order);
88
+ const pricing = OrderPricingSheet({
89
+ calculation: order.calculation,
90
+ currency: order.currency,
91
+ });
85
92
  const ourTotal = (pricing.total({ useNetPrice: false }).amount / 100).toFixed(2);
86
93
  const paypalTotal = paypalOrder.result.purchase_units[0].amount.value;
87
94
 
@@ -1,4 +1,3 @@
1
- /// <reference lib="dom" />
2
1
  import fs from 'fs';
3
2
  import util from 'util';
4
3
  import { resolve } from 'path';
@@ -48,7 +47,7 @@ export default (
48
47
  new TextEncoder().encode(secret),
49
48
  { name: 'HMAC', hash: 'SHA-256' },
50
49
  false,
51
- ['sign', 'verify'],
50
+ ['sign'],
52
51
  );
53
52
  const signature = await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(query));
54
53
  return btoa(String.fromCharCode(...new Uint8Array(signature)));
@@ -61,7 +60,7 @@ export default (
61
60
  };
62
61
 
63
62
  return async (path: string, method: 'GET' | 'DELETE' | 'POST', data?: any): Promise<Response> => {
64
- logger.verbose(`${method} ${path}`);
63
+ logger.info(`${method} ${path}`);
65
64
  if (method === 'POST') {
66
65
  const queryParams = { ...data };
67
66
  const signature = await buildSignature(new URLSearchParams(queryParams).toString());
@@ -1,8 +1,13 @@
1
- import { IPaymentAdapter } from '@unchainedshop/core-payment';
2
- import { PaymentAdapter, PaymentDirector, PaymentError } from '@unchainedshop/core-payment';
3
1
  import { createLogger } from '@unchainedshop/logger';
4
2
  import { mapOrderDataToGatewayObject, mapUserToGatewayObject } from './payrexx.js';
5
3
  import createPayrexxAPI, { GatewayObjectStatus } from './api/index.js';
4
+ import {
5
+ OrderPricingSheet,
6
+ IPaymentAdapter,
7
+ PaymentAdapter,
8
+ PaymentDirector,
9
+ PaymentError,
10
+ } from '@unchainedshop/core';
6
11
 
7
12
  export * from './middleware.js';
8
13
 
@@ -19,17 +24,17 @@ const Payrexx: IPaymentAdapter = {
19
24
  return type === 'GENERIC';
20
25
  },
21
26
 
22
- actions: (params) => {
23
- const { modules } = params.context;
27
+ actions: (config, context) => {
28
+ const { modules } = context;
24
29
 
25
30
  const getInstance = () => {
26
- return params.config.find((c) => c.key === 'instance')?.value;
31
+ return config.find((c) => c.key === 'instance')?.value;
27
32
  };
28
33
 
29
34
  const api = createPayrexxAPI(getInstance(), process.env.PAYREXX_SECRET);
30
35
 
31
36
  const adapterActions = {
32
- ...PaymentAdapter.actions(params),
37
+ ...PaymentAdapter.actions(config, context),
33
38
 
34
39
  configurationError() {
35
40
  if (!process.env.PAYREXX_SECRET) {
@@ -51,10 +56,13 @@ const Payrexx: IPaymentAdapter = {
51
56
  },
52
57
 
53
58
  sign: async (transactionContext = {}) => {
54
- const { orderPayment, userId, order } = params.paymentContext;
59
+ const { orderPayment, userId, order } = context;
55
60
  if (orderPayment) {
56
61
  // Order Checkout signing (One-time payment)
57
- const pricing = await modules.orders.pricingSheet(order);
62
+ const pricing = OrderPricingSheet({
63
+ calculation: order.calculation,
64
+ currency: order.currency,
65
+ });
58
66
  const gatewayObject = mapOrderDataToGatewayObject(
59
67
  { order, orderPayment, pricing },
60
68
  transactionContext,
@@ -94,13 +102,13 @@ const Payrexx: IPaymentAdapter = {
94
102
  // transactionId,
95
103
  // })) as StatusResponseSuccess;
96
104
  // if (result.transactionId) {
97
- // return parseRegistrationData(result);
105
+ // return await parseRegistrationData(result);
98
106
  // }
99
107
  return null;
100
108
  },
101
109
 
102
110
  async confirm() {
103
- const { orderPayment } = params.paymentContext;
111
+ const { orderPayment } = context;
104
112
  const { transactionId } = orderPayment;
105
113
 
106
114
  if (!transactionId) {
@@ -133,7 +141,7 @@ const Payrexx: IPaymentAdapter = {
133
141
  },
134
142
 
135
143
  async cancel() {
136
- const { orderPayment } = params.paymentContext;
144
+ const { orderPayment } = context;
137
145
  const { transactionId } = orderPayment;
138
146
  if (!transactionId) {
139
147
  return false;
@@ -164,7 +172,7 @@ const Payrexx: IPaymentAdapter = {
164
172
  throw new Error('You have to provide gatewayId or paymentCredentials');
165
173
  }
166
174
 
167
- const { order } = params.paymentContext;
175
+ const { order } = context;
168
176
  const orderPayment = await modules.orders.payments.findOrderPayment({
169
177
  orderPaymentId: order.paymentId,
170
178
  });
@@ -175,7 +183,10 @@ const Payrexx: IPaymentAdapter = {
175
183
  throw new Error('Could not load gateway from the Payrexx API');
176
184
  }
177
185
 
178
- const pricing = await modules.orders.pricingSheet(order);
186
+ const pricing = OrderPricingSheet({
187
+ calculation: order.calculation,
188
+ currency: order.currency,
189
+ });
179
190
  const { currency, amount } = pricing.total({ useNetPrice: false });
180
191
 
181
192
  if (
@@ -195,7 +206,7 @@ const Payrexx: IPaymentAdapter = {
195
206
  }
196
207
 
197
208
  // confirm will do the transition, to do a checkout those stati above are fine
198
- logger.verbose(`Mark as charged, status is ${gatewayObject.status}`, {
209
+ logger.info(`Mark as charged, status is ${gatewayObject.status}`, {
199
210
  orderPaymentId: gatewayObject.referenceId,
200
211
  });
201
212
  return {
@@ -214,7 +225,7 @@ const Payrexx: IPaymentAdapter = {
214
225
  }
215
226
  }
216
227
 
217
- logger.verbose('Charge not possible', {
228
+ logger.info('Charge not possible', {
218
229
  orderPaymentId: gatewayObject.referenceId,
219
230
  status: gatewayObject.status,
220
231
  });
@@ -5,12 +5,12 @@ const logger = createLogger('unchained:core-payment:payrexx:webhook');
5
5
 
6
6
  export const payrexxHandler = async (request, response) => {
7
7
  const resolvedContext = request.unchainedContext as Context;
8
- const { modules } = resolvedContext;
8
+ const { modules, services } = resolvedContext;
9
9
 
10
10
  const { transaction } = request.body;
11
11
 
12
12
  if (!transaction) {
13
- logger.verbose(`unhandled event type`, {
13
+ logger.info(`unhandled event type`, {
14
14
  type: Object.keys(request.body).join(','),
15
15
  });
16
16
  response.writeHead(200);
@@ -25,7 +25,7 @@ export const payrexxHandler = async (request, response) => {
25
25
  if (transaction.referenceId === '__IGNORE_WEBHOOK__' || transaction.status === 'waiting') {
26
26
  // Ignore confirmed transactions, because those hooks are generated through calling the confirm()
27
27
  // method in the payment adapter and could lead to double bookings.
28
- logger.verbose(`unhandled transaction state: ${transaction.status}`);
28
+ logger.info(`unhandled transaction state: ${transaction.status}`);
29
29
  response.writeHead(200);
30
30
  response.end(
31
31
  JSON.stringify({
@@ -36,7 +36,7 @@ export const payrexxHandler = async (request, response) => {
36
36
  return;
37
37
  }
38
38
 
39
- logger.verbose(`Processing event`, {
39
+ logger.info(`Processing event`, {
40
40
  transactionId: transaction.id,
41
41
  });
42
42
  try {
@@ -44,12 +44,11 @@ export const payrexxHandler = async (request, response) => {
44
44
  // Pre-Authorization Flow, referenceId is a userId
45
45
  const { referenceId: paymentProviderId, invoice } = transaction;
46
46
  const userId = '';
47
- logger.verbose(`register credentials for: ${userId}`);
48
- await modules.payment.registerCredentials(
49
- paymentProviderId,
50
- { userId, transactionContext: { gatewayId: invoice.paymentRequestId } },
51
- resolvedContext,
52
- );
47
+ logger.info(`register credentials for: ${userId}`);
48
+ await services.orders.registerPaymentCredentials(paymentProviderId, {
49
+ userId,
50
+ transactionContext: { gatewayId: invoice.paymentRequestId },
51
+ });
53
52
  logger.info(`registration successful`, {
54
53
  paymentProviderId,
55
54
  userId,
@@ -64,7 +63,7 @@ export const payrexxHandler = async (request, response) => {
64
63
  );
65
64
  } else {
66
65
  const { referenceId: orderPaymentId, invoice } = transaction;
67
- logger.verbose(`checkout with orderPaymentId: ${orderPaymentId}`);
66
+ logger.info(`checkout with orderPaymentId: ${orderPaymentId}`);
68
67
  await modules.orders.payments.logEvent(orderPaymentId, {
69
68
  transactionId: transaction.id,
70
69
  });
@@ -75,15 +74,11 @@ export const payrexxHandler = async (request, response) => {
75
74
  throw new Error(`order payment not found with orderPaymentId: ${orderPaymentId}`);
76
75
  }
77
76
 
78
- const order = await modules.orders.checkout(
79
- orderPayment.orderId,
80
- {
81
- paymentContext: {
82
- gatewayId: invoice.paymentRequestId,
83
- },
77
+ const order = await services.orders.checkoutOrder(orderPayment.orderId, {
78
+ paymentContext: {
79
+ gatewayId: invoice.paymentRequestId,
84
80
  },
85
- resolvedContext,
86
- );
81
+ });
87
82
  logger.info(`checkout successful`, {
88
83
  orderPaymentId,
89
84
  orderId: order._id,