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