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

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
@@ -19024,47 +19024,76 @@ var Paystack = (function (exports) {
19024
19024
  return this.listenForCharge(listenerOptions, callback);
19025
19025
  },
19026
19026
  sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19027
- return CardAPI$1.sendSavedCardsOTP({
19028
- phone: phone,
19029
- transaction: this.id
19030
- });
19031
- },
19032
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19033
19027
  var _this9 = this;
19034
19028
 
19035
19029
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19036
- var code, token, payload, response;
19030
+ var response;
19037
19031
  return regeneratorRuntime.wrap(function _callee$(_context) {
19038
19032
  while (1) {
19039
19033
  switch (_context.prev = _context.next) {
19040
19034
  case 0:
19041
- code = _ref4.code, token = _ref4.token;
19035
+ _context.prev = 0;
19036
+ _context.next = 3;
19037
+ return CardAPI$1.sendSavedCardsOTP({
19038
+ phone: phone,
19039
+ transaction: _this9.id
19040
+ });
19041
+
19042
+ case 3:
19043
+ response = _context.sent;
19044
+ _this9.savedCardsTempAuthToken = response.data.token;
19045
+ return _context.abrupt("return", response);
19046
+
19047
+ case 8:
19048
+ _context.prev = 8;
19049
+ _context.t0 = _context["catch"](0);
19050
+ _this9.savedCardsTempAuthToken = null;
19051
+ throw _context.t0;
19052
+
19053
+ case 12:
19054
+ case "end":
19055
+ return _context.stop();
19056
+ }
19057
+ }
19058
+ }, _callee, null, [[0, 8]]);
19059
+ }))();
19060
+ },
19061
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19062
+ var _this10 = this;
19063
+
19064
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
19065
+ var code, payload, response;
19066
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
19067
+ while (1) {
19068
+ switch (_context2.prev = _context2.next) {
19069
+ case 0:
19070
+ code = _ref4.code;
19042
19071
  payload = {
19043
19072
  code: code,
19044
- token: token,
19045
- transaction: _this9.id
19073
+ transaction: _this10.id,
19074
+ token: _this10.savedCardsTempAuthToken
19046
19075
  };
19047
- _context.prev = 2;
19048
- _context.next = 5;
19076
+ _context2.prev = 2;
19077
+ _context2.next = 5;
19049
19078
  return CardAPI$1.verifySavedCardsOtp(payload);
19050
19079
 
19051
19080
  case 5:
19052
- response = _context.sent;
19053
- _this9.savedCardsToken = response.data.token;
19054
- return _context.abrupt("return", response);
19081
+ response = _context2.sent;
19082
+ _this10.savedCardsToken = response.data.token;
19083
+ return _context2.abrupt("return", response);
19055
19084
 
19056
19085
  case 10:
19057
- _context.prev = 10;
19058
- _context.t0 = _context["catch"](2);
19059
- _this9.savedCardsToken = null;
19060
- throw _context.t0;
19086
+ _context2.prev = 10;
19087
+ _context2.t0 = _context2["catch"](2);
19088
+ _this10.savedCardsToken = null;
19089
+ throw _context2.t0;
19061
19090
 
19062
19091
  case 14:
19063
19092
  case "end":
19064
- return _context.stop();
19093
+ return _context2.stop();
19065
19094
  }
19066
19095
  }
19067
- }, _callee, null, [[2, 10]]);
19096
+ }, _callee2, null, [[2, 10]]);
19068
19097
  }))();
19069
19098
  },
19070
19099
  getSavedCards: function getSavedCards() {
@@ -20465,6 +20494,12 @@ var Paystack = (function (exports) {
20465
20494
  this.planDetails = data.plan_details || null;
20466
20495
  this.exchangeRate = data.exchange_rate || null;
20467
20496
  this.savedCardsConfig = data.saved_cards || {};
20497
+ /**
20498
+ * 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.
20499
+ * savedCardsToken: This token is issued after verification and is used for all saved card auth requests.
20500
+ */
20501
+
20502
+ this.savedCardsTempAuthToken = null;
20468
20503
  this.savedCardsToken = null;
20469
20504
  /**
20470
20505
  * We initialize parameters we send to the API as empty strings
package/es/checkout.js CHANGED
@@ -19021,47 +19021,76 @@ 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) {
19030
19024
  var _this9 = this;
19031
19025
 
19032
19026
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19033
- var code, token, payload, response;
19027
+ var response;
19034
19028
  return regeneratorRuntime.wrap(function _callee$(_context) {
19035
19029
  while (1) {
19036
19030
  switch (_context.prev = _context.next) {
19037
19031
  case 0:
19038
- code = _ref4.code, token = _ref4.token;
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;
19039
19068
  payload = {
19040
19069
  code: code,
19041
- token: token,
19042
- transaction: _this9.id
19070
+ transaction: _this10.id,
19071
+ token: _this10.savedCardsTempAuthToken
19043
19072
  };
19044
- _context.prev = 2;
19045
- _context.next = 5;
19073
+ _context2.prev = 2;
19074
+ _context2.next = 5;
19046
19075
  return CardAPI$1.verifySavedCardsOtp(payload);
19047
19076
 
19048
19077
  case 5:
19049
- response = _context.sent;
19050
- _this9.savedCardsToken = response.data.token;
19051
- return _context.abrupt("return", response);
19078
+ response = _context2.sent;
19079
+ _this10.savedCardsToken = response.data.token;
19080
+ return _context2.abrupt("return", response);
19052
19081
 
19053
19082
  case 10:
19054
- _context.prev = 10;
19055
- _context.t0 = _context["catch"](2);
19056
- _this9.savedCardsToken = null;
19057
- throw _context.t0;
19083
+ _context2.prev = 10;
19084
+ _context2.t0 = _context2["catch"](2);
19085
+ _this10.savedCardsToken = null;
19086
+ throw _context2.t0;
19058
19087
 
19059
19088
  case 14:
19060
19089
  case "end":
19061
- return _context.stop();
19090
+ return _context2.stop();
19062
19091
  }
19063
19092
  }
19064
- }, _callee, null, [[2, 10]]);
19093
+ }, _callee2, null, [[2, 10]]);
19065
19094
  }))();
19066
19095
  },
19067
19096
  getSavedCards: function getSavedCards() {
@@ -20462,6 +20491,12 @@ var TransactionInstance = /*#__PURE__*/function () {
20462
20491
  this.planDetails = data.plan_details || null;
20463
20492
  this.exchangeRate = data.exchange_rate || null;
20464
20493
  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;
20465
20500
  this.savedCardsToken = null;
20466
20501
  /**
20467
20502
  * We initialize parameters we send to the API as empty strings
package/lib/checkout.js CHANGED
@@ -19025,47 +19025,76 @@ 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) {
19034
19028
  var _this9 = this;
19035
19029
 
19036
19030
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19037
- var code, token, payload, response;
19031
+ var response;
19038
19032
  return regeneratorRuntime.wrap(function _callee$(_context) {
19039
19033
  while (1) {
19040
19034
  switch (_context.prev = _context.next) {
19041
19035
  case 0:
19042
- code = _ref4.code, token = _ref4.token;
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;
19043
19072
  payload = {
19044
19073
  code: code,
19045
- token: token,
19046
- transaction: _this9.id
19074
+ transaction: _this10.id,
19075
+ token: _this10.savedCardsTempAuthToken
19047
19076
  };
19048
- _context.prev = 2;
19049
- _context.next = 5;
19077
+ _context2.prev = 2;
19078
+ _context2.next = 5;
19050
19079
  return CardAPI$1.verifySavedCardsOtp(payload);
19051
19080
 
19052
19081
  case 5:
19053
- response = _context.sent;
19054
- _this9.savedCardsToken = response.data.token;
19055
- return _context.abrupt("return", response);
19082
+ response = _context2.sent;
19083
+ _this10.savedCardsToken = response.data.token;
19084
+ return _context2.abrupt("return", response);
19056
19085
 
19057
19086
  case 10:
19058
- _context.prev = 10;
19059
- _context.t0 = _context["catch"](2);
19060
- _this9.savedCardsToken = null;
19061
- throw _context.t0;
19087
+ _context2.prev = 10;
19088
+ _context2.t0 = _context2["catch"](2);
19089
+ _this10.savedCardsToken = null;
19090
+ throw _context2.t0;
19062
19091
 
19063
19092
  case 14:
19064
19093
  case "end":
19065
- return _context.stop();
19094
+ return _context2.stop();
19066
19095
  }
19067
19096
  }
19068
- }, _callee, null, [[2, 10]]);
19097
+ }, _callee2, null, [[2, 10]]);
19069
19098
  }))();
19070
19099
  },
19071
19100
  getSavedCards: function getSavedCards() {
@@ -20466,6 +20495,12 @@ var TransactionInstance = /*#__PURE__*/function () {
20466
20495
  this.planDetails = data.plan_details || null;
20467
20496
  this.exchangeRate = data.exchange_rate || null;
20468
20497
  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;
20469
20504
  this.savedCardsToken = null;
20470
20505
  /**
20471
20506
  * We initialize parameters we send to the API as empty strings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.24.0-dev.1",
3
+ "version": "1.24.0-dev.2",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",