@unchainedshop/plugins 4.0.0-rc.2 → 4.0.0-rc.21

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 (347) hide show
  1. package/lib/accounts/google-oauth.d.ts +4 -0
  2. package/lib/accounts/google-oauth.d.ts.map +1 -0
  3. package/lib/accounts/google-oauth.js +145 -0
  4. package/lib/accounts/google-oauth.js.map +1 -0
  5. package/lib/accounts/linkedin-oauth.d.ts +4 -0
  6. package/lib/accounts/linkedin-oauth.d.ts.map +1 -0
  7. package/lib/accounts/linkedin-oauth.js +82 -0
  8. package/lib/accounts/linkedin-oauth.js.map +1 -0
  9. package/lib/delivery/send-message.js.map +1 -1
  10. package/lib/enrollments/licensed.js +15 -2
  11. package/lib/enrollments/licensed.js.map +1 -1
  12. package/lib/files/gridfs/adapter.d.ts.map +1 -1
  13. package/lib/files/gridfs/adapter.js +19 -11
  14. package/lib/files/gridfs/adapter.js.map +1 -1
  15. package/lib/files/gridfs/gridfs-adapter.d.ts +3 -0
  16. package/lib/files/gridfs/gridfs-adapter.d.ts.map +1 -0
  17. package/lib/files/gridfs/gridfs-adapter.js +97 -0
  18. package/lib/files/gridfs/gridfs-adapter.js.map +1 -0
  19. package/lib/files/gridfs/gridfs-webhook.d.ts +11 -0
  20. package/lib/files/gridfs/gridfs-webhook.d.ts.map +1 -0
  21. package/lib/files/gridfs/gridfs-webhook.js +84 -0
  22. package/lib/files/gridfs/gridfs-webhook.js.map +1 -0
  23. package/lib/files/gridfs/handler-express.d.ts.map +1 -1
  24. package/lib/files/gridfs/handler-express.js +27 -24
  25. package/lib/files/gridfs/handler-express.js.map +1 -1
  26. package/lib/files/gridfs/handler-fastify.d.ts.map +1 -1
  27. package/lib/files/gridfs/handler-fastify.js +57 -14
  28. package/lib/files/gridfs/handler-fastify.js.map +1 -1
  29. package/lib/files/gridfs/module.d.ts +4 -4
  30. package/lib/files/gridfs/module.d.ts.map +1 -1
  31. package/lib/files/gridfs/module.js +2 -2
  32. package/lib/files/gridfs/module.js.map +1 -1
  33. package/lib/files/minio/handler-express.d.ts.map +1 -1
  34. package/lib/files/minio/handler-express.js +4 -7
  35. package/lib/files/minio/handler-express.js.map +1 -1
  36. package/lib/files/minio/handler-fastify.js +2 -2
  37. package/lib/files/minio/handler-fastify.js.map +1 -1
  38. package/lib/files/minio/index.d.ts +1 -1
  39. package/lib/files/minio/index.d.ts.map +1 -1
  40. package/lib/files/minio/index.js +7 -7
  41. package/lib/files/minio/index.js.map +1 -1
  42. package/lib/files/minio/minio-adapter.d.ts +6 -0
  43. package/lib/files/minio/minio-adapter.d.ts.map +1 -0
  44. package/lib/files/minio/minio-adapter.js +181 -0
  45. package/lib/files/minio/minio-adapter.js.map +1 -0
  46. package/lib/files/minio/minio-webhook.d.ts +2 -0
  47. package/lib/files/minio/minio-webhook.d.ts.map +1 -0
  48. package/lib/files/minio/minio-webhook.js +33 -0
  49. package/lib/files/minio/minio-webhook.js.map +1 -0
  50. package/lib/filters/local-search.js +1 -1
  51. package/lib/filters/local-search.js.map +1 -1
  52. package/lib/payment/apple-iap/adapter.js +12 -10
  53. package/lib/payment/apple-iap/adapter.js.map +1 -1
  54. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +1 -1
  55. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts.map +1 -1
  56. package/lib/payment/apple-iap/handler-express.d.ts.map +1 -1
  57. package/lib/payment/apple-iap/handler-express.js +14 -10
  58. package/lib/payment/apple-iap/handler-express.js.map +1 -1
  59. package/lib/payment/apple-iap/handler-fastify.d.ts.map +1 -1
  60. package/lib/payment/apple-iap/handler-fastify.js +15 -8
  61. package/lib/payment/apple-iap/handler-fastify.js.map +1 -1
  62. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +9 -0
  63. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts.map +1 -0
  64. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js +17 -0
  65. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js.map +1 -0
  66. package/lib/payment/apple-iap/module.d.ts +4 -4
  67. package/lib/payment/apple-iap/module.d.ts.map +1 -1
  68. package/lib/payment/apple-iap/module.js +4 -2
  69. package/lib/payment/apple-iap/module.js.map +1 -1
  70. package/lib/payment/braintree.js +3 -1
  71. package/lib/payment/braintree.js.map +1 -1
  72. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts +1 -1
  73. package/lib/payment/cryptopay/db/CryptopayTransactions.d.ts.map +1 -1
  74. package/lib/payment/cryptopay/derive-btc-address.d.ts.map +1 -1
  75. package/lib/payment/cryptopay/derive-btc-address.js +2 -3
  76. package/lib/payment/cryptopay/derive-btc-address.js.map +1 -1
  77. package/lib/payment/cryptopay/derive-eth-address.d.ts.map +1 -1
  78. package/lib/payment/cryptopay/derive-eth-address.js +5 -3
  79. package/lib/payment/cryptopay/derive-eth-address.js.map +1 -1
  80. package/lib/payment/cryptopay/handle-webhook.js +2 -2
  81. package/lib/payment/cryptopay/handle-webhook.js.map +1 -1
  82. package/lib/payment/cryptopay/handler-express.d.ts.map +1 -1
  83. package/lib/payment/cryptopay/handler-express.js +4 -7
  84. package/lib/payment/cryptopay/handler-express.js.map +1 -1
  85. package/lib/payment/cryptopay/handler-fastify.d.ts.map +1 -1
  86. package/lib/payment/cryptopay/handler-fastify.js +1 -1
  87. package/lib/payment/cryptopay/handler-fastify.js.map +1 -1
  88. package/lib/payment/cryptopay/middleware.d.ts +2 -0
  89. package/lib/payment/cryptopay/middleware.d.ts.map +1 -0
  90. package/lib/payment/cryptopay/middleware.js +75 -0
  91. package/lib/payment/cryptopay/middleware.js.map +1 -0
  92. package/lib/payment/cryptopay/module/configureCryptopayModule.d.ts +25 -0
  93. package/lib/payment/cryptopay/module/configureCryptopayModule.d.ts.map +1 -0
  94. package/lib/payment/cryptopay/module/configureCryptopayModule.js +75 -0
  95. package/lib/payment/cryptopay/module/configureCryptopayModule.js.map +1 -0
  96. package/lib/payment/cryptopay/module.d.ts +2 -2
  97. package/lib/payment/cryptopay/module.d.ts.map +1 -1
  98. package/lib/payment/cryptopay/module.js +4 -4
  99. package/lib/payment/cryptopay/module.js.map +1 -1
  100. package/lib/payment/cryptopay/plugin.d.ts.map +1 -1
  101. package/lib/payment/cryptopay/plugin.js +18 -4
  102. package/lib/payment/cryptopay/plugin.js.map +1 -1
  103. package/lib/payment/datatrans-v2/handler-express.d.ts.map +1 -1
  104. package/lib/payment/datatrans-v2/handler-express.js +13 -11
  105. package/lib/payment/datatrans-v2/handler-express.js.map +1 -1
  106. package/lib/payment/datatrans-v2/handler-fastify.d.ts.map +1 -1
  107. package/lib/payment/datatrans-v2/handler-fastify.js +11 -5
  108. package/lib/payment/datatrans-v2/handler-fastify.js.map +1 -1
  109. package/lib/payment/datatrans-v2/index.js +63 -37
  110. package/lib/payment/datatrans-v2/index.js.map +1 -1
  111. package/lib/payment/datatrans-v2/middleware.d.ts +2 -0
  112. package/lib/payment/datatrans-v2/middleware.d.ts.map +1 -0
  113. package/lib/payment/datatrans-v2/middleware.js +68 -0
  114. package/lib/payment/datatrans-v2/middleware.js.map +1 -0
  115. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +1 -1
  116. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts.map +1 -1
  117. package/lib/payment/paypal-checkout.js +8 -8
  118. package/lib/payment/paypal-checkout.js.map +1 -1
  119. package/lib/payment/payrexx/api/index.d.ts +1 -1
  120. package/lib/payment/payrexx/api/index.d.ts.map +1 -1
  121. package/lib/payment/payrexx/api/makeFetcher.d.ts +1 -1
  122. package/lib/payment/payrexx/api/makeFetcher.d.ts.map +1 -1
  123. package/lib/payment/payrexx/api/makeFetcher.js +1 -1
  124. package/lib/payment/payrexx/api/makeFetcher.js.map +1 -1
  125. package/lib/payment/payrexx/handler-express.d.ts.map +1 -1
  126. package/lib/payment/payrexx/handler-express.js +15 -15
  127. package/lib/payment/payrexx/handler-express.js.map +1 -1
  128. package/lib/payment/payrexx/handler-fastify.js +23 -15
  129. package/lib/payment/payrexx/handler-fastify.js.map +1 -1
  130. package/lib/payment/payrexx/index.js +21 -15
  131. package/lib/payment/payrexx/index.js.map +1 -1
  132. package/lib/payment/payrexx/middleware.d.ts +2 -0
  133. package/lib/payment/payrexx/middleware.d.ts.map +1 -0
  134. package/lib/payment/payrexx/middleware.js +86 -0
  135. package/lib/payment/payrexx/middleware.js.map +1 -0
  136. package/lib/payment/postfinance-checkout/api-client.d.ts +16 -0
  137. package/lib/payment/postfinance-checkout/api-client.d.ts.map +1 -0
  138. package/lib/payment/postfinance-checkout/api-client.js +75 -0
  139. package/lib/payment/postfinance-checkout/api-client.js.map +1 -0
  140. package/lib/payment/postfinance-checkout/api-types.d.ts +98 -0
  141. package/lib/payment/postfinance-checkout/api-types.d.ts.map +1 -0
  142. package/lib/payment/postfinance-checkout/api-types.js +51 -0
  143. package/lib/payment/postfinance-checkout/api-types.js.map +1 -0
  144. package/lib/payment/postfinance-checkout/api.d.ts +5 -5
  145. package/lib/payment/postfinance-checkout/api.d.ts.map +1 -1
  146. package/lib/payment/postfinance-checkout/api.js +38 -62
  147. package/lib/payment/postfinance-checkout/api.js.map +1 -1
  148. package/lib/payment/postfinance-checkout/handler-express.d.ts.map +1 -1
  149. package/lib/payment/postfinance-checkout/handler-express.js +10 -11
  150. package/lib/payment/postfinance-checkout/handler-express.js.map +1 -1
  151. package/lib/payment/postfinance-checkout/handler-fastify.d.ts.map +1 -1
  152. package/lib/payment/postfinance-checkout/handler-fastify.js +10 -8
  153. package/lib/payment/postfinance-checkout/handler-fastify.js.map +1 -1
  154. package/lib/payment/postfinance-checkout/index.d.ts +2 -1
  155. package/lib/payment/postfinance-checkout/index.d.ts.map +1 -1
  156. package/lib/payment/postfinance-checkout/index.js +44 -32
  157. package/lib/payment/postfinance-checkout/index.js.map +1 -1
  158. package/lib/payment/postfinance-checkout/middleware.d.ts +2 -0
  159. package/lib/payment/postfinance-checkout/middleware.d.ts.map +1 -0
  160. package/lib/payment/postfinance-checkout/middleware.js +38 -0
  161. package/lib/payment/postfinance-checkout/middleware.js.map +1 -0
  162. package/lib/payment/postfinance-checkout/utils.d.ts +3 -3
  163. package/lib/payment/postfinance-checkout/utils.d.ts.map +1 -1
  164. package/lib/payment/postfinance-checkout/utils.js +3 -4
  165. package/lib/payment/postfinance-checkout/utils.js.map +1 -1
  166. package/lib/payment/saferpay/adapter.d.ts.map +1 -1
  167. package/lib/payment/saferpay/adapter.js +9 -0
  168. package/lib/payment/saferpay/adapter.js.map +1 -1
  169. package/lib/payment/saferpay/handler-express.d.ts.map +1 -1
  170. package/lib/payment/saferpay/handler-express.js +10 -8
  171. package/lib/payment/saferpay/handler-express.js.map +1 -1
  172. package/lib/payment/saferpay/handler-fastify.d.ts.map +1 -1
  173. package/lib/payment/saferpay/handler-fastify.js +11 -5
  174. package/lib/payment/saferpay/handler-fastify.js.map +1 -1
  175. package/lib/payment/saferpay/middleware.d.ts +2 -0
  176. package/lib/payment/saferpay/middleware.d.ts.map +1 -0
  177. package/lib/payment/saferpay/middleware.js +57 -0
  178. package/lib/payment/saferpay/middleware.js.map +1 -0
  179. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.d.ts +10 -0
  180. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.d.ts.map +1 -0
  181. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.js +24 -0
  182. package/lib/payment/saferpay/module/configureSaferpayTransactionsModule.js.map +1 -0
  183. package/lib/payment/saferpay/module.d.ts +2 -2
  184. package/lib/payment/stripe/handler-express.js +25 -17
  185. package/lib/payment/stripe/handler-express.js.map +1 -1
  186. package/lib/payment/stripe/handler-fastify.d.ts.map +1 -1
  187. package/lib/payment/stripe/handler-fastify.js +33 -12
  188. package/lib/payment/stripe/handler-fastify.js.map +1 -1
  189. package/lib/payment/stripe/index.js +19 -13
  190. package/lib/payment/stripe/index.js.map +1 -1
  191. package/lib/payment/stripe/middleware.d.ts +6 -0
  192. package/lib/payment/stripe/middleware.d.ts.map +1 -0
  193. package/lib/payment/stripe/middleware.js +114 -0
  194. package/lib/payment/stripe/middleware.js.map +1 -0
  195. package/lib/payment/stripe/stripe.d.ts +2 -2
  196. package/lib/payment/stripe/stripe.d.ts.map +1 -1
  197. package/lib/payment/stripe/stripe.js +14 -11
  198. package/lib/payment/stripe/stripe.js.map +1 -1
  199. package/lib/plugins-index.d.ts +48 -0
  200. package/lib/plugins-index.d.ts.map +1 -0
  201. package/lib/plugins-index.js +107 -0
  202. package/lib/plugins-index.js.map +1 -0
  203. package/lib/presets/all.d.ts +9 -7
  204. package/lib/presets/all.d.ts.map +1 -1
  205. package/lib/presets/all.js +3 -1
  206. package/lib/presets/all.js.map +1 -1
  207. package/lib/pricing/delivery-swiss-tax.d.ts.map +1 -1
  208. package/lib/pricing/delivery-swiss-tax.js +13 -20
  209. package/lib/pricing/delivery-swiss-tax.js.map +1 -1
  210. package/lib/pricing/order-discount.d.ts.map +1 -1
  211. package/lib/pricing/order-discount.js +5 -3
  212. package/lib/pricing/order-discount.js.map +1 -1
  213. package/lib/pricing/order-round.d.ts.map +1 -1
  214. package/lib/pricing/order-round.js +4 -3
  215. package/lib/pricing/order-round.js.map +1 -1
  216. package/lib/pricing/product-catalog-price.d.ts.map +1 -1
  217. package/lib/pricing/product-catalog-price.js +26 -2
  218. package/lib/pricing/product-catalog-price.js.map +1 -1
  219. package/lib/pricing/product-price-rateconversion.js +3 -3
  220. package/lib/pricing/product-price-rateconversion.js.map +1 -1
  221. package/lib/pricing/product-swiss-tax.d.ts +1 -5
  222. package/lib/pricing/product-swiss-tax.d.ts.map +1 -1
  223. package/lib/pricing/product-swiss-tax.js +26 -22
  224. package/lib/pricing/product-swiss-tax.js.map +1 -1
  225. package/lib/pricing/tax/ch.d.ts +7 -2
  226. package/lib/pricing/tax/ch.d.ts.map +1 -1
  227. package/lib/pricing/tax/ch.js +16 -1
  228. package/lib/pricing/tax/ch.js.map +1 -1
  229. package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts +7 -0
  230. package/lib/pricing/utils/isDeliveryAddressInCountry.d.ts.map +1 -0
  231. package/lib/pricing/utils/isDeliveryAddressInCountry.js +13 -0
  232. package/lib/pricing/utils/isDeliveryAddressInCountry.js.map +1 -0
  233. package/lib/warehousing/eth-minter.js +23 -11
  234. package/lib/warehousing/eth-minter.js.map +1 -1
  235. package/lib/worker/budgetsms.d.ts +10 -0
  236. package/lib/worker/budgetsms.d.ts.map +1 -0
  237. package/lib/worker/budgetsms.js +217 -0
  238. package/lib/worker/budgetsms.js.map +1 -0
  239. package/lib/worker/bulk-import.d.ts +1 -1
  240. package/lib/worker/bulk-import.d.ts.map +1 -1
  241. package/lib/worker/bulk-import.js +11 -33
  242. package/lib/worker/bulk-import.js.map +1 -1
  243. package/lib/worker/bulkgate.d.ts +2 -0
  244. package/lib/worker/bulkgate.d.ts.map +1 -0
  245. package/lib/worker/bulkgate.js +104 -0
  246. package/lib/worker/bulkgate.js.map +1 -0
  247. package/lib/worker/email.d.ts.map +1 -1
  248. package/lib/worker/email.js +25 -7
  249. package/lib/worker/email.js.map +1 -1
  250. package/lib/worker/enrollment-order-generator.d.ts.map +1 -1
  251. package/lib/worker/enrollment-order-generator.js +7 -49
  252. package/lib/worker/enrollment-order-generator.js.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.map +1 -1
  256. package/lib/worker/export-token.js +0 -1
  257. package/lib/worker/export-token.js.map +1 -1
  258. package/lib/worker/heartbeat.js +2 -8
  259. package/lib/worker/heartbeat.js.map +1 -1
  260. package/lib/worker/message.d.ts +1 -1
  261. package/lib/worker/message.d.ts.map +1 -1
  262. package/lib/worker/message.js +4 -2
  263. package/lib/worker/message.js.map +1 -1
  264. package/lib/worker/sms.js +16 -16
  265. package/lib/worker/sms.js.map +1 -1
  266. package/lib/worker/twilio.d.ts +2 -0
  267. package/lib/worker/twilio.d.ts.map +1 -0
  268. package/lib/worker/twilio.js +60 -0
  269. package/lib/worker/twilio.js.map +1 -0
  270. package/package.json +29 -45
  271. package/src/delivery/send-message.ts +1 -1
  272. package/src/enrollments/licensed.ts +15 -2
  273. package/src/files/gridfs/adapter.ts +24 -10
  274. package/src/files/gridfs/handler-express.ts +32 -24
  275. package/src/files/gridfs/handler-fastify.ts +63 -15
  276. package/src/files/gridfs/module.ts +7 -2
  277. package/src/files/minio/handler-express.ts +4 -7
  278. package/src/files/minio/handler-fastify.ts +2 -2
  279. package/src/files/minio/index.ts +16 -16
  280. package/src/filters/local-search.ts +1 -1
  281. package/src/payment/apple-iap/adapter.ts +12 -14
  282. package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +1 -1
  283. package/src/payment/apple-iap/handler-express.ts +17 -11
  284. package/src/payment/apple-iap/handler-fastify.ts +19 -9
  285. package/src/payment/apple-iap/module.ts +9 -4
  286. package/src/payment/braintree.ts +4 -1
  287. package/src/payment/cryptopay/db/CryptopayTransactions.ts +1 -1
  288. package/src/payment/cryptopay/derive-btc-address.ts +1 -3
  289. package/src/payment/cryptopay/derive-eth-address.ts +5 -3
  290. package/src/payment/cryptopay/handle-webhook.ts +6 -6
  291. package/src/payment/cryptopay/handler-express.ts +4 -7
  292. package/src/payment/cryptopay/handler-fastify.ts +2 -2
  293. package/src/payment/cryptopay/module.ts +8 -5
  294. package/src/payment/cryptopay/plugin.ts +21 -4
  295. package/src/payment/datatrans-v2/handler-express.ts +17 -12
  296. package/src/payment/datatrans-v2/handler-fastify.ts +15 -6
  297. package/src/payment/datatrans-v2/index.ts +82 -50
  298. package/src/payment/paypal-checkout.ts +8 -11
  299. package/src/payment/payrexx/api/index.ts +1 -1
  300. package/src/payment/payrexx/api/makeFetcher.ts +2 -2
  301. package/src/payment/payrexx/handler-express.ts +24 -32
  302. package/src/payment/payrexx/handler-fastify.ts +33 -33
  303. package/src/payment/payrexx/index.ts +26 -16
  304. package/src/payment/postfinance-checkout/api-client.ts +111 -0
  305. package/src/payment/postfinance-checkout/api-types.ts +111 -0
  306. package/src/payment/postfinance-checkout/api.ts +58 -85
  307. package/src/payment/postfinance-checkout/handler-express.ts +11 -13
  308. package/src/payment/postfinance-checkout/handler-fastify.ts +11 -10
  309. package/src/payment/postfinance-checkout/index.ts +60 -38
  310. package/src/payment/postfinance-checkout/utils.ts +5 -10
  311. package/src/payment/saferpay/adapter.ts +14 -2
  312. package/src/payment/saferpay/handler-express.ts +14 -13
  313. package/src/payment/saferpay/handler-fastify.ts +14 -9
  314. package/src/payment/stripe/handler-express.ts +33 -33
  315. package/src/payment/stripe/handler-fastify.ts +40 -27
  316. package/src/payment/stripe/index.ts +17 -13
  317. package/src/payment/stripe/stripe.ts +17 -12
  318. package/src/presets/all.ts +3 -1
  319. package/src/pricing/delivery-swiss-tax.ts +16 -31
  320. package/src/pricing/order-discount.ts +6 -4
  321. package/src/pricing/order-round.ts +5 -4
  322. package/src/pricing/product-catalog-price.ts +25 -2
  323. package/src/pricing/product-price-rateconversion.ts +3 -3
  324. package/src/pricing/product-swiss-tax.ts +39 -40
  325. package/src/pricing/tax/ch.ts +33 -7
  326. package/src/pricing/utils/isDeliveryAddressInCountry.test.ts +106 -0
  327. package/src/pricing/utils/isDeliveryAddressInCountry.ts +26 -0
  328. package/src/warehousing/eth-minter.ts +30 -11
  329. package/src/worker/budgetsms.ts +268 -0
  330. package/src/worker/bulk-import.ts +12 -53
  331. package/src/worker/bulkgate.ts +138 -0
  332. package/src/worker/email.ts +30 -8
  333. package/src/worker/enrollment-order-generator.ts +14 -72
  334. package/src/worker/error-notifications.ts +2 -2
  335. package/src/worker/export-token.ts +0 -1
  336. package/src/worker/heartbeat.ts +2 -9
  337. package/src/worker/message.ts +5 -3
  338. package/src/worker/{sms.ts → twilio.ts} +15 -26
  339. package/lib/payment/cryptopay/de.d.ts +0 -2
  340. package/lib/payment/cryptopay/de.d.ts.map +0 -1
  341. package/lib/payment/cryptopay/de.js +0 -10
  342. package/lib/payment/cryptopay/de.js.map +0 -1
  343. package/lib/payment/cryptopay/derive-btc-address.test copy.d.ts +0 -2
  344. package/lib/payment/cryptopay/derive-btc-address.test copy.d.ts.map +0 -1
  345. package/lib/payment/cryptopay/derive-btc-address.test copy.js +0 -10
  346. package/lib/payment/cryptopay/derive-btc-address.test copy.js.map +0 -1
  347. package/src/pricing/product-swiss-tax.test.ts +0 -139
@@ -2,42 +2,39 @@ import { Context } from '@unchainedshop/api';
2
2
  import { createLogger } from '@unchainedshop/logger';
3
3
  import { FastifyRequest, RouteHandlerMethod } from 'fastify';
4
4
 
5
- const logger = createLogger('unchained:core-payment:payrexx:handler');
5
+ const logger = createLogger('unchained:payrexx:handler');
6
6
 
7
7
  export const payrexxHandler: RouteHandlerMethod = async (
8
8
  request: FastifyRequest & {
9
9
  unchainedContext: Context;
10
- },
10
+ } & { body: Record<string, any> },
11
11
  reply,
12
12
  ) => {
13
13
  const resolvedContext = request.unchainedContext as Context;
14
14
  const { modules, services } = resolvedContext;
15
15
 
16
- const { transaction } = request.body as Record<string, any>;
17
-
16
+ const { transaction } = request.body;
18
17
  if (!transaction) {
19
18
  logger.info(`unhandled event type`, {
20
19
  type: Object.keys(request.body).join(','),
21
20
  });
22
21
  reply.status(200);
23
- return reply.send(
24
- JSON.stringify({
25
- ignored: true,
26
- message: `Unhandled event type: ${Object.keys(request.body).join(',')}. Supported type: transaction`,
27
- }),
28
- );
22
+ return reply.send({
23
+ success: false,
24
+ ignored: true,
25
+ message: `Unhandled event type: ${Object.keys(request.body).join(',')}. Supported type: transaction`,
26
+ });
29
27
  }
30
28
  if (transaction.referenceId === '__IGNORE_WEBHOOK__' || transaction.status === 'waiting') {
31
29
  // Ignore confirmed transactions, because those hooks are generated through calling the confirm()
32
30
  // method in the payment adapter and could lead to double bookings.
33
31
  logger.info(`unhandled transaction state: ${transaction.status}`);
34
32
  reply.status(200);
35
- return reply.send(
36
- JSON.stringify({
37
- ignored: true,
38
- message: `Unhandled transaction state: ${transaction.status}`,
39
- }),
40
- );
33
+ return reply.send({
34
+ success: false,
35
+ ignored: true,
36
+ message: `Unhandled transaction state: ${transaction.status}`,
37
+ });
41
38
  }
42
39
 
43
40
  logger.info(`Processing event`, {
@@ -58,19 +55,14 @@ export const payrexxHandler: RouteHandlerMethod = async (
58
55
  userId,
59
56
  });
60
57
  reply.status(200);
61
- return reply.send(
62
- JSON.stringify({
63
- message: 'registration successful',
64
- paymentProviderId,
65
- userId,
66
- }),
67
- );
58
+ return reply.send({
59
+ success: true,
60
+ paymentProviderId,
61
+ userId,
62
+ });
68
63
  } else {
69
64
  const { referenceId: orderPaymentId, invoice } = transaction;
70
65
  logger.info(`checkout with orderPaymentId: ${orderPaymentId}`);
71
- await modules.orders.payments.logEvent(orderPaymentId, {
72
- transactionId: transaction.id,
73
- });
74
66
  const orderPayment = await modules.orders.payments.findOrderPayment({
75
67
  orderPaymentId,
76
68
  });
@@ -78,28 +70,36 @@ export const payrexxHandler: RouteHandlerMethod = async (
78
70
  throw new Error(`order payment not found with orderPaymentId: ${orderPaymentId}`);
79
71
  }
80
72
 
73
+ await modules.orders.payments.logEvent(orderPaymentId, {
74
+ transactionId: transaction.id,
75
+ });
76
+
81
77
  const order = await services.orders.checkoutOrder(orderPayment.orderId, {
82
78
  paymentContext: {
83
79
  gatewayId: invoice.paymentRequestId,
84
80
  },
85
81
  });
82
+ if (!order) throw new Error(`Order with id ${orderPayment.orderId} not found`);
83
+
86
84
  logger.info(`checkout successful`, {
87
85
  orderPaymentId,
88
86
  orderId: order._id,
89
87
  });
90
88
  reply.status(200);
91
- return reply.send(
92
- JSON.stringify({
93
- message: 'checkout successful',
94
- orderId: order._id,
95
- }),
96
- );
89
+ return reply.send({
90
+ success: true,
91
+ orderId: order._id,
92
+ });
97
93
  }
98
94
  } catch (error) {
99
95
  logger.error(error, {
100
96
  transactionId: transaction.id,
101
97
  });
102
98
  reply.status(500);
103
- return reply.send(error.message);
99
+ return reply.send({
100
+ success: false,
101
+ message: error.message,
102
+ name: error.name,
103
+ });
104
104
  }
105
105
  };
@@ -9,7 +9,7 @@ import {
9
9
  PaymentError,
10
10
  } from '@unchainedshop/core';
11
11
 
12
- const logger = createLogger('unchained:core-payment:payrexx');
12
+ const logger = createLogger('unchained:payrexx');
13
13
 
14
14
  const Payrexx: IPaymentAdapter = {
15
15
  ...PaymentAdapter,
@@ -25,11 +25,7 @@ const Payrexx: IPaymentAdapter = {
25
25
  actions: (config, context) => {
26
26
  const { modules } = context;
27
27
 
28
- const getInstance = () => {
29
- return config.find((c) => c.key === 'instance')?.value;
30
- };
31
-
32
- const api = createPayrexxAPI(getInstance(), process.env.PAYREXX_SECRET);
28
+ const instance = config.find((c) => c.key === 'instance')?.value;
33
29
 
34
30
  const adapterActions = {
35
31
  ...PaymentAdapter.actions(config, context),
@@ -38,7 +34,7 @@ const Payrexx: IPaymentAdapter = {
38
34
  if (!process.env.PAYREXX_SECRET) {
39
35
  return PaymentError.INCOMPLETE_CONFIGURATION;
40
36
  }
41
- if (!getInstance()) {
37
+ if (!instance) {
42
38
  return PaymentError.INCOMPLETE_CONFIGURATION;
43
39
  }
44
40
  return null;
@@ -55,6 +51,11 @@ const Payrexx: IPaymentAdapter = {
55
51
 
56
52
  sign: async (transactionContext = {}) => {
57
53
  const { orderPayment, userId, order } = context;
54
+
55
+ if (!order) throw new Error('No order in context, can only sign with order context');
56
+
57
+ const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
58
+
58
59
  if (orderPayment) {
59
60
  // Order Checkout signing (One-time payment)
60
61
  const pricing = OrderPricingSheet({
@@ -70,7 +71,10 @@ const Payrexx: IPaymentAdapter = {
70
71
  }
71
72
 
72
73
  // Payment Credential Registration signing
73
- const user = await modules.users.findUserById(userId);
74
+
75
+ const user = userId && (await modules.users.findUserById(userId));
76
+ if (!user) throw new Error('User not found, can only sign registrations with user context');
77
+
74
78
  const emailAddress = modules.users.primaryEmail(user)?.address;
75
79
  const gateway = await api.createGateway(
76
80
  mapUserToGatewayObject({
@@ -107,11 +111,13 @@ const Payrexx: IPaymentAdapter = {
107
111
 
108
112
  async confirm() {
109
113
  const { orderPayment } = context;
110
- const { transactionId } = orderPayment;
111
114
 
112
- if (!transactionId) {
115
+ if (!orderPayment?.transactionId) {
113
116
  return false;
114
117
  }
118
+ const { transactionId } = orderPayment;
119
+
120
+ const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
115
121
 
116
122
  const gatewayObject = await api.getGateway(transactionId);
117
123
 
@@ -140,10 +146,12 @@ const Payrexx: IPaymentAdapter = {
140
146
 
141
147
  async cancel() {
142
148
  const { orderPayment } = context;
143
- const { transactionId } = orderPayment;
144
- if (!transactionId) {
149
+ if (!orderPayment?.transactionId) {
145
150
  return false;
146
151
  }
152
+ const { transactionId } = orderPayment;
153
+
154
+ const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
147
155
 
148
156
  const gatewayObject = await api.getGateway(transactionId);
149
157
 
@@ -170,10 +178,12 @@ const Payrexx: IPaymentAdapter = {
170
178
  throw new Error('You have to provide gatewayId or paymentCredentials');
171
179
  }
172
180
 
173
- const { order } = context;
174
- const orderPayment = await modules.orders.payments.findOrderPayment({
175
- orderPaymentId: order.paymentId,
176
- });
181
+ const { order, orderPayment } = context;
182
+
183
+ if (!order) throw new Error('No order in context, can only charge with order context');
184
+ if (!orderPayment) throw new Error('Order payment not found');
185
+
186
+ const api = createPayrexxAPI(instance!, process.env.PAYREXX_SECRET!);
177
187
 
178
188
  const gatewayObject = await api.getGateway(gatewayId);
179
189
 
@@ -0,0 +1,111 @@
1
+ const API_BASE_URL = 'https://checkout.postfinance.ch/api';
2
+
3
+ interface ApiConfig {
4
+ spaceId: number;
5
+ userId: number;
6
+ apiSecret: string;
7
+ }
8
+
9
+ interface MacHeaders {
10
+ 'x-mac-version': string;
11
+ 'x-mac-userid': string;
12
+ 'x-mac-timestamp': string;
13
+ 'x-mac-value': string;
14
+ }
15
+
16
+ export class PostFinanceApiClient {
17
+ private config: ApiConfig;
18
+
19
+ constructor(config: ApiConfig) {
20
+ this.config = config;
21
+ }
22
+
23
+ private async generateMacHeaders(method: string, path: string): Promise<MacHeaders> {
24
+ const version = '1';
25
+ const timestamp = Math.floor(Date.now() / 1000).toString();
26
+ const userId = this.config.userId.toString();
27
+
28
+ // Use path as-is since it already includes /api from the URL
29
+ const resourcePath = path;
30
+
31
+ const dataToSign = [version, userId, timestamp, method, resourcePath].join('|');
32
+
33
+ // Use Web Crypto API instead of crypto.createHmac
34
+ const secretBytes = Uint8Array.from(atob(this.config.apiSecret), (c) => c.charCodeAt(0));
35
+ const key = await crypto.subtle.importKey(
36
+ 'raw',
37
+ secretBytes,
38
+ { name: 'HMAC', hash: 'SHA-512' },
39
+ false,
40
+ ['sign'],
41
+ );
42
+ const signature = await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(dataToSign));
43
+ const macValue = btoa(String.fromCharCode(...new Uint8Array(signature)));
44
+
45
+ return {
46
+ 'x-mac-version': version,
47
+ 'x-mac-userid': userId,
48
+ 'x-mac-timestamp': timestamp,
49
+ 'x-mac-value': macValue,
50
+ };
51
+ }
52
+
53
+ async request<T>(method: string, endpoint: string, body?: any): Promise<T> {
54
+ const url = `${API_BASE_URL}${endpoint}`;
55
+ const urlObj = new URL(url);
56
+ // Include both pathname and search (query parameters) for MAC signature
57
+ const pathWithQuery = urlObj.pathname + urlObj.search;
58
+ const macHeaders = await this.generateMacHeaders(method, pathWithQuery);
59
+
60
+ const headers: Record<string, string> = {
61
+ ...macHeaders,
62
+ 'Content-Type': 'application/json',
63
+ Accept: 'application/json',
64
+ };
65
+
66
+ const options: RequestInit = {
67
+ method,
68
+ headers,
69
+ };
70
+
71
+ if (body && method !== 'GET') {
72
+ options.body = JSON.stringify(body);
73
+ }
74
+
75
+ const response = await fetch(url, options);
76
+
77
+ if (!response.ok) {
78
+ const errorData = await response.json().catch(() => ({}));
79
+ throw new Error(
80
+ `PostFinance API error: ${response.status} ${response.statusText} ${JSON.stringify(errorData)}`,
81
+ );
82
+ }
83
+
84
+ const responseText = await response.text();
85
+ const contentType = response.headers.get('content-type');
86
+
87
+ if (contentType && contentType.includes('application/json')) {
88
+ try {
89
+ return JSON.parse(responseText);
90
+ } catch {
91
+ // If JSON parsing fails but content-type is json, return as text
92
+ // This handles PostFinance's payment-page-url endpoint that returns plain text with json content-type
93
+ return responseText as any;
94
+ }
95
+ } else {
96
+ return responseText as any;
97
+ }
98
+ }
99
+
100
+ get<T>(endpoint: string): Promise<T> {
101
+ return this.request<T>('GET', endpoint);
102
+ }
103
+
104
+ post<T>(endpoint: string, body: any): Promise<T> {
105
+ return this.request<T>('POST', endpoint, body);
106
+ }
107
+
108
+ patch<T>(endpoint: string, body: any): Promise<T> {
109
+ return this.request<T>('PATCH', endpoint, body);
110
+ }
111
+ }
@@ -0,0 +1,111 @@
1
+ // PostFinance Checkout API Types
2
+
3
+ export enum TransactionState {
4
+ CREATE = 'CREATE',
5
+ PENDING = 'PENDING',
6
+ CONFIRMED = 'CONFIRMED',
7
+ PROCESSING = 'PROCESSING',
8
+ FAILED = 'FAILED',
9
+ AUTHORIZED = 'AUTHORIZED',
10
+ VOIDED = 'VOIDED',
11
+ COMPLETED = 'COMPLETED',
12
+ FULFILL = 'FULFILL',
13
+ DECLINE = 'DECLINE',
14
+ }
15
+
16
+ export enum TokenizationMode {
17
+ FORCE_UPDATE = 'FORCE_UPDATE',
18
+ ALLOW = 'ALLOW',
19
+ ALLOW_ONE_CLICK_PAYMENT = 'ALLOW_ONE_CLICK_PAYMENT',
20
+ DENY = 'DENY',
21
+ }
22
+
23
+ export enum TransactionCompletionBehavior {
24
+ COMPLETE_IMMEDIATELY = 'COMPLETE_IMMEDIATELY',
25
+ COMPLETE_DEFERRED = 'COMPLETE_DEFERRED',
26
+ USE_CONFIGURATION = 'USE_CONFIGURATION',
27
+ }
28
+
29
+ export enum LineItemType {
30
+ SHIPPING = 'SHIPPING',
31
+ DISCOUNT = 'DISCOUNT',
32
+ FEE = 'FEE',
33
+ PRODUCT = 'PRODUCT',
34
+ TIP = 'TIP',
35
+ }
36
+
37
+ export enum RefundType {
38
+ MERCHANT_INITIATED_ONLINE = 'MERCHANT_INITIATED_ONLINE',
39
+ MERCHANT_INITIATED_OFFLINE = 'MERCHANT_INITIATED_OFFLINE',
40
+ CUSTOMER_INITIATED_AUTOMATIC = 'CUSTOMER_INITIATED_AUTOMATIC',
41
+ CUSTOMER_INITIATED_MANUAL = 'CUSTOMER_INITIATED_MANUAL',
42
+ }
43
+
44
+ export enum CreationEntityState {
45
+ CREATE = 'CREATE',
46
+ ACTIVE = 'ACTIVE',
47
+ INACTIVE = 'INACTIVE',
48
+ DELETING = 'DELETING',
49
+ DELETED = 'DELETED',
50
+ }
51
+
52
+ export interface LineItem {
53
+ name: string;
54
+ type: LineItemType;
55
+ quantity: number;
56
+ uniqueId: string;
57
+ amountIncludingTax: number;
58
+ }
59
+
60
+ export interface TransactionCreate {
61
+ currency: string;
62
+ customerId?: string;
63
+ tokenizationMode?: TokenizationMode;
64
+ completionBehavior?: TransactionCompletionBehavior;
65
+ lineItems?: LineItem[];
66
+ successUrl?: string;
67
+ failedUrl?: string;
68
+ metaData?: Record<string, any>;
69
+ }
70
+
71
+ export interface Transaction {
72
+ id: number;
73
+ state: TransactionState;
74
+ currency: string;
75
+ completedAmount?: number;
76
+ authorizationAmount?: number;
77
+ metaData?: Record<string, any>;
78
+ token?: {
79
+ id: number;
80
+ [key: string]: any;
81
+ };
82
+ }
83
+
84
+ export interface TransactionCompletion {
85
+ id: number;
86
+ state: string;
87
+ transaction: number;
88
+ linkedTransaction?: number;
89
+ }
90
+
91
+ export interface Token {
92
+ id: number;
93
+ state: CreationEntityState;
94
+ name?: string;
95
+ customerId?: string;
96
+ enabledForOneClickPayment?: boolean;
97
+ }
98
+
99
+ export interface RefundCreate {
100
+ transaction: number;
101
+ externalId: string;
102
+ amount: number;
103
+ type: RefundType;
104
+ }
105
+
106
+ export interface Refund {
107
+ id: number;
108
+ state: string;
109
+ amount: number;
110
+ transaction: number;
111
+ }
@@ -1,91 +1,55 @@
1
- import * as pf from 'postfinancecheckout';
1
+ import { PostFinanceApiClient } from './api-client.js';
2
+ import {
3
+ Transaction,
4
+ TransactionCreate,
5
+ TransactionCompletion,
6
+ Token,
7
+ RefundCreate,
8
+ RefundType,
9
+ } from './api-types.js';
2
10
 
3
- const { PostFinanceCheckout } = pf;
4
11
  const { PFCHECKOUT_SPACE_ID, PFCHECKOUT_USER_ID, PFCHECKOUT_SECRET } = process.env;
5
12
  const SPACE_ID = parseInt(PFCHECKOUT_SPACE_ID as string, 10);
6
13
  const USER_ID = parseInt(PFCHECKOUT_USER_ID as string, 10);
7
14
 
8
- const getConfig = () => {
9
- return {
10
- space_id: SPACE_ID,
11
- user_id: USER_ID,
12
- api_secret: PFCHECKOUT_SECRET,
13
- };
14
- };
15
-
16
- const getTransactionService = () => {
17
- return new PostFinanceCheckout.api.TransactionService(getConfig());
18
- };
19
-
20
- const getTransactionCompletionService = () => {
21
- return new PostFinanceCheckout.api.TransactionCompletionService(getConfig());
22
- };
23
-
24
- const getTransactionVoidService = () => {
25
- return new PostFinanceCheckout.api.TransactionVoidService(getConfig());
26
- };
27
-
28
- const getRefundService = () => {
29
- return new PostFinanceCheckout.api.RefundService(getConfig());
30
- };
31
-
32
- const getTransactionPaymentPageService = () => {
33
- return new PostFinanceCheckout.api.TransactionPaymentPageService(getConfig());
34
- };
35
-
36
- const getTransactionIframeService = () => {
37
- return new PostFinanceCheckout.api.TransactionIframeService(getConfig());
38
- };
15
+ let apiClient: PostFinanceApiClient;
39
16
 
40
- const getTransactionLightboxService = () => {
41
- return new PostFinanceCheckout.api.TransactionLightboxService(getConfig());
17
+ const getApiClient = () => {
18
+ if (!apiClient) {
19
+ apiClient = new PostFinanceApiClient({
20
+ spaceId: SPACE_ID,
21
+ userId: USER_ID,
22
+ apiSecret: PFCHECKOUT_SECRET as string,
23
+ });
24
+ }
25
+ return apiClient;
42
26
  };
43
27
 
44
- const getTokenService = () => {
45
- return new PostFinanceCheckout.api.TokenService(getConfig());
28
+ export const getTransaction = async (transactionId: string): Promise<Transaction> => {
29
+ const client = getApiClient();
30
+ return client.get<Transaction>(`/transaction/read?spaceId=${SPACE_ID}&id=${transactionId}`);
46
31
  };
47
32
 
48
- export const getTransaction = async (
49
- transactionId: string,
50
- ): Promise<pf.PostFinanceCheckout.model.Transaction> => {
51
- const transactionService = getTransactionService();
52
- const transaction = await transactionService.read(SPACE_ID, parseInt(transactionId, 10));
53
- return transaction.body;
33
+ export const getTransactionCompletion = async (id: string): Promise<TransactionCompletion> => {
34
+ const client = getApiClient();
35
+ return client.get<TransactionCompletion>(`/transaction-completion/read?spaceId=${SPACE_ID}&id=${id}`);
54
36
  };
55
37
 
56
- export const getTransactionCompletion = async (
57
- entityId: string,
58
- ): Promise<pf.PostFinanceCheckout.model.TransactionCompletion> => {
59
- const transactionCompletionService = getTransactionCompletionService();
60
- const transactionCompletion = await transactionCompletionService.read(
61
- SPACE_ID,
62
- parseInt(entityId, 10),
63
- );
64
- return transactionCompletion.body;
38
+ export const getToken = async (spaceId: number, tokenId: number): Promise<Token> => {
39
+ const client = getApiClient();
40
+ return client.get<Token>(`/token/read?spaceId=${spaceId || SPACE_ID}&id=${tokenId}`);
65
41
  };
66
42
 
67
- export const getToken = async (
68
- spaceId: number,
69
- tokenId: number,
70
- ): Promise<pf.PostFinanceCheckout.model.Token> => {
71
- const tokenService = getTokenService();
72
- const token = await tokenService.read(spaceId || SPACE_ID, tokenId);
73
- return token.body;
74
- };
75
-
76
- export const createTransaction = async (
77
- transaction: pf.PostFinanceCheckout.model.TransactionCreate,
78
- ): Promise<number | null> => {
79
- const transactionService = getTransactionService();
80
- const transactionCreateRes = await transactionService.create(SPACE_ID, transaction);
81
- const transactionCreate = transactionCreateRes.body;
82
- return transactionCreate.id || null;
43
+ export const createTransaction = async (transaction: TransactionCreate): Promise<number | null> => {
44
+ const client = getApiClient();
45
+ const result = await client.post<Transaction>(`/transaction/create?spaceId=${SPACE_ID}`, transaction);
46
+ return result.id || null;
83
47
  };
84
48
 
85
49
  export const voidTransaction = async (transactionId: string): Promise<boolean> => {
86
- const transactionVoidService = getTransactionVoidService();
50
+ const client = getApiClient();
87
51
  try {
88
- await transactionVoidService.voidOnline(SPACE_ID, parseInt(transactionId, 10));
52
+ await client.post(`/transaction-void/voidOnline?spaceId=${SPACE_ID}&id=${transactionId}`, {});
89
53
  return true;
90
54
  } catch {
91
55
  return false;
@@ -97,15 +61,15 @@ export const refundTransaction = async (
97
61
  orderId: string,
98
62
  amount: number,
99
63
  ): Promise<boolean> => {
100
- const refundService = getRefundService();
101
- const refund: pf.PostFinanceCheckout.model.RefundCreate = {
64
+ const client = getApiClient();
65
+ const refund: RefundCreate = {
102
66
  transaction: parseInt(transactionId, 10),
103
67
  externalId: orderId,
104
68
  amount,
105
- type: PostFinanceCheckout.model.RefundType.MERCHANT_INITIATED_ONLINE,
69
+ type: RefundType.MERCHANT_INITIATED_ONLINE,
106
70
  };
107
71
  try {
108
- await refundService.refund(SPACE_ID, refund);
72
+ await client.post(`/refund/refund?spaceId=${SPACE_ID}`, refund);
109
73
  return true;
110
74
  } catch {
111
75
  return false;
@@ -113,9 +77,12 @@ export const refundTransaction = async (
113
77
  };
114
78
 
115
79
  export const confirmDeferredTransaction = async (transactionId: string): Promise<boolean> => {
116
- const transactionCompletionService = getTransactionCompletionService();
80
+ const client = getApiClient();
117
81
  try {
118
- await transactionCompletionService.completeOnline(SPACE_ID, parseInt(transactionId, 10));
82
+ await client.post(
83
+ `/transaction-completion/completeOnline?spaceId=${SPACE_ID}&transactionId=${transactionId}`,
84
+ {},
85
+ );
119
86
  return true;
120
87
  } catch {
121
88
  return false;
@@ -123,19 +90,25 @@ export const confirmDeferredTransaction = async (transactionId: string): Promise
123
90
  };
124
91
 
125
92
  export const getPaymentPageUrl = async (transactionId: number): Promise<string> => {
126
- const transactionPaymentPageService = getTransactionPaymentPageService();
127
- const paymentPageUrl = await transactionPaymentPageService.paymentPageUrl(SPACE_ID, transactionId);
128
- return paymentPageUrl.body;
93
+ const client = getApiClient();
94
+ const result = await client.get<string>(
95
+ `/transaction-payment-page/payment-page-url?spaceId=${SPACE_ID}&id=${transactionId}`,
96
+ );
97
+ return result;
129
98
  };
130
99
 
131
100
  export const getLightboxJavascriptUrl = async (transactionId: number): Promise<string> => {
132
- const transactionLightboxService = getTransactionLightboxService();
133
- const javascriptUrl = await transactionLightboxService.javascriptUrl(SPACE_ID, transactionId);
134
- return javascriptUrl.body;
101
+ const client = getApiClient();
102
+ const result = await client.get<string>(
103
+ `/transaction-lightbox/javascript-url?spaceId=${SPACE_ID}&id=${transactionId}`,
104
+ );
105
+ return result;
135
106
  };
136
107
 
137
108
  export const getIframeJavascriptUrl = async (transactionId: number): Promise<string> => {
138
- const transactionIframeService = getTransactionIframeService();
139
- const javascriptUrl = await transactionIframeService.javascriptUrl(SPACE_ID, transactionId);
140
- return javascriptUrl.body;
109
+ const client = getApiClient();
110
+ const result = await client.get<string>(
111
+ `/transaction-iframe/javascript-url?spaceId=${SPACE_ID}&id=${transactionId}`,
112
+ );
113
+ return result;
141
114
  };