@paystack/checkout-js 1.52.0-beta.11 → 1.52.0-beta.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/checkout.js CHANGED
@@ -19155,7 +19155,8 @@ var Paystack = (function (exports) {
19155
19155
  resumeCardCharge: function resumeCardCharge(_ref2) {
19156
19156
  var device = _ref2.device,
19157
19157
  accessCode = _ref2.accessCode,
19158
- pin = _ref2.pin;
19158
+ pin = _ref2.pin,
19159
+ customFields = _ref2.customFields;
19159
19160
  var url = "".concat(configToUse.paymentBaseUrl, "charge/resume/").concat(accessCode);
19160
19161
  var language = getLanguage();
19161
19162
  var headers = _objectSpread2({
@@ -19163,11 +19164,11 @@ var Paystack = (function (exports) {
19163
19164
  }, language && {
19164
19165
  'Accept-Language': language
19165
19166
  });
19166
- var data = _objectSpread2({
19167
+ var data = _objectSpread2(_objectSpread2({
19167
19168
  device: device
19168
19169
  }, pin && {
19169
19170
  handle: pin
19170
- });
19171
+ }), customFields && customFields);
19171
19172
  var urlEncodedData = formUrlencoded(data);
19172
19173
  return axiosInstance.post(url, urlEncodedData, {
19173
19174
  headers: headers
@@ -19589,12 +19590,15 @@ var Paystack = (function (exports) {
19589
19590
  resumeCardCharge: function resumeCardCharge(_ref2) {
19590
19591
  var _this5 = this;
19591
19592
  var accessCode = _ref2.accessCode,
19592
- pin = _ref2.pin;
19593
+ pin = _ref2.pin,
19594
+ _ref2$customFields = _ref2.customFields,
19595
+ customFields = _ref2$customFields === void 0 ? {} : _ref2$customFields;
19593
19596
  var params = _objectSpread2(_objectSpread2({}, pin && {
19594
19597
  pin: encrypt(pin)
19595
19598
  }), {}, {
19596
19599
  accessCode: accessCode,
19597
- device: this.deviceFingerprint
19600
+ device: this.deviceFingerprint,
19601
+ customFields: customFields
19598
19602
  });
19599
19603
  return CardAPI$1.resumeCardCharge(params).then(function (response) {
19600
19604
  _this5.logAPIResponse(response, paymentMethod$5);
@@ -21691,6 +21695,7 @@ var Paystack = (function (exports) {
21691
21695
  this.subscription = data.subscription || null;
21692
21696
  this.planDetails = data.plan_details || null;
21693
21697
  this.exchangeRate = data.exchange_rate || null;
21698
+ this.preChargeCheckEnabled = data.pre_charge_check_enabled || false;
21694
21699
  this.savedCardsConfig = data.saved_cards || {};
21695
21700
  this.supportedBanks = data.supported_banks || [];
21696
21701
  this.isWhiteLabeled = data.whitelabel || null;
@@ -21985,9 +21990,29 @@ var Paystack = (function (exports) {
21985
21990
  return data;
21986
21991
  });
21987
21992
  },
21988
- fetchCountries: function fetchCountries(_ref2) {
21989
- var scope = _ref2.scope,
21993
+ preChargeCheck: function preChargeCheck(_ref2) {
21994
+ var bin = _ref2.bin,
21995
+ transactionId = _ref2.transactionId,
21990
21996
  merchantKey = _ref2.merchantKey;
21997
+ var url = new URL("/transaction/pre_charge_check/".concat(bin), configToUse.paystackApiUrl).toString();
21998
+ var language = getLanguage();
21999
+ var headers = _objectSpread2({
22000
+ Authorization: "Bearer ".concat(merchantKey)
22001
+ }, language && {
22002
+ 'Accept-Language': language
22003
+ });
22004
+ return axiosInstance.post(url, {
22005
+ transaction_id: transactionId
22006
+ }, {
22007
+ headers: headers
22008
+ }).then(function (_ref3) {
22009
+ var data = _ref3.data;
22010
+ return data;
22011
+ });
22012
+ },
22013
+ fetchCountries: function fetchCountries(_ref4) {
22014
+ var scope = _ref4.scope,
22015
+ merchantKey = _ref4.merchantKey;
21991
22016
  var url = new URL('/address/country', configToUse.paystackApiUrl).toString();
21992
22017
  var language = getLanguage();
21993
22018
  var headers = _objectSpread2({
@@ -22005,9 +22030,9 @@ var Paystack = (function (exports) {
22005
22030
  return response.data;
22006
22031
  });
22007
22032
  },
22008
- fetchReachStates: function fetchReachStates(_ref3) {
22009
- var country = _ref3.country,
22010
- merchantKey = _ref3.merchantKey;
22033
+ fetchReachStates: function fetchReachStates(_ref5) {
22034
+ var country = _ref5.country,
22035
+ merchantKey = _ref5.merchantKey;
22011
22036
  var url = new URL("/address/country/".concat(country, "/state"), configToUse.paystackApiUrl).toString();
22012
22037
  var language = getLanguage();
22013
22038
  var headers = _objectSpread2({
@@ -22089,6 +22114,11 @@ var Paystack = (function (exports) {
22089
22114
  value: function resolveCardBin(bin) {
22090
22115
  return ToolkitAPI.resolveCardBin(bin);
22091
22116
  }
22117
+ }, {
22118
+ key: "preChargeCheck",
22119
+ value: function preChargeCheck(params) {
22120
+ return ToolkitAPI.preChargeCheck(params);
22121
+ }
22092
22122
  }]);
22093
22123
  return Toolkit;
22094
22124
  }();
package/es/checkout.js CHANGED
@@ -19152,7 +19152,8 @@ var CardAPI$1 = {
19152
19152
  resumeCardCharge: function resumeCardCharge(_ref2) {
19153
19153
  var device = _ref2.device,
19154
19154
  accessCode = _ref2.accessCode,
19155
- pin = _ref2.pin;
19155
+ pin = _ref2.pin,
19156
+ customFields = _ref2.customFields;
19156
19157
  var url = "".concat(configToUse.paymentBaseUrl, "charge/resume/").concat(accessCode);
19157
19158
  var language = getLanguage();
19158
19159
  var headers = _objectSpread2({
@@ -19160,11 +19161,11 @@ var CardAPI$1 = {
19160
19161
  }, language && {
19161
19162
  'Accept-Language': language
19162
19163
  });
19163
- var data = _objectSpread2({
19164
+ var data = _objectSpread2(_objectSpread2({
19164
19165
  device: device
19165
19166
  }, pin && {
19166
19167
  handle: pin
19167
- });
19168
+ }), customFields && customFields);
19168
19169
  var urlEncodedData = formUrlencoded(data);
19169
19170
  return axiosInstance.post(url, urlEncodedData, {
19170
19171
  headers: headers
@@ -19586,12 +19587,15 @@ var CardCharge = {
19586
19587
  resumeCardCharge: function resumeCardCharge(_ref2) {
19587
19588
  var _this5 = this;
19588
19589
  var accessCode = _ref2.accessCode,
19589
- pin = _ref2.pin;
19590
+ pin = _ref2.pin,
19591
+ _ref2$customFields = _ref2.customFields,
19592
+ customFields = _ref2$customFields === void 0 ? {} : _ref2$customFields;
19590
19593
  var params = _objectSpread2(_objectSpread2({}, pin && {
19591
19594
  pin: encrypt(pin)
19592
19595
  }), {}, {
19593
19596
  accessCode: accessCode,
19594
- device: this.deviceFingerprint
19597
+ device: this.deviceFingerprint,
19598
+ customFields: customFields
19595
19599
  });
19596
19600
  return CardAPI$1.resumeCardCharge(params).then(function (response) {
19597
19601
  _this5.logAPIResponse(response, paymentMethod$5);
@@ -21688,6 +21692,7 @@ var TransactionInstance = /*#__PURE__*/function () {
21688
21692
  this.subscription = data.subscription || null;
21689
21693
  this.planDetails = data.plan_details || null;
21690
21694
  this.exchangeRate = data.exchange_rate || null;
21695
+ this.preChargeCheckEnabled = data.pre_charge_check_enabled || false;
21691
21696
  this.savedCardsConfig = data.saved_cards || {};
21692
21697
  this.supportedBanks = data.supported_banks || [];
21693
21698
  this.isWhiteLabeled = data.whitelabel || null;
@@ -21982,9 +21987,29 @@ var ToolkitAPI = {
21982
21987
  return data;
21983
21988
  });
21984
21989
  },
21985
- fetchCountries: function fetchCountries(_ref2) {
21986
- var scope = _ref2.scope,
21990
+ preChargeCheck: function preChargeCheck(_ref2) {
21991
+ var bin = _ref2.bin,
21992
+ transactionId = _ref2.transactionId,
21987
21993
  merchantKey = _ref2.merchantKey;
21994
+ var url = new URL("/transaction/pre_charge_check/".concat(bin), configToUse.paystackApiUrl).toString();
21995
+ var language = getLanguage();
21996
+ var headers = _objectSpread2({
21997
+ Authorization: "Bearer ".concat(merchantKey)
21998
+ }, language && {
21999
+ 'Accept-Language': language
22000
+ });
22001
+ return axiosInstance.post(url, {
22002
+ transaction_id: transactionId
22003
+ }, {
22004
+ headers: headers
22005
+ }).then(function (_ref3) {
22006
+ var data = _ref3.data;
22007
+ return data;
22008
+ });
22009
+ },
22010
+ fetchCountries: function fetchCountries(_ref4) {
22011
+ var scope = _ref4.scope,
22012
+ merchantKey = _ref4.merchantKey;
21988
22013
  var url = new URL('/address/country', configToUse.paystackApiUrl).toString();
21989
22014
  var language = getLanguage();
21990
22015
  var headers = _objectSpread2({
@@ -22002,9 +22027,9 @@ var ToolkitAPI = {
22002
22027
  return response.data;
22003
22028
  });
22004
22029
  },
22005
- fetchReachStates: function fetchReachStates(_ref3) {
22006
- var country = _ref3.country,
22007
- merchantKey = _ref3.merchantKey;
22030
+ fetchReachStates: function fetchReachStates(_ref5) {
22031
+ var country = _ref5.country,
22032
+ merchantKey = _ref5.merchantKey;
22008
22033
  var url = new URL("/address/country/".concat(country, "/state"), configToUse.paystackApiUrl).toString();
22009
22034
  var language = getLanguage();
22010
22035
  var headers = _objectSpread2({
@@ -22086,6 +22111,11 @@ var Toolkit = /*#__PURE__*/function () {
22086
22111
  value: function resolveCardBin(bin) {
22087
22112
  return ToolkitAPI.resolveCardBin(bin);
22088
22113
  }
22114
+ }, {
22115
+ key: "preChargeCheck",
22116
+ value: function preChargeCheck(params) {
22117
+ return ToolkitAPI.preChargeCheck(params);
22118
+ }
22089
22119
  }]);
22090
22120
  return Toolkit;
22091
22121
  }();
package/lib/checkout.js CHANGED
@@ -19156,7 +19156,8 @@ var CardAPI$1 = {
19156
19156
  resumeCardCharge: function resumeCardCharge(_ref2) {
19157
19157
  var device = _ref2.device,
19158
19158
  accessCode = _ref2.accessCode,
19159
- pin = _ref2.pin;
19159
+ pin = _ref2.pin,
19160
+ customFields = _ref2.customFields;
19160
19161
  var url = "".concat(configToUse.paymentBaseUrl, "charge/resume/").concat(accessCode);
19161
19162
  var language = getLanguage();
19162
19163
  var headers = _objectSpread2({
@@ -19164,11 +19165,11 @@ var CardAPI$1 = {
19164
19165
  }, language && {
19165
19166
  'Accept-Language': language
19166
19167
  });
19167
- var data = _objectSpread2({
19168
+ var data = _objectSpread2(_objectSpread2({
19168
19169
  device: device
19169
19170
  }, pin && {
19170
19171
  handle: pin
19171
- });
19172
+ }), customFields && customFields);
19172
19173
  var urlEncodedData = formUrlencoded(data);
19173
19174
  return axiosInstance.post(url, urlEncodedData, {
19174
19175
  headers: headers
@@ -19590,12 +19591,15 @@ var CardCharge = {
19590
19591
  resumeCardCharge: function resumeCardCharge(_ref2) {
19591
19592
  var _this5 = this;
19592
19593
  var accessCode = _ref2.accessCode,
19593
- pin = _ref2.pin;
19594
+ pin = _ref2.pin,
19595
+ _ref2$customFields = _ref2.customFields,
19596
+ customFields = _ref2$customFields === void 0 ? {} : _ref2$customFields;
19594
19597
  var params = _objectSpread2(_objectSpread2({}, pin && {
19595
19598
  pin: encrypt(pin)
19596
19599
  }), {}, {
19597
19600
  accessCode: accessCode,
19598
- device: this.deviceFingerprint
19601
+ device: this.deviceFingerprint,
19602
+ customFields: customFields
19599
19603
  });
19600
19604
  return CardAPI$1.resumeCardCharge(params).then(function (response) {
19601
19605
  _this5.logAPIResponse(response, paymentMethod$5);
@@ -21692,6 +21696,7 @@ var TransactionInstance = /*#__PURE__*/function () {
21692
21696
  this.subscription = data.subscription || null;
21693
21697
  this.planDetails = data.plan_details || null;
21694
21698
  this.exchangeRate = data.exchange_rate || null;
21699
+ this.preChargeCheckEnabled = data.pre_charge_check_enabled || false;
21695
21700
  this.savedCardsConfig = data.saved_cards || {};
21696
21701
  this.supportedBanks = data.supported_banks || [];
21697
21702
  this.isWhiteLabeled = data.whitelabel || null;
@@ -21986,9 +21991,29 @@ var ToolkitAPI = {
21986
21991
  return data;
21987
21992
  });
21988
21993
  },
21989
- fetchCountries: function fetchCountries(_ref2) {
21990
- var scope = _ref2.scope,
21994
+ preChargeCheck: function preChargeCheck(_ref2) {
21995
+ var bin = _ref2.bin,
21996
+ transactionId = _ref2.transactionId,
21991
21997
  merchantKey = _ref2.merchantKey;
21998
+ var url = new URL("/transaction/pre_charge_check/".concat(bin), configToUse.paystackApiUrl).toString();
21999
+ var language = getLanguage();
22000
+ var headers = _objectSpread2({
22001
+ Authorization: "Bearer ".concat(merchantKey)
22002
+ }, language && {
22003
+ 'Accept-Language': language
22004
+ });
22005
+ return axiosInstance.post(url, {
22006
+ transaction_id: transactionId
22007
+ }, {
22008
+ headers: headers
22009
+ }).then(function (_ref3) {
22010
+ var data = _ref3.data;
22011
+ return data;
22012
+ });
22013
+ },
22014
+ fetchCountries: function fetchCountries(_ref4) {
22015
+ var scope = _ref4.scope,
22016
+ merchantKey = _ref4.merchantKey;
21992
22017
  var url = new URL('/address/country', configToUse.paystackApiUrl).toString();
21993
22018
  var language = getLanguage();
21994
22019
  var headers = _objectSpread2({
@@ -22006,9 +22031,9 @@ var ToolkitAPI = {
22006
22031
  return response.data;
22007
22032
  });
22008
22033
  },
22009
- fetchReachStates: function fetchReachStates(_ref3) {
22010
- var country = _ref3.country,
22011
- merchantKey = _ref3.merchantKey;
22034
+ fetchReachStates: function fetchReachStates(_ref5) {
22035
+ var country = _ref5.country,
22036
+ merchantKey = _ref5.merchantKey;
22012
22037
  var url = new URL("/address/country/".concat(country, "/state"), configToUse.paystackApiUrl).toString();
22013
22038
  var language = getLanguage();
22014
22039
  var headers = _objectSpread2({
@@ -22090,6 +22115,11 @@ var Toolkit = /*#__PURE__*/function () {
22090
22115
  value: function resolveCardBin(bin) {
22091
22116
  return ToolkitAPI.resolveCardBin(bin);
22092
22117
  }
22118
+ }, {
22119
+ key: "preChargeCheck",
22120
+ value: function preChargeCheck(params) {
22121
+ return ToolkitAPI.preChargeCheck(params);
22122
+ }
22093
22123
  }]);
22094
22124
  return Toolkit;
22095
22125
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.52.0-beta.11",
3
+ "version": "1.52.0-beta.13",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",