@paystack/inline-js 2.27.0-dev.3 → 2.27.0-dev.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/dist/inline.js CHANGED
@@ -833,17 +833,19 @@ var PaystackPop = (function () {
833
833
  var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
834
834
  return {
835
835
  type: 'CARD',
836
- parameters: {
836
+ parameters: _objectSpread2({
837
837
  allowedAuthMethods: authMethods,
838
838
  allowedCardNetworks: googlePayConfig.allowed_card_networks,
839
839
  billingAddressRequired: true,
840
840
  billingAddressParameters: googlePayConfig.billing_address_parameters,
841
841
  assuranceDetailsRequired: true
842
- }
842
+ }, googlePayConfig.allowed_issuer_country_codes && googlePayConfig.allowed_issuer_country_codes.length && {
843
+ allowedIssuerCountryCodes: googlePayConfig.allowed_issuer_country_codes
844
+ })
843
845
  };
844
846
  };
845
847
  var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
846
- var merchantInfo = googlePayConfig.merchant_info || {};
848
+ var merchantInfo = googlePayConfig.registered_merchant_info || {};
847
849
  return {
848
850
  merchantId: merchantInfo.merchantId,
849
851
  merchantName: merchantInfo.merchantName,
@@ -851,7 +853,7 @@ var PaystackPop = (function () {
851
853
  };
852
854
  };
853
855
  var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
854
- var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
856
+ var registeredOrigin = googlePayConfig.registered_merchant_info && googlePayConfig.registered_merchant_info.merchantOrigin;
855
857
  var hostname = window.location.hostname;
856
858
  if (registeredOrigin && registeredOrigin !== hostname) {
857
859
  logWarning("Google Pay: the registered merchantOrigin (\"".concat(registeredOrigin, "\") does not match this page (\"").concat(hostname, "\"). Google may reject the payment sheet. Update the domain in Dashboard > Developers > Google Pay."));
@@ -925,6 +927,11 @@ var PaystackPop = (function () {
925
927
  if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
926
928
  return Promise.resolve(null);
927
929
  }
930
+ var googlePayConfig = getGooglePayConfig(transaction);
931
+ if (googlePayConfig && !googlePayConfig.registered_merchant_info) {
932
+ logWarning('Google Pay: this business has no Google Pay merchant profile, so no Google Pay button is shown. Add one in Dashboard > Developers > Google Pay.');
933
+ return Promise.resolve(null);
934
+ }
928
935
  var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
929
936
  return hasGooglePaySDKLoaded();
930
937
  });
package/es/inline.js CHANGED
@@ -830,17 +830,19 @@ var buildBaseRequest = function buildBaseRequest(googlePayConfig) {
830
830
  var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
831
831
  return {
832
832
  type: 'CARD',
833
- parameters: {
833
+ parameters: _objectSpread2({
834
834
  allowedAuthMethods: authMethods,
835
835
  allowedCardNetworks: googlePayConfig.allowed_card_networks,
836
836
  billingAddressRequired: true,
837
837
  billingAddressParameters: googlePayConfig.billing_address_parameters,
838
838
  assuranceDetailsRequired: true
839
- }
839
+ }, googlePayConfig.allowed_issuer_country_codes && googlePayConfig.allowed_issuer_country_codes.length && {
840
+ allowedIssuerCountryCodes: googlePayConfig.allowed_issuer_country_codes
841
+ })
840
842
  };
841
843
  };
842
844
  var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
843
- var merchantInfo = googlePayConfig.merchant_info || {};
845
+ var merchantInfo = googlePayConfig.registered_merchant_info || {};
844
846
  return {
845
847
  merchantId: merchantInfo.merchantId,
846
848
  merchantName: merchantInfo.merchantName,
@@ -848,7 +850,7 @@ var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
848
850
  };
849
851
  };
850
852
  var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
851
- var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
853
+ var registeredOrigin = googlePayConfig.registered_merchant_info && googlePayConfig.registered_merchant_info.merchantOrigin;
852
854
  var hostname = window.location.hostname;
853
855
  if (registeredOrigin && registeredOrigin !== hostname) {
854
856
  logWarning("Google Pay: the registered merchantOrigin (\"".concat(registeredOrigin, "\") does not match this page (\"").concat(hostname, "\"). Google may reject the payment sheet. Update the domain in Dashboard > Developers > Google Pay."));
@@ -922,6 +924,11 @@ var loadGooglePay = function loadGooglePay(transaction) {
922
924
  if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
923
925
  return Promise.resolve(null);
924
926
  }
927
+ var googlePayConfig = getGooglePayConfig(transaction);
928
+ if (googlePayConfig && !googlePayConfig.registered_merchant_info) {
929
+ logWarning('Google Pay: this business has no Google Pay merchant profile, so no Google Pay button is shown. Add one in Dashboard > Developers > Google Pay.');
930
+ return Promise.resolve(null);
931
+ }
925
932
  var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
926
933
  return hasGooglePaySDKLoaded();
927
934
  });
package/lib/inline.js CHANGED
@@ -832,17 +832,19 @@ var buildBaseRequest = function buildBaseRequest(googlePayConfig) {
832
832
  var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
833
833
  return {
834
834
  type: 'CARD',
835
- parameters: {
835
+ parameters: _objectSpread2({
836
836
  allowedAuthMethods: authMethods,
837
837
  allowedCardNetworks: googlePayConfig.allowed_card_networks,
838
838
  billingAddressRequired: true,
839
839
  billingAddressParameters: googlePayConfig.billing_address_parameters,
840
840
  assuranceDetailsRequired: true
841
- }
841
+ }, googlePayConfig.allowed_issuer_country_codes && googlePayConfig.allowed_issuer_country_codes.length && {
842
+ allowedIssuerCountryCodes: googlePayConfig.allowed_issuer_country_codes
843
+ })
842
844
  };
843
845
  };
844
846
  var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
845
- var merchantInfo = googlePayConfig.merchant_info || {};
847
+ var merchantInfo = googlePayConfig.registered_merchant_info || {};
846
848
  return {
847
849
  merchantId: merchantInfo.merchantId,
848
850
  merchantName: merchantInfo.merchantName,
@@ -850,7 +852,7 @@ var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
850
852
  };
851
853
  };
852
854
  var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
853
- var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
855
+ var registeredOrigin = googlePayConfig.registered_merchant_info && googlePayConfig.registered_merchant_info.merchantOrigin;
854
856
  var hostname = window.location.hostname;
855
857
  if (registeredOrigin && registeredOrigin !== hostname) {
856
858
  logWarning("Google Pay: the registered merchantOrigin (\"".concat(registeredOrigin, "\") does not match this page (\"").concat(hostname, "\"). Google may reject the payment sheet. Update the domain in Dashboard > Developers > Google Pay."));
@@ -924,6 +926,11 @@ var loadGooglePay = function loadGooglePay(transaction) {
924
926
  if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
925
927
  return Promise.resolve(null);
926
928
  }
929
+ var googlePayConfig = getGooglePayConfig(transaction);
930
+ if (googlePayConfig && !googlePayConfig.registered_merchant_info) {
931
+ logWarning('Google Pay: this business has no Google Pay merchant profile, so no Google Pay button is shown. Add one in Dashboard > Developers > Google Pay.');
932
+ return Promise.resolve(null);
933
+ }
927
934
  var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
928
935
  return hasGooglePaySDKLoaded();
929
936
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.27.0-dev.3",
3
+ "version": "2.27.0-dev.4",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
6
6
  "main": "lib/inline.js",