@paystack/checkout-js 1.21.0-dev.7 → 1.21.0

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
@@ -6403,16 +6403,14 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6403
6403
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6404
6404
  paystackApiUrl: 'https://studio-api.paystack.co/',
6405
6405
  pusherKey: '1c7b262ee18455815893',
6406
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6407
- savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6406
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6408
6407
  });
6409
6408
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6410
6409
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6411
6410
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6412
6411
  paystackApiUrl: 'https://studio-api.paystack.co/',
6413
6412
  pusherKey: '1c7b262ee18455815893',
6414
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6415
- savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6413
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6416
6414
  });
6417
6415
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6418
6416
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -18666,208 +18664,6 @@ var CardAPI$1 = {
18666
18664
  }).then(function (response) {
18667
18665
  return ChargeResponses.parse(response.data);
18668
18666
  });
18669
- },
18670
- sendSavedCardsOTP: function sendSavedCardsOTP(email) {
18671
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18672
- var url, language, headers, _yield$axiosInstance$, data;
18673
-
18674
- return regeneratorRuntime.wrap(function _callee$(_context) {
18675
- while (1) {
18676
- switch (_context.prev = _context.next) {
18677
- case 0:
18678
- url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
18679
- language = getLanguage();
18680
- headers = _objectSpread2({}, language && {
18681
- 'Accept-Language': language
18682
- });
18683
- _context.next = 5;
18684
- return axiosInstance.post(url, {
18685
- email: email
18686
- }, {
18687
- headers: headers
18688
- });
18689
-
18690
- case 5:
18691
- _yield$axiosInstance$ = _context.sent;
18692
- data = _yield$axiosInstance$.data;
18693
- return _context.abrupt("return", data);
18694
-
18695
- case 8:
18696
- case "end":
18697
- return _context.stop();
18698
- }
18699
- }
18700
- }, _callee);
18701
- }))();
18702
- },
18703
- addUserToSavedCards: function addUserToSavedCards(_ref6) {
18704
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
18705
- var phone, email, url, language, headers, data, response;
18706
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
18707
- while (1) {
18708
- switch (_context2.prev = _context2.next) {
18709
- case 0:
18710
- phone = _ref6.phone, email = _ref6.email;
18711
- url = new URL('/user', configToUse.savedCardsApiUrl).toString();
18712
- language = getLanguage();
18713
- headers = _objectSpread2({}, language && {
18714
- 'Accept-Language': language
18715
- });
18716
- data = {
18717
- phone: phone,
18718
- email: email
18719
- };
18720
- _context2.next = 7;
18721
- return axiosInstance.post(url, data, {
18722
- headers: headers
18723
- });
18724
-
18725
- case 7:
18726
- response = _context2.sent;
18727
- return _context2.abrupt("return", response.data);
18728
-
18729
- case 9:
18730
- case "end":
18731
- return _context2.stop();
18732
- }
18733
- }
18734
- }, _callee2);
18735
- }))();
18736
- },
18737
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18738
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
18739
- var code, transaction, url, language, headers, data, response;
18740
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
18741
- while (1) {
18742
- switch (_context3.prev = _context3.next) {
18743
- case 0:
18744
- code = _ref7.code, transaction = _ref7.transaction;
18745
- url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18746
- language = getLanguage();
18747
- headers = _objectSpread2({}, language && {
18748
- 'Accept-Language': language
18749
- });
18750
- data = {
18751
- code: code,
18752
- transaction: transaction
18753
- };
18754
- _context3.next = 7;
18755
- return axiosInstance.post(url, data, {
18756
- headers: headers
18757
- });
18758
-
18759
- case 7:
18760
- response = _context3.sent;
18761
- return _context3.abrupt("return", response.data);
18762
-
18763
- case 9:
18764
- case "end":
18765
- return _context3.stop();
18766
- }
18767
- }
18768
- }, _callee3);
18769
- }))();
18770
- },
18771
- getSavedCards: function getSavedCards(_ref8) {
18772
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
18773
- var token, url, language, headers, response;
18774
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
18775
- while (1) {
18776
- switch (_context4.prev = _context4.next) {
18777
- case 0:
18778
- token = _ref8.token;
18779
- url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
18780
- language = getLanguage();
18781
- headers = _objectSpread2({
18782
- Authorization: "Bearer ".concat(token),
18783
- 'jwt-auth': true
18784
- }, language && {
18785
- 'Accept-Language': language
18786
- });
18787
- _context4.next = 6;
18788
- return axiosInstance.get(url, {
18789
- headers: headers
18790
- });
18791
-
18792
- case 6:
18793
- response = _context4.sent;
18794
- return _context4.abrupt("return", response.data);
18795
-
18796
- case 8:
18797
- case "end":
18798
- return _context4.stop();
18799
- }
18800
- }
18801
- }, _callee4);
18802
- }))();
18803
- },
18804
- deleteSavedCard: function deleteSavedCard(_ref9) {
18805
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
18806
- var cardCode, token, url, language, headers, response;
18807
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
18808
- while (1) {
18809
- switch (_context5.prev = _context5.next) {
18810
- case 0:
18811
- cardCode = _ref9.cardCode, token = _ref9.token;
18812
- url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
18813
- language = getLanguage();
18814
- headers = _objectSpread2({
18815
- Authorization: "Bearer ".concat(token),
18816
- 'jwt-auth': true
18817
- }, language && {
18818
- 'Accept-Language': language
18819
- });
18820
- _context5.next = 6;
18821
- return axiosInstance.delete(url, {
18822
- headers: headers
18823
- });
18824
-
18825
- case 6:
18826
- response = _context5.sent;
18827
- return _context5.abrupt("return", response.data);
18828
-
18829
- case 8:
18830
- case "end":
18831
- return _context5.stop();
18832
- }
18833
- }
18834
- }, _callee5);
18835
- }))();
18836
- },
18837
- chargeSavedCard: function chargeSavedCard(_ref10) {
18838
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
18839
- var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18840
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
18841
- while (1) {
18842
- switch (_context6.prev = _context6.next) {
18843
- case 0:
18844
- token = _ref10.token, device = _ref10.device, cardCode = _ref10.cardCode, transaction = _ref10.transaction, selectedCurrency = _ref10.selectedCurrency;
18845
- url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18846
- language = getLanguage();
18847
- headers = _objectSpread2({
18848
- Authorization: "Bearer ".concat(token),
18849
- 'jwt-auth': true
18850
- }, language && {
18851
- 'Accept-Language': language
18852
- });
18853
- data = {
18854
- device: device,
18855
- transaction: transaction,
18856
- selected_currency: selectedCurrency
18857
- };
18858
- return _context6.abrupt("return", axiosInstance.post(url, data, {
18859
- headers: headers
18860
- }).then(function (response) {
18861
- return ChargeResponses.parse(response.data);
18862
- }));
18863
-
18864
- case 6:
18865
- case "end":
18866
- return _context6.stop();
18867
- }
18868
- }
18869
- }, _callee6);
18870
- }))();
18871
18667
  }
18872
18668
  };
18873
18669
 
@@ -19048,74 +18844,6 @@ var CardCharge = {
19048
18844
  paymentMethod: paymentMethod$4
19049
18845
  };
19050
18846
  return this.listenForCharge(listenerOptions, callback);
19051
- },
19052
- sendSavedCardsOTP: function sendSavedCardsOTP() {
19053
- return CardAPI$1.sendSavedCardsOTP(this.email);
19054
- },
19055
- addUserToSavedCards: function addUserToSavedCards(_ref4) {
19056
- var phone = _ref4.phone;
19057
- return CardAPI$1.addUserToSavedCards({
19058
- phone: phone,
19059
- email: this.email
19060
- });
19061
- },
19062
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
19063
- var _this9 = this;
19064
-
19065
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19066
- var code, payload, response;
19067
- return regeneratorRuntime.wrap(function _callee$(_context) {
19068
- while (1) {
19069
- switch (_context.prev = _context.next) {
19070
- case 0:
19071
- code = _ref5.code;
19072
- payload = {
19073
- code: code,
19074
- transaction: _this9.id
19075
- };
19076
- _context.prev = 2;
19077
- _context.next = 5;
19078
- return CardAPI$1.verifySavedCardsOtp(payload);
19079
-
19080
- case 5:
19081
- response = _context.sent;
19082
- _this9.savedCardsToken = response.data.token;
19083
- return _context.abrupt("return", response);
19084
-
19085
- case 10:
19086
- _context.prev = 10;
19087
- _context.t0 = _context["catch"](2);
19088
- _this9.savedCardsToken = null;
19089
- throw _context.t0;
19090
-
19091
- case 14:
19092
- case "end":
19093
- return _context.stop();
19094
- }
19095
- }
19096
- }, _callee, null, [[2, 10]]);
19097
- }))();
19098
- },
19099
- getSavedCards: function getSavedCards() {
19100
- return CardAPI$1.getSavedCards({
19101
- token: this.savedCardsToken
19102
- });
19103
- },
19104
- deleteSavedCard: function deleteSavedCard(cardCode) {
19105
- return CardAPI$1.deleteSavedCard({
19106
- cardCode: cardCode,
19107
- token: this.savedCardsToken
19108
- });
19109
- },
19110
- chargeSavedCard: function chargeSavedCard(_ref6) {
19111
- var cardCode = _ref6.cardCode;
19112
- return CardAPI$1.chargeSavedCard({
19113
- cardCode: cardCode,
19114
- transaction: this.id,
19115
- token: this.savedCardsToken,
19116
- device: this.deviceFingerprint,
19117
- selectedCurrency: this.currency
19118
- });
19119
18847
  }
19120
18848
  };
19121
18849
 
@@ -20387,17 +20115,6 @@ var AnalyticsFunctions = {
20387
20115
  });
20388
20116
  return this.saveLog();
20389
20117
  },
20390
- logTransactionCurrencySwitch: function logTransactionCurrencySwitch(_ref3) {
20391
- var currency = _ref3.currency,
20392
- isUserAction = _ref3.isUserAction;
20393
- var prefix = isUserAction ? 'User switched' : 'Switched';
20394
- this.log.history.push({
20395
- type: 'action',
20396
- message: "".concat(prefix, " transaction currency to ").concat(currency),
20397
- time: this.getTimeSpent()
20398
- });
20399
- return this.saveLog();
20400
- },
20401
20118
  saveLog: function saveLog() {
20402
20119
  return AnalyticsAPI.saveLog(this.id, this.merchant.key, this.log);
20403
20120
  },
@@ -20455,8 +20172,6 @@ var TransactionInstance = /*#__PURE__*/function () {
20455
20172
  this.subscription = data.subscription || null;
20456
20173
  this.planDetails = data.plan_details || null;
20457
20174
  this.exchangeRate = data.exchange_rate || null;
20458
- this.savedCardsConfig = data.saved_cards || {};
20459
- this.savedCardsToken = null;
20460
20175
  /**
20461
20176
  * We initialize parameters we send to the API as empty strings
20462
20177
  * when we don't have them instead of null because the API expects
@@ -20727,21 +20442,6 @@ var ToolkitAPI = {
20727
20442
  resolvedCardBins[bin] = data;
20728
20443
  return data;
20729
20444
  });
20730
- },
20731
- resolveIPAddress: function resolveIPAddress(ipAddress) {
20732
- var url = new URL("decision/resolve_ip/".concat(ipAddress), configToUse.paystackApiUrl).toString();
20733
- var language = getLanguage();
20734
-
20735
- var headers = _objectSpread2({}, language && {
20736
- 'Accept-Language': language
20737
- });
20738
-
20739
- return axiosInstance.get(url, {
20740
- headers: headers
20741
- }).then(function (_ref2) {
20742
- var data = _ref2.data;
20743
- return data;
20744
- });
20745
20445
  }
20746
20446
  };
20747
20447
 
@@ -20807,11 +20507,6 @@ var Toolkit = /*#__PURE__*/function () {
20807
20507
  value: function resolveCardBin(bin) {
20808
20508
  return ToolkitAPI.resolveCardBin(bin);
20809
20509
  }
20810
- }, {
20811
- key: "resolveIPAddress",
20812
- value: function resolveIPAddress(ipAddress) {
20813
- return ToolkitAPI.resolveIPAddress(ipAddress);
20814
- }
20815
20510
  }]);
20816
20511
 
20817
20512
  return Toolkit;