@paystack/checkout-js 1.19.0-dev.4 → 1.19.0-dev.5

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
@@ -18707,7 +18707,7 @@ var CardAPI = {
18707
18707
 
18708
18708
  var paymentMethod$3 = 'card';
18709
18709
 
18710
- function validate$4(card, isSetter) {
18710
+ function validate$3(card, isSetter) {
18711
18711
  return new Promise(function (resolve, reject) {
18712
18712
  var validation = Card.validate(card);
18713
18713
 
@@ -18728,7 +18728,7 @@ var CardCharge = {
18728
18728
  setCard: function setCard(params) {
18729
18729
  var _this = this;
18730
18730
 
18731
- return validate$4(params, true).then(function () {
18731
+ return validate$3(params, true).then(function () {
18732
18732
  _this.card = new Card(params);
18733
18733
  });
18734
18734
  },
@@ -18744,7 +18744,7 @@ var CardCharge = {
18744
18744
  return this.chargeCardWithPin(customFields);
18745
18745
  }
18746
18746
 
18747
- return validate$4(this.card).then(function () {
18747
+ return validate$3(this.card).then(function () {
18748
18748
  _this2.logAttempt(paymentMethod$3);
18749
18749
 
18750
18750
  var chargeParams = {
@@ -19081,7 +19081,7 @@ var EMandateAPI = {
19081
19081
 
19082
19082
  var paymentMethod$2 = 'bank account';
19083
19083
 
19084
- function validate$3(bankAccount, isSetter) {
19084
+ function validate$2(bankAccount, isSetter) {
19085
19085
  return new Promise(function (resolve, reject) {
19086
19086
  var validation = BankAccount.validate(bankAccount);
19087
19087
 
@@ -19099,14 +19099,14 @@ var EMandate = {
19099
19099
  setBankAccount: function setBankAccount(params) {
19100
19100
  var _this = this;
19101
19101
 
19102
- return validate$3(params, true).then(function () {
19102
+ return validate$2(params, true).then(function () {
19103
19103
  _this.bankAccount = new BankAccount(params);
19104
19104
  });
19105
19105
  },
19106
19106
  chargeBankAccount: function chargeBankAccount() {
19107
19107
  var _this2 = this;
19108
19108
 
19109
- return validate$3(this.bankAccount).then(function () {
19109
+ return validate$2(this.bankAccount).then(function () {
19110
19110
  _this2.logAttempt(paymentMethod$2);
19111
19111
 
19112
19112
  var verifyParams = {
@@ -19125,7 +19125,7 @@ var EMandate = {
19125
19125
  registerBankAccount: function registerBankAccount(birthday) {
19126
19126
  var _this3 = this;
19127
19127
 
19128
- return validate$3(this.bankAccount).then(function () {
19128
+ return validate$2(this.bankAccount).then(function () {
19129
19129
  var registerParams = {
19130
19130
  bankId: _this3.bankAccount.bankId,
19131
19131
  transactionId: _this3.id,
@@ -19142,7 +19142,7 @@ var EMandate = {
19142
19142
  authenticateBankAccount: function authenticateBankAccount(token) {
19143
19143
  var _this4 = this;
19144
19144
 
19145
- return validate$3(this.bankAccount).then(function () {
19145
+ return validate$2(this.bankAccount).then(function () {
19146
19146
  var chargeParams = {
19147
19147
  bankId: _this4.bankAccount.bankId,
19148
19148
  transactionId: _this4.id,
@@ -19367,7 +19367,7 @@ var QrAPI = {
19367
19367
  }
19368
19368
  };
19369
19369
 
19370
- function validate$2(channel) {
19370
+ function validate$1(channel) {
19371
19371
  return new Promise(function (resolve, reject) {
19372
19372
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19373
19373
 
@@ -19385,7 +19385,7 @@ var QRCharge = {
19385
19385
  var _this = this;
19386
19386
 
19387
19387
  var channel = _ref.channel;
19388
- return validate$2(channel).then(function () {
19388
+ return validate$1(channel).then(function () {
19389
19389
  if (_this.qr[channel]) {
19390
19390
  return _this.qr[channel];
19391
19391
  }
@@ -19407,7 +19407,7 @@ var QRCharge = {
19407
19407
  var _this2 = this;
19408
19408
 
19409
19409
  var channel = _ref2.channel;
19410
- return validate$2(channel).then(function () {
19410
+ return validate$1(channel).then(function () {
19411
19411
  if (!_this2.qr[channel]) {
19412
19412
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19413
19413
  }
@@ -19528,7 +19528,7 @@ var MobileMoneyAPI = {
19528
19528
  }
19529
19529
  };
19530
19530
 
19531
- function validate$1(phoneNumber) {
19531
+ function validate(phoneNumber) {
19532
19532
  return new Promise(function (resolve, reject) {
19533
19533
  var validation = PhoneNumber.validate(phoneNumber);
19534
19534
 
@@ -19549,7 +19549,7 @@ var MobileMoneyCharge = {
19549
19549
  provider = _ref.provider,
19550
19550
  voucher = _ref.voucher,
19551
19551
  registrationToken = _ref.registrationToken;
19552
- return validate$1(phoneNumber).then(function () {
19552
+ return validate(phoneNumber).then(function () {
19553
19553
  _this.logAttempt('mobile money');
19554
19554
 
19555
19555
  var params = {
@@ -19580,7 +19580,7 @@ var MobileMoneyCharge = {
19580
19580
  var phoneNumber = payload.phoneNumber,
19581
19581
  provider = payload.provider,
19582
19582
  registrationToken = payload.registrationToken;
19583
- return validate$1(phoneNumber).then(function () {
19583
+ return validate(phoneNumber).then(function () {
19584
19584
  _this2.logMobileMoneyActions(payload);
19585
19585
 
19586
19586
  var params = {
@@ -19636,233 +19636,6 @@ var MobileMoneyCharge = {
19636
19636
  }
19637
19637
  };
19638
19638
 
19639
- var PhoneAPI = {
19640
- verify: function verify(phoneNumber, publicKey) {
19641
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
19642
- var language = getLanguage();
19643
-
19644
- var headers = _objectSpread2({
19645
- Authorization: "Bearer ".concat(publicKey)
19646
- }, language && {
19647
- 'Accept-Language': language
19648
- });
19649
-
19650
- return axiosInstance.post(url, {
19651
- phone: phoneNumber
19652
- }, {
19653
- headers: headers
19654
- }).then(function (response) {
19655
- return response.data;
19656
- });
19657
- },
19658
- deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
19659
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
19660
- var language = getLanguage();
19661
-
19662
- var headers = _objectSpread2({
19663
- Authorization: "Bearer ".concat(publicKey)
19664
- }, language && {
19665
- 'Accept-Language': language
19666
- });
19667
-
19668
- return axiosInstance.post(url, {
19669
- phone: phoneNumber,
19670
- id: cardId
19671
- }, {
19672
- headers: headers
19673
- }).then(function (response) {
19674
- return response.data;
19675
- });
19676
- },
19677
- authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
19678
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
19679
- var language = getLanguage();
19680
-
19681
- var headers = _objectSpread2({
19682
- Authorization: "Bearer ".concat(publicKey)
19683
- }, language && {
19684
- 'Accept-Language': language
19685
- });
19686
-
19687
- return axiosInstance.post(url, {
19688
- phone: phoneNumber,
19689
- otp: otp,
19690
- transaction: transactionId
19691
- }, {
19692
- headers: headers
19693
- }).then(function (response) {
19694
- return response.data;
19695
- });
19696
- },
19697
- authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
19698
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
19699
- var language = getLanguage();
19700
-
19701
- var headers = _objectSpread2({
19702
- Authorization: "Bearer ".concat(publicKey)
19703
- }, language && {
19704
- 'Accept-Language': language
19705
- });
19706
-
19707
- return axiosInstance.post(url, {
19708
- phone: phoneNumber,
19709
- pin: pin,
19710
- transaction: transactionId
19711
- }, {
19712
- headers: headers
19713
- }).then(function (response) {
19714
- return response.data;
19715
- });
19716
- },
19717
- setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
19718
- var language = getLanguage();
19719
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
19720
-
19721
- var headers = _objectSpread2({
19722
- Authorization: "Bearer ".concat(publicKey)
19723
- }, language && {
19724
- 'Accept-Language': language
19725
- });
19726
-
19727
- return axiosInstance.post(url, {
19728
- phone: phoneNumber,
19729
- token: transactionToken,
19730
- transaction: transactionId,
19731
- pin: pin
19732
- }, {
19733
- headers: headers
19734
- }).then(function (response) {
19735
- return response.data;
19736
- });
19737
- },
19738
- charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
19739
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
19740
- var language = getLanguage();
19741
-
19742
- var headers = _objectSpread2({
19743
- Authorization: "Bearer ".concat(publicKey)
19744
- }, language && {
19745
- 'Accept-Language': language
19746
- });
19747
-
19748
- return axiosInstance.post(url, {
19749
- id: authId,
19750
- token: token,
19751
- cvv: cvv,
19752
- transaction: transactionId,
19753
- phone: phoneNumber
19754
- }, {
19755
- headers: headers
19756
- }).then(function (response) {
19757
- return response.data;
19758
- });
19759
- },
19760
- enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
19761
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
19762
- var language = getLanguage();
19763
-
19764
- var headers = _objectSpread2({
19765
- Authorization: "Bearer ".concat(publicKey)
19766
- }, language && {
19767
- 'Accept-Language': language
19768
- });
19769
-
19770
- return axiosInstance.post(url, {
19771
- phone: phoneNumber,
19772
- transaction: transactionId
19773
- }, {
19774
- headers: headers
19775
- }).then(function (response) {
19776
- return response.data;
19777
- });
19778
- }
19779
- };
19780
-
19781
- /*
19782
- TODO:
19783
- Implement analytics for Pay with Phone. Since unique actions are takens here e.g
19784
- user verifies pay with phone account, user charged saved card, etc, these should
19785
- all be reflected as custom analytics actions
19786
- */
19787
-
19788
- function validate(phoneNumber) {
19789
- return new Promise(function (resolve, reject) {
19790
- var validation = PhoneNumber.validate(phoneNumber);
19791
-
19792
- if (!validation.isValid) {
19793
- var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
19794
- reject(Error(errorMessage));
19795
- }
19796
-
19797
- resolve(validation);
19798
- });
19799
- }
19800
-
19801
- var PhoneNumberCharge = {
19802
- setCustomer: function setCustomer(_ref) {
19803
- var _this = this;
19804
-
19805
- var phoneNumber = _ref.phoneNumber;
19806
- return validate(phoneNumber).then(function () {
19807
- _this.customer = phoneNumber;
19808
- });
19809
- },
19810
- verifyCustomer: function verifyCustomer() {
19811
- var _this2 = this;
19812
-
19813
- return validate(this.customer).then(function () {
19814
- return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
19815
- });
19816
- },
19817
- deleteSavedCard: function deleteSavedCard(cardId) {
19818
- var _this3 = this;
19819
-
19820
- return validate(this.customer).then(function () {
19821
- return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
19822
- });
19823
- },
19824
- authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
19825
- var _this4 = this;
19826
-
19827
- return validate(this.customer).then(function () {
19828
- return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
19829
- });
19830
- },
19831
- authenticateCustomerPin: function authenticateCustomerPin(pin) {
19832
- var _this5 = this;
19833
-
19834
- return validate(this.customer).then(function () {
19835
- return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
19836
- });
19837
- },
19838
- setCustomerPin: function setCustomerPin(_ref2) {
19839
- var _this6 = this;
19840
-
19841
- var pin = _ref2.pin,
19842
- token = _ref2.token;
19843
- return validate(this.customer).then(function () {
19844
- return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
19845
- });
19846
- },
19847
- chargeSavedCard: function chargeSavedCard(_ref3) {
19848
- var _this7 = this;
19849
-
19850
- var cardId = _ref3.cardId,
19851
- token = _ref3.token,
19852
- cvv = _ref3.cvv;
19853
- return validate(this.customer).then(function () {
19854
- return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
19855
- });
19856
- },
19857
- enrollPhoneNumber: function enrollPhoneNumber(number) {
19858
- var _this8 = this;
19859
-
19860
- return validate(this.customer).then(function () {
19861
- return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
19862
- });
19863
- }
19864
- };
19865
-
19866
19639
  var DirectDebitAPI = {
19867
19640
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19868
19641
  var email = _ref.email,
@@ -20053,7 +19826,6 @@ var ChargeFunctions = {
20053
19826
  ussd: USSDCharge,
20054
19827
  qr: QRCharge,
20055
19828
  mobile_money: MobileMoneyCharge,
20056
- phone: PhoneNumberCharge,
20057
19829
  direct_debit: DirectDebitCharge,
20058
19830
  bank_transfer: PayWithTransferCharge,
20059
19831
  eft: EFT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.19.0-dev.4",
3
+ "version": "1.19.0-dev.5",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",