@bigbinary/neeto-payments-frontend 6.1.12 → 6.1.13
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/dist/AccountsDashboard.js +308 -333
- package/dist/AccountsDashboard.js.map +1 -1
- package/dist/AdminCancelRecurringPaymentButton.js +43 -54
- package/dist/AdminCancelRecurringPaymentButton.js.map +1 -1
- package/dist/CashPaymentButton.js +32 -34
- package/dist/CashPaymentButton.js.map +1 -1
- package/dist/ConfirmCashPaymentButton.js +77 -71
- package/dist/ConfirmCashPaymentButton.js.map +1 -1
- package/dist/{CopyButtonWrapper-rv-OaINx.js → CopyButtonWrapper-Bp5IVO76.js} +16 -14
- package/dist/CopyButtonWrapper-Bp5IVO76.js.map +1 -0
- package/dist/CustomerCancelRecurringPaymentForm.js +76 -75
- package/dist/CustomerCancelRecurringPaymentForm.js.map +1 -1
- package/dist/ExportModal-DyRGg_4o.js +120 -0
- package/dist/ExportModal-DyRGg_4o.js.map +1 -0
- package/dist/ManualUpiConnect.js +159 -178
- package/dist/ManualUpiConnect.js.map +1 -1
- package/dist/ManualUpiPayment.js +85 -89
- package/dist/ManualUpiPayment.js.map +1 -1
- package/dist/ManualUpiPaymentConfirmButton.js +119 -115
- package/dist/ManualUpiPaymentConfirmButton.js.map +1 -1
- package/dist/ManualUpiPaymentRejectButton.js +98 -92
- package/dist/ManualUpiPaymentRejectButton.js.map +1 -1
- package/dist/PaymentKindRestrictionAlert.js +14 -19
- package/dist/PaymentKindRestrictionAlert.js.map +1 -1
- package/dist/PaymentsDashboard.js +318 -349
- package/dist/PaymentsDashboard.js.map +1 -1
- package/dist/PayoutsDashboard.js +327 -350
- package/dist/PayoutsDashboard.js.map +1 -1
- package/dist/PayoutsPage.js +114 -92
- package/dist/PayoutsPage.js.map +1 -1
- package/dist/RazorpayConnect.js +71 -62
- package/dist/RazorpayConnect.js.map +1 -1
- package/dist/RazorpayLinkedAccountForm.js +145 -156
- package/dist/RazorpayLinkedAccountForm.js.map +1 -1
- package/dist/RazorpayPaymentButton.js +72 -100
- package/dist/RazorpayPaymentButton.js.map +1 -1
- package/dist/RecurringPaymentSettings.js +85 -85
- package/dist/RecurringPaymentSettings.js.map +1 -1
- package/dist/RefundsDashboard.js +363 -386
- package/dist/RefundsDashboard.js.map +1 -1
- package/dist/SplitTransfersDashboard.js +868 -829
- package/dist/SplitTransfersDashboard.js.map +1 -1
- package/dist/StripeCheckoutSetting.js +63 -75
- package/dist/StripeCheckoutSetting.js.map +1 -1
- package/dist/StripeConnect.js +257 -259
- package/dist/StripeConnect.js.map +1 -1
- package/dist/StripeManage.js +28 -25
- package/dist/StripeManage.js.map +1 -1
- package/dist/TaxesDashboard.js +284 -292
- package/dist/TaxesDashboard.js.map +1 -1
- package/dist/buildStripeTransactionLink.js +1 -1
- package/dist/cjs/AccountsDashboard.js +308 -333
- package/dist/cjs/AccountsDashboard.js.map +1 -1
- package/dist/cjs/AdminCancelRecurringPaymentButton.js +43 -54
- package/dist/cjs/AdminCancelRecurringPaymentButton.js.map +1 -1
- package/dist/cjs/CashPaymentButton.js +32 -34
- package/dist/cjs/CashPaymentButton.js.map +1 -1
- package/dist/cjs/ConfirmCashPaymentButton.js +77 -71
- package/dist/cjs/ConfirmCashPaymentButton.js.map +1 -1
- package/dist/cjs/{CopyButtonWrapper-BkpN0Wmd.js → CopyButtonWrapper-I-kdKiiB.js} +16 -14
- package/dist/cjs/CopyButtonWrapper-I-kdKiiB.js.map +1 -0
- package/dist/cjs/CustomerCancelRecurringPaymentForm.js +76 -75
- package/dist/cjs/CustomerCancelRecurringPaymentForm.js.map +1 -1
- package/dist/cjs/ExportModal-DE-VcN1X.js +122 -0
- package/dist/cjs/ExportModal-DE-VcN1X.js.map +1 -0
- package/dist/cjs/ManualUpiConnect.js +159 -178
- package/dist/cjs/ManualUpiConnect.js.map +1 -1
- package/dist/cjs/ManualUpiPayment.js +85 -89
- package/dist/cjs/ManualUpiPayment.js.map +1 -1
- package/dist/cjs/ManualUpiPaymentConfirmButton.js +118 -114
- package/dist/cjs/ManualUpiPaymentConfirmButton.js.map +1 -1
- package/dist/cjs/ManualUpiPaymentRejectButton.js +98 -92
- package/dist/cjs/ManualUpiPaymentRejectButton.js.map +1 -1
- package/dist/cjs/PaymentKindRestrictionAlert.js +14 -19
- package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -1
- package/dist/cjs/PaymentsDashboard.js +318 -349
- package/dist/cjs/PaymentsDashboard.js.map +1 -1
- package/dist/cjs/PayoutsDashboard.js +327 -350
- package/dist/cjs/PayoutsDashboard.js.map +1 -1
- package/dist/cjs/PayoutsPage.js +114 -92
- package/dist/cjs/PayoutsPage.js.map +1 -1
- package/dist/cjs/RazorpayConnect.js +71 -62
- package/dist/cjs/RazorpayConnect.js.map +1 -1
- package/dist/cjs/RazorpayLinkedAccountForm.js +145 -156
- package/dist/cjs/RazorpayLinkedAccountForm.js.map +1 -1
- package/dist/cjs/RazorpayPaymentButton.js +72 -100
- package/dist/cjs/RazorpayPaymentButton.js.map +1 -1
- package/dist/cjs/RecurringPaymentSettings.js +85 -85
- package/dist/cjs/RecurringPaymentSettings.js.map +1 -1
- package/dist/cjs/RefundsDashboard.js +363 -386
- package/dist/cjs/RefundsDashboard.js.map +1 -1
- package/dist/cjs/SplitTransfersDashboard.js +867 -828
- package/dist/cjs/SplitTransfersDashboard.js.map +1 -1
- package/dist/cjs/StripeCheckoutSetting.js +63 -75
- package/dist/cjs/StripeCheckoutSetting.js.map +1 -1
- package/dist/cjs/StripeConnect.js +257 -259
- package/dist/cjs/StripeConnect.js.map +1 -1
- package/dist/cjs/StripeManage.js +28 -25
- package/dist/cjs/StripeManage.js.map +1 -1
- package/dist/cjs/TaxesDashboard.js +284 -292
- package/dist/cjs/TaxesDashboard.js.map +1 -1
- package/dist/cjs/buildStripeTransactionLink.js +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/dashboard-BiCB2A6S.js +96 -0
- package/dist/cjs/dashboard-BiCB2A6S.js.map +1 -0
- package/dist/cjs/{exportChannel-D1Wls92m.js → exportChannel-BL2RGGhP.js} +16 -18
- package/dist/cjs/{exportChannel-D1Wls92m.js.map → exportChannel-BL2RGGhP.js.map} +1 -1
- package/dist/cjs/getAddressElementOptions.js +1 -1
- package/dist/cjs/getAmountInLargestCurrencyUnit.js +1 -1
- package/dist/cjs/getAmountInSmallestCurrencyUnit.js +1 -1
- package/dist/cjs/getAmountWithAppliedTax.js +1 -1
- package/dist/cjs/getFormattedAmount.js +1 -1
- package/dist/cjs/getFormattedDiscountedAmount.js +1 -1
- package/dist/cjs/getFormattedDiscountedPercentage.js +1 -1
- package/dist/cjs/getFormattedTaxAmount.js +1 -1
- package/dist/cjs/getFormattedTipAmount.js +1 -1
- package/dist/cjs/getQrCodeValue.js +1 -1
- package/dist/cjs/getTaxAmount.js +1 -1
- package/dist/cjs/getTipAmount.js +1 -1
- package/dist/cjs/hasAmountToPay.js +1 -1
- package/dist/cjs/index-D6V3Vofs.js +855 -0
- package/dist/cjs/{index-CZ_VFGNj.js.map → index-D6V3Vofs.js.map} +1 -1
- package/dist/cjs/index.js +14 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{queryConstants-Cka1X6GX.js → queryConstants-Dc6wh21D.js} +2 -2
- package/dist/cjs/{queryConstants-Cka1X6GX.js.map → queryConstants-Dc6wh21D.js.map} +1 -1
- package/dist/cjs/renderFunctions-DhCwlBWw.js +48 -0
- package/dist/cjs/renderFunctions-DhCwlBWw.js.map +1 -0
- package/dist/cjs/useAccountsApi-B2MZWHMY.js +42 -0
- package/dist/cjs/useAccountsApi-B2MZWHMY.js.map +1 -0
- package/dist/cjs/useIntegrationsApi-CVlTmLKc.js +20 -0
- package/dist/cjs/{useIntegrationsApi-BO9PhVVO.js.map → useIntegrationsApi-CVlTmLKc.js.map} +1 -1
- package/dist/cjs/usePaymentApi-BCE_Ql18.js +29 -0
- package/dist/cjs/usePaymentApi-BCE_Ql18.js.map +1 -0
- package/dist/cjs/usePaymentApi-Bl8jWvnG.js +44 -0
- package/dist/cjs/usePaymentApi-Bl8jWvnG.js.map +1 -0
- package/dist/cjs/usePaymentApi-CiwXBe90.js +29 -0
- package/dist/cjs/{usePaymentApi-BE8xfY-U.js.map → usePaymentApi-CiwXBe90.js.map} +1 -1
- package/dist/cjs/usePlatformApi-CcGVG4Qi.js +55 -0
- package/dist/cjs/{usePlatformApi-C7lXP6ev.js.map → usePlatformApi-CcGVG4Qi.js.map} +1 -1
- package/dist/cjs/useRazorpayPayment.js +48 -73
- package/dist/cjs/useRazorpayPayment.js.map +1 -1
- package/dist/cjs/useStripePromise.js +22 -48
- package/dist/cjs/useStripePromise.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/dashboard-CwvqEeOl.js +90 -0
- package/dist/dashboard-CwvqEeOl.js.map +1 -0
- package/dist/{exportChannel-DAxJ44QB.js → exportChannel-Db0U5gc1.js} +16 -18
- package/dist/{exportChannel-DAxJ44QB.js.map → exportChannel-Db0U5gc1.js.map} +1 -1
- package/dist/getAddressElementOptions.js +1 -1
- package/dist/getAmountInLargestCurrencyUnit.js +1 -1
- package/dist/getAmountInSmallestCurrencyUnit.js +1 -1
- package/dist/getAmountWithAppliedTax.js +1 -1
- package/dist/getFormattedAmount.js +1 -1
- package/dist/getFormattedDiscountedAmount.js +1 -1
- package/dist/getFormattedDiscountedPercentage.js +1 -1
- package/dist/getFormattedTaxAmount.js +1 -1
- package/dist/getFormattedTipAmount.js +1 -1
- package/dist/getQrCodeValue.js +1 -1
- package/dist/getTaxAmount.js +1 -1
- package/dist/getTipAmount.js +1 -1
- package/dist/hasAmountToPay.js +1 -1
- package/dist/index-CNouM9_z.js +804 -0
- package/dist/{index-C7irWceQ.js.map → index-CNouM9_z.js.map} +1 -1
- package/dist/index.js +14 -20
- package/dist/index.js.map +1 -1
- package/dist/{queryConstants-DFKKEEo0.js → queryConstants-C7AqdemO.js} +2 -2
- package/dist/{queryConstants-DFKKEEo0.js.map → queryConstants-C7AqdemO.js.map} +1 -1
- package/dist/renderFunctions-Bx5nzyE_.js +44 -0
- package/dist/renderFunctions-Bx5nzyE_.js.map +1 -0
- package/dist/useAccountsApi-C9_eNmEZ.js +38 -0
- package/dist/useAccountsApi-C9_eNmEZ.js.map +1 -0
- package/dist/useIntegrationsApi-D9eA_FrB.js +18 -0
- package/dist/{useIntegrationsApi-D1bkKtoy.js.map → useIntegrationsApi-D9eA_FrB.js.map} +1 -1
- package/dist/usePaymentApi-B98qoM7U.js +26 -0
- package/dist/usePaymentApi-B98qoM7U.js.map +1 -0
- package/dist/usePaymentApi-DMHHdCK1.js +41 -0
- package/dist/usePaymentApi-DMHHdCK1.js.map +1 -0
- package/dist/usePaymentApi-DSlW_EBq.js +27 -0
- package/dist/{usePaymentApi-DcMNbOMk.js.map → usePaymentApi-DSlW_EBq.js.map} +1 -1
- package/dist/usePlatformApi-sJUY6wju.js +50 -0
- package/dist/{usePlatformApi-Di7Dg-Gn.js.map → usePlatformApi-sJUY6wju.js.map} +1 -1
- package/dist/useRazorpayPayment.js +48 -73
- package/dist/useRazorpayPayment.js.map +1 -1
- package/dist/useStripePromise.js +22 -48
- package/dist/useStripePromise.js.map +1 -1
- package/package.json +1 -1
- package/dist/CopyButtonWrapper-rv-OaINx.js.map +0 -1
- package/dist/ExportModal-CxKyrlwf.js +0 -120
- package/dist/ExportModal-CxKyrlwf.js.map +0 -1
- package/dist/cjs/CopyButtonWrapper-BkpN0Wmd.js.map +0 -1
- package/dist/cjs/ExportModal-DxCzPCh0.js +0 -122
- package/dist/cjs/ExportModal-DxCzPCh0.js.map +0 -1
- package/dist/cjs/dashboard-DKHencVn.js +0 -110
- package/dist/cjs/dashboard-DKHencVn.js.map +0 -1
- package/dist/cjs/index-CZ_VFGNj.js +0 -899
- package/dist/cjs/renderFunctions-CX_K4qf8.js +0 -51
- package/dist/cjs/renderFunctions-CX_K4qf8.js.map +0 -1
- package/dist/cjs/useAccountsApi-DC617yB4.js +0 -62
- package/dist/cjs/useAccountsApi-DC617yB4.js.map +0 -1
- package/dist/cjs/useIntegrationsApi-BO9PhVVO.js +0 -26
- package/dist/cjs/usePaymentApi-BE8xfY-U.js +0 -39
- package/dist/cjs/usePaymentApi-C9aQhuda.js +0 -56
- package/dist/cjs/usePaymentApi-C9aQhuda.js.map +0 -1
- package/dist/cjs/usePaymentApi-CrKom4eT.js +0 -41
- package/dist/cjs/usePaymentApi-CrKom4eT.js.map +0 -1
- package/dist/cjs/usePlatformApi-C7lXP6ev.js +0 -84
- package/dist/dashboard-ClEN2ygs.js +0 -104
- package/dist/dashboard-ClEN2ygs.js.map +0 -1
- package/dist/index-C7irWceQ.js +0 -848
- package/dist/renderFunctions-D9sAy3V_.js +0 -47
- package/dist/renderFunctions-D9sAy3V_.js.map +0 -1
- package/dist/useAccountsApi-DPem_UA-.js +0 -58
- package/dist/useAccountsApi-DPem_UA-.js.map +0 -1
- package/dist/useIntegrationsApi-D1bkKtoy.js +0 -24
- package/dist/usePaymentApi-BV0jXF-6.js +0 -38
- package/dist/usePaymentApi-BV0jXF-6.js.map +0 -1
- package/dist/usePaymentApi-DHARy-kC.js +0 -53
- package/dist/usePaymentApi-DHARy-kC.js.map +0 -1
- package/dist/usePaymentApi-DcMNbOMk.js +0 -37
- package/dist/usePlatformApi-Di7Dg-Gn.js +0 -79
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
import { t } from 'i18next';
|
|
2
|
+
import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE } from 'neetocommons/constants';
|
|
3
|
+
import Decimal from 'decimal.js';
|
|
4
|
+
import { isNotPresent, isPresent, snakeToCamelCase, removeBy } from 'neetocist';
|
|
5
|
+
import { currencyFormat } from 'neetocommons/utils';
|
|
6
|
+
import { pipe, pluck, uniq, map, sortBy, prop, concat } from 'ramda';
|
|
7
|
+
|
|
8
|
+
const RAZORPAY_CURRENCIES = ["AED", "ALL", "AMD", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BZD", "CAD", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ETB", "EUR", "FJD", "GBP", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KRW", "KWD", "KYD", "KZT", "LAK", "LKR", "LRD", "LSL", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SCR", "SEK", "SGD", "SLL", "SOS", "SSP", "SVC", "SZL", "THB", "TND", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VND", "VUV", "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMW"];
|
|
9
|
+
const STRIPE_CURRENCIES = ["USD", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BWP", "BYN", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HTG", "HUF", "IDR", "ILS", "INR", "ISK", "JMD", "JPY", "KES", "KGS", "KHR", "KMF", "KRW", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SEK", "SGD", "SHP", "SLE", "SOS", "SRD", "STD", "SZL", "THB", "TJS", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "UYU", "UZS", "VND", "VUV", "WST", "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMW"];
|
|
10
|
+
|
|
11
|
+
Decimal.set({
|
|
12
|
+
rounding: Decimal.ROUND_HALF_UP
|
|
13
|
+
});
|
|
14
|
+
const roundAmount = amount => {
|
|
15
|
+
const factor = new Decimal(100); // 10^2 → for 2 decimal places
|
|
16
|
+
|
|
17
|
+
return new Decimal(amount).mul(factor).floor().div(factor);
|
|
18
|
+
};
|
|
19
|
+
const buildStripeTransactionLink = (identifier, isLive = true) => `${STRIPE_DASHBOARD_LINK}${isLive ? "" : "test/"}payments/${identifier}`;
|
|
20
|
+
const buildStripeAccountLink = (identifier, isLive = true) => `${STRIPE_DASHBOARD_LINK}${isLive ? "" : "test/"}connect/accounts/${identifier}`;
|
|
21
|
+
const uuidV4 = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
|
|
22
|
+
const processDataIndex = dataIndex => typeof dataIndex === "string" ? dataIndex : dataIndex.join(",");
|
|
23
|
+
const buildStripePayoutLink = (identifier, isLive = true) => `${STRIPE_DASHBOARD_LINK}${isLive ? "" : "test/"}payouts/${identifier}`;
|
|
24
|
+
const formatCurrency = currency => currency?.toUpperCase();
|
|
25
|
+
const formatAmount = amount => currencyFormat.withAmount(amount, {
|
|
26
|
+
minimumFractionDigits: 2,
|
|
27
|
+
maximumFractionDigits: 2
|
|
28
|
+
});
|
|
29
|
+
const shouldTabsVisible = views => views["total"] > 0;
|
|
30
|
+
const getUniquePaymentProviders = pipe(pluck("paymentProvider"), uniq);
|
|
31
|
+
const getQrCodeValue = (vpaId, amount) => {
|
|
32
|
+
let qr = `upi://pay?pa=${vpaId}`;
|
|
33
|
+
if (amount) {
|
|
34
|
+
qr += `&am=${amount}`;
|
|
35
|
+
}
|
|
36
|
+
return qr;
|
|
37
|
+
};
|
|
38
|
+
const buildDefaultTableColumns = ({
|
|
39
|
+
isAllTab = false,
|
|
40
|
+
defaultColumns = [],
|
|
41
|
+
payableEntityColumns = []
|
|
42
|
+
}) => {
|
|
43
|
+
let filteredColumns;
|
|
44
|
+
filteredColumns = sortBy(prop("position"), concat(defaultColumns, payableEntityColumns));
|
|
45
|
+
if (!isAllTab) {
|
|
46
|
+
filteredColumns = removeBy({
|
|
47
|
+
key: "status"
|
|
48
|
+
}, filteredColumns);
|
|
49
|
+
}
|
|
50
|
+
return filteredColumns;
|
|
51
|
+
};
|
|
52
|
+
const getCurrencyOptions = map(currency => ({
|
|
53
|
+
label: currency,
|
|
54
|
+
value: currency.toLowerCase()
|
|
55
|
+
}));
|
|
56
|
+
const getTagStyle = status => TAG_STYLE[status] || DEFAULT_TAG_STYLE;
|
|
57
|
+
const preProcessStatus = (type, status, record = {}) => {
|
|
58
|
+
if (type === "payment") {
|
|
59
|
+
return record.isRefunded ? "refunded" : status;
|
|
60
|
+
}
|
|
61
|
+
return snakeToCamelCase(status);
|
|
62
|
+
};
|
|
63
|
+
const getAmountInSmallestCurrencyUnit = (amount = 0.0, currency = "usd") => {
|
|
64
|
+
if (ZERO_DECIMAL_CURRENCIES.includes(currency)) return parseInt(amount);
|
|
65
|
+
return parseInt(amount * 100);
|
|
66
|
+
};
|
|
67
|
+
const getAmountInLargestCurrencyUnit = (amount = 0.0, currency = "usd") => {
|
|
68
|
+
if (ZERO_DECIMAL_CURRENCIES.includes(currency)) return parseFloat(amount);
|
|
69
|
+
return parseFloat(amount / 100);
|
|
70
|
+
};
|
|
71
|
+
const hasAmountToPay = ({
|
|
72
|
+
amount,
|
|
73
|
+
discountCode
|
|
74
|
+
}) => {
|
|
75
|
+
const amountAfterDiscount = getAmountAfterDiscount({
|
|
76
|
+
amount,
|
|
77
|
+
discountCode
|
|
78
|
+
});
|
|
79
|
+
return amountAfterDiscount.gt(0);
|
|
80
|
+
};
|
|
81
|
+
const getDiscountedAmount = ({
|
|
82
|
+
amount,
|
|
83
|
+
discountCode
|
|
84
|
+
}) => {
|
|
85
|
+
const decimalAmount = new Decimal(amount);
|
|
86
|
+
const amountAfterDiscount = getAmountAfterDiscount({
|
|
87
|
+
amount,
|
|
88
|
+
discountCode
|
|
89
|
+
});
|
|
90
|
+
return decimalAmount.minus(amountAfterDiscount);
|
|
91
|
+
};
|
|
92
|
+
const getDiscountedPercentage = ({
|
|
93
|
+
amount,
|
|
94
|
+
discountCode
|
|
95
|
+
}) => {
|
|
96
|
+
const decimalAmount = new Decimal(amount);
|
|
97
|
+
if (decimalAmount.equals(0)) return new Decimal(0);
|
|
98
|
+
const discountedAmount = getDiscountedAmount({
|
|
99
|
+
amount,
|
|
100
|
+
discountCode
|
|
101
|
+
});
|
|
102
|
+
return discountedAmount.div(decimalAmount).mul(100);
|
|
103
|
+
};
|
|
104
|
+
const getAmountAfterDiscount = ({
|
|
105
|
+
amount,
|
|
106
|
+
discountCode = {}
|
|
107
|
+
}) => {
|
|
108
|
+
const {
|
|
109
|
+
kind,
|
|
110
|
+
value
|
|
111
|
+
} = discountCode || {};
|
|
112
|
+
if (isNotPresent(kind) || isNotPresent(value)) return new Decimal(amount);
|
|
113
|
+
const decimalAmount = new Decimal(amount);
|
|
114
|
+
if (kind === "fixed") {
|
|
115
|
+
const discountedAmount = decimalAmount.minus(value);
|
|
116
|
+
return discountedAmount.gte(0) ? discountedAmount : new Decimal(0);
|
|
117
|
+
}
|
|
118
|
+
if (kind === "percentage" && value === 100) return new Decimal(0);
|
|
119
|
+
return decimalAmount.minus(decimalAmount.mul(value).div(100));
|
|
120
|
+
};
|
|
121
|
+
const getTaxAmount = (taxes, amount) => {
|
|
122
|
+
const decimalAmount = new Decimal(amount);
|
|
123
|
+
if (decimalAmount.lte(0)) return "0.00";
|
|
124
|
+
return taxes.reduce((acc, tax) => {
|
|
125
|
+
const taxValue = new Decimal(tax.value);
|
|
126
|
+
if (tax.kind === "percentage") {
|
|
127
|
+
return acc.plus(decimalAmount.mul(taxValue).div(100));
|
|
128
|
+
}
|
|
129
|
+
return acc.plus(taxValue);
|
|
130
|
+
}, new Decimal(0));
|
|
131
|
+
};
|
|
132
|
+
const getTipAmount = ({
|
|
133
|
+
amount,
|
|
134
|
+
tip = {},
|
|
135
|
+
discountCode = {}
|
|
136
|
+
}) => {
|
|
137
|
+
const amountAfterDiscount = getAmountAfterDiscount({
|
|
138
|
+
amount,
|
|
139
|
+
discountCode
|
|
140
|
+
});
|
|
141
|
+
if (isNotPresent(tip.value) || tip.value === 0) {
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
if (tip.kind === TIP_KIND.percentage) {
|
|
145
|
+
return amountAfterDiscount.mul(tip.value).div(100);
|
|
146
|
+
}
|
|
147
|
+
return tip.value;
|
|
148
|
+
};
|
|
149
|
+
const getAmountWithAppliedTax = ({
|
|
150
|
+
taxes,
|
|
151
|
+
amount,
|
|
152
|
+
isTaxEnabled = false
|
|
153
|
+
}) => {
|
|
154
|
+
const originalAmount = new Decimal(amount);
|
|
155
|
+
if (!isTaxEnabled || isNotPresent(taxes)) {
|
|
156
|
+
return originalAmount;
|
|
157
|
+
}
|
|
158
|
+
const taxAmount = getTaxAmount(taxes, amount);
|
|
159
|
+
return originalAmount.plus(taxAmount);
|
|
160
|
+
};
|
|
161
|
+
const getAmountToApplyTax = ({
|
|
162
|
+
amount,
|
|
163
|
+
discountCode = {},
|
|
164
|
+
tip = {},
|
|
165
|
+
isTaxApplicableOnTip = false
|
|
166
|
+
}) => {
|
|
167
|
+
const amountAfterDiscount = getAmountAfterDiscount({
|
|
168
|
+
amount,
|
|
169
|
+
discountCode
|
|
170
|
+
});
|
|
171
|
+
const tipAmount = getTipAmount({
|
|
172
|
+
amount,
|
|
173
|
+
tip,
|
|
174
|
+
discountCode
|
|
175
|
+
});
|
|
176
|
+
return isPresent(tip?.value) && isTaxApplicableOnTip ? amountAfterDiscount.plus(tipAmount) : amountAfterDiscount;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
Formats a monetary amount by applying tax (if enabled) and truncating to 2 decimal places to avoid rounding errors in Intl.NumberFormat.
|
|
181
|
+
|
|
182
|
+
Why truncate? Rounding can introduce discrepancies between frontend and backend in billing, tax, or total calculations.
|
|
183
|
+
Truncation ensures predictable, consistent results.
|
|
184
|
+
*/
|
|
185
|
+
const getFormattedAmount = ({
|
|
186
|
+
amount,
|
|
187
|
+
discountCode = {},
|
|
188
|
+
taxes = [],
|
|
189
|
+
tip = {},
|
|
190
|
+
isTaxEnabled = false,
|
|
191
|
+
isTaxApplicableOnTip = false
|
|
192
|
+
}) => {
|
|
193
|
+
if (isNotPresent(amount)) return "";
|
|
194
|
+
const tipAmount = getTipAmount({
|
|
195
|
+
amount,
|
|
196
|
+
tip,
|
|
197
|
+
discountCode
|
|
198
|
+
});
|
|
199
|
+
const amountToApplyTax = getAmountToApplyTax({
|
|
200
|
+
amount,
|
|
201
|
+
discountCode,
|
|
202
|
+
tip,
|
|
203
|
+
isTaxApplicableOnTip
|
|
204
|
+
});
|
|
205
|
+
const taxedAmount = getAmountWithAppliedTax({
|
|
206
|
+
taxes,
|
|
207
|
+
amount: amountToApplyTax,
|
|
208
|
+
isTaxEnabled
|
|
209
|
+
});
|
|
210
|
+
const finalAmount = isPresent(tip?.value) && !isTaxApplicableOnTip ? taxedAmount.plus(tipAmount) : taxedAmount;
|
|
211
|
+
return roundAmount(finalAmount).toString();
|
|
212
|
+
};
|
|
213
|
+
const getFormattedTaxAmount = ({
|
|
214
|
+
amount,
|
|
215
|
+
discountCode = {},
|
|
216
|
+
taxes = [],
|
|
217
|
+
tip = {},
|
|
218
|
+
isTaxApplicableOnTip = false
|
|
219
|
+
}) => {
|
|
220
|
+
const amountToApplyTax = getAmountToApplyTax({
|
|
221
|
+
amount,
|
|
222
|
+
discountCode,
|
|
223
|
+
tip,
|
|
224
|
+
isTaxApplicableOnTip
|
|
225
|
+
});
|
|
226
|
+
return roundAmount(getTaxAmount(taxes, amountToApplyTax)).toString();
|
|
227
|
+
};
|
|
228
|
+
const getFormattedTipAmount = ({
|
|
229
|
+
amount,
|
|
230
|
+
tip = {},
|
|
231
|
+
discountCode = {}
|
|
232
|
+
}) => roundAmount(getTipAmount({
|
|
233
|
+
amount,
|
|
234
|
+
tip,
|
|
235
|
+
discountCode
|
|
236
|
+
})).toString();
|
|
237
|
+
const getFormattedDiscountedAmount = ({
|
|
238
|
+
amount,
|
|
239
|
+
discountCode = {}
|
|
240
|
+
}) => roundAmount(getDiscountedAmount({
|
|
241
|
+
amount,
|
|
242
|
+
discountCode
|
|
243
|
+
})).toString();
|
|
244
|
+
const getFormattedDiscountedPercentage = ({
|
|
245
|
+
amount,
|
|
246
|
+
discountCode = {}
|
|
247
|
+
}) => roundAmount(getDiscountedPercentage({
|
|
248
|
+
amount,
|
|
249
|
+
discountCode
|
|
250
|
+
})).toString();
|
|
251
|
+
const getAddressElementOptions = (checkoutSetting = {}) => {
|
|
252
|
+
const {
|
|
253
|
+
isPhoneNumberEnabled
|
|
254
|
+
} = checkoutSetting;
|
|
255
|
+
const fields = {
|
|
256
|
+
address: "always"
|
|
257
|
+
};
|
|
258
|
+
const validation = {
|
|
259
|
+
address: {
|
|
260
|
+
required: "always"
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
if (isPhoneNumberEnabled) {
|
|
264
|
+
fields.phone = "always";
|
|
265
|
+
validation.phone = {
|
|
266
|
+
required: "always"
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
fields,
|
|
271
|
+
validation,
|
|
272
|
+
mode: "billing"
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const BASE_URL = "payments";
|
|
277
|
+
const ZERO_DECIMAL_CURRENCIES = ["bif", "clp", "djf", "gnf", "jpy", "kmf", "krw", "mga", "pyg", "rwf", "ugx", "vnd", "vuv", "xaf", "xof", "xpf"];
|
|
278
|
+
const PAYMENT_STATUS_TYPE = {
|
|
279
|
+
successful: "successful",
|
|
280
|
+
pending: "pending",
|
|
281
|
+
declined: "declined",
|
|
282
|
+
initiated: "initiated",
|
|
283
|
+
cancelled: "cancelled"
|
|
284
|
+
};
|
|
285
|
+
const REFUND_STATUS_TYPE = {
|
|
286
|
+
pending: "pending",
|
|
287
|
+
successful: "successful",
|
|
288
|
+
failed: "failed",
|
|
289
|
+
requires_action: "requires_action",
|
|
290
|
+
canceled: "canceled",
|
|
291
|
+
initiated: "initiated"
|
|
292
|
+
};
|
|
293
|
+
const STRIPE_DASHBOARD_LINK = "https://dashboard.stripe.com/";
|
|
294
|
+
const STRIPE_CURRENCY_OPTIONS = getCurrencyOptions(STRIPE_CURRENCIES);
|
|
295
|
+
const RAZORPAY_CURRENCY_OPTIONS = getCurrencyOptions(RAZORPAY_CURRENCIES);
|
|
296
|
+
const CURRENCY_OPTIONS = [{
|
|
297
|
+
label: "USD",
|
|
298
|
+
value: "usd"
|
|
299
|
+
}, {
|
|
300
|
+
label: "AED",
|
|
301
|
+
value: "aed"
|
|
302
|
+
}, {
|
|
303
|
+
label: "AFN",
|
|
304
|
+
value: "afn"
|
|
305
|
+
}, {
|
|
306
|
+
label: "ALL",
|
|
307
|
+
value: "all"
|
|
308
|
+
}, {
|
|
309
|
+
label: "AMD",
|
|
310
|
+
value: "amd"
|
|
311
|
+
}, {
|
|
312
|
+
label: "ANG",
|
|
313
|
+
value: "ang"
|
|
314
|
+
}, {
|
|
315
|
+
label: "AOA",
|
|
316
|
+
value: "aoa"
|
|
317
|
+
}, {
|
|
318
|
+
label: "ARS",
|
|
319
|
+
value: "ars"
|
|
320
|
+
}, {
|
|
321
|
+
label: "AUD",
|
|
322
|
+
value: "aud"
|
|
323
|
+
}, {
|
|
324
|
+
label: "AWG",
|
|
325
|
+
value: "awg"
|
|
326
|
+
}, {
|
|
327
|
+
label: "AZN",
|
|
328
|
+
value: "azn"
|
|
329
|
+
}, {
|
|
330
|
+
label: "BAM",
|
|
331
|
+
value: "bam"
|
|
332
|
+
}, {
|
|
333
|
+
label: "BBD",
|
|
334
|
+
value: "bbd"
|
|
335
|
+
}, {
|
|
336
|
+
label: "BDT",
|
|
337
|
+
value: "bdt"
|
|
338
|
+
}, {
|
|
339
|
+
label: "BGN",
|
|
340
|
+
value: "bgn"
|
|
341
|
+
}, {
|
|
342
|
+
label: "BIF",
|
|
343
|
+
value: "bif"
|
|
344
|
+
}, {
|
|
345
|
+
label: "BMD",
|
|
346
|
+
value: "bmd"
|
|
347
|
+
}, {
|
|
348
|
+
label: "BND",
|
|
349
|
+
value: "bnd"
|
|
350
|
+
}, {
|
|
351
|
+
label: "BOB",
|
|
352
|
+
value: "bob"
|
|
353
|
+
}, {
|
|
354
|
+
label: "BRL",
|
|
355
|
+
value: "brl"
|
|
356
|
+
}, {
|
|
357
|
+
label: "BSD",
|
|
358
|
+
value: "bsd"
|
|
359
|
+
}, {
|
|
360
|
+
label: "BWP",
|
|
361
|
+
value: "bwp"
|
|
362
|
+
}, {
|
|
363
|
+
label: "BYN",
|
|
364
|
+
value: "byn"
|
|
365
|
+
}, {
|
|
366
|
+
label: "BZD",
|
|
367
|
+
value: "bzd"
|
|
368
|
+
}, {
|
|
369
|
+
label: "CAD",
|
|
370
|
+
value: "cad"
|
|
371
|
+
}, {
|
|
372
|
+
label: "CDF",
|
|
373
|
+
value: "cdf"
|
|
374
|
+
}, {
|
|
375
|
+
label: "CHF",
|
|
376
|
+
value: "chf"
|
|
377
|
+
}, {
|
|
378
|
+
label: "CLP",
|
|
379
|
+
value: "clp"
|
|
380
|
+
}, {
|
|
381
|
+
label: "CNY",
|
|
382
|
+
value: "cny"
|
|
383
|
+
}, {
|
|
384
|
+
label: "COP",
|
|
385
|
+
value: "cop"
|
|
386
|
+
}, {
|
|
387
|
+
label: "CRC",
|
|
388
|
+
value: "crc"
|
|
389
|
+
}, {
|
|
390
|
+
label: "CVE",
|
|
391
|
+
value: "cve"
|
|
392
|
+
}, {
|
|
393
|
+
label: "CZK",
|
|
394
|
+
value: "czk"
|
|
395
|
+
}, {
|
|
396
|
+
label: "DJF",
|
|
397
|
+
value: "djf"
|
|
398
|
+
}, {
|
|
399
|
+
label: "DKK",
|
|
400
|
+
value: "dkk"
|
|
401
|
+
}, {
|
|
402
|
+
label: "DOP",
|
|
403
|
+
value: "dop"
|
|
404
|
+
}, {
|
|
405
|
+
label: "DZD",
|
|
406
|
+
value: "dzd"
|
|
407
|
+
}, {
|
|
408
|
+
label: "EGP",
|
|
409
|
+
value: "egp"
|
|
410
|
+
}, {
|
|
411
|
+
label: "ETB",
|
|
412
|
+
value: "etb"
|
|
413
|
+
}, {
|
|
414
|
+
label: "EUR",
|
|
415
|
+
value: "eur"
|
|
416
|
+
}, {
|
|
417
|
+
label: "FJD",
|
|
418
|
+
value: "fjd"
|
|
419
|
+
}, {
|
|
420
|
+
label: "FKP",
|
|
421
|
+
value: "fkp"
|
|
422
|
+
}, {
|
|
423
|
+
label: "GBP",
|
|
424
|
+
value: "gbp"
|
|
425
|
+
}, {
|
|
426
|
+
label: "GEL",
|
|
427
|
+
value: "gel"
|
|
428
|
+
}, {
|
|
429
|
+
label: "GIP",
|
|
430
|
+
value: "gip"
|
|
431
|
+
}, {
|
|
432
|
+
label: "GMD",
|
|
433
|
+
value: "gmd"
|
|
434
|
+
}, {
|
|
435
|
+
label: "GNF",
|
|
436
|
+
value: "gnf"
|
|
437
|
+
}, {
|
|
438
|
+
label: "GTQ",
|
|
439
|
+
value: "gtq"
|
|
440
|
+
}, {
|
|
441
|
+
label: "GYD",
|
|
442
|
+
value: "gyd"
|
|
443
|
+
}, {
|
|
444
|
+
label: "HKD",
|
|
445
|
+
value: "hkd"
|
|
446
|
+
}, {
|
|
447
|
+
label: "HNL",
|
|
448
|
+
value: "hnl"
|
|
449
|
+
}, {
|
|
450
|
+
label: "HTG",
|
|
451
|
+
value: "htg"
|
|
452
|
+
}, {
|
|
453
|
+
label: "HUF",
|
|
454
|
+
value: "huf"
|
|
455
|
+
}, {
|
|
456
|
+
label: "IDR",
|
|
457
|
+
value: "idr"
|
|
458
|
+
}, {
|
|
459
|
+
label: "ILS",
|
|
460
|
+
value: "ils"
|
|
461
|
+
}, {
|
|
462
|
+
label: "INR",
|
|
463
|
+
value: "inr"
|
|
464
|
+
}, {
|
|
465
|
+
label: "ISK",
|
|
466
|
+
value: "isk"
|
|
467
|
+
}, {
|
|
468
|
+
label: "JMD",
|
|
469
|
+
value: "jmd"
|
|
470
|
+
}, {
|
|
471
|
+
label: "JPY",
|
|
472
|
+
value: "jpy"
|
|
473
|
+
}, {
|
|
474
|
+
label: "KES",
|
|
475
|
+
value: "kes"
|
|
476
|
+
}, {
|
|
477
|
+
label: "KGS",
|
|
478
|
+
value: "kgs"
|
|
479
|
+
}, {
|
|
480
|
+
label: "KHR",
|
|
481
|
+
value: "khr"
|
|
482
|
+
}, {
|
|
483
|
+
label: "KMF",
|
|
484
|
+
value: "kmf"
|
|
485
|
+
}, {
|
|
486
|
+
label: "KRW",
|
|
487
|
+
value: "krw"
|
|
488
|
+
}, {
|
|
489
|
+
label: "KYD",
|
|
490
|
+
value: "kyd"
|
|
491
|
+
}, {
|
|
492
|
+
label: "KZT",
|
|
493
|
+
value: "kzt"
|
|
494
|
+
}, {
|
|
495
|
+
label: "LAK",
|
|
496
|
+
value: "lak"
|
|
497
|
+
}, {
|
|
498
|
+
label: "LBP",
|
|
499
|
+
value: "lbp"
|
|
500
|
+
}, {
|
|
501
|
+
label: "LKR",
|
|
502
|
+
value: "lkr"
|
|
503
|
+
}, {
|
|
504
|
+
label: "LRD",
|
|
505
|
+
value: "lrd"
|
|
506
|
+
}, {
|
|
507
|
+
label: "LSL",
|
|
508
|
+
value: "lsl"
|
|
509
|
+
}, {
|
|
510
|
+
label: "MAD",
|
|
511
|
+
value: "mad"
|
|
512
|
+
}, {
|
|
513
|
+
label: "MDL",
|
|
514
|
+
value: "mdl"
|
|
515
|
+
}, {
|
|
516
|
+
label: "MGA",
|
|
517
|
+
value: "mga"
|
|
518
|
+
}, {
|
|
519
|
+
label: "MKD",
|
|
520
|
+
value: "mkd"
|
|
521
|
+
}, {
|
|
522
|
+
label: "MMK",
|
|
523
|
+
value: "mmk"
|
|
524
|
+
}, {
|
|
525
|
+
label: "MNT",
|
|
526
|
+
value: "mnt"
|
|
527
|
+
}, {
|
|
528
|
+
label: "MOP",
|
|
529
|
+
value: "mop"
|
|
530
|
+
}, {
|
|
531
|
+
label: "MRO",
|
|
532
|
+
value: "mro"
|
|
533
|
+
}, {
|
|
534
|
+
label: "MUR",
|
|
535
|
+
value: "mur"
|
|
536
|
+
}, {
|
|
537
|
+
label: "MVR",
|
|
538
|
+
value: "mvr"
|
|
539
|
+
}, {
|
|
540
|
+
label: "MWK",
|
|
541
|
+
value: "mwk"
|
|
542
|
+
}, {
|
|
543
|
+
label: "MXN",
|
|
544
|
+
value: "mxn"
|
|
545
|
+
}, {
|
|
546
|
+
label: "MYR",
|
|
547
|
+
value: "myr"
|
|
548
|
+
}, {
|
|
549
|
+
label: "MZN",
|
|
550
|
+
value: "mzn"
|
|
551
|
+
}, {
|
|
552
|
+
label: "NAD",
|
|
553
|
+
value: "nad"
|
|
554
|
+
}, {
|
|
555
|
+
label: "NGN",
|
|
556
|
+
value: "ngn"
|
|
557
|
+
}, {
|
|
558
|
+
label: "NIO",
|
|
559
|
+
value: "nio"
|
|
560
|
+
}, {
|
|
561
|
+
label: "NOK",
|
|
562
|
+
value: "nok"
|
|
563
|
+
}, {
|
|
564
|
+
label: "NPR",
|
|
565
|
+
value: "npr"
|
|
566
|
+
}, {
|
|
567
|
+
label: "NZD",
|
|
568
|
+
value: "nzd"
|
|
569
|
+
}, {
|
|
570
|
+
label: "PAB",
|
|
571
|
+
value: "pab"
|
|
572
|
+
}, {
|
|
573
|
+
label: "PEN",
|
|
574
|
+
value: "pen"
|
|
575
|
+
}, {
|
|
576
|
+
label: "PGK",
|
|
577
|
+
value: "pgk"
|
|
578
|
+
}, {
|
|
579
|
+
label: "PHP",
|
|
580
|
+
value: "php"
|
|
581
|
+
}, {
|
|
582
|
+
label: "PKR",
|
|
583
|
+
value: "pkr"
|
|
584
|
+
}, {
|
|
585
|
+
label: "PLN",
|
|
586
|
+
value: "pln"
|
|
587
|
+
}, {
|
|
588
|
+
label: "PYG",
|
|
589
|
+
value: "pyg"
|
|
590
|
+
}, {
|
|
591
|
+
label: "QAR",
|
|
592
|
+
value: "qar"
|
|
593
|
+
}, {
|
|
594
|
+
label: "RON",
|
|
595
|
+
value: "ron"
|
|
596
|
+
}, {
|
|
597
|
+
label: "RSD",
|
|
598
|
+
value: "rsd"
|
|
599
|
+
}, {
|
|
600
|
+
label: "RUB",
|
|
601
|
+
value: "rub"
|
|
602
|
+
}, {
|
|
603
|
+
label: "RWF",
|
|
604
|
+
value: "rwf"
|
|
605
|
+
}, {
|
|
606
|
+
label: "SAR",
|
|
607
|
+
value: "sar"
|
|
608
|
+
}, {
|
|
609
|
+
label: "SBD",
|
|
610
|
+
value: "sbd"
|
|
611
|
+
}, {
|
|
612
|
+
label: "SCR",
|
|
613
|
+
value: "scr"
|
|
614
|
+
}, {
|
|
615
|
+
label: "SEK",
|
|
616
|
+
value: "sek"
|
|
617
|
+
}, {
|
|
618
|
+
label: "SGD",
|
|
619
|
+
value: "sgd"
|
|
620
|
+
}, {
|
|
621
|
+
label: "SHP",
|
|
622
|
+
value: "shp"
|
|
623
|
+
}, {
|
|
624
|
+
label: "SLE",
|
|
625
|
+
value: "sle"
|
|
626
|
+
}, {
|
|
627
|
+
label: "SOS",
|
|
628
|
+
value: "sos"
|
|
629
|
+
}, {
|
|
630
|
+
label: "SRD",
|
|
631
|
+
value: "srd"
|
|
632
|
+
}, {
|
|
633
|
+
label: "STD",
|
|
634
|
+
value: "std"
|
|
635
|
+
}, {
|
|
636
|
+
label: "SZL",
|
|
637
|
+
value: "szl"
|
|
638
|
+
}, {
|
|
639
|
+
label: "THB",
|
|
640
|
+
value: "thb"
|
|
641
|
+
}, {
|
|
642
|
+
label: "TJS",
|
|
643
|
+
value: "tjs"
|
|
644
|
+
}, {
|
|
645
|
+
label: "TOP",
|
|
646
|
+
value: "top"
|
|
647
|
+
}, {
|
|
648
|
+
label: "TRY",
|
|
649
|
+
value: "try"
|
|
650
|
+
}, {
|
|
651
|
+
label: "TTD",
|
|
652
|
+
value: "ttd"
|
|
653
|
+
}, {
|
|
654
|
+
label: "TWD",
|
|
655
|
+
value: "twd"
|
|
656
|
+
}, {
|
|
657
|
+
label: "TZS",
|
|
658
|
+
value: "tzs"
|
|
659
|
+
}, {
|
|
660
|
+
label: "UAH",
|
|
661
|
+
value: "uah"
|
|
662
|
+
}, {
|
|
663
|
+
label: "UGX",
|
|
664
|
+
value: "ugx"
|
|
665
|
+
}, {
|
|
666
|
+
label: "UYU",
|
|
667
|
+
value: "uyu"
|
|
668
|
+
}, {
|
|
669
|
+
label: "UZS",
|
|
670
|
+
value: "uzs"
|
|
671
|
+
}, {
|
|
672
|
+
label: "VND",
|
|
673
|
+
value: "vnd"
|
|
674
|
+
}, {
|
|
675
|
+
label: "VUV",
|
|
676
|
+
value: "vuv"
|
|
677
|
+
}, {
|
|
678
|
+
label: "WST",
|
|
679
|
+
value: "wst"
|
|
680
|
+
}, {
|
|
681
|
+
label: "XAF",
|
|
682
|
+
value: "xaf"
|
|
683
|
+
}, {
|
|
684
|
+
label: "XCD",
|
|
685
|
+
value: "xcd"
|
|
686
|
+
}, {
|
|
687
|
+
label: "XOF",
|
|
688
|
+
value: "xof"
|
|
689
|
+
}, {
|
|
690
|
+
label: "XPF",
|
|
691
|
+
value: "xpf"
|
|
692
|
+
}, {
|
|
693
|
+
label: "YER",
|
|
694
|
+
value: "yer"
|
|
695
|
+
}, {
|
|
696
|
+
label: "ZAR",
|
|
697
|
+
value: "zar"
|
|
698
|
+
}, {
|
|
699
|
+
label: "ZMW",
|
|
700
|
+
value: "zmw"
|
|
701
|
+
}];
|
|
702
|
+
const DEFAULT_PAGE_VALUES = {
|
|
703
|
+
page: DEFAULT_PAGE_INDEX,
|
|
704
|
+
pageSize: DEFAULT_PAGE_SIZE
|
|
705
|
+
};
|
|
706
|
+
const UN_HIDEABLE_COLUMNS = ["id", "identifier", "status"];
|
|
707
|
+
const FILTER_COLUMNS = [{
|
|
708
|
+
key: "amount",
|
|
709
|
+
label: t("neetoPayments.common.amount"),
|
|
710
|
+
node: "amount",
|
|
711
|
+
type: "decimal",
|
|
712
|
+
showRuleSelector: true
|
|
713
|
+
}, {
|
|
714
|
+
key: "payment_time",
|
|
715
|
+
label: t("neetoPayments.common.paymentTime"),
|
|
716
|
+
node: "payment_at",
|
|
717
|
+
type: "date",
|
|
718
|
+
showRuleSelector: true
|
|
719
|
+
}];
|
|
720
|
+
const DEFAULT_TAG_STYLE = "warning";
|
|
721
|
+
const TAG_STYLE = {
|
|
722
|
+
successful: "success",
|
|
723
|
+
paid: "success",
|
|
724
|
+
connected: "success",
|
|
725
|
+
disconnected: "danger",
|
|
726
|
+
declined: "danger",
|
|
727
|
+
initiated: "info",
|
|
728
|
+
canceled: "secondary",
|
|
729
|
+
cancelled: "secondary",
|
|
730
|
+
refunded: "secondary",
|
|
731
|
+
failed: "danger",
|
|
732
|
+
completed: "success",
|
|
733
|
+
rejected: "danger"
|
|
734
|
+
};
|
|
735
|
+
const DASHBOARD_KIND = {
|
|
736
|
+
payments: "payments",
|
|
737
|
+
refunds: "refunds",
|
|
738
|
+
splitTransfers: "splitTransfers"
|
|
739
|
+
};
|
|
740
|
+
const PAYMENT_KIND = {
|
|
741
|
+
connected: "connected",
|
|
742
|
+
platform: "platform",
|
|
743
|
+
temporary: "temporary",
|
|
744
|
+
mandate: "mandate"
|
|
745
|
+
};
|
|
746
|
+
const DEFAULT_SORT_PROPERTIES = {
|
|
747
|
+
sortBy: "updated_at",
|
|
748
|
+
orderBy: "DESC"
|
|
749
|
+
};
|
|
750
|
+
const SORT_DIRECTIONS = ["ascend", "descend"];
|
|
751
|
+
const PAYMENT_PROVIDERS = ["Stripe", "Razorpay", "Manual", "Cash"];
|
|
752
|
+
const ASSOCIATED_TABLE_COLUMNS = {
|
|
753
|
+
"payment,amount": "neeto_payments_engine_payments.amount"
|
|
754
|
+
};
|
|
755
|
+
const RAZORPAY_PAYMENT_BUTTON_OPTIONS = {
|
|
756
|
+
readonly: {
|
|
757
|
+
email: true
|
|
758
|
+
},
|
|
759
|
+
config: {
|
|
760
|
+
display: {
|
|
761
|
+
blocks: {
|
|
762
|
+
mum: {
|
|
763
|
+
name: "Most used methods",
|
|
764
|
+
instruments: [{
|
|
765
|
+
method: "upi",
|
|
766
|
+
flows: ["collect", "intent"]
|
|
767
|
+
}]
|
|
768
|
+
},
|
|
769
|
+
other: {
|
|
770
|
+
name: "Other payment modes",
|
|
771
|
+
instruments: [{
|
|
772
|
+
method: "card"
|
|
773
|
+
}, {
|
|
774
|
+
method: "wallet"
|
|
775
|
+
}, {
|
|
776
|
+
method: "netbanking"
|
|
777
|
+
}, {
|
|
778
|
+
method: "bank_transfer"
|
|
779
|
+
}]
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
hide: [{
|
|
783
|
+
method: "paylater"
|
|
784
|
+
}],
|
|
785
|
+
sequence: ["block.mum", "block.other"],
|
|
786
|
+
preferences: {
|
|
787
|
+
show_default_blocks: false
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
const TIP_KIND = {
|
|
793
|
+
percentage: "percentage",
|
|
794
|
+
fixed: "fixed"
|
|
795
|
+
};
|
|
796
|
+
const STRIPE_CONNECT_ENDPOINT = "/payments/api/v1/integrations/connect/stripe";
|
|
797
|
+
const POLLING_INTERVAL = 5000;
|
|
798
|
+
const MAX_POLLING_TIME = 30000;
|
|
799
|
+
const ERROR_TYPE = {
|
|
800
|
+
processing_error: "processing_error"
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
export { ASSOCIATED_TABLE_COLUMNS as A, BASE_URL as B, getAmountWithAppliedTax as C, DEFAULT_SORT_PROPERTIES as D, ERROR_TYPE as E, getFormattedDiscountedAmount as F, getFormattedDiscountedPercentage as G, hasAmountToPay as H, getAddressElementOptions as I, CURRENCY_OPTIONS as J, PAYMENT_STATUS_TYPE as K, REFUND_STATUS_TYPE as L, MAX_POLLING_TIME as M, STRIPE_DASHBOARD_LINK as N, STRIPE_CURRENCY_OPTIONS as O, PAYMENT_PROVIDERS as P, RAZORPAY_CURRENCY_OPTIONS as Q, RAZORPAY_PAYMENT_BUTTON_OPTIONS as R, SORT_DIRECTIONS as S, TAG_STYLE as T, UN_HIDEABLE_COLUMNS as U, FILTER_COLUMNS as V, TIP_KIND as W, ZERO_DECIMAL_CURRENCIES as Z, getAmountInLargestCurrencyUnit as a, buildStripeTransactionLink as b, getFormattedAmount as c, getFormattedTaxAmount as d, getTipAmount as e, getFormattedTipAmount as f, getAmountInSmallestCurrencyUnit as g, buildStripeAccountLink as h, DEFAULT_PAGE_VALUES as i, DEFAULT_TAG_STYLE as j, getQrCodeValue as k, formatAmount as l, formatCurrency as m, getUniquePaymentProviders as n, buildDefaultTableColumns as o, processDataIndex as p, DASHBOARD_KIND as q, buildStripePayoutLink as r, shouldTabsVisible as s, POLLING_INTERVAL as t, uuidV4 as u, preProcessStatus as v, getTagStyle as w, PAYMENT_KIND as x, STRIPE_CONNECT_ENDPOINT as y, getTaxAmount as z };
|
|
804
|
+
//# sourceMappingURL=index-CNouM9_z.js.map
|