@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.
- package/lib/delivery/pick-mup.d.ts +1 -0
- package/lib/delivery/pick-mup.js +98 -0
- package/lib/delivery/pick-mup.js.map +1 -0
- package/lib/delivery/post.d.ts +1 -0
- package/lib/delivery/post.js +23 -0
- package/lib/delivery/post.js.map +1 -0
- package/lib/delivery/send-message.d.ts +1 -0
- package/lib/delivery/send-message.js +41 -0
- package/lib/delivery/send-message.js.map +1 -0
- package/lib/delivery/stores.d.ts +1 -0
- package/lib/delivery/stores.js +39 -0
- package/lib/delivery/stores.js.map +1 -0
- package/lib/enrollments/licensed.d.ts +1 -0
- package/lib/enrollments/licensed.js +40 -0
- package/lib/enrollments/licensed.js.map +1 -0
- package/lib/filters/local-search.d.ts +3 -0
- package/lib/filters/local-search.js +84 -0
- package/lib/filters/local-search.js.map +1 -0
- package/lib/filters/strict-equal.d.ts +1 -0
- package/lib/filters/strict-equal.js +25 -0
- package/lib/filters/strict-equal.js.map +1 -0
- package/lib/payment/apple-iap/adapter.d.ts +1 -0
- package/lib/payment/apple-iap/adapter.js +284 -0
- package/lib/payment/apple-iap/adapter.js.map +1 -0
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.d.ts +7 -0
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js +5 -0
- package/lib/payment/apple-iap/db/AppleTransactionsCollection.js.map +1 -0
- package/lib/payment/apple-iap/index.d.ts +2 -0
- package/lib/payment/apple-iap/index.js +3 -0
- package/lib/payment/apple-iap/index.js.map +1 -0
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.d.ts +9 -0
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js +18 -0
- package/lib/payment/apple-iap/module/configureAppleTransactionsModule.js.map +1 -0
- package/lib/payment/bity/adapter.d.ts +1 -0
- package/lib/payment/bity/adapter.js +316 -0
- package/lib/payment/bity/adapter.js.map +1 -0
- package/lib/payment/bity/db/BityCredentialsCollection.d.ts +11 -0
- package/lib/payment/bity/db/BityCredentialsCollection.js +5 -0
- package/lib/payment/bity/db/BityCredentialsCollection.js.map +1 -0
- package/lib/payment/bity/index.d.ts +2 -0
- package/lib/payment/bity/index.js +3 -0
- package/lib/payment/bity/index.js.map +1 -0
- package/lib/payment/bity/module/configureBityModule.d.ts +11 -0
- package/lib/payment/bity/module/configureBityModule.js +33 -0
- package/lib/payment/bity/module/configureBityModule.js.map +1 -0
- package/lib/payment/braintree.d.ts +1 -0
- package/lib/payment/braintree.js +129 -0
- package/lib/payment/braintree.js.map +1 -0
- package/lib/payment/cryptopay.d.ts +1 -0
- package/lib/payment/cryptopay.js +159 -0
- package/lib/payment/cryptopay.js.map +1 -0
- package/lib/payment/datatrans-v2/api/authorize.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/authorize.js +12 -0
- package/lib/payment/datatrans-v2/api/authorize.js.map +1 -0
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js +11 -0
- package/lib/payment/datatrans-v2/api/authorizeAuthenticated.js.map +1 -0
- package/lib/payment/datatrans-v2/api/cancel.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/cancel.js +10 -0
- package/lib/payment/datatrans-v2/api/cancel.js.map +1 -0
- package/lib/payment/datatrans-v2/api/index.d.ts +19 -0
- package/lib/payment/datatrans-v2/api/index.js +24 -0
- package/lib/payment/datatrans-v2/api/index.js.map +1 -0
- package/lib/payment/datatrans-v2/api/init.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/init.js +31 -0
- package/lib/payment/datatrans-v2/api/init.js.map +1 -0
- package/lib/payment/datatrans-v2/api/makeFetcher.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/makeFetcher.js +41 -0
- package/lib/payment/datatrans-v2/api/makeFetcher.js.map +1 -0
- package/lib/payment/datatrans-v2/api/secureFields.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/secureFields.js +14 -0
- package/lib/payment/datatrans-v2/api/secureFields.js.map +1 -0
- package/lib/payment/datatrans-v2/api/settle.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/settle.js +10 -0
- package/lib/payment/datatrans-v2/api/settle.js.map +1 -0
- package/lib/payment/datatrans-v2/api/status.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/status.js +7 -0
- package/lib/payment/datatrans-v2/api/status.js.map +1 -0
- package/lib/payment/datatrans-v2/api/validate.d.ts +2 -0
- package/lib/payment/datatrans-v2/api/validate.js +10 -0
- package/lib/payment/datatrans-v2/api/validate.js.map +1 -0
- package/lib/payment/datatrans-v2/generateSignature.d.ts +10 -0
- package/lib/payment/datatrans-v2/generateSignature.js +19 -0
- package/lib/payment/datatrans-v2/generateSignature.js.map +1 -0
- package/lib/payment/datatrans-v2/getPaths.d.ts +9 -0
- package/lib/payment/datatrans-v2/getPaths.js +9 -0
- package/lib/payment/datatrans-v2/getPaths.js.map +1 -0
- package/lib/payment/datatrans-v2/index.d.ts +1 -0
- package/lib/payment/datatrans-v2/index.js +384 -0
- package/lib/payment/datatrans-v2/index.js.map +1 -0
- package/lib/payment/datatrans-v2/middleware.d.ts +1 -0
- package/lib/payment/datatrans-v2/middleware.js +111 -0
- package/lib/payment/datatrans-v2/middleware.js.map +1 -0
- package/lib/payment/datatrans-v2/parseRegistrationData.d.ts +11 -0
- package/lib/payment/datatrans-v2/parseRegistrationData.js +26 -0
- package/lib/payment/datatrans-v2/parseRegistrationData.js.map +1 -0
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.d.ts +7 -0
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js +10 -0
- package/lib/payment/datatrans-v2/roundedAmountFromOrder.js.map +1 -0
- package/lib/payment/datatrans-v2/splitProperties.d.ts +8 -0
- package/lib/payment/datatrans-v2/splitProperties.js +58 -0
- package/lib/payment/datatrans-v2/splitProperties.js.map +1 -0
- package/lib/payment/invoice-prepaid.d.ts +1 -0
- package/lib/payment/invoice-prepaid.js +30 -0
- package/lib/payment/invoice-prepaid.js.map +1 -0
- package/lib/payment/invoice.d.ts +1 -0
- package/lib/payment/invoice.js +27 -0
- package/lib/payment/invoice.js.map +1 -0
- package/lib/payment/paypal-checkout.d.ts +1 -0
- package/lib/payment/paypal-checkout.js +82 -0
- package/lib/payment/paypal-checkout.js.map +1 -0
- package/lib/payment/postfinance-checkout/api.d.ts +11 -0
- package/lib/payment/postfinance-checkout/api.js +109 -0
- package/lib/payment/postfinance-checkout/api.js.map +1 -0
- package/lib/payment/postfinance-checkout/index.d.ts +1 -0
- package/lib/payment/postfinance-checkout/index.js +186 -0
- package/lib/payment/postfinance-checkout/index.js.map +1 -0
- package/lib/payment/postfinance-checkout/middleware.d.ts +1 -0
- package/lib/payment/postfinance-checkout/middleware.js +42 -0
- package/lib/payment/postfinance-checkout/middleware.js.map +1 -0
- package/lib/payment/postfinance-checkout/types.d.ts +23 -0
- package/lib/payment/postfinance-checkout/types.js +12 -0
- package/lib/payment/postfinance-checkout/types.js.map +1 -0
- package/lib/payment/postfinance-checkout/utils.d.ts +4 -0
- package/lib/payment/postfinance-checkout/utils.js +20 -0
- package/lib/payment/postfinance-checkout/utils.js.map +1 -0
- package/lib/payment/stripe.d.ts +1 -0
- package/lib/payment/stripe.js +214 -0
- package/lib/payment/stripe.js.map +1 -0
- package/lib/payment/worldline-saferpay/index.d.ts +1 -0
- package/lib/payment/worldline-saferpay/index.js +112 -0
- package/lib/payment/worldline-saferpay/index.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.d.ts +14 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js +29 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.d.ts +9 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.js +28 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.d.ts +4 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/index.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.d.ts +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.d.ts +73 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.d.ts +53 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.d.ts +13 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Request.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.d.ts +9 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Response.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.d.ts +5 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.js.map +1 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.d.ts +13 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.js +2 -0
- package/lib/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.js.map +1 -0
- package/lib/pricing/delivery-swiss-tax.d.ts +15 -0
- package/lib/pricing/delivery-swiss-tax.js +98 -0
- package/lib/pricing/delivery-swiss-tax.js.map +1 -0
- package/lib/pricing/discount-100-off.d.ts +1 -0
- package/lib/pricing/discount-100-off.js +34 -0
- package/lib/pricing/discount-100-off.js.map +1 -0
- package/lib/pricing/discount-half-price-manual.d.ts +1 -0
- package/lib/pricing/discount-half-price-manual.js +34 -0
- package/lib/pricing/discount-half-price-manual.js.map +1 -0
- package/lib/pricing/discount-half-price.d.ts +1 -0
- package/lib/pricing/discount-half-price.js +37 -0
- package/lib/pricing/discount-half-price.js.map +1 -0
- package/lib/pricing/free-delivery.d.ts +2 -0
- package/lib/pricing/free-delivery.js +26 -0
- package/lib/pricing/free-delivery.js.map +1 -0
- package/lib/pricing/free-payment.d.ts +2 -0
- package/lib/pricing/free-payment.js +26 -0
- package/lib/pricing/free-payment.js.map +1 -0
- package/lib/pricing/order-delivery.d.ts +1 -0
- package/lib/pricing/order-delivery.js +33 -0
- package/lib/pricing/order-delivery.js.map +1 -0
- package/lib/pricing/order-discount.d.ts +1 -0
- package/lib/pricing/order-discount.js +110 -0
- package/lib/pricing/order-discount.js.map +1 -0
- package/lib/pricing/order-items-discount.d.ts +1 -0
- package/lib/pricing/order-items-discount.js +88 -0
- package/lib/pricing/order-items-discount.js.map +1 -0
- package/lib/pricing/order-items.d.ts +1 -0
- package/lib/pricing/order-items.js +44 -0
- package/lib/pricing/order-items.js.map +1 -0
- package/lib/pricing/order-payment.d.ts +1 -0
- package/lib/pricing/order-payment.js +33 -0
- package/lib/pricing/order-payment.js.map +1 -0
- package/lib/pricing/product-catalog-price.d.ts +1 -0
- package/lib/pricing/product-catalog-price.js +37 -0
- package/lib/pricing/product-catalog-price.js.map +1 -0
- package/lib/pricing/product-discount.d.ts +1 -0
- package/lib/pricing/product-discount.js +55 -0
- package/lib/pricing/product-discount.js.map +1 -0
- package/lib/pricing/product-price-ECB-interbank-exchange.d.ts +1 -0
- package/lib/pricing/product-price-ECB-interbank-exchange.js +90 -0
- package/lib/pricing/product-price-ECB-interbank-exchange.js.map +1 -0
- package/lib/pricing/product-price-coinbase-exchange.d.ts +1 -0
- package/lib/pricing/product-price-coinbase-exchange.js +60 -0
- package/lib/pricing/product-price-coinbase-exchange.js.map +1 -0
- package/lib/pricing/product-price-cryptopay.d.ts +1 -0
- package/lib/pricing/product-price-cryptopay.js +21 -0
- package/lib/pricing/product-price-cryptopay.js.map +1 -0
- package/lib/pricing/product-price-rateconversion.d.ts +1 -0
- package/lib/pricing/product-price-rateconversion.js +51 -0
- package/lib/pricing/product-price-rateconversion.js.map +1 -0
- package/lib/pricing/product-price-round.d.ts +11 -0
- package/lib/pricing/product-price-round.js +54 -0
- package/lib/pricing/product-price-round.js.map +1 -0
- package/lib/pricing/product-swiss-tax.d.ts +13 -0
- package/lib/pricing/product-swiss-tax.js +102 -0
- package/lib/pricing/product-swiss-tax.js.map +1 -0
- package/lib/pricing/utils/cache.d.ts +9 -0
- package/lib/pricing/utils/cache.js +28 -0
- package/lib/pricing/utils/cache.js.map +1 -0
- package/lib/quotations/manual.d.ts +1 -0
- package/lib/quotations/manual.js +21 -0
- package/lib/quotations/manual.js.map +1 -0
- package/lib/warehousing/google-sheets.d.ts +1 -0
- package/lib/warehousing/google-sheets.js +153 -0
- package/lib/warehousing/google-sheets.js.map +1 -0
- package/lib/warehousing/store.d.ts +1 -0
- package/lib/warehousing/store.js +33 -0
- package/lib/warehousing/store.js.map +1 -0
- package/lib/worker/BulkImportWorker.js +3 -3
- package/lib/worker/BulkImportWorker.js.map +1 -1
- package/lib/worker/GenerateOrderWorker.js +1 -1
- package/lib/worker/GenerateOrderWorker.js.map +1 -1
- package/lib/worker/email.js +55 -4
- package/lib/worker/email.js.map +1 -1
- package/package.json +18 -2
- package/src/delivery/pick-mup.ts +119 -0
- package/src/delivery/post.ts +30 -0
- package/src/delivery/send-message.ts +54 -0
- package/src/delivery/stores.ts +49 -0
- package/src/enrollments/licensed.ts +49 -0
- package/src/filters/local-search.ts +105 -0
- package/src/filters/strict-equal.ts +31 -0
- package/src/payment/apple-iap/adapter.ts +390 -0
- package/src/payment/apple-iap/db/AppleTransactionsCollection.ts +13 -0
- package/src/payment/apple-iap/index.ts +3 -0
- package/src/payment/apple-iap/module/configureAppleTransactionsModule.ts +31 -0
- package/src/payment/bity/adapter.ts +417 -0
- package/src/payment/bity/db/BityCredentialsCollection.ts +17 -0
- package/src/payment/bity/index.ts +3 -0
- package/src/payment/bity/module/configureBityModule.ts +46 -0
- package/src/payment/braintree.ts +147 -0
- package/src/payment/cryptopay.ts +195 -0
- package/src/payment/datatrans-v2/api/authorize.ts +17 -0
- package/src/payment/datatrans-v2/api/authorizeAuthenticated.ts +20 -0
- package/src/payment/datatrans-v2/api/cancel.ts +13 -0
- package/src/payment/datatrans-v2/api/index.ts +24 -0
- package/src/payment/datatrans-v2/api/init.ts +40 -0
- package/src/payment/datatrans-v2/api/makeFetcher.ts +49 -0
- package/src/payment/datatrans-v2/api/secureFields.ts +19 -0
- package/src/payment/datatrans-v2/api/settle.ts +13 -0
- package/src/payment/datatrans-v2/api/status.ts +8 -0
- package/src/payment/datatrans-v2/api/types.d.ts +378 -0
- package/src/payment/datatrans-v2/api/validate.ts +13 -0
- package/src/payment/datatrans-v2/generateSignature.ts +24 -0
- package/src/payment/datatrans-v2/getPaths.ts +24 -0
- package/src/payment/datatrans-v2/index.ts +476 -0
- package/src/payment/datatrans-v2/middleware.ts +147 -0
- package/src/payment/datatrans-v2/parseRegistrationData.ts +32 -0
- package/src/payment/datatrans-v2/roundedAmountFromOrder.ts +16 -0
- package/src/payment/datatrans-v2/splitProperties.ts +63 -0
- package/src/payment/invoice-prepaid.ts +40 -0
- package/src/payment/invoice.ts +36 -0
- package/src/payment/paypal-checkout.ts +107 -0
- package/src/payment/postfinance-checkout/api.ts +142 -0
- package/src/payment/postfinance-checkout/index.ts +241 -0
- package/src/payment/postfinance-checkout/middleware.ts +54 -0
- package/src/payment/postfinance-checkout/types.ts +27 -0
- package/src/payment/postfinance-checkout/utils.ts +35 -0
- package/src/payment/stripe.ts +278 -0
- package/src/payment/worldline-saferpay/index.ts +140 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayClient.ts +54 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/api/SaferpayConnection.ts +36 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/index.ts +8 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentMethods.ts +26 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageAssert.ts +75 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/PaymentPageInitialize.ts +55 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/Request.ts +14 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/Response.ts +9 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/Transaction.ts +6 -0
- package/src/payment/worldline-saferpay/worldline-saferpay-client/models/TransactionCancel.ts +15 -0
- package/src/pricing/delivery-swiss-tax.ts +115 -0
- package/src/pricing/discount-100-off.ts +44 -0
- package/src/pricing/discount-half-price-manual.ts +43 -0
- package/src/pricing/discount-half-price.ts +46 -0
- package/src/pricing/free-delivery.ts +31 -0
- package/src/pricing/free-payment.ts +32 -0
- package/src/pricing/order-delivery.ts +45 -0
- package/src/pricing/order-discount.ts +158 -0
- package/src/pricing/order-items-discount.ts +116 -0
- package/src/pricing/order-items.ts +61 -0
- package/src/pricing/order-payment.ts +46 -0
- package/src/pricing/product-catalog-price.ts +56 -0
- package/src/pricing/product-discount.ts +69 -0
- package/src/pricing/product-price-ECB-interbank-exchange.ts +108 -0
- package/src/pricing/product-price-coinbase-exchange.ts +82 -0
- package/src/pricing/product-price-cryptopay.ts +25 -0
- package/src/pricing/product-price-rateconversion.ts +73 -0
- package/src/pricing/product-price-round.ts +78 -0
- package/src/pricing/product-swiss-tax.ts +117 -0
- package/src/pricing/utils/cache.js +32 -0
- package/src/quotations/manual.ts +27 -0
- package/src/warehousing/google-sheets.ts +165 -0
- package/src/warehousing/store.ts +47 -0
- package/src/worker/BulkImportWorker.ts +3 -3
- package/src/worker/GenerateOrderWorker.ts +1 -1
- package/src/worker/email.ts +56 -4
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
export type Address = {
|
|
2
|
+
gender?: 'female' | 'male';
|
|
3
|
+
title?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
firstName?: string;
|
|
6
|
+
lastName?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
street?: string;
|
|
9
|
+
street2?: string;
|
|
10
|
+
zipCode?: string;
|
|
11
|
+
city?: string;
|
|
12
|
+
country?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type BillingAddress = Address & {
|
|
16
|
+
countrySubdivision?: string;
|
|
17
|
+
sortingCode?: string;
|
|
18
|
+
phoneNumber?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ShippingAddress = Address & {
|
|
22
|
+
countrySubdivision?: string;
|
|
23
|
+
sortingCode?: string;
|
|
24
|
+
phone?: string;
|
|
25
|
+
cellPhone?: string;
|
|
26
|
+
carrier?: string;
|
|
27
|
+
price?: number;
|
|
28
|
+
priceGross?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type Customer = Address & {
|
|
32
|
+
id?: string;
|
|
33
|
+
phone?: string;
|
|
34
|
+
cellPhone?: string;
|
|
35
|
+
birthDate?: string; // YYYY-MM-DD
|
|
36
|
+
language?: string;
|
|
37
|
+
type?: 'P' | 'C'; // c = company, companyRegisterNumber + name required
|
|
38
|
+
companyLegalForm?: string;
|
|
39
|
+
companyRegisterNumber?: string;
|
|
40
|
+
ipAddress?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type Order = {
|
|
44
|
+
articles: Record<string, unknown>;
|
|
45
|
+
taxAmount: number;
|
|
46
|
+
shippingAmount: number;
|
|
47
|
+
discountAmount: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type DT2015Configuration = {
|
|
51
|
+
brandColor: string;
|
|
52
|
+
textColor: 'white' | 'black';
|
|
53
|
+
logoType: 'circle' | 'rectangle' | 'none';
|
|
54
|
+
logoBorderColor: string;
|
|
55
|
+
brandButton: string;
|
|
56
|
+
payButtonTextColor: string;
|
|
57
|
+
logoSrc: string;
|
|
58
|
+
initialView: 'list' | 'grid';
|
|
59
|
+
brandTitle: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type SupportedLanguage =
|
|
63
|
+
| 'de'
|
|
64
|
+
| 'en'
|
|
65
|
+
| 'fr'
|
|
66
|
+
| 'it'
|
|
67
|
+
| 'es'
|
|
68
|
+
| 'el'
|
|
69
|
+
| 'no'
|
|
70
|
+
| 'da'
|
|
71
|
+
| 'pl'
|
|
72
|
+
| 'pt'
|
|
73
|
+
| 'ru'
|
|
74
|
+
| 'ja';
|
|
75
|
+
|
|
76
|
+
export type PaymentMethod =
|
|
77
|
+
| 'ACC'
|
|
78
|
+
| 'ALP'
|
|
79
|
+
| 'APL'
|
|
80
|
+
| 'AMX'
|
|
81
|
+
| 'AZP'
|
|
82
|
+
| 'BON'
|
|
83
|
+
| 'CFY'
|
|
84
|
+
| 'CSY'
|
|
85
|
+
| 'CUP'
|
|
86
|
+
| 'DIN'
|
|
87
|
+
| 'DII'
|
|
88
|
+
| 'DIB'
|
|
89
|
+
| 'DIS'
|
|
90
|
+
| 'DNK'
|
|
91
|
+
| 'ECA'
|
|
92
|
+
| 'ELV'
|
|
93
|
+
| 'EPS'
|
|
94
|
+
| 'ESY'
|
|
95
|
+
| 'INT'
|
|
96
|
+
| 'JCB'
|
|
97
|
+
| 'JEL'
|
|
98
|
+
| 'KLN'
|
|
99
|
+
| 'MAU'
|
|
100
|
+
| 'MDP'
|
|
101
|
+
| 'MFX'
|
|
102
|
+
| 'MPX'
|
|
103
|
+
| 'MYO'
|
|
104
|
+
| 'PAP'
|
|
105
|
+
| 'PAY'
|
|
106
|
+
| 'PEF'
|
|
107
|
+
| 'PFC'
|
|
108
|
+
| 'PSC'
|
|
109
|
+
| 'REK'
|
|
110
|
+
| 'SAM'
|
|
111
|
+
| 'SWB'
|
|
112
|
+
| 'SCX'
|
|
113
|
+
| 'SWP'
|
|
114
|
+
| 'TWI'
|
|
115
|
+
| 'UAP'
|
|
116
|
+
| 'VIS'
|
|
117
|
+
| 'WEC';
|
|
118
|
+
|
|
119
|
+
export type TransactionType = 'payment' | 'credit' | 'card_check';
|
|
120
|
+
|
|
121
|
+
export type TransactionStatusCode =
|
|
122
|
+
| 'initialized'
|
|
123
|
+
| 'challenge_required'
|
|
124
|
+
| 'challenge_ongoing'
|
|
125
|
+
| 'authenticated'
|
|
126
|
+
| 'authorized'
|
|
127
|
+
| 'settled'
|
|
128
|
+
| 'canceled'
|
|
129
|
+
| 'transmitted'
|
|
130
|
+
| 'failed';
|
|
131
|
+
|
|
132
|
+
export type ResponseError = {
|
|
133
|
+
error: {
|
|
134
|
+
code:
|
|
135
|
+
| 'UNKNOWN_ERROR'
|
|
136
|
+
| 'UNAUTHORIZED'
|
|
137
|
+
| 'INVALID_JSON_PAYLOAD'
|
|
138
|
+
| 'UNRECOGNIZED_PROPERTY'
|
|
139
|
+
| 'INVALID_PROPERTY'
|
|
140
|
+
| 'CLIENT_ERROR'
|
|
141
|
+
| 'SERVER_ERROR'
|
|
142
|
+
| 'INVALID_TRANSACTION_STATUS'
|
|
143
|
+
| 'TRANSACTION_NOT_FOUND'
|
|
144
|
+
| 'EXPIRED_CARD'
|
|
145
|
+
| 'INVALID_CARD'
|
|
146
|
+
| 'BLOCKED_CARD'
|
|
147
|
+
| 'UNSUPPORTED_CARD'
|
|
148
|
+
| 'INVALID_ALIAS'
|
|
149
|
+
| 'INVALID_CVV'
|
|
150
|
+
| 'DUPLICATE_REFNO'
|
|
151
|
+
| 'DECLINED'
|
|
152
|
+
| 'SOFT_DECLINED'
|
|
153
|
+
| 'INVALID_SIGN'
|
|
154
|
+
| 'BLOCKED_BY_VELOCITY_CHECKER'
|
|
155
|
+
| 'THIRD_PARTY_ERROR'
|
|
156
|
+
| 'REFERRAL'
|
|
157
|
+
| 'INVALID_SETUP';
|
|
158
|
+
message: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type Split = {
|
|
163
|
+
subMerchantId: string;
|
|
164
|
+
amount: number;
|
|
165
|
+
commission: number;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type Marketplace = {
|
|
169
|
+
splits: Split[];
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type InitRequestPayload = {
|
|
173
|
+
endpoint: string;
|
|
174
|
+
secret: string;
|
|
175
|
+
merchantId: string;
|
|
176
|
+
currency: string;
|
|
177
|
+
refno: string;
|
|
178
|
+
refno2?: string; // optional
|
|
179
|
+
amount?: number; // omit if only for registration
|
|
180
|
+
customer?: Customer;
|
|
181
|
+
billing?: BillingAddress;
|
|
182
|
+
shipping?: ShippingAddress;
|
|
183
|
+
order?: Order;
|
|
184
|
+
card?: Record<string, unknown>;
|
|
185
|
+
BON?: Record<string, unknown>;
|
|
186
|
+
PAP?: Record<string, unknown>;
|
|
187
|
+
PFC?: Record<string, unknown>;
|
|
188
|
+
REK?: Record<string, unknown>;
|
|
189
|
+
KLN?: Record<string, unknown>;
|
|
190
|
+
TWI?: Record<string, unknown>;
|
|
191
|
+
INT?: Record<string, unknown>;
|
|
192
|
+
ESY?: Record<string, unknown>;
|
|
193
|
+
SWP?: Record<string, unknown>;
|
|
194
|
+
MFX?: Record<string, unknown>;
|
|
195
|
+
MPX?: Record<string, unknown>;
|
|
196
|
+
AZP?: Record<string, unknown>;
|
|
197
|
+
EPS?: Record<string, unknown>;
|
|
198
|
+
ALP?: Record<string, unknown>;
|
|
199
|
+
WEC?: Record<string, unknown>;
|
|
200
|
+
SWB?: Record<string, unknown>;
|
|
201
|
+
MDF?: Record<string, unknown>;
|
|
202
|
+
PSC?: Record<string, unknown>;
|
|
203
|
+
airlineData?: Record<string, unknown>;
|
|
204
|
+
language?: SupportedLanguage;
|
|
205
|
+
paymentMethods?: PaymentMethod[];
|
|
206
|
+
theme?: {
|
|
207
|
+
configuration: DT2015Configuration;
|
|
208
|
+
};
|
|
209
|
+
redirect?: {
|
|
210
|
+
successUrl?: string;
|
|
211
|
+
cancelUrl?: string;
|
|
212
|
+
errorUrl?: string;
|
|
213
|
+
startTarget?: string;
|
|
214
|
+
returnTarget?: string;
|
|
215
|
+
method?: 'GET' | 'POST';
|
|
216
|
+
};
|
|
217
|
+
option?: {
|
|
218
|
+
createAlias?: boolean;
|
|
219
|
+
returnMaskedCardNumber?: boolean;
|
|
220
|
+
returnCustomerCountry?: boolean;
|
|
221
|
+
authenticationOnly?: boolean;
|
|
222
|
+
rememberMe?: 'true' | 'checked';
|
|
223
|
+
returnMobileToken?: boolean;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
export type InitResponseSuccess = {
|
|
228
|
+
transactionId: string;
|
|
229
|
+
mobileToken?: string;
|
|
230
|
+
WEC?: Record<string, unknown>;
|
|
231
|
+
['3D']?: Record<string, unknown>;
|
|
232
|
+
location?: string;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export type StatusRequestPayload = {
|
|
236
|
+
transactionId: string;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export type StatusResponseSuccess = {
|
|
240
|
+
transactionId: string;
|
|
241
|
+
type: TransactionType;
|
|
242
|
+
status: TransactionStatusCode;
|
|
243
|
+
currency: string;
|
|
244
|
+
refno: string;
|
|
245
|
+
refno2: string;
|
|
246
|
+
paymentMethod: PaymentMethod;
|
|
247
|
+
detail: Record<string, unknown>;
|
|
248
|
+
customer?: Customer;
|
|
249
|
+
cdm?: Record<string, unknown>;
|
|
250
|
+
language: SupportedLanguage;
|
|
251
|
+
card?: Record<string, unknown>;
|
|
252
|
+
TWI?: Record<string, unknown>;
|
|
253
|
+
PAP?: Record<string, unknown>;
|
|
254
|
+
REK?: Record<string, unknown>;
|
|
255
|
+
ELV?: Record<string, unknown>;
|
|
256
|
+
KLN?: Record<string, unknown>;
|
|
257
|
+
INT?: Record<string, unknown>;
|
|
258
|
+
SWP?: Record<string, unknown>;
|
|
259
|
+
MFX?: Record<string, unknown>;
|
|
260
|
+
MPX?: Record<string, unknown>;
|
|
261
|
+
MDP?: Record<string, unknown>;
|
|
262
|
+
ESY?: Record<string, unknown>;
|
|
263
|
+
PFC?: Record<string, unknown>;
|
|
264
|
+
WEC?: Record<string, unknown>;
|
|
265
|
+
SCX?: Record<string, unknown>;
|
|
266
|
+
history: Record<string, unknown>[];
|
|
267
|
+
ep2?: Record<string, unknown>;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export type SecureFieldsRequestPayload = {
|
|
271
|
+
currency: string;
|
|
272
|
+
returnUrl?: string;
|
|
273
|
+
amount?: number;
|
|
274
|
+
['3D']?: Record<string, unknown>;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export type SecureFieldsResponseSuccess = {
|
|
278
|
+
transactionId: string;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export type AuthorizeRequestPayload = {
|
|
282
|
+
amount: number;
|
|
283
|
+
currency: string;
|
|
284
|
+
refno: string;
|
|
285
|
+
refno2?: string;
|
|
286
|
+
autoSettle?: boolean;
|
|
287
|
+
customer?: Customer;
|
|
288
|
+
billing?: BillingAddress;
|
|
289
|
+
shipping?: ShippingAddress;
|
|
290
|
+
order?: Order;
|
|
291
|
+
card?: Record<string, unknown>;
|
|
292
|
+
BON?: Record<string, unknown>;
|
|
293
|
+
PAP?: Record<string, unknown>;
|
|
294
|
+
PFC?: Record<string, unknown>;
|
|
295
|
+
REK?: Record<string, unknown>;
|
|
296
|
+
KLN?: Record<string, unknown>;
|
|
297
|
+
TWI?: Record<string, unknown>;
|
|
298
|
+
INT?: Record<string, unknown>;
|
|
299
|
+
ESY?: Record<string, unknown>;
|
|
300
|
+
ACC?: Record<string, unknown>;
|
|
301
|
+
PAY?: Record<string, unknown>;
|
|
302
|
+
APL?: Record<string, unknown>;
|
|
303
|
+
SWB?: Record<string, unknown>;
|
|
304
|
+
airlineData?: Record<string, unknown>;
|
|
305
|
+
marketplace?: Marketplace;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export type AuthorizeResponseSuccess = {
|
|
309
|
+
transactionId: string;
|
|
310
|
+
acquirerAuthorizationCode?: string;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
export type AuthorizeAuthenticatedRequestPayload = {
|
|
314
|
+
transactionId: string;
|
|
315
|
+
refno: string;
|
|
316
|
+
amount?: number;
|
|
317
|
+
currency?: string;
|
|
318
|
+
refno2?: string;
|
|
319
|
+
autoSettle?: boolean;
|
|
320
|
+
CDM?: Record<string, unknown>;
|
|
321
|
+
['3D']?: Record<string, unknown>;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export type AuthorizeAuthenticatedResponseSuccess = {
|
|
325
|
+
acquirerAuthorizationCode: string;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export type ValidateRequestPayload = {
|
|
329
|
+
currency: string;
|
|
330
|
+
refno: string;
|
|
331
|
+
refno2?: string;
|
|
332
|
+
card?: Record<string, unknown>;
|
|
333
|
+
PFC?: Record<string, unknown>;
|
|
334
|
+
KLN?: Record<string, unknown>;
|
|
335
|
+
PAP?: Record<string, unknown>;
|
|
336
|
+
PAY?: Record<string, unknown>;
|
|
337
|
+
APL?: Record<string, unknown>;
|
|
338
|
+
ESY?: Record<string, unknown>;
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export type ValidateResponseSuccess = {
|
|
342
|
+
transactionId: string;
|
|
343
|
+
acquirerAuthorizationCode?: string;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export type SettleRequestPayload = {
|
|
347
|
+
transactionId: string;
|
|
348
|
+
amount: number;
|
|
349
|
+
currency: string;
|
|
350
|
+
refno: string;
|
|
351
|
+
refno2?: string;
|
|
352
|
+
airlineData?: Record<string, unknown>;
|
|
353
|
+
marketplace?: Marketplace;
|
|
354
|
+
extensions?: Record<string, string>;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export type CancelRequestPayload = {
|
|
358
|
+
transactionId: string;
|
|
359
|
+
refno: string;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
export type InitResponse = InitResponseSuccess | ResponseError;
|
|
363
|
+
|
|
364
|
+
export type SecureFieldsResponse = SecureFieldsResponseSuccess | ResponseError;
|
|
365
|
+
|
|
366
|
+
export type StatusResponse = StatusResponseSuccess | ResponseError;
|
|
367
|
+
|
|
368
|
+
export type AuthorizeResponse = AuthorizeResponseSuccess | ResponseError;
|
|
369
|
+
|
|
370
|
+
export type AuthorizeAuthenticatedResponse = AuthorizeAuthenticatedResponseSuccess | ResponseError;
|
|
371
|
+
|
|
372
|
+
export type ValidateResponse = ValidateResponseSuccess | ResponseError;
|
|
373
|
+
|
|
374
|
+
export type SettleResponse = true | ResponseError;
|
|
375
|
+
|
|
376
|
+
export type CancelResponse = true | ResponseError;
|
|
377
|
+
|
|
378
|
+
export type FetchDatatransFn = (path: string, body?: unknown) => Promise<Response>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FetchDatatransFn, ValidateRequestPayload, ValidateResponse } from './types';
|
|
2
|
+
|
|
3
|
+
export default async function validate(payload: ValidateRequestPayload): Promise<ValidateResponse> {
|
|
4
|
+
const { fetchDatatrans }: { fetchDatatrans: FetchDatatransFn } = this;
|
|
5
|
+
|
|
6
|
+
const reqBody = {
|
|
7
|
+
...payload,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const result = await fetchDatatrans(`/v1/transactions/validate`, reqBody);
|
|
11
|
+
const json = await result.json();
|
|
12
|
+
return json;
|
|
13
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
|
|
3
|
+
export const Security = {
|
|
4
|
+
NONE: '',
|
|
5
|
+
STATIC_SIGN: 'static-sign',
|
|
6
|
+
DYNAMIC_SIGN: 'dynamic-sign',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const generateSignature =
|
|
10
|
+
({ security, signKey }: { security: '' | 'static-sign' | 'dynamic-sign'; signKey: string }) =>
|
|
11
|
+
(...parts) => {
|
|
12
|
+
// https://docs.datatrans.ch/docs/security-sign
|
|
13
|
+
if (security.toLowerCase() === Security.STATIC_SIGN) return signKey;
|
|
14
|
+
if (security.toLowerCase() === Security.NONE) return '';
|
|
15
|
+
|
|
16
|
+
const resultString = parts.filter(Boolean).join('');
|
|
17
|
+
const signKeyInBytes = Buffer.from(signKey, 'hex');
|
|
18
|
+
|
|
19
|
+
const signedString = crypto.createHmac('sha256', signKeyInBytes).update(resultString).digest('hex');
|
|
20
|
+
|
|
21
|
+
return signedString;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default generateSignature;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const {
|
|
2
|
+
ROOT_URL,
|
|
3
|
+
DATATRANS_WEBHOOK_PATH,
|
|
4
|
+
DATATRANS_SUCCESS_PATH,
|
|
5
|
+
DATATRANS_ERROR_PATH,
|
|
6
|
+
DATATRANS_CANCEL_PATH,
|
|
7
|
+
DATATRANS_RETURN_PATH,
|
|
8
|
+
} = process.env;
|
|
9
|
+
|
|
10
|
+
type Paths = {
|
|
11
|
+
postUrl: string;
|
|
12
|
+
cancelUrl: string;
|
|
13
|
+
successUrl: string;
|
|
14
|
+
errorUrl: string;
|
|
15
|
+
returnUrl: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default (relative = false): Paths => ({
|
|
19
|
+
postUrl: `${relative ? '' : ROOT_URL}${DATATRANS_WEBHOOK_PATH || '/payment/datatrans/webhook'}`,
|
|
20
|
+
successUrl: `${relative ? '' : ROOT_URL}${DATATRANS_SUCCESS_PATH || '/payment/datatrans/success'}`,
|
|
21
|
+
cancelUrl: `${relative ? '' : ROOT_URL}${DATATRANS_CANCEL_PATH || '/payment/datatrans/cancel'}`,
|
|
22
|
+
errorUrl: `${relative ? '' : ROOT_URL}${DATATRANS_ERROR_PATH || '/payment/datatrans/error'}`,
|
|
23
|
+
returnUrl: `${relative ? '' : ROOT_URL}${DATATRANS_RETURN_PATH || '/payment/datatrans/return'}`,
|
|
24
|
+
});
|