@unchainedshop/plugins 1.1.3 → 1.1.4

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 (319) hide show
  1. package/lib/delivery/pick-mup.d.ts +1 -0
  2. package/lib/delivery/pick-mup.js +98 -0
  3. package/lib/delivery/pick-mup.js.map +1 -0
  4. package/lib/delivery/post.d.ts +1 -0
  5. package/lib/delivery/post.js +23 -0
  6. package/lib/delivery/post.js.map +1 -0
  7. package/lib/delivery/send-message.d.ts +1 -0
  8. package/lib/delivery/send-message.js +41 -0
  9. package/lib/delivery/send-message.js.map +1 -0
  10. package/lib/delivery/stores.d.ts +1 -0
  11. package/lib/delivery/stores.js +39 -0
  12. package/lib/delivery/stores.js.map +1 -0
  13. package/lib/enrollments/licensed.d.ts +1 -0
  14. package/lib/enrollments/licensed.js +40 -0
  15. package/lib/enrollments/licensed.js.map +1 -0
  16. package/lib/filters/local-search.d.ts +3 -0
  17. package/lib/filters/local-search.js +84 -0
  18. package/lib/filters/local-search.js.map +1 -0
  19. package/lib/filters/strict-equal.d.ts +1 -0
  20. package/lib/filters/strict-equal.js +25 -0
  21. package/lib/filters/strict-equal.js.map +1 -0
  22. package/lib/payment/apple-iap/adapter.d.ts +1 -0
  23. package/lib/payment/apple-iap/adapter.js +284 -0
  24. package/lib/payment/apple-iap/adapter.js.map +1 -0
  25. package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +7 -0
  26. package/lib/payment/apple-iap/db/AppleTransactionsCollection.js +5 -0
  27. package/lib/payment/apple-iap/db/AppleTransactionsCollection.js.map +1 -0
  28. package/lib/payment/apple-iap/index.d.ts +2 -0
  29. package/lib/payment/apple-iap/index.js +3 -0
  30. package/lib/payment/apple-iap/index.js.map +1 -0
  31. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +9 -0
  32. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js +18 -0
  33. package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js.map +1 -0
  34. package/lib/payment/bity/adapter.d.ts +1 -0
  35. package/lib/payment/bity/adapter.js +316 -0
  36. package/lib/payment/bity/adapter.js.map +1 -0
  37. package/lib/payment/bity/db/BityCredentialsCollection.d.ts +11 -0
  38. package/lib/payment/bity/db/BityCredentialsCollection.js +5 -0
  39. package/lib/payment/bity/db/BityCredentialsCollection.js.map +1 -0
  40. package/lib/payment/bity/index.d.ts +2 -0
  41. package/lib/payment/bity/index.js +3 -0
  42. package/lib/payment/bity/index.js.map +1 -0
  43. package/lib/payment/bity/module/configureBityModule.d.ts +11 -0
  44. package/lib/payment/bity/module/configureBityModule.js +33 -0
  45. package/lib/payment/bity/module/configureBityModule.js.map +1 -0
  46. package/lib/payment/braintree.d.ts +1 -0
  47. package/lib/payment/braintree.js +129 -0
  48. package/lib/payment/braintree.js.map +1 -0
  49. package/lib/payment/cryptopay.d.ts +1 -0
  50. package/lib/payment/cryptopay.js +159 -0
  51. package/lib/payment/cryptopay.js.map +1 -0
  52. package/lib/payment/datatrans-v2/api/authorize.d.ts +2 -0
  53. package/lib/payment/datatrans-v2/api/authorize.js +12 -0
  54. package/lib/payment/datatrans-v2/api/authorize.js.map +1 -0
  55. package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +2 -0
  56. package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +11 -0
  57. package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js.map +1 -0
  58. package/lib/payment/datatrans-v2/api/cancel.d.ts +2 -0
  59. package/lib/payment/datatrans-v2/api/cancel.js +10 -0
  60. package/lib/payment/datatrans-v2/api/cancel.js.map +1 -0
  61. package/lib/payment/datatrans-v2/api/index.d.ts +19 -0
  62. package/lib/payment/datatrans-v2/api/index.js +24 -0
  63. package/lib/payment/datatrans-v2/api/index.js.map +1 -0
  64. package/lib/payment/datatrans-v2/api/init.d.ts +2 -0
  65. package/lib/payment/datatrans-v2/api/init.js +31 -0
  66. package/lib/payment/datatrans-v2/api/init.js.map +1 -0
  67. package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +2 -0
  68. package/lib/payment/datatrans-v2/api/makeFetcher.js +41 -0
  69. package/lib/payment/datatrans-v2/api/makeFetcher.js.map +1 -0
  70. package/lib/payment/datatrans-v2/api/secureFields.d.ts +2 -0
  71. package/lib/payment/datatrans-v2/api/secureFields.js +14 -0
  72. package/lib/payment/datatrans-v2/api/secureFields.js.map +1 -0
  73. package/lib/payment/datatrans-v2/api/settle.d.ts +2 -0
  74. package/lib/payment/datatrans-v2/api/settle.js +10 -0
  75. package/lib/payment/datatrans-v2/api/settle.js.map +1 -0
  76. package/lib/payment/datatrans-v2/api/status.d.ts +2 -0
  77. package/lib/payment/datatrans-v2/api/status.js +7 -0
  78. package/lib/payment/datatrans-v2/api/status.js.map +1 -0
  79. package/lib/payment/datatrans-v2/api/validate.d.ts +2 -0
  80. package/lib/payment/datatrans-v2/api/validate.js +10 -0
  81. package/lib/payment/datatrans-v2/api/validate.js.map +1 -0
  82. package/lib/payment/datatrans-v2/generateSignature.d.ts +10 -0
  83. package/lib/payment/datatrans-v2/generateSignature.js +19 -0
  84. package/lib/payment/datatrans-v2/generateSignature.js.map +1 -0
  85. package/lib/payment/datatrans-v2/getPaths.d.ts +9 -0
  86. package/lib/payment/datatrans-v2/getPaths.js +9 -0
  87. package/lib/payment/datatrans-v2/getPaths.js.map +1 -0
  88. package/lib/payment/datatrans-v2/index.d.ts +1 -0
  89. package/lib/payment/datatrans-v2/index.js +384 -0
  90. package/lib/payment/datatrans-v2/index.js.map +1 -0
  91. package/lib/payment/datatrans-v2/middleware.d.ts +1 -0
  92. package/lib/payment/datatrans-v2/middleware.js +111 -0
  93. package/lib/payment/datatrans-v2/middleware.js.map +1 -0
  94. package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +11 -0
  95. package/lib/payment/datatrans-v2/parseRegistrationData.js +26 -0
  96. package/lib/payment/datatrans-v2/parseRegistrationData.js.map +1 -0
  97. package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +7 -0
  98. package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +10 -0
  99. package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +1 -0
  100. package/lib/payment/datatrans-v2/splitProperties.d.ts +8 -0
  101. package/lib/payment/datatrans-v2/splitProperties.js +58 -0
  102. package/lib/payment/datatrans-v2/splitProperties.js.map +1 -0
  103. package/lib/payment/invoice-prepaid.d.ts +1 -0
  104. package/lib/payment/invoice-prepaid.js +30 -0
  105. package/lib/payment/invoice-prepaid.js.map +1 -0
  106. package/lib/payment/invoice.d.ts +1 -0
  107. package/lib/payment/invoice.js +27 -0
  108. package/lib/payment/invoice.js.map +1 -0
  109. package/lib/payment/paypal-checkout.d.ts +1 -0
  110. package/lib/payment/paypal-checkout.js +82 -0
  111. package/lib/payment/paypal-checkout.js.map +1 -0
  112. package/lib/payment/postfinance-checkout/api.d.ts +11 -0
  113. package/lib/payment/postfinance-checkout/api.js +109 -0
  114. package/lib/payment/postfinance-checkout/api.js.map +1 -0
  115. package/lib/payment/postfinance-checkout/index.d.ts +1 -0
  116. package/lib/payment/postfinance-checkout/index.js +186 -0
  117. package/lib/payment/postfinance-checkout/index.js.map +1 -0
  118. package/lib/payment/postfinance-checkout/middleware.d.ts +1 -0
  119. package/lib/payment/postfinance-checkout/middleware.js +42 -0
  120. package/lib/payment/postfinance-checkout/middleware.js.map +1 -0
  121. package/lib/payment/postfinance-checkout/types.d.ts +23 -0
  122. package/lib/payment/postfinance-checkout/types.js +12 -0
  123. package/lib/payment/postfinance-checkout/types.js.map +1 -0
  124. package/lib/payment/postfinance-checkout/utils.d.ts +4 -0
  125. package/lib/payment/postfinance-checkout/utils.js +20 -0
  126. package/lib/payment/postfinance-checkout/utils.js.map +1 -0
  127. package/lib/payment/stripe.d.ts +1 -0
  128. package/lib/payment/stripe.js +214 -0
  129. package/lib/payment/stripe.js.map +1 -0
  130. package/lib/payment/worldline-saferpay/index.d.ts +1 -0
  131. package/lib/payment/worldline-saferpay/index.js +112 -0
  132. package/lib/payment/worldline-saferpay/index.js.map +1 -0
  133. package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.d.ts +14 -0
  134. package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js +29 -0
  135. package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js.map +1 -0
  136. package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.d.ts +9 -0
  137. package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.js +28 -0
  138. package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.js.map +1 -0
  139. package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.d.ts +4 -0
  140. package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js +2 -0
  141. package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js.map +1 -0
  142. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.d.ts +1 -0
  143. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.js +2 -0
  144. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.js.map +1 -0
  145. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.d.ts +73 -0
  146. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.js +2 -0
  147. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.js.map +1 -0
  148. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.d.ts +53 -0
  149. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.js +2 -0
  150. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.js.map +1 -0
  151. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.d.ts +13 -0
  152. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.js +2 -0
  153. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.js.map +1 -0
  154. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.d.ts +9 -0
  155. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.js +2 -0
  156. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.js.map +1 -0
  157. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.d.ts +5 -0
  158. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.js +2 -0
  159. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.js.map +1 -0
  160. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.d.ts +13 -0
  161. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.js +2 -0
  162. package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.js.map +1 -0
  163. package/lib/pricing/delivery-swiss-tax.d.ts +15 -0
  164. package/lib/pricing/delivery-swiss-tax.js +98 -0
  165. package/lib/pricing/delivery-swiss-tax.js.map +1 -0
  166. package/lib/pricing/discount-100-off.d.ts +1 -0
  167. package/lib/pricing/discount-100-off.js +34 -0
  168. package/lib/pricing/discount-100-off.js.map +1 -0
  169. package/lib/pricing/discount-half-price-manual.d.ts +1 -0
  170. package/lib/pricing/discount-half-price-manual.js +34 -0
  171. package/lib/pricing/discount-half-price-manual.js.map +1 -0
  172. package/lib/pricing/discount-half-price.d.ts +1 -0
  173. package/lib/pricing/discount-half-price.js +37 -0
  174. package/lib/pricing/discount-half-price.js.map +1 -0
  175. package/lib/pricing/free-delivery.d.ts +2 -0
  176. package/lib/pricing/free-delivery.js +26 -0
  177. package/lib/pricing/free-delivery.js.map +1 -0
  178. package/lib/pricing/free-payment.d.ts +2 -0
  179. package/lib/pricing/free-payment.js +26 -0
  180. package/lib/pricing/free-payment.js.map +1 -0
  181. package/lib/pricing/order-delivery.d.ts +1 -0
  182. package/lib/pricing/order-delivery.js +33 -0
  183. package/lib/pricing/order-delivery.js.map +1 -0
  184. package/lib/pricing/order-discount.d.ts +1 -0
  185. package/lib/pricing/order-discount.js +110 -0
  186. package/lib/pricing/order-discount.js.map +1 -0
  187. package/lib/pricing/order-items-discount.d.ts +1 -0
  188. package/lib/pricing/order-items-discount.js +88 -0
  189. package/lib/pricing/order-items-discount.js.map +1 -0
  190. package/lib/pricing/order-items.d.ts +1 -0
  191. package/lib/pricing/order-items.js +44 -0
  192. package/lib/pricing/order-items.js.map +1 -0
  193. package/lib/pricing/order-payment.d.ts +1 -0
  194. package/lib/pricing/order-payment.js +33 -0
  195. package/lib/pricing/order-payment.js.map +1 -0
  196. package/lib/pricing/product-catalog-price.d.ts +1 -0
  197. package/lib/pricing/product-catalog-price.js +37 -0
  198. package/lib/pricing/product-catalog-price.js.map +1 -0
  199. package/lib/pricing/product-discount.d.ts +1 -0
  200. package/lib/pricing/product-discount.js +55 -0
  201. package/lib/pricing/product-discount.js.map +1 -0
  202. package/lib/pricing/product-price-ECB-interbank-exchange.d.ts +1 -0
  203. package/lib/pricing/product-price-ECB-interbank-exchange.js +90 -0
  204. package/lib/pricing/product-price-ECB-interbank-exchange.js.map +1 -0
  205. package/lib/pricing/product-price-coinbase-exchange.d.ts +1 -0
  206. package/lib/pricing/product-price-coinbase-exchange.js +60 -0
  207. package/lib/pricing/product-price-coinbase-exchange.js.map +1 -0
  208. package/lib/pricing/product-price-cryptopay.d.ts +1 -0
  209. package/lib/pricing/product-price-cryptopay.js +21 -0
  210. package/lib/pricing/product-price-cryptopay.js.map +1 -0
  211. package/lib/pricing/product-price-rateconversion.d.ts +1 -0
  212. package/lib/pricing/product-price-rateconversion.js +51 -0
  213. package/lib/pricing/product-price-rateconversion.js.map +1 -0
  214. package/lib/pricing/product-price-round.d.ts +11 -0
  215. package/lib/pricing/product-price-round.js +54 -0
  216. package/lib/pricing/product-price-round.js.map +1 -0
  217. package/lib/pricing/product-swiss-tax.d.ts +13 -0
  218. package/lib/pricing/product-swiss-tax.js +102 -0
  219. package/lib/pricing/product-swiss-tax.js.map +1 -0
  220. package/lib/pricing/utils/cache.d.ts +9 -0
  221. package/lib/pricing/utils/cache.js +28 -0
  222. package/lib/pricing/utils/cache.js.map +1 -0
  223. package/lib/quotations/manual.d.ts +1 -0
  224. package/lib/quotations/manual.js +21 -0
  225. package/lib/quotations/manual.js.map +1 -0
  226. package/lib/warehousing/google-sheets.d.ts +1 -0
  227. package/lib/warehousing/google-sheets.js +153 -0
  228. package/lib/warehousing/google-sheets.js.map +1 -0
  229. package/lib/warehousing/store.d.ts +1 -0
  230. package/lib/warehousing/store.js +33 -0
  231. package/lib/warehousing/store.js.map +1 -0
  232. package/lib/worker/BulkImportWorker.js +3 -3
  233. package/lib/worker/BulkImportWorker.js.map +1 -1
  234. package/lib/worker/GenerateOrderWorker.js +1 -1
  235. package/lib/worker/GenerateOrderWorker.js.map +1 -1
  236. package/lib/worker/email.js +55 -4
  237. package/lib/worker/email.js.map +1 -1
  238. package/package.json +18 -2
  239. package/src/delivery/pick-mup.ts +119 -0
  240. package/src/delivery/post.ts +30 -0
  241. package/src/delivery/send-message.ts +54 -0
  242. package/src/delivery/stores.ts +49 -0
  243. package/src/enrollments/licensed.ts +49 -0
  244. package/src/filters/local-search.ts +105 -0
  245. package/src/filters/strict-equal.ts +31 -0
  246. package/src/payment/apple-iap/adapter.ts +390 -0
  247. package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +13 -0
  248. package/src/payment/apple-iap/index.ts +3 -0
  249. package/src/payment/apple-iap/module/configureAppleTransactionsModule.ts +31 -0
  250. package/src/payment/bity/adapter.ts +417 -0
  251. package/src/payment/bity/db/BityCredentialsCollection.ts +17 -0
  252. package/src/payment/bity/index.ts +3 -0
  253. package/src/payment/bity/module/configureBityModule.ts +46 -0
  254. package/src/payment/braintree.ts +147 -0
  255. package/src/payment/cryptopay.ts +195 -0
  256. package/src/payment/datatrans-v2/api/authorize.ts +17 -0
  257. package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +20 -0
  258. package/src/payment/datatrans-v2/api/cancel.ts +13 -0
  259. package/src/payment/datatrans-v2/api/index.ts +24 -0
  260. package/src/payment/datatrans-v2/api/init.ts +40 -0
  261. package/src/payment/datatrans-v2/api/makeFetcher.ts +49 -0
  262. package/src/payment/datatrans-v2/api/secureFields.ts +19 -0
  263. package/src/payment/datatrans-v2/api/settle.ts +13 -0
  264. package/src/payment/datatrans-v2/api/status.ts +8 -0
  265. package/src/payment/datatrans-v2/api/types.d.ts +378 -0
  266. package/src/payment/datatrans-v2/api/validate.ts +13 -0
  267. package/src/payment/datatrans-v2/generateSignature.ts +24 -0
  268. package/src/payment/datatrans-v2/getPaths.ts +24 -0
  269. package/src/payment/datatrans-v2/index.ts +476 -0
  270. package/src/payment/datatrans-v2/middleware.ts +147 -0
  271. package/src/payment/datatrans-v2/parseRegistrationData.ts +32 -0
  272. package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +16 -0
  273. package/src/payment/datatrans-v2/splitProperties.ts +63 -0
  274. package/src/payment/invoice-prepaid.ts +40 -0
  275. package/src/payment/invoice.ts +36 -0
  276. package/src/payment/paypal-checkout.ts +107 -0
  277. package/src/payment/postfinance-checkout/api.ts +142 -0
  278. package/src/payment/postfinance-checkout/index.ts +241 -0
  279. package/src/payment/postfinance-checkout/middleware.ts +54 -0
  280. package/src/payment/postfinance-checkout/types.ts +27 -0
  281. package/src/payment/postfinance-checkout/utils.ts +35 -0
  282. package/src/payment/stripe.ts +278 -0
  283. package/src/payment/worldline-saferpay/index.ts +140 -0
  284. package/src/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.ts +54 -0
  285. package/src/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.ts +36 -0
  286. package/src/payment/worldline-saferpay/worldline-saferpay-client/index.ts +8 -0
  287. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.ts +26 -0
  288. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.ts +75 -0
  289. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.ts +55 -0
  290. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/Request.ts +14 -0
  291. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/Response.ts +9 -0
  292. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.ts +6 -0
  293. package/src/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.ts +15 -0
  294. package/src/pricing/delivery-swiss-tax.ts +115 -0
  295. package/src/pricing/discount-100-off.ts +44 -0
  296. package/src/pricing/discount-half-price-manual.ts +43 -0
  297. package/src/pricing/discount-half-price.ts +46 -0
  298. package/src/pricing/free-delivery.ts +31 -0
  299. package/src/pricing/free-payment.ts +32 -0
  300. package/src/pricing/order-delivery.ts +45 -0
  301. package/src/pricing/order-discount.ts +158 -0
  302. package/src/pricing/order-items-discount.ts +116 -0
  303. package/src/pricing/order-items.ts +61 -0
  304. package/src/pricing/order-payment.ts +46 -0
  305. package/src/pricing/product-catalog-price.ts +56 -0
  306. package/src/pricing/product-discount.ts +69 -0
  307. package/src/pricing/product-price-ECB-interbank-exchange.ts +108 -0
  308. package/src/pricing/product-price-coinbase-exchange.ts +82 -0
  309. package/src/pricing/product-price-cryptopay.ts +25 -0
  310. package/src/pricing/product-price-rateconversion.ts +73 -0
  311. package/src/pricing/product-price-round.ts +78 -0
  312. package/src/pricing/product-swiss-tax.ts +117 -0
  313. package/src/pricing/utils/cache.js +32 -0
  314. package/src/quotations/manual.ts +27 -0
  315. package/src/warehousing/google-sheets.ts +165 -0
  316. package/src/warehousing/store.ts +47 -0
  317. package/src/worker/BulkImportWorker.ts +3 -3
  318. package/src/worker/GenerateOrderWorker.ts +1 -1
  319. package/src/worker/email.ts +56 -4
@@ -0,0 +1,55 @@
1
+ import { PaymentMethods } from './PaymentMethods';
2
+ import { Request } from './Request';
3
+ import { Response } from './Response';
4
+ import { TransactionAmount } from './Transaction';
5
+
6
+ export interface PaymentPageInitializeInput extends Request {
7
+ ConfigSet?: string;
8
+ TerminalId: string;
9
+ Payment: {
10
+ Amount: TransactionAmount;
11
+ OrderId?: string;
12
+ PayerNote?: string;
13
+ Description: string;
14
+ MandateId?: string;
15
+ Options?: {
16
+ PreAuth?: boolean;
17
+ AllowPartialAuthorization?: boolean;
18
+ };
19
+ };
20
+ Recurring?: {
21
+ initial: boolean;
22
+ };
23
+ Installment?: {
24
+ initial: boolean;
25
+ };
26
+ PaymentMethods?: PaymentMethods[];
27
+ PaymentMethodsOptions?: Map<string, Map<string, string>>;
28
+ Authentication?: {
29
+ Exemption?: string;
30
+ ThreeDsChallenge?: string;
31
+ };
32
+ Wallets?: string[];
33
+ Payer?: {
34
+ IpAddress?: string;
35
+ LanguageCode?: string;
36
+ };
37
+ BillingAddress?: Map<string, string>;
38
+ DeliveryAddress?: Map<string, string>;
39
+ RegisterAlias?: {
40
+ IdGenerator: 'MANUAL' | 'RANDOM' | 'RANDOM_UNIQUE';
41
+ Id?: string;
42
+ Lifetime?: number;
43
+ };
44
+ ReturnUrls: {
45
+ Success: string;
46
+ Fail: string;
47
+ Abort?: string;
48
+ };
49
+ }
50
+
51
+ export interface PaymentPageInitializeResponse extends Response {
52
+ Token: string;
53
+ Expiration: string; // ISO8601 UTC
54
+ RedirectUrl: string;
55
+ }
@@ -0,0 +1,14 @@
1
+ export interface RequestHeader {
2
+ SpecVersion: string;
3
+ CustomerId: string;
4
+ RequestId: string;
5
+ RetryIndicator: number;
6
+ ClientInfo?: {
7
+ ShopInfo?: string;
8
+ OsInfo?: string;
9
+ };
10
+ }
11
+
12
+ export interface Request {
13
+ RequestHeader: RequestHeader;
14
+ }
@@ -0,0 +1,9 @@
1
+ export interface Response {
2
+ ResponseHeader: {
3
+ RequestId: string;
4
+ SpecVersion: string;
5
+ };
6
+ ErrorName?: string;
7
+ ErrorMessage?: string;
8
+ Behavior?: 'ABORT' | 'OTHER_MEANS' | 'RETRY' | 'RETRY_LATER';
9
+ }
@@ -0,0 +1,6 @@
1
+ export type TransactionStatus = 'AUTHORIZED' | 'CANCELED' | 'CAPTURED' | 'PENDING';
2
+
3
+ export type TransactionAmount = {
4
+ Value: string;
5
+ CurrencyCode: string;
6
+ };
@@ -0,0 +1,15 @@
1
+ import { Response } from './Response';
2
+ import { Request } from './Request';
3
+
4
+ export interface TransactionCancelInput extends Request {
5
+ TransactionReference: {
6
+ TransactionId: string;
7
+ OrderId?: string;
8
+ };
9
+ }
10
+
11
+ export interface TransactionCancelResponse extends Response {
12
+ TransactionId: string;
13
+ OrderId?: string;
14
+ Date: string;
15
+ }
@@ -0,0 +1,115 @@
1
+ import moment from 'moment';
2
+ import { DeliveryPricingAdapter, DeliveryPricingDirector } from '@unchainedshop/core-delivery';
3
+ import {
4
+ DeliveryPricingAdapterContext,
5
+ IDeliveryPricingAdapter,
6
+ } from '@unchainedshop/types/delivery.pricing';
7
+
8
+ // https://www.ch.ch/de/mehrwertsteuersatz-schweiz/
9
+ export const SwissTaxCategories = {
10
+ DEFAULT: {
11
+ rate: (date) => {
12
+ const referenceDate = moment(date);
13
+ if (referenceDate.isBefore('2018-01-01')) {
14
+ return 0.08;
15
+ }
16
+ return 0.077;
17
+ },
18
+ },
19
+ REDUCED: {
20
+ value: 'reduced',
21
+ rate: () => {
22
+ return 0.025;
23
+ },
24
+ },
25
+ SPECIAL: {
26
+ value: 'special',
27
+ rate: () => {
28
+ return 0.037;
29
+ },
30
+ },
31
+ };
32
+
33
+ const getTaxRate = (context: DeliveryPricingAdapterContext) => {
34
+ const date = context.order && context.order.ordered ? new Date(context.order.ordered) : new Date();
35
+
36
+ const taxCategoryFromProvider = context.deliveryProvider?.configuration?.find(({ key }) => {
37
+ if (key === 'swiss-tax-category') return true;
38
+ return null;
39
+ })?.value;
40
+
41
+ if (taxCategoryFromProvider === SwissTaxCategories.REDUCED.value) {
42
+ return SwissTaxCategories.REDUCED.rate();
43
+ }
44
+ if (taxCategoryFromProvider === SwissTaxCategories.SPECIAL.value) {
45
+ return SwissTaxCategories.SPECIAL.rate();
46
+ }
47
+ return SwissTaxCategories.DEFAULT.rate(date);
48
+ };
49
+
50
+ const isDeliveryAddressInSwitzerland = ({ orderDelivery, order, country = null }) => {
51
+ let countryCode = country?.toUpperCase().trim() || order.countryCode;
52
+
53
+ const address = orderDelivery?.context?.address || order?.billingAddress;
54
+
55
+ if (address?.countryCode > '') {
56
+ countryCode = address.countryCode?.toUpperCase().trim();
57
+ }
58
+
59
+ return countryCode === 'CH' || countryCode === 'LI';
60
+ };
61
+
62
+ export const DeliverySwissTax: IDeliveryPricingAdapter = {
63
+ ...DeliveryPricingAdapter,
64
+
65
+ key: 'shop.unchained.pricing.delivery-swiss-tax',
66
+ version: '1.0',
67
+ label: 'Apply Swiss Tax on Delivery Fees',
68
+ orderIndex: 20,
69
+
70
+ isActivatedFor: (context) => {
71
+ return isDeliveryAddressInSwitzerland(context);
72
+ },
73
+
74
+ actions: (params) => {
75
+ const pricingAdapter = DeliveryPricingAdapter.actions(params);
76
+ const { context } = params;
77
+
78
+ return {
79
+ ...pricingAdapter,
80
+
81
+ calculate: async () => {
82
+ const taxRate = getTaxRate(context);
83
+ DeliveryPricingAdapter.log(`DeliverySwissTax -> Tax Multiplicator: ${taxRate}`);
84
+ params.calculationSheet.filterBy({ isTaxable: true }).forEach(({ isNetPrice, ...row }) => {
85
+ if (!isNetPrice) {
86
+ const taxAmount = row.amount - row.amount / (1 + taxRate);
87
+ pricingAdapter.resultSheet().calculation.push({
88
+ ...row,
89
+ amount: -taxAmount,
90
+ isTaxable: false,
91
+ isNetPrice: false,
92
+ meta: { adapter: DeliverySwissTax.key },
93
+ });
94
+ pricingAdapter.resultSheet().addTax({
95
+ amount: taxAmount,
96
+ rate: taxRate,
97
+ meta: { adapter: DeliverySwissTax.key },
98
+ });
99
+ } else {
100
+ const taxAmount = row.amount * taxRate;
101
+ pricingAdapter.resultSheet().addTax({
102
+ amount: taxAmount,
103
+ rate: taxRate,
104
+ meta: { adapter: DeliverySwissTax.key },
105
+ });
106
+ }
107
+ });
108
+
109
+ return pricingAdapter.calculate();
110
+ },
111
+ };
112
+ },
113
+ };
114
+
115
+ DeliveryPricingDirector.registerAdapter(DeliverySwissTax);
@@ -0,0 +1,44 @@
1
+ import { IDiscountAdapter } from '@unchainedshop/types/discount';
2
+ import { OrderDiscountDirector, OrderDiscountAdapter } from '@unchainedshop/core-orders';
3
+
4
+ const HundredOff: IDiscountAdapter = {
5
+ ...OrderDiscountAdapter,
6
+
7
+ key: 'shop.unchained.discount.100-off',
8
+ label: '100 Off',
9
+ version: '1.0',
10
+ orderIndex: 1,
11
+
12
+ // return true if a discount is allowed to get added manually by a user
13
+ isManualAdditionAllowed: async () => {
14
+ return true;
15
+ },
16
+
17
+ // return true if a discount is allowed to get removed manually by a user
18
+ isManualRemovalAllowed: async () => {
19
+ return true;
20
+ },
21
+
22
+ actions: async ({ context }) => ({
23
+ ...(await OrderDiscountAdapter.actions({ context })),
24
+
25
+ isValidForSystemTriggering: async () => {
26
+ return false;
27
+ },
28
+
29
+ isValidForCodeTriggering: async ({ code }) => {
30
+ return code.toUpperCase() === '100OFF';
31
+ },
32
+
33
+ // returns the appropriate discount context for a calculation adapter
34
+ discountForPricingAdapterKey: ({ pricingAdapterKey }) => {
35
+ if (pricingAdapterKey === 'shop.unchained.pricing.order-discount') {
36
+ return { fixedRate: 10000 };
37
+ }
38
+
39
+ return null;
40
+ },
41
+ }),
42
+ };
43
+
44
+ OrderDiscountDirector.registerAdapter(HundredOff);
@@ -0,0 +1,43 @@
1
+ import { IDiscountAdapter } from '@unchainedshop/types/discount';
2
+ import { OrderDiscountDirector, OrderDiscountAdapter } from '@unchainedshop/core-orders';
3
+
4
+ const HalfPriceManual: IDiscountAdapter = {
5
+ ...OrderDiscountAdapter,
6
+
7
+ key: 'shop.unchained.discount.half-price-manual',
8
+ label: 'Half Price',
9
+ version: '1.0',
10
+ orderIndex: 2,
11
+
12
+ // return true if a discount is allowed to get added manually by a user
13
+ isManualAdditionAllowed: async () => {
14
+ return true;
15
+ },
16
+
17
+ // return true if a discount is allowed to get removed manually by a user
18
+ isManualRemovalAllowed: async () => {
19
+ return true;
20
+ },
21
+
22
+ actions: async ({ context }) => ({
23
+ ...(await OrderDiscountAdapter.actions({ context })),
24
+
25
+ isValidForSystemTriggering: async () => {
26
+ return false;
27
+ },
28
+
29
+ isValidForCodeTriggering: async ({ code }) => {
30
+ return code === 'HALFPRICE';
31
+ },
32
+
33
+ // returns the appropriate discount context for a calculation adapter
34
+ discountForPricingAdapterKey({ pricingAdapterKey }) {
35
+ if (pricingAdapterKey === 'shop.unchained.pricing.product-discount') {
36
+ return { rate: 0.5 };
37
+ }
38
+ return null;
39
+ },
40
+ }),
41
+ };
42
+
43
+ OrderDiscountDirector.registerAdapter(HalfPriceManual);
@@ -0,0 +1,46 @@
1
+ import { IDiscountAdapter } from '@unchainedshop/types/discount';
2
+ import { OrderDiscountDirector, OrderDiscountAdapter } from '@unchainedshop/core-orders';
3
+
4
+ const HalfPrice: IDiscountAdapter = {
5
+ ...OrderDiscountAdapter,
6
+
7
+ key: 'shop.unchained.discount.half-price',
8
+ label: 'Half Price',
9
+ version: '1.0',
10
+ orderIndex: 3,
11
+
12
+ // return true if a discount is allowed to get added manually by a user
13
+ isManualAdditionAllowed: async () => {
14
+ return false;
15
+ },
16
+
17
+ // return true if a discount is allowed to get removed manually by a user
18
+ isManualRemovalAllowed: async () => {
19
+ return false;
20
+ },
21
+
22
+ actions: async ({ context }) => ({
23
+ ...(await OrderDiscountAdapter.actions({ context })),
24
+
25
+ isValidForSystemTriggering: async () => {
26
+ const { order } = context;
27
+ const user = await context.modules.users.findUserById(order.userId);
28
+ const isUserEligibleForHalfPrice = user?.tags && user.tags.indexOf('half-price') !== -1;
29
+ return !!isUserEligibleForHalfPrice;
30
+ },
31
+
32
+ isValidForCodeTriggering: async () => {
33
+ return false;
34
+ },
35
+
36
+ // returns the appropriate discount context for a calculation adapter
37
+ discountForPricingAdapterKey({ pricingAdapterKey }) {
38
+ if (pricingAdapterKey === 'shop.unchained.pricing.product-discount') {
39
+ return { rate: 0.5 };
40
+ }
41
+ return null;
42
+ },
43
+ }),
44
+ };
45
+
46
+ OrderDiscountDirector.registerAdapter(HalfPrice);
@@ -0,0 +1,31 @@
1
+ import { DeliveryPricingAdapter, DeliveryPricingDirector } from '@unchainedshop/core-delivery';
2
+ import { IDeliveryPricingAdapter } from '@unchainedshop/types/delivery.pricing';
3
+
4
+ export const DeliveryFreePrice: IDeliveryPricingAdapter = {
5
+ ...DeliveryPricingAdapter,
6
+
7
+ key: 'shop.unchained.pricing.delivery-free',
8
+ version: '1.0',
9
+ label: 'Free Delivery',
10
+ orderIndex: 0,
11
+
12
+ isActivatedFor: () => {
13
+ return true;
14
+ },
15
+
16
+ actions: (params) => {
17
+ const pricingAdapter = DeliveryPricingAdapter.actions(params);
18
+ return {
19
+ ...pricingAdapter,
20
+ calculate: async () => {
21
+ pricingAdapter.resultSheet().addFee({
22
+ amount: 0,
23
+ meta: { adapter: DeliveryFreePrice.key },
24
+ });
25
+ return pricingAdapter.calculate();
26
+ },
27
+ };
28
+ },
29
+ };
30
+
31
+ DeliveryPricingDirector.registerAdapter(DeliveryFreePrice);
@@ -0,0 +1,32 @@
1
+ import { PaymentPricingAdapter, PaymentPricingDirector } from '@unchainedshop/core-payment';
2
+ import { IPaymentPricingAdapter } from '@unchainedshop/types/payments.pricing';
3
+
4
+ export const PaymentFreePrice: IPaymentPricingAdapter = {
5
+ ...PaymentPricingAdapter,
6
+
7
+ key: 'shop.unchained.pricing.payment-free',
8
+ version: '1.0',
9
+ label: 'Free Payment',
10
+ orderIndex: 0,
11
+
12
+ isActivatedFor: () => {
13
+ return true;
14
+ },
15
+
16
+ actions: (params) => {
17
+ const pricingAdapter = PaymentPricingAdapter.actions(params);
18
+
19
+ return {
20
+ ...pricingAdapter,
21
+ calculate: async () => {
22
+ pricingAdapter.resultSheet().addFee({
23
+ amount: 0,
24
+ meta: { adapter: PaymentFreePrice.key },
25
+ });
26
+ return pricingAdapter.calculate();
27
+ },
28
+ };
29
+ },
30
+ };
31
+
32
+ PaymentPricingDirector.registerAdapter(PaymentFreePrice);
@@ -0,0 +1,45 @@
1
+ import { IOrderPricingAdapter } from '@unchainedshop/types/orders.pricing';
2
+ import { OrderPricingDirector, OrderPricingAdapter } from '@unchainedshop/core-orders';
3
+
4
+ const OrderDelivery: IOrderPricingAdapter = {
5
+ ...OrderPricingAdapter,
6
+
7
+ key: 'shop.unchained.pricing.order-delivery',
8
+ version: '1.0',
9
+ label: 'Add Delivery Fees to Order',
10
+ orderIndex: 10,
11
+
12
+ isActivatedFor: () => {
13
+ return true;
14
+ },
15
+
16
+ actions: (params) => {
17
+ const pricingAdapter = OrderPricingAdapter.actions(params);
18
+ const { order, orderDelivery, modules } = params.context;
19
+
20
+ return {
21
+ ...pricingAdapter,
22
+
23
+ calculate: async () => {
24
+ // just add tax + net price to order pricing
25
+ if (!orderDelivery) return null;
26
+ const pricing = modules.orders.deliveries.pricingSheet(
27
+ orderDelivery,
28
+ order.currency,
29
+ params.context,
30
+ );
31
+ const tax = pricing.taxSum();
32
+ const shipping = pricing.gross();
33
+
34
+ pricingAdapter.resultSheet().addDelivery({ amount: shipping });
35
+ if (tax !== 0) {
36
+ pricingAdapter.resultSheet().addTax({ amount: tax });
37
+ }
38
+
39
+ return pricingAdapter.calculate();
40
+ },
41
+ };
42
+ },
43
+ };
44
+
45
+ OrderPricingDirector.registerAdapter(OrderDelivery);
@@ -0,0 +1,158 @@
1
+ import { IOrderPricingAdapter, OrderPricingRowCategory } from '@unchainedshop/types/orders.pricing';
2
+ import { OrderPricingDirector, OrderPricingAdapter } from '@unchainedshop/core-orders';
3
+
4
+ const resolveRatioAndTaxDivisorForPricingSheet = (pricing, total) => {
5
+ if (total === 0 || !pricing) {
6
+ return {
7
+ ratio: 1,
8
+ taxDivisor: 1,
9
+ };
10
+ }
11
+ const tax = pricing.taxSum();
12
+ const gross = pricing.gross();
13
+ if (gross - tax === 0) {
14
+ return {
15
+ ratio: 0,
16
+ taxDivisor: 0,
17
+ };
18
+ }
19
+ return {
20
+ ratio: gross / total,
21
+ taxDivisor: gross / (gross - tax),
22
+ };
23
+ };
24
+
25
+ const resolveAmountAndTax = ({ ratio, taxDivisor }, amount) => {
26
+ const shareAmount = Number.isFinite(ratio) ? amount * ratio : 0;
27
+ const shareTaxAmount =
28
+ Number.isFinite(taxDivisor) && taxDivisor !== 0 ? shareAmount - shareAmount / taxDivisor : 0;
29
+ return [shareAmount, shareTaxAmount];
30
+ };
31
+
32
+ const applyDiscountToMultipleShares = (shares, amount) => {
33
+ return shares.reduce(
34
+ ([currentDiscountAmount, currentTaxAmount], share) => {
35
+ const [shareAmount, shareTaxAmount] = resolveAmountAndTax(share, amount);
36
+ return [currentDiscountAmount + shareAmount, currentTaxAmount + shareTaxAmount];
37
+ },
38
+ [0, 0],
39
+ );
40
+ };
41
+
42
+ const calculateAmountToSplit = (configuration, amount) => {
43
+ const deductionAmount = configuration.rate ? amount * configuration.rate : configuration.fixedRate;
44
+
45
+ const leftInDiscount = Math.max(0, deductionAmount - (configuration.alreadyDeductedForDiscount || 0));
46
+ const leftToDeduct = Math.min(configuration.amountLeft, leftInDiscount);
47
+ return Math.max(0, leftToDeduct);
48
+ };
49
+
50
+ const OrderDiscount: IOrderPricingAdapter = {
51
+ ...OrderPricingAdapter,
52
+
53
+ key: 'shop.unchained.pricing.order-discount',
54
+ version: '1.0',
55
+ label: 'Apply Discounts on Total Order Value',
56
+ orderIndex: 90,
57
+
58
+ isActivatedFor: () => {
59
+ return true;
60
+ },
61
+
62
+ actions: (params) => {
63
+ const pricingAdapter = OrderPricingAdapter.actions(params);
64
+ const { order, orderDelivery, orderPositions, orderPayment, modules } = params.context;
65
+
66
+ return {
67
+ ...pricingAdapter,
68
+
69
+ calculate: async () => {
70
+ // discounts need to provide a *fixedRate*
71
+ // if you want to add percentual discounts,
72
+ // add it to the order item calculation
73
+ const totalAmountOfItems = params.calculationSheet.sum({
74
+ category: OrderPricingRowCategory.Items,
75
+ });
76
+ const totalAmountOfPaymentAndDelivery =
77
+ params.calculationSheet.sum({
78
+ category: OrderPricingRowCategory.Payment,
79
+ }) +
80
+ params.calculationSheet.sum({
81
+ category: OrderPricingRowCategory.Delivery,
82
+ });
83
+
84
+ const itemShares = orderPositions.map((orderPosition) =>
85
+ resolveRatioAndTaxDivisorForPricingSheet(
86
+ modules.orders.positions.pricingSheet(orderPosition, order.currency, params.context),
87
+ totalAmountOfItems,
88
+ ),
89
+ );
90
+
91
+ const deliveryShare = resolveRatioAndTaxDivisorForPricingSheet(
92
+ orderDelivery &&
93
+ modules.orders.deliveries.pricingSheet(orderDelivery, order.currency, params.context),
94
+ totalAmountOfPaymentAndDelivery,
95
+ );
96
+ const paymentShare = resolveRatioAndTaxDivisorForPricingSheet(
97
+ orderPayment &&
98
+ modules.orders.payments.pricingSheet(orderPayment, order.currency, params.context),
99
+ totalAmountOfPaymentAndDelivery,
100
+ );
101
+
102
+ let amountLeft = totalAmountOfPaymentAndDelivery + totalAmountOfItems;
103
+
104
+ params.discounts.forEach(({ configuration, discountId }) => {
105
+ // First, we deduce the discount from the items
106
+ let alreadyDeductedForDiscount = 0;
107
+ const [itemsDiscountAmount, itemsTaxAmount] = applyDiscountToMultipleShares(
108
+ itemShares,
109
+ calculateAmountToSplit(
110
+ { ...configuration, amountLeft, alreadyDeductedForDiscount },
111
+ totalAmountOfItems,
112
+ ),
113
+ );
114
+ amountLeft -= itemsDiscountAmount;
115
+ alreadyDeductedForDiscount += itemsDiscountAmount;
116
+
117
+ // After the items, we deduct the remaining discount from payment & delivery fees
118
+ const [deliveryAndPaymentDiscountAmount, deliveryAndPaymentTaxAmount] =
119
+ applyDiscountToMultipleShares(
120
+ [deliveryShare, paymentShare],
121
+ calculateAmountToSplit(
122
+ { ...configuration, amountLeft, alreadyDeductedForDiscount },
123
+ totalAmountOfPaymentAndDelivery,
124
+ ),
125
+ );
126
+ amountLeft -= deliveryAndPaymentDiscountAmount;
127
+ alreadyDeductedForDiscount += itemsDiscountAmount;
128
+
129
+ const discountAmount = itemsDiscountAmount + deliveryAndPaymentDiscountAmount;
130
+ const taxAmount = itemsTaxAmount + deliveryAndPaymentTaxAmount;
131
+
132
+ if (discountAmount) {
133
+ pricingAdapter.resultSheet().addDiscount({
134
+ amount: discountAmount * -1,
135
+ discountId,
136
+ meta: {
137
+ adapter: OrderDiscount.key,
138
+ },
139
+ });
140
+ if (taxAmount !== 0) {
141
+ pricingAdapter.resultSheet().addTax({
142
+ amount: taxAmount * -1,
143
+ meta: {
144
+ discountId,
145
+ adapter: OrderDiscount.key,
146
+ },
147
+ });
148
+ }
149
+ }
150
+ });
151
+
152
+ return pricingAdapter.calculate();
153
+ },
154
+ };
155
+ },
156
+ };
157
+
158
+ OrderPricingDirector.registerAdapter(OrderDiscount);