paymob-pixel-alpha 1.1.44 → 1.1.46

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 +22 -21
  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 ",
@@ -81111,11 +81111,11 @@ function Knet(props) {
81111
81111
  className: "text-[#101828] text-sm font-medium",
81112
81112
  children: [displayCurrency, " ", displayAmount]
81113
81113
  })]
81114
- }), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
81114
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
81115
81115
  className: "text-[#475467] font-inter text-sm leading-[18px] tracking-[0.16px] mb-2",
81116
- children: [(_customStyle$knetText5 = customStyle == null || (_customStyle$knetText6 = customStyle.knetText) == null ? void 0 : _customStyle$knetText6.TRANSACTION_PROCEED) != null ? _customStyle$knetText5 : t('TRANSACTION_PROCESS_CURRENCY', {
81116
+ children: (_customStyle$knetText5 = customStyle == null || (_customStyle$knetText6 = customStyle.knetText) == null ? void 0 : _customStyle$knetText6.TRANSACTION_PROCEED) != null ? _customStyle$knetText5 : t('TRANSACTION_PROCESS_CURRENCY', {
81117
81117
  currency: displayCurrency
81118
- }), "."]
81118
+ })
81119
81119
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button, {
81120
81120
  id: "pay-button",
81121
81121
  label: `${(_customStyle$knetText7 = customStyle == null || (_customStyle$knetText8 = customStyle.knetText) == null ? void 0 : _customStyle$knetText8.PAY_KNET_BUTTON) != null ? _customStyle$knetText7 : t('PAY')} ${displayCurrency} ${displayAmount}`,
@@ -81147,7 +81147,7 @@ const payWithKnet = (token, amount) => {
81147
81147
  subtype: 'KNET'
81148
81148
  },
81149
81149
  payment_token: token,
81150
- api_source: " Pixel"
81150
+ api_source: " PIXEL"
81151
81151
  }).then(res => res).catch(err => err == null ? void 0 : err.response);
81152
81152
  };
81153
81153
  ;// ./src/components/Payments/Knet/index.tsx
@@ -81268,14 +81268,15 @@ 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 () => {
@@ -81413,11 +81414,11 @@ function KnetApplePay(props) {
81413
81414
  className: "text-[#101828] text-sm font-medium",
81414
81415
  children: [displayCurrency, " ", displayAmount]
81415
81416
  })]
81416
- }), /*#__PURE__*/(0,jsx_runtime.jsxs)("p", {
81417
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
81417
81418
  className: "text-[#475467] font-inter text-sm leading-[18px] tracking-[0.16px] mb-6",
81418
- children: [(_customStyle$knetAppl5 = customStyle == null || (_customStyle$knetAppl6 = customStyle.knetApplePayText) == null ? void 0 : _customStyle$knetAppl6.TRANSACTION_PROCEED) != null ? _customStyle$knetAppl5 : t('TRANSACTION_PROCESS_CURRENCY', {
81419
+ children: (_customStyle$knetAppl5 = customStyle == null || (_customStyle$knetAppl6 = customStyle.knetApplePayText) == null ? void 0 : _customStyle$knetAppl6.TRANSACTION_PROCEED) != null ? _customStyle$knetAppl5 : t('TRANSACTION_PROCESS_CURRENCY', {
81419
81420
  currency: displayCurrency
81420
- }), "."]
81421
+ })
81421
81422
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button, {
81422
81423
  id: "apple-pay-button",
81423
81424
  icon: apple_pay_namespaceObject,
@@ -81444,11 +81445,11 @@ const validatemerchant = async (appleURL, integrationId) => {
81444
81445
  integrationId
81445
81446
  }).then(res => res.data.api_response).catch(err => err == null ? void 0 : err.response);
81446
81447
  };
81447
- const knetApplePayPayment = async (paymentToken, applePaytoken, clientData) => {
81448
+ const knetApplePayPayment = async (applePaytoken, paymentToken, clientData) => {
81448
81449
  var _clientData$name$trim, _clientData$name$trim2, _clientData$name$trim3, _clientData$name$trim4;
81449
81450
  return lib_axios.post(`/api/acceptance/payments/pay`, Object.assign({
81450
81451
  payment_token: paymentToken,
81451
- api_source: "Pixel",
81452
+ api_source: "PIXEL",
81452
81453
  source: {
81453
81454
  identifier: applePaytoken,
81454
81455
  subtype: 'KNET_APPLE_PAY'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paymob-pixel-alpha",
3
- "version": "1.1.44",
3
+ "version": "1.1.46",
4
4
  "keywords": ["paymob","pixel","paymob-pixel"],
5
5
  "main": "./main.js",
6
6
  "license": "MIT",