@paystack/checkout-js 1.23.2 → 1.24.0-dev.1

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/es/checkout.js CHANGED
@@ -19021,76 +19021,47 @@ var CardCharge = {
19021
19021
  return this.listenForCharge(listenerOptions, callback);
19022
19022
  },
19023
19023
  sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19024
+ return CardAPI$1.sendSavedCardsOTP({
19025
+ phone: phone,
19026
+ transaction: this.id
19027
+ });
19028
+ },
19029
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19024
19030
  var _this9 = this;
19025
19031
 
19026
19032
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19027
- var response;
19033
+ var code, token, payload, response;
19028
19034
  return regeneratorRuntime.wrap(function _callee$(_context) {
19029
19035
  while (1) {
19030
19036
  switch (_context.prev = _context.next) {
19031
19037
  case 0:
19032
- _context.prev = 0;
19033
- _context.next = 3;
19034
- return CardAPI$1.sendSavedCardsOTP({
19035
- phone: phone,
19036
- transaction: _this9.id
19037
- });
19038
-
19039
- case 3:
19040
- response = _context.sent;
19041
- _this9.savedCardsTempAuthToken = response.data.token;
19042
- return _context.abrupt("return", response);
19043
-
19044
- case 8:
19045
- _context.prev = 8;
19046
- _context.t0 = _context["catch"](0);
19047
- _this9.savedCardsTempAuthToken = null;
19048
- throw _context.t0;
19049
-
19050
- case 12:
19051
- case "end":
19052
- return _context.stop();
19053
- }
19054
- }
19055
- }, _callee, null, [[0, 8]]);
19056
- }))();
19057
- },
19058
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19059
- var _this10 = this;
19060
-
19061
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
19062
- var code, payload, response;
19063
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
19064
- while (1) {
19065
- switch (_context2.prev = _context2.next) {
19066
- case 0:
19067
- code = _ref4.code;
19038
+ code = _ref4.code, token = _ref4.token;
19068
19039
  payload = {
19069
19040
  code: code,
19070
- transaction: _this10.id,
19071
- token: _this10.savedCardsTempAuthToken
19041
+ token: token,
19042
+ transaction: _this9.id
19072
19043
  };
19073
- _context2.prev = 2;
19074
- _context2.next = 5;
19044
+ _context.prev = 2;
19045
+ _context.next = 5;
19075
19046
  return CardAPI$1.verifySavedCardsOtp(payload);
19076
19047
 
19077
19048
  case 5:
19078
- response = _context2.sent;
19079
- _this10.savedCardsToken = response.data.token;
19080
- return _context2.abrupt("return", response);
19049
+ response = _context.sent;
19050
+ _this9.savedCardsToken = response.data.token;
19051
+ return _context.abrupt("return", response);
19081
19052
 
19082
19053
  case 10:
19083
- _context2.prev = 10;
19084
- _context2.t0 = _context2["catch"](2);
19085
- _this10.savedCardsToken = null;
19086
- throw _context2.t0;
19054
+ _context.prev = 10;
19055
+ _context.t0 = _context["catch"](2);
19056
+ _this9.savedCardsToken = null;
19057
+ throw _context.t0;
19087
19058
 
19088
19059
  case 14:
19089
19060
  case "end":
19090
- return _context2.stop();
19061
+ return _context.stop();
19091
19062
  }
19092
19063
  }
19093
- }, _callee2, null, [[2, 10]]);
19064
+ }, _callee, null, [[2, 10]]);
19094
19065
  }))();
19095
19066
  },
19096
19067
  getSavedCards: function getSavedCards() {
@@ -20491,12 +20462,6 @@ var TransactionInstance = /*#__PURE__*/function () {
20491
20462
  this.planDetails = data.plan_details || null;
20492
20463
  this.exchangeRate = data.exchange_rate || null;
20493
20464
  this.savedCardsConfig = data.saved_cards || {};
20494
- /**
20495
- * savedCardsTempAuthToken: This token is issued on calling `authorize` and we pass it down to `authorize/verify` to ensure we only add users to saved cards only after a successful verification.
20496
- * savedCardsToken: This token is issued after verification and is used for all saved card auth requests.
20497
- */
20498
-
20499
- this.savedCardsTempAuthToken = null;
20500
20465
  this.savedCardsToken = null;
20501
20466
  /**
20502
20467
  * We initialize parameters we send to the API as empty strings
@@ -20768,6 +20733,21 @@ var ToolkitAPI = {
20768
20733
  resolvedCardBins[bin] = data;
20769
20734
  return data;
20770
20735
  });
20736
+ },
20737
+ resolveIPAddress: function resolveIPAddress(ipAddress) {
20738
+ var url = new URL("decision/resolve_ip/".concat(ipAddress), configToUse.paystackApiUrl).toString();
20739
+ var language = getLanguage();
20740
+
20741
+ var headers = _objectSpread2({}, language && {
20742
+ 'Accept-Language': language
20743
+ });
20744
+
20745
+ return axiosInstance.get(url, {
20746
+ headers: headers
20747
+ }).then(function (_ref2) {
20748
+ var data = _ref2.data;
20749
+ return data;
20750
+ });
20771
20751
  }
20772
20752
  };
20773
20753
 
@@ -20833,6 +20813,11 @@ var Toolkit = /*#__PURE__*/function () {
20833
20813
  value: function resolveCardBin(bin) {
20834
20814
  return ToolkitAPI.resolveCardBin(bin);
20835
20815
  }
20816
+ }, {
20817
+ key: "resolveIPAddress",
20818
+ value: function resolveIPAddress(ipAddress) {
20819
+ return ToolkitAPI.resolveIPAddress(ipAddress);
20820
+ }
20836
20821
  }]);
20837
20822
 
20838
20823
  return Toolkit;
package/lib/checkout.js CHANGED
@@ -19025,76 +19025,47 @@ var CardCharge = {
19025
19025
  return this.listenForCharge(listenerOptions, callback);
19026
19026
  },
19027
19027
  sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19028
+ return CardAPI$1.sendSavedCardsOTP({
19029
+ phone: phone,
19030
+ transaction: this.id
19031
+ });
19032
+ },
19033
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19028
19034
  var _this9 = this;
19029
19035
 
19030
19036
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19031
- var response;
19037
+ var code, token, payload, response;
19032
19038
  return regeneratorRuntime.wrap(function _callee$(_context) {
19033
19039
  while (1) {
19034
19040
  switch (_context.prev = _context.next) {
19035
19041
  case 0:
19036
- _context.prev = 0;
19037
- _context.next = 3;
19038
- return CardAPI$1.sendSavedCardsOTP({
19039
- phone: phone,
19040
- transaction: _this9.id
19041
- });
19042
-
19043
- case 3:
19044
- response = _context.sent;
19045
- _this9.savedCardsTempAuthToken = response.data.token;
19046
- return _context.abrupt("return", response);
19047
-
19048
- case 8:
19049
- _context.prev = 8;
19050
- _context.t0 = _context["catch"](0);
19051
- _this9.savedCardsTempAuthToken = null;
19052
- throw _context.t0;
19053
-
19054
- case 12:
19055
- case "end":
19056
- return _context.stop();
19057
- }
19058
- }
19059
- }, _callee, null, [[0, 8]]);
19060
- }))();
19061
- },
19062
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19063
- var _this10 = this;
19064
-
19065
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
19066
- var code, payload, response;
19067
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
19068
- while (1) {
19069
- switch (_context2.prev = _context2.next) {
19070
- case 0:
19071
- code = _ref4.code;
19042
+ code = _ref4.code, token = _ref4.token;
19072
19043
  payload = {
19073
19044
  code: code,
19074
- transaction: _this10.id,
19075
- token: _this10.savedCardsTempAuthToken
19045
+ token: token,
19046
+ transaction: _this9.id
19076
19047
  };
19077
- _context2.prev = 2;
19078
- _context2.next = 5;
19048
+ _context.prev = 2;
19049
+ _context.next = 5;
19079
19050
  return CardAPI$1.verifySavedCardsOtp(payload);
19080
19051
 
19081
19052
  case 5:
19082
- response = _context2.sent;
19083
- _this10.savedCardsToken = response.data.token;
19084
- return _context2.abrupt("return", response);
19053
+ response = _context.sent;
19054
+ _this9.savedCardsToken = response.data.token;
19055
+ return _context.abrupt("return", response);
19085
19056
 
19086
19057
  case 10:
19087
- _context2.prev = 10;
19088
- _context2.t0 = _context2["catch"](2);
19089
- _this10.savedCardsToken = null;
19090
- throw _context2.t0;
19058
+ _context.prev = 10;
19059
+ _context.t0 = _context["catch"](2);
19060
+ _this9.savedCardsToken = null;
19061
+ throw _context.t0;
19091
19062
 
19092
19063
  case 14:
19093
19064
  case "end":
19094
- return _context2.stop();
19065
+ return _context.stop();
19095
19066
  }
19096
19067
  }
19097
- }, _callee2, null, [[2, 10]]);
19068
+ }, _callee, null, [[2, 10]]);
19098
19069
  }))();
19099
19070
  },
19100
19071
  getSavedCards: function getSavedCards() {
@@ -20495,12 +20466,6 @@ var TransactionInstance = /*#__PURE__*/function () {
20495
20466
  this.planDetails = data.plan_details || null;
20496
20467
  this.exchangeRate = data.exchange_rate || null;
20497
20468
  this.savedCardsConfig = data.saved_cards || {};
20498
- /**
20499
- * savedCardsTempAuthToken: This token is issued on calling `authorize` and we pass it down to `authorize/verify` to ensure we only add users to saved cards only after a successful verification.
20500
- * savedCardsToken: This token is issued after verification and is used for all saved card auth requests.
20501
- */
20502
-
20503
- this.savedCardsTempAuthToken = null;
20504
20469
  this.savedCardsToken = null;
20505
20470
  /**
20506
20471
  * We initialize parameters we send to the API as empty strings
@@ -20772,6 +20737,21 @@ var ToolkitAPI = {
20772
20737
  resolvedCardBins[bin] = data;
20773
20738
  return data;
20774
20739
  });
20740
+ },
20741
+ resolveIPAddress: function resolveIPAddress(ipAddress) {
20742
+ var url = new URL("decision/resolve_ip/".concat(ipAddress), configToUse.paystackApiUrl).toString();
20743
+ var language = getLanguage();
20744
+
20745
+ var headers = _objectSpread2({}, language && {
20746
+ 'Accept-Language': language
20747
+ });
20748
+
20749
+ return axiosInstance.get(url, {
20750
+ headers: headers
20751
+ }).then(function (_ref2) {
20752
+ var data = _ref2.data;
20753
+ return data;
20754
+ });
20775
20755
  }
20776
20756
  };
20777
20757
 
@@ -20837,6 +20817,11 @@ var Toolkit = /*#__PURE__*/function () {
20837
20817
  value: function resolveCardBin(bin) {
20838
20818
  return ToolkitAPI.resolveCardBin(bin);
20839
20819
  }
20820
+ }, {
20821
+ key: "resolveIPAddress",
20822
+ value: function resolveIPAddress(ipAddress) {
20823
+ return ToolkitAPI.resolveIPAddress(ipAddress);
20824
+ }
20840
20825
  }]);
20841
20826
 
20842
20827
  return Toolkit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.23.2",
3
+ "version": "1.24.0-dev.1",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",