paymob-pixel-alpha 1.1.43 → 1.1.45

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 (2) hide show
  1. package/main.js +15 -14
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -81071,17 +81071,17 @@ function Knet(props) {
81071
81071
  }
81072
81072
  setErrorMessage(null);
81073
81073
  }, [minAmount, EquivalentAmount, amount]);
81074
- function formatNumber(val) {
81075
- return val.toLocaleString(undefined, {
81076
- minimumFractionDigits: 2,
81077
- maximumFractionDigits: 2
81074
+ function formatNumber(amount, currency) {
81075
+ const fractionDigits = currency === "KWD" ? 3 : 2;
81076
+ return amount.toLocaleString(undefined, {
81077
+ minimumFractionDigits: fractionDigits,
81078
+ maximumFractionDigits: fractionDigits
81078
81079
  });
81079
81080
  }
81080
- const formattedAmount = formatNumber(Number(amount));
81081
- const formattedEquivalentAmount = formatNumber(Number(EquivalentAmount || amount));
81081
+ const formattedAmount = formatNumber(Number(amount), currency);
81082
+ const formattedEquivalentAmount = formatNumber(Number(EquivalentAmount || amount), KnetCurrency || currency);
81082
81083
  const displayAmount = formattedEquivalentAmount || formattedAmount;
81083
81084
  const displayCurrency = KnetCurrency || currency;
81084
- console.log('customStyle knet', customStyle);
81085
81085
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
81086
81086
  children: [paymentMethodsCount === 1 && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
81087
81087
  className: "flex items-center gap-3 w-full pb-4 border-b border-gray-200 ",
@@ -81268,27 +81268,28 @@ function KnetApplePay(props) {
81268
81268
  setErrorMessage(null);
81269
81269
  }, [minAmount, EquivalentAmount, amount]);
81270
81270
  const [loading, setLoading] = (0,react.useState)(false);
81271
- function formatNumber(amount) {
81271
+ function formatNumber(amount, currency) {
81272
+ const fractionDigits = currency === "KWD" ? 3 : 2;
81272
81273
  return amount.toLocaleString(undefined, {
81273
- minimumFractionDigits: 2,
81274
- maximumFractionDigits: 2
81274
+ minimumFractionDigits: fractionDigits,
81275
+ maximumFractionDigits: fractionDigits
81275
81276
  });
81276
81277
  }
81277
- const formattedAmount = formatNumber(Number(amount));
81278
- const formattedEquivalentAmount = formatNumber(Number(EquivalentAmount || amount));
81278
+ const formattedAmount = formatNumber(Number(amount), currency);
81279
+ const formattedEquivalentAmount = formatNumber(Number(EquivalentAmount || amount), KnetCurrency || currency);
81279
81280
  const displayCurrency = KnetCurrency || currency;
81280
81281
  const displayAmount = formattedEquivalentAmount || formattedAmount;
81281
81282
  const handleSubmit = async () => {
81282
81283
  setLoading(true);
81283
81284
  const payload = {
81284
81285
  countryCode: countryCode,
81285
- currencyCode: currency,
81286
+ currencyCode: KnetCurrency || currency,
81286
81287
  supportedNetworks: ['visa', 'masterCard', 'amex', 'discover', 'mada', 'maestro', 'electron', 'chinaUnionPay', 'jcb'],
81287
81288
  requiredShippingContactFields: [],
81288
81289
  merchantCapabilities: ['supports3DS'],
81289
81290
  total: {
81290
81291
  label: merchantName,
81291
- amount: amount
81292
+ amount: formattedEquivalentAmount || formattedAmount
81292
81293
  }
81293
81294
  };
81294
81295
  if (country === 'EGYPT') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paymob-pixel-alpha",
3
- "version": "1.1.43",
3
+ "version": "1.1.45",
4
4
  "keywords": ["paymob","pixel","paymob-pixel"],
5
5
  "main": "./main.js",
6
6
  "license": "MIT",