@paystack/checkout-js 1.18.0 → 1.19.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/es/checkout.js CHANGED
@@ -6403,14 +6403,16 @@ 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'
6406
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6407
+ savedCardsApiUrl: 'https://saved-cards-api.private.paystack.studio/'
6407
6408
  });
6408
6409
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6409
6410
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6410
6411
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6411
6412
  paystackApiUrl: 'https://studio-api.paystack.co/',
6412
6413
  pusherKey: '1c7b262ee18455815893',
6413
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6414
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6415
+ savedCardsApiUrl: 'https://saved-cards-api.private.paystack.studio/'
6414
6416
  });
6415
6417
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6416
6418
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -18564,6 +18566,45 @@ var CardAPI = {
18564
18566
  }).then(function (response) {
18565
18567
  return ChargeResponses.parse(response.data);
18566
18568
  });
18569
+ },
18570
+ requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
18571
+ var url = new URL("/authorize/".concat(phoneNumber), configToUse.savedCardsApiUrl).toString();
18572
+ var language = getLanguage();
18573
+
18574
+ var headers = _objectSpread2({}, language && {
18575
+ 'Accept-Language': language
18576
+ });
18577
+
18578
+ return axiosInstance.post(url, {
18579
+ headers: headers
18580
+ }).then(function (_ref6) {
18581
+ var data = _ref6.data;
18582
+ return data;
18583
+ });
18584
+ },
18585
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18586
+ var code = _ref7.code,
18587
+ phone = _ref7.phone,
18588
+ transaction = _ref7.transaction;
18589
+ var url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18590
+ var language = getLanguage();
18591
+
18592
+ var headers = _objectSpread2({
18593
+ 'Content-Type': 'application/x-www-form-urlencoded'
18594
+ }, language && {
18595
+ 'Accept-Language': language
18596
+ });
18597
+
18598
+ var urlEncodedData = formUrlencoded({
18599
+ code: code,
18600
+ phone: phone,
18601
+ transaction: transaction
18602
+ });
18603
+ return axiosInstance.post(url, urlEncodedData, {
18604
+ headers: headers
18605
+ }).then(function (response) {
18606
+ return response.data;
18607
+ });
18567
18608
  }
18568
18609
  };
18569
18610
 
@@ -18744,6 +18785,19 @@ var CardCharge = {
18744
18785
  paymentMethod: paymentMethod$3
18745
18786
  };
18746
18787
  return this.listenForCharge(listenerOptions, callback);
18788
+ },
18789
+ requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
18790
+ return CardAPI.requestOtpForSavedCards(phoneNumber);
18791
+ },
18792
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
18793
+ var code = _ref4.code,
18794
+ phone = _ref4.phone;
18795
+ var payload = {
18796
+ code: code,
18797
+ phone: phone,
18798
+ transaction: this.id
18799
+ };
18800
+ return CardAPI.verifySavedCardsOtp(payload);
18747
18801
  }
18748
18802
  };
18749
18803
 
@@ -20300,6 +20354,7 @@ var TransactionInstance = /*#__PURE__*/function () {
20300
20354
  this.subscription = data.subscription || null;
20301
20355
  this.planDetails = data.plan_details || null;
20302
20356
  this.exchangeRate = data.exchange_rate || null;
20357
+ this.isSavedCardsEnabled = data.saved_cards && data.saved_cards.enabled || null;
20303
20358
  /**
20304
20359
  * We initialize parameters we send to the API as empty strings
20305
20360
  * when we don't have them instead of null because the API expects
package/lib/checkout.js CHANGED
@@ -6407,14 +6407,16 @@ 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'
6410
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6411
+ savedCardsApiUrl: 'https://saved-cards-api.private.paystack.studio/'
6411
6412
  });
6412
6413
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6413
6414
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6414
6415
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6415
6416
  paystackApiUrl: 'https://studio-api.paystack.co/',
6416
6417
  pusherKey: '1c7b262ee18455815893',
6417
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6418
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6419
+ savedCardsApiUrl: 'https://saved-cards-api.private.paystack.studio/'
6418
6420
  });
6419
6421
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6420
6422
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -18568,6 +18570,45 @@ var CardAPI = {
18568
18570
  }).then(function (response) {
18569
18571
  return ChargeResponses.parse(response.data);
18570
18572
  });
18573
+ },
18574
+ requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
18575
+ var url = new URL("/authorize/".concat(phoneNumber), configToUse.savedCardsApiUrl).toString();
18576
+ var language = getLanguage();
18577
+
18578
+ var headers = _objectSpread2({}, language && {
18579
+ 'Accept-Language': language
18580
+ });
18581
+
18582
+ return axiosInstance.post(url, {
18583
+ headers: headers
18584
+ }).then(function (_ref6) {
18585
+ var data = _ref6.data;
18586
+ return data;
18587
+ });
18588
+ },
18589
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18590
+ var code = _ref7.code,
18591
+ phone = _ref7.phone,
18592
+ transaction = _ref7.transaction;
18593
+ var url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18594
+ var language = getLanguage();
18595
+
18596
+ var headers = _objectSpread2({
18597
+ 'Content-Type': 'application/x-www-form-urlencoded'
18598
+ }, language && {
18599
+ 'Accept-Language': language
18600
+ });
18601
+
18602
+ var urlEncodedData = formUrlencoded({
18603
+ code: code,
18604
+ phone: phone,
18605
+ transaction: transaction
18606
+ });
18607
+ return axiosInstance.post(url, urlEncodedData, {
18608
+ headers: headers
18609
+ }).then(function (response) {
18610
+ return response.data;
18611
+ });
18571
18612
  }
18572
18613
  };
18573
18614
 
@@ -18748,6 +18789,19 @@ var CardCharge = {
18748
18789
  paymentMethod: paymentMethod$3
18749
18790
  };
18750
18791
  return this.listenForCharge(listenerOptions, callback);
18792
+ },
18793
+ requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
18794
+ return CardAPI.requestOtpForSavedCards(phoneNumber);
18795
+ },
18796
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
18797
+ var code = _ref4.code,
18798
+ phone = _ref4.phone;
18799
+ var payload = {
18800
+ code: code,
18801
+ phone: phone,
18802
+ transaction: this.id
18803
+ };
18804
+ return CardAPI.verifySavedCardsOtp(payload);
18751
18805
  }
18752
18806
  };
18753
18807
 
@@ -20304,6 +20358,7 @@ var TransactionInstance = /*#__PURE__*/function () {
20304
20358
  this.subscription = data.subscription || null;
20305
20359
  this.planDetails = data.plan_details || null;
20306
20360
  this.exchangeRate = data.exchange_rate || null;
20361
+ this.isSavedCardsEnabled = data.saved_cards && data.saved_cards.enabled || null;
20307
20362
  /**
20308
20363
  * We initialize parameters we send to the API as empty strings
20309
20364
  * when we don't have them instead of null because the API expects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.18.0",
3
+ "version": "1.19.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",