@paystack/checkout-js 1.26.0 → 1.27.1

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
@@ -18703,19 +18703,21 @@ var CardAPI$1 = {
18703
18703
  },
18704
18704
  sendSavedCardsOTP: function sendSavedCardsOTP(_ref6) {
18705
18705
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18706
- var transaction, phone, url, language, headers, data, response;
18706
+ var transaction, phone, channels, url, language, headers, data, response;
18707
18707
  return regeneratorRuntime.wrap(function _callee$(_context) {
18708
18708
  while (1) {
18709
18709
  switch (_context.prev = _context.next) {
18710
18710
  case 0:
18711
- transaction = _ref6.transaction, phone = _ref6.phone;
18711
+ transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels;
18712
18712
  url = new URL('/saved_cards/authorize', configToUse.paystackApiUrl).toString();
18713
18713
  language = getLanguage();
18714
18714
  headers = _objectSpread2({}, language && {
18715
18715
  'Accept-Language': language
18716
18716
  });
18717
- data = _objectSpread2(_objectSpread2({}, phone && {
18717
+ data = _objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18718
18718
  phone: phone
18719
+ }), channels && {
18720
+ channels: channels
18719
18721
  }), {}, {
18720
18722
  transaction: transaction
18721
18723
  });
@@ -19060,7 +19062,7 @@ var CardCharge = {
19060
19062
  };
19061
19063
  return this.listenForCharge(listenerOptions, callback);
19062
19064
  },
19063
- sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19065
+ sendSavedCardsOTP: function sendSavedCardsOTP(phone, channels) {
19064
19066
  var _this9 = this;
19065
19067
 
19066
19068
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
@@ -19076,7 +19078,8 @@ var CardCharge = {
19076
19078
  _context.next = 4;
19077
19079
  return CardAPI$1.sendSavedCardsOTP({
19078
19080
  phone: phone,
19079
- transaction: _this9.id
19081
+ transaction: _this9.id,
19082
+ channels: channels
19080
19083
  });
19081
19084
 
19082
19085
  case 4:
@@ -19774,66 +19777,86 @@ function validate$1(phoneNumber) {
19774
19777
  }
19775
19778
 
19776
19779
  var MobileMoneyCharge = {
19777
- chargeMobileMoney: function chargeMobileMoney(_ref) {
19780
+ mobileMoneyChargeAPI: function mobileMoneyChargeAPI(params) {
19778
19781
  var _this = this;
19779
19782
 
19783
+ return MobileMoneyAPI.charge(params).then(function (response) {
19784
+ if (response.status === 'success') {
19785
+ _this.mobileMoney = response;
19786
+
19787
+ if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
19788
+ _this.logTokenRequest('mobile money');
19789
+ }
19790
+ }
19791
+
19792
+ return response;
19793
+ });
19794
+ },
19795
+ chargeMobileMoney: function chargeMobileMoney(_ref) {
19796
+ var _this2 = this;
19797
+
19780
19798
  var phoneNumber = _ref.phoneNumber,
19781
19799
  provider = _ref.provider,
19782
19800
  voucher = _ref.voucher,
19783
19801
  registrationToken = _ref.registrationToken;
19784
19802
  return validate$1(phoneNumber).then(function () {
19785
- _this.logAttempt('mobile money');
19803
+ _this2.logAttempt('mobile money');
19786
19804
 
19787
19805
  var params = {
19788
19806
  provider: provider,
19789
19807
  voucher: voucher,
19790
19808
  registrationToken: registrationToken,
19791
- transaction: _this.id,
19809
+ transaction: _this2.id,
19792
19810
  phone: phoneNumber,
19793
- device: _this.deviceFingerprint,
19794
- channel_name: "MOBILE_MONEY_".concat(_this.id)
19811
+ device: _this2.deviceFingerprint,
19812
+ channel_name: "MOBILE_MONEY_".concat(_this2.id)
19795
19813
  };
19796
- return MobileMoneyAPI.charge(params).then(function (response) {
19797
- if (response.status === 'success') {
19798
- _this.mobileMoney = response;
19799
-
19800
- if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
19801
- _this.logTokenRequest('mobile money');
19802
- }
19803
- }
19804
-
19805
- return response;
19806
- });
19814
+ return _this2.mobileMoneyChargeAPI(params);
19807
19815
  });
19808
19816
  },
19817
+ chargeMpesaOffline: function chargeMpesaOffline(_ref2) {
19818
+ var provider = _ref2.provider,
19819
+ voucher = _ref2.voucher,
19820
+ registrationToken = _ref2.registrationToken;
19821
+ this.logAttempt('mobile money');
19822
+ var params = {
19823
+ provider: provider,
19824
+ voucher: voucher,
19825
+ registrationToken: registrationToken,
19826
+ transaction: this.id,
19827
+ device: this.deviceFingerprint,
19828
+ channel_name: "MOBILE_MONEY_".concat(this.id)
19829
+ };
19830
+ return this.mobileMoneyChargeAPI(params);
19831
+ },
19809
19832
  authenticateMobileMoney: function authenticateMobileMoney(payload) {
19810
- var _this2 = this;
19833
+ var _this3 = this;
19811
19834
 
19812
19835
  var phoneNumber = payload.phoneNumber,
19813
19836
  provider = payload.provider,
19814
19837
  registrationToken = payload.registrationToken;
19815
19838
  return validate$1(phoneNumber).then(function () {
19816
- _this2.logMobileMoneyActions(payload);
19839
+ _this3.logMobileMoneyActions(payload);
19817
19840
 
19818
19841
  var params = {
19819
19842
  provider: provider,
19820
19843
  registrationToken: registrationToken,
19821
- transaction: _this2.id,
19844
+ transaction: _this3.id,
19822
19845
  phone: phoneNumber,
19823
- device: _this2.deviceFingerprint,
19824
- channel_name: "MOBILE_MONEY_".concat(_this2.id)
19846
+ device: _this3.deviceFingerprint,
19847
+ channel_name: "MOBILE_MONEY_".concat(_this3.id)
19825
19848
  };
19826
19849
  return MobileMoneyAPI.charge(params).then(function (response) {
19827
19850
  if (response.status === 'success') {
19828
- _this2.mobileMoney = response;
19851
+ _this3.mobileMoney = response;
19829
19852
 
19830
19853
  if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
19831
- _this2.logTokenRequest('mobile money');
19854
+ _this3.logTokenRequest('mobile money');
19832
19855
  }
19833
19856
  } else if (response.errors && response.errors.data && response.errors.data.status === 'awaiting_registration_token') {
19834
- _this2.logTokenAuthenticationFailure(response.message);
19857
+ _this3.logTokenAuthenticationFailure(response.message);
19835
19858
  } else {
19836
- _this2.logError(response.message);
19859
+ _this3.logError(response.message);
19837
19860
  }
19838
19861
 
19839
19862
  return response;
@@ -19841,13 +19864,13 @@ var MobileMoneyCharge = {
19841
19864
  });
19842
19865
  },
19843
19866
  submitMobileMoneyCode: function submitMobileMoneyCode(payload) {
19844
- var _this3 = this;
19867
+ var _this4 = this;
19845
19868
 
19846
19869
  return MobileMoneyAPI.submitCode({
19847
19870
  code: payload.code,
19848
19871
  transaction: this.id
19849
19872
  }).then(function (response) {
19850
- _this3.logAPIResponse(response, 'mobile_money');
19873
+ _this4.logAPIResponse(response, 'mobile_money');
19851
19874
 
19852
19875
  return response;
19853
19876
  });
package/lib/checkout.js CHANGED
@@ -18707,19 +18707,21 @@ var CardAPI$1 = {
18707
18707
  },
18708
18708
  sendSavedCardsOTP: function sendSavedCardsOTP(_ref6) {
18709
18709
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18710
- var transaction, phone, url, language, headers, data, response;
18710
+ var transaction, phone, channels, url, language, headers, data, response;
18711
18711
  return regeneratorRuntime.wrap(function _callee$(_context) {
18712
18712
  while (1) {
18713
18713
  switch (_context.prev = _context.next) {
18714
18714
  case 0:
18715
- transaction = _ref6.transaction, phone = _ref6.phone;
18715
+ transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels;
18716
18716
  url = new URL('/saved_cards/authorize', configToUse.paystackApiUrl).toString();
18717
18717
  language = getLanguage();
18718
18718
  headers = _objectSpread2({}, language && {
18719
18719
  'Accept-Language': language
18720
18720
  });
18721
- data = _objectSpread2(_objectSpread2({}, phone && {
18721
+ data = _objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18722
18722
  phone: phone
18723
+ }), channels && {
18724
+ channels: channels
18723
18725
  }), {}, {
18724
18726
  transaction: transaction
18725
18727
  });
@@ -19064,7 +19066,7 @@ var CardCharge = {
19064
19066
  };
19065
19067
  return this.listenForCharge(listenerOptions, callback);
19066
19068
  },
19067
- sendSavedCardsOTP: function sendSavedCardsOTP(phone) {
19069
+ sendSavedCardsOTP: function sendSavedCardsOTP(phone, channels) {
19068
19070
  var _this9 = this;
19069
19071
 
19070
19072
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
@@ -19080,7 +19082,8 @@ var CardCharge = {
19080
19082
  _context.next = 4;
19081
19083
  return CardAPI$1.sendSavedCardsOTP({
19082
19084
  phone: phone,
19083
- transaction: _this9.id
19085
+ transaction: _this9.id,
19086
+ channels: channels
19084
19087
  });
19085
19088
 
19086
19089
  case 4:
@@ -19778,66 +19781,86 @@ function validate$1(phoneNumber) {
19778
19781
  }
19779
19782
 
19780
19783
  var MobileMoneyCharge = {
19781
- chargeMobileMoney: function chargeMobileMoney(_ref) {
19784
+ mobileMoneyChargeAPI: function mobileMoneyChargeAPI(params) {
19782
19785
  var _this = this;
19783
19786
 
19787
+ return MobileMoneyAPI.charge(params).then(function (response) {
19788
+ if (response.status === 'success') {
19789
+ _this.mobileMoney = response;
19790
+
19791
+ if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
19792
+ _this.logTokenRequest('mobile money');
19793
+ }
19794
+ }
19795
+
19796
+ return response;
19797
+ });
19798
+ },
19799
+ chargeMobileMoney: function chargeMobileMoney(_ref) {
19800
+ var _this2 = this;
19801
+
19784
19802
  var phoneNumber = _ref.phoneNumber,
19785
19803
  provider = _ref.provider,
19786
19804
  voucher = _ref.voucher,
19787
19805
  registrationToken = _ref.registrationToken;
19788
19806
  return validate$1(phoneNumber).then(function () {
19789
- _this.logAttempt('mobile money');
19807
+ _this2.logAttempt('mobile money');
19790
19808
 
19791
19809
  var params = {
19792
19810
  provider: provider,
19793
19811
  voucher: voucher,
19794
19812
  registrationToken: registrationToken,
19795
- transaction: _this.id,
19813
+ transaction: _this2.id,
19796
19814
  phone: phoneNumber,
19797
- device: _this.deviceFingerprint,
19798
- channel_name: "MOBILE_MONEY_".concat(_this.id)
19815
+ device: _this2.deviceFingerprint,
19816
+ channel_name: "MOBILE_MONEY_".concat(_this2.id)
19799
19817
  };
19800
- return MobileMoneyAPI.charge(params).then(function (response) {
19801
- if (response.status === 'success') {
19802
- _this.mobileMoney = response;
19803
-
19804
- if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
19805
- _this.logTokenRequest('mobile money');
19806
- }
19807
- }
19808
-
19809
- return response;
19810
- });
19818
+ return _this2.mobileMoneyChargeAPI(params);
19811
19819
  });
19812
19820
  },
19821
+ chargeMpesaOffline: function chargeMpesaOffline(_ref2) {
19822
+ var provider = _ref2.provider,
19823
+ voucher = _ref2.voucher,
19824
+ registrationToken = _ref2.registrationToken;
19825
+ this.logAttempt('mobile money');
19826
+ var params = {
19827
+ provider: provider,
19828
+ voucher: voucher,
19829
+ registrationToken: registrationToken,
19830
+ transaction: this.id,
19831
+ device: this.deviceFingerprint,
19832
+ channel_name: "MOBILE_MONEY_".concat(this.id)
19833
+ };
19834
+ return this.mobileMoneyChargeAPI(params);
19835
+ },
19813
19836
  authenticateMobileMoney: function authenticateMobileMoney(payload) {
19814
- var _this2 = this;
19837
+ var _this3 = this;
19815
19838
 
19816
19839
  var phoneNumber = payload.phoneNumber,
19817
19840
  provider = payload.provider,
19818
19841
  registrationToken = payload.registrationToken;
19819
19842
  return validate$1(phoneNumber).then(function () {
19820
- _this2.logMobileMoneyActions(payload);
19843
+ _this3.logMobileMoneyActions(payload);
19821
19844
 
19822
19845
  var params = {
19823
19846
  provider: provider,
19824
19847
  registrationToken: registrationToken,
19825
- transaction: _this2.id,
19848
+ transaction: _this3.id,
19826
19849
  phone: phoneNumber,
19827
- device: _this2.deviceFingerprint,
19828
- channel_name: "MOBILE_MONEY_".concat(_this2.id)
19850
+ device: _this3.deviceFingerprint,
19851
+ channel_name: "MOBILE_MONEY_".concat(_this3.id)
19829
19852
  };
19830
19853
  return MobileMoneyAPI.charge(params).then(function (response) {
19831
19854
  if (response.status === 'success') {
19832
- _this2.mobileMoney = response;
19855
+ _this3.mobileMoney = response;
19833
19856
 
19834
19857
  if (response.data && response.data.display && response.data.display.otpSentCount === 1) {
19835
- _this2.logTokenRequest('mobile money');
19858
+ _this3.logTokenRequest('mobile money');
19836
19859
  }
19837
19860
  } else if (response.errors && response.errors.data && response.errors.data.status === 'awaiting_registration_token') {
19838
- _this2.logTokenAuthenticationFailure(response.message);
19861
+ _this3.logTokenAuthenticationFailure(response.message);
19839
19862
  } else {
19840
- _this2.logError(response.message);
19863
+ _this3.logError(response.message);
19841
19864
  }
19842
19865
 
19843
19866
  return response;
@@ -19845,13 +19868,13 @@ var MobileMoneyCharge = {
19845
19868
  });
19846
19869
  },
19847
19870
  submitMobileMoneyCode: function submitMobileMoneyCode(payload) {
19848
- var _this3 = this;
19871
+ var _this4 = this;
19849
19872
 
19850
19873
  return MobileMoneyAPI.submitCode({
19851
19874
  code: payload.code,
19852
19875
  transaction: this.id
19853
19876
  }).then(function (response) {
19854
- _this3.logAPIResponse(response, 'mobile_money');
19877
+ _this4.logAPIResponse(response, 'mobile_money');
19855
19878
 
19856
19879
  return response;
19857
19880
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.26.0",
3
+ "version": "1.27.1",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",