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

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
@@ -11516,6 +11516,24 @@ var Paystack = (function (exports) {
11516
11516
  }).then(function (response) {
11517
11517
  return response.data;
11518
11518
  });
11519
+ },
11520
+ verifyTransactionStatus: function verifyTransactionStatus(_ref2) {
11521
+ var reference = _ref2.reference,
11522
+ publicKey = _ref2.publicKey;
11523
+ var url = new URL("transaction/verify_status/".concat(reference)).toString();
11524
+ var language = getLanguage();
11525
+
11526
+ var headers = _objectSpread2({
11527
+ Authorization: "Bearer ".concat(publicKey)
11528
+ }, language && {
11529
+ 'Accept-Language': language
11530
+ });
11531
+
11532
+ return axiosInstance.get(url, {
11533
+ headers: headers
11534
+ }).then(function (response) {
11535
+ return ChargeResponses.parse(response.data);
11536
+ });
11519
11537
  }
11520
11538
  };
11521
11539
 
@@ -19024,47 +19042,76 @@ var Paystack = (function (exports) {
19024
19042
  return this.listenForCharge(listenerOptions, callback);
19025
19043
  },
19026
19044
  sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19027
- return CardAPI$1.sendSavedCardsOTP({
19028
- phone: phone,
19029
- transaction: this.id
19030
- });
19031
- },
19032
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19033
19045
  var _this9 = this;
19034
19046
 
19035
19047
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19036
- var code, token, payload, response;
19048
+ var response;
19037
19049
  return regeneratorRuntime.wrap(function _callee$(_context) {
19038
19050
  while (1) {
19039
19051
  switch (_context.prev = _context.next) {
19040
19052
  case 0:
19041
- code = _ref4.code, token = _ref4.token;
19053
+ _context.prev = 0;
19054
+ _context.next = 3;
19055
+ return CardAPI$1.sendSavedCardsOTP({
19056
+ phone: phone,
19057
+ transaction: _this9.id
19058
+ });
19059
+
19060
+ case 3:
19061
+ response = _context.sent;
19062
+ _this9.savedCardsTempAuthToken = response.data.token;
19063
+ return _context.abrupt("return", response);
19064
+
19065
+ case 8:
19066
+ _context.prev = 8;
19067
+ _context.t0 = _context["catch"](0);
19068
+ _this9.savedCardsTempAuthToken = null;
19069
+ throw _context.t0;
19070
+
19071
+ case 12:
19072
+ case "end":
19073
+ return _context.stop();
19074
+ }
19075
+ }
19076
+ }, _callee, null, [[0, 8]]);
19077
+ }))();
19078
+ },
19079
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19080
+ var _this10 = this;
19081
+
19082
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
19083
+ var code, payload, response;
19084
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
19085
+ while (1) {
19086
+ switch (_context2.prev = _context2.next) {
19087
+ case 0:
19088
+ code = _ref4.code;
19042
19089
  payload = {
19043
19090
  code: code,
19044
- token: token,
19045
- transaction: _this9.id
19091
+ transaction: _this10.id,
19092
+ token: _this10.savedCardsTempAuthToken
19046
19093
  };
19047
- _context.prev = 2;
19048
- _context.next = 5;
19094
+ _context2.prev = 2;
19095
+ _context2.next = 5;
19049
19096
  return CardAPI$1.verifySavedCardsOtp(payload);
19050
19097
 
19051
19098
  case 5:
19052
- response = _context.sent;
19053
- _this9.savedCardsToken = response.data.token;
19054
- return _context.abrupt("return", response);
19099
+ response = _context2.sent;
19100
+ _this10.savedCardsToken = response.data.token;
19101
+ return _context2.abrupt("return", response);
19055
19102
 
19056
19103
  case 10:
19057
- _context.prev = 10;
19058
- _context.t0 = _context["catch"](2);
19059
- _this9.savedCardsToken = null;
19060
- throw _context.t0;
19104
+ _context2.prev = 10;
19105
+ _context2.t0 = _context2["catch"](2);
19106
+ _this10.savedCardsToken = null;
19107
+ throw _context2.t0;
19061
19108
 
19062
19109
  case 14:
19063
19110
  case "end":
19064
- return _context.stop();
19111
+ return _context2.stop();
19065
19112
  }
19066
19113
  }
19067
- }, _callee, null, [[2, 10]]);
19114
+ }, _callee2, null, [[2, 10]]);
19068
19115
  }))();
19069
19116
  },
19070
19117
  getSavedCards: function getSavedCards() {
@@ -20465,6 +20512,12 @@ var Paystack = (function (exports) {
20465
20512
  this.planDetails = data.plan_details || null;
20466
20513
  this.exchangeRate = data.exchange_rate || null;
20467
20514
  this.savedCardsConfig = data.saved_cards || {};
20515
+ /**
20516
+ * 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.
20517
+ * savedCardsToken: This token is issued after verification and is used for all saved card auth requests.
20518
+ */
20519
+
20520
+ this.savedCardsTempAuthToken = null;
20468
20521
  this.savedCardsToken = null;
20469
20522
  /**
20470
20523
  * We initialize parameters we send to the API as empty strings
@@ -20652,6 +20705,12 @@ var Paystack = (function (exports) {
20652
20705
  }
20653
20706
  }, _callee4);
20654
20707
  }))();
20708
+ },
20709
+ verifyTransactionStatus: function verifyTransactionStatus(reference, publicKey) {
20710
+ return TransactionAPI.verifyTransactionStatus({
20711
+ reference: reference,
20712
+ publicKey: publicKey
20713
+ });
20655
20714
  }
20656
20715
  };
20657
20716
 
package/es/checkout.js CHANGED
@@ -11513,6 +11513,24 @@ var TransactionAPI = {
11513
11513
  }).then(function (response) {
11514
11514
  return response.data;
11515
11515
  });
11516
+ },
11517
+ verifyTransactionStatus: function verifyTransactionStatus(_ref2) {
11518
+ var reference = _ref2.reference,
11519
+ publicKey = _ref2.publicKey;
11520
+ var url = new URL("transaction/verify_status/".concat(reference)).toString();
11521
+ var language = getLanguage();
11522
+
11523
+ var headers = _objectSpread2({
11524
+ Authorization: "Bearer ".concat(publicKey)
11525
+ }, language && {
11526
+ 'Accept-Language': language
11527
+ });
11528
+
11529
+ return axiosInstance.get(url, {
11530
+ headers: headers
11531
+ }).then(function (response) {
11532
+ return ChargeResponses.parse(response.data);
11533
+ });
11516
11534
  }
11517
11535
  };
11518
11536
 
@@ -19021,47 +19039,76 @@ var CardCharge = {
19021
19039
  return this.listenForCharge(listenerOptions, callback);
19022
19040
  },
19023
19041
  sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19024
- return CardAPI$1.sendSavedCardsOTP({
19025
- phone: phone,
19026
- transaction: this.id
19027
- });
19028
- },
19029
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19030
19042
  var _this9 = this;
19031
19043
 
19032
19044
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19033
- var code, token, payload, response;
19045
+ var response;
19034
19046
  return regeneratorRuntime.wrap(function _callee$(_context) {
19035
19047
  while (1) {
19036
19048
  switch (_context.prev = _context.next) {
19037
19049
  case 0:
19038
- code = _ref4.code, token = _ref4.token;
19050
+ _context.prev = 0;
19051
+ _context.next = 3;
19052
+ return CardAPI$1.sendSavedCardsOTP({
19053
+ phone: phone,
19054
+ transaction: _this9.id
19055
+ });
19056
+
19057
+ case 3:
19058
+ response = _context.sent;
19059
+ _this9.savedCardsTempAuthToken = response.data.token;
19060
+ return _context.abrupt("return", response);
19061
+
19062
+ case 8:
19063
+ _context.prev = 8;
19064
+ _context.t0 = _context["catch"](0);
19065
+ _this9.savedCardsTempAuthToken = null;
19066
+ throw _context.t0;
19067
+
19068
+ case 12:
19069
+ case "end":
19070
+ return _context.stop();
19071
+ }
19072
+ }
19073
+ }, _callee, null, [[0, 8]]);
19074
+ }))();
19075
+ },
19076
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19077
+ var _this10 = this;
19078
+
19079
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
19080
+ var code, payload, response;
19081
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
19082
+ while (1) {
19083
+ switch (_context2.prev = _context2.next) {
19084
+ case 0:
19085
+ code = _ref4.code;
19039
19086
  payload = {
19040
19087
  code: code,
19041
- token: token,
19042
- transaction: _this9.id
19088
+ transaction: _this10.id,
19089
+ token: _this10.savedCardsTempAuthToken
19043
19090
  };
19044
- _context.prev = 2;
19045
- _context.next = 5;
19091
+ _context2.prev = 2;
19092
+ _context2.next = 5;
19046
19093
  return CardAPI$1.verifySavedCardsOtp(payload);
19047
19094
 
19048
19095
  case 5:
19049
- response = _context.sent;
19050
- _this9.savedCardsToken = response.data.token;
19051
- return _context.abrupt("return", response);
19096
+ response = _context2.sent;
19097
+ _this10.savedCardsToken = response.data.token;
19098
+ return _context2.abrupt("return", response);
19052
19099
 
19053
19100
  case 10:
19054
- _context.prev = 10;
19055
- _context.t0 = _context["catch"](2);
19056
- _this9.savedCardsToken = null;
19057
- throw _context.t0;
19101
+ _context2.prev = 10;
19102
+ _context2.t0 = _context2["catch"](2);
19103
+ _this10.savedCardsToken = null;
19104
+ throw _context2.t0;
19058
19105
 
19059
19106
  case 14:
19060
19107
  case "end":
19061
- return _context.stop();
19108
+ return _context2.stop();
19062
19109
  }
19063
19110
  }
19064
- }, _callee, null, [[2, 10]]);
19111
+ }, _callee2, null, [[2, 10]]);
19065
19112
  }))();
19066
19113
  },
19067
19114
  getSavedCards: function getSavedCards() {
@@ -20462,6 +20509,12 @@ var TransactionInstance = /*#__PURE__*/function () {
20462
20509
  this.planDetails = data.plan_details || null;
20463
20510
  this.exchangeRate = data.exchange_rate || null;
20464
20511
  this.savedCardsConfig = data.saved_cards || {};
20512
+ /**
20513
+ * 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.
20514
+ * savedCardsToken: This token is issued after verification and is used for all saved card auth requests.
20515
+ */
20516
+
20517
+ this.savedCardsTempAuthToken = null;
20465
20518
  this.savedCardsToken = null;
20466
20519
  /**
20467
20520
  * We initialize parameters we send to the API as empty strings
@@ -20649,6 +20702,12 @@ var Transaction = {
20649
20702
  }
20650
20703
  }, _callee4);
20651
20704
  }))();
20705
+ },
20706
+ verifyTransactionStatus: function verifyTransactionStatus(reference, publicKey) {
20707
+ return TransactionAPI.verifyTransactionStatus({
20708
+ reference: reference,
20709
+ publicKey: publicKey
20710
+ });
20652
20711
  }
20653
20712
  };
20654
20713
 
package/lib/checkout.js CHANGED
@@ -11517,6 +11517,24 @@ var TransactionAPI = {
11517
11517
  }).then(function (response) {
11518
11518
  return response.data;
11519
11519
  });
11520
+ },
11521
+ verifyTransactionStatus: function verifyTransactionStatus(_ref2) {
11522
+ var reference = _ref2.reference,
11523
+ publicKey = _ref2.publicKey;
11524
+ var url = new URL("transaction/verify_status/".concat(reference)).toString();
11525
+ var language = getLanguage();
11526
+
11527
+ var headers = _objectSpread2({
11528
+ Authorization: "Bearer ".concat(publicKey)
11529
+ }, language && {
11530
+ 'Accept-Language': language
11531
+ });
11532
+
11533
+ return axiosInstance.get(url, {
11534
+ headers: headers
11535
+ }).then(function (response) {
11536
+ return ChargeResponses.parse(response.data);
11537
+ });
11520
11538
  }
11521
11539
  };
11522
11540
 
@@ -19025,47 +19043,76 @@ var CardCharge = {
19025
19043
  return this.listenForCharge(listenerOptions, callback);
19026
19044
  },
19027
19045
  sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19028
- return CardAPI$1.sendSavedCardsOTP({
19029
- phone: phone,
19030
- transaction: this.id
19031
- });
19032
- },
19033
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19034
19046
  var _this9 = this;
19035
19047
 
19036
19048
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19037
- var code, token, payload, response;
19049
+ var response;
19038
19050
  return regeneratorRuntime.wrap(function _callee$(_context) {
19039
19051
  while (1) {
19040
19052
  switch (_context.prev = _context.next) {
19041
19053
  case 0:
19042
- code = _ref4.code, token = _ref4.token;
19054
+ _context.prev = 0;
19055
+ _context.next = 3;
19056
+ return CardAPI$1.sendSavedCardsOTP({
19057
+ phone: phone,
19058
+ transaction: _this9.id
19059
+ });
19060
+
19061
+ case 3:
19062
+ response = _context.sent;
19063
+ _this9.savedCardsTempAuthToken = response.data.token;
19064
+ return _context.abrupt("return", response);
19065
+
19066
+ case 8:
19067
+ _context.prev = 8;
19068
+ _context.t0 = _context["catch"](0);
19069
+ _this9.savedCardsTempAuthToken = null;
19070
+ throw _context.t0;
19071
+
19072
+ case 12:
19073
+ case "end":
19074
+ return _context.stop();
19075
+ }
19076
+ }
19077
+ }, _callee, null, [[0, 8]]);
19078
+ }))();
19079
+ },
19080
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19081
+ var _this10 = this;
19082
+
19083
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
19084
+ var code, payload, response;
19085
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
19086
+ while (1) {
19087
+ switch (_context2.prev = _context2.next) {
19088
+ case 0:
19089
+ code = _ref4.code;
19043
19090
  payload = {
19044
19091
  code: code,
19045
- token: token,
19046
- transaction: _this9.id
19092
+ transaction: _this10.id,
19093
+ token: _this10.savedCardsTempAuthToken
19047
19094
  };
19048
- _context.prev = 2;
19049
- _context.next = 5;
19095
+ _context2.prev = 2;
19096
+ _context2.next = 5;
19050
19097
  return CardAPI$1.verifySavedCardsOtp(payload);
19051
19098
 
19052
19099
  case 5:
19053
- response = _context.sent;
19054
- _this9.savedCardsToken = response.data.token;
19055
- return _context.abrupt("return", response);
19100
+ response = _context2.sent;
19101
+ _this10.savedCardsToken = response.data.token;
19102
+ return _context2.abrupt("return", response);
19056
19103
 
19057
19104
  case 10:
19058
- _context.prev = 10;
19059
- _context.t0 = _context["catch"](2);
19060
- _this9.savedCardsToken = null;
19061
- throw _context.t0;
19105
+ _context2.prev = 10;
19106
+ _context2.t0 = _context2["catch"](2);
19107
+ _this10.savedCardsToken = null;
19108
+ throw _context2.t0;
19062
19109
 
19063
19110
  case 14:
19064
19111
  case "end":
19065
- return _context.stop();
19112
+ return _context2.stop();
19066
19113
  }
19067
19114
  }
19068
- }, _callee, null, [[2, 10]]);
19115
+ }, _callee2, null, [[2, 10]]);
19069
19116
  }))();
19070
19117
  },
19071
19118
  getSavedCards: function getSavedCards() {
@@ -20466,6 +20513,12 @@ var TransactionInstance = /*#__PURE__*/function () {
20466
20513
  this.planDetails = data.plan_details || null;
20467
20514
  this.exchangeRate = data.exchange_rate || null;
20468
20515
  this.savedCardsConfig = data.saved_cards || {};
20516
+ /**
20517
+ * 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.
20518
+ * savedCardsToken: This token is issued after verification and is used for all saved card auth requests.
20519
+ */
20520
+
20521
+ this.savedCardsTempAuthToken = null;
20469
20522
  this.savedCardsToken = null;
20470
20523
  /**
20471
20524
  * We initialize parameters we send to the API as empty strings
@@ -20653,6 +20706,12 @@ var Transaction = {
20653
20706
  }
20654
20707
  }, _callee4);
20655
20708
  }))();
20709
+ },
20710
+ verifyTransactionStatus: function verifyTransactionStatus(reference, publicKey) {
20711
+ return TransactionAPI.verifyTransactionStatus({
20712
+ reference: reference,
20713
+ publicKey: publicKey
20714
+ });
20656
20715
  }
20657
20716
  };
20658
20717
 
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.3",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",