@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/es/checkout.js CHANGED
@@ -18703,7 +18703,7 @@ var CardAPI = {
18703
18703
 
18704
18704
  var paymentMethod$3 = 'card';
18705
18705
 
18706
- function validate$4(card, isSetter) {
18706
+ function validate$3(card, isSetter) {
18707
18707
  return new Promise(function (resolve, reject) {
18708
18708
  var validation = Card.validate(card);
18709
18709
 
@@ -18724,7 +18724,7 @@ var CardCharge = {
18724
18724
  setCard: function setCard(params) {
18725
18725
  var _this = this;
18726
18726
 
18727
- return validate$4(params, true).then(function () {
18727
+ return validate$3(params, true).then(function () {
18728
18728
  _this.card = new Card(params);
18729
18729
  });
18730
18730
  },
@@ -18740,7 +18740,7 @@ var CardCharge = {
18740
18740
  return this.chargeCardWithPin(customFields);
18741
18741
  }
18742
18742
 
18743
- return validate$4(this.card).then(function () {
18743
+ return validate$3(this.card).then(function () {
18744
18744
  _this2.logAttempt(paymentMethod$3);
18745
18745
 
18746
18746
  var chargeParams = {
@@ -19077,7 +19077,7 @@ var EMandateAPI = {
19077
19077
 
19078
19078
  var paymentMethod$2 = 'bank account';
19079
19079
 
19080
- function validate$3(bankAccount, isSetter) {
19080
+ function validate$2(bankAccount, isSetter) {
19081
19081
  return new Promise(function (resolve, reject) {
19082
19082
  var validation = BankAccount.validate(bankAccount);
19083
19083
 
@@ -19095,14 +19095,14 @@ var EMandate = {
19095
19095
  setBankAccount: function setBankAccount(params) {
19096
19096
  var _this = this;
19097
19097
 
19098
- return validate$3(params, true).then(function () {
19098
+ return validate$2(params, true).then(function () {
19099
19099
  _this.bankAccount = new BankAccount(params);
19100
19100
  });
19101
19101
  },
19102
19102
  chargeBankAccount: function chargeBankAccount() {
19103
19103
  var _this2 = this;
19104
19104
 
19105
- return validate$3(this.bankAccount).then(function () {
19105
+ return validate$2(this.bankAccount).then(function () {
19106
19106
  _this2.logAttempt(paymentMethod$2);
19107
19107
 
19108
19108
  var verifyParams = {
@@ -19121,7 +19121,7 @@ var EMandate = {
19121
19121
  registerBankAccount: function registerBankAccount(birthday) {
19122
19122
  var _this3 = this;
19123
19123
 
19124
- return validate$3(this.bankAccount).then(function () {
19124
+ return validate$2(this.bankAccount).then(function () {
19125
19125
  var registerParams = {
19126
19126
  bankId: _this3.bankAccount.bankId,
19127
19127
  transactionId: _this3.id,
@@ -19138,7 +19138,7 @@ var EMandate = {
19138
19138
  authenticateBankAccount: function authenticateBankAccount(token) {
19139
19139
  var _this4 = this;
19140
19140
 
19141
- return validate$3(this.bankAccount).then(function () {
19141
+ return validate$2(this.bankAccount).then(function () {
19142
19142
  var chargeParams = {
19143
19143
  bankId: _this4.bankAccount.bankId,
19144
19144
  transactionId: _this4.id,
@@ -19363,7 +19363,7 @@ var QrAPI = {
19363
19363
  }
19364
19364
  };
19365
19365
 
19366
- function validate$2(channel) {
19366
+ function validate$1(channel) {
19367
19367
  return new Promise(function (resolve, reject) {
19368
19368
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19369
19369
 
@@ -19381,7 +19381,7 @@ var QRCharge = {
19381
19381
  var _this = this;
19382
19382
 
19383
19383
  var channel = _ref.channel;
19384
- return validate$2(channel).then(function () {
19384
+ return validate$1(channel).then(function () {
19385
19385
  if (_this.qr[channel]) {
19386
19386
  return _this.qr[channel];
19387
19387
  }
@@ -19403,7 +19403,7 @@ var QRCharge = {
19403
19403
  var _this2 = this;
19404
19404
 
19405
19405
  var channel = _ref2.channel;
19406
- return validate$2(channel).then(function () {
19406
+ return validate$1(channel).then(function () {
19407
19407
  if (!_this2.qr[channel]) {
19408
19408
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19409
19409
  }
@@ -19524,7 +19524,7 @@ var MobileMoneyAPI = {
19524
19524
  }
19525
19525
  };
19526
19526
 
19527
- function validate$1(phoneNumber) {
19527
+ function validate(phoneNumber) {
19528
19528
  return new Promise(function (resolve, reject) {
19529
19529
  var validation = PhoneNumber.validate(phoneNumber);
19530
19530
 
@@ -19545,7 +19545,7 @@ var MobileMoneyCharge = {
19545
19545
  provider = _ref.provider,
19546
19546
  voucher = _ref.voucher,
19547
19547
  registrationToken = _ref.registrationToken;
19548
- return validate$1(phoneNumber).then(function () {
19548
+ return validate(phoneNumber).then(function () {
19549
19549
  _this.logAttempt('mobile money');
19550
19550
 
19551
19551
  var params = {
@@ -19576,7 +19576,7 @@ var MobileMoneyCharge = {
19576
19576
  var phoneNumber = payload.phoneNumber,
19577
19577
  provider = payload.provider,
19578
19578
  registrationToken = payload.registrationToken;
19579
- return validate$1(phoneNumber).then(function () {
19579
+ return validate(phoneNumber).then(function () {
19580
19580
  _this2.logMobileMoneyActions(payload);
19581
19581
 
19582
19582
  var params = {
@@ -19632,233 +19632,6 @@ var MobileMoneyCharge = {
19632
19632
  }
19633
19633
  };
19634
19634
 
19635
- var PhoneAPI = {
19636
- verify: function verify(phoneNumber, publicKey) {
19637
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
19638
- var language = getLanguage();
19639
-
19640
- var headers = _objectSpread2({
19641
- Authorization: "Bearer ".concat(publicKey)
19642
- }, language && {
19643
- 'Accept-Language': language
19644
- });
19645
-
19646
- return axiosInstance.post(url, {
19647
- phone: phoneNumber
19648
- }, {
19649
- headers: headers
19650
- }).then(function (response) {
19651
- return response.data;
19652
- });
19653
- },
19654
- deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
19655
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
19656
- var language = getLanguage();
19657
-
19658
- var headers = _objectSpread2({
19659
- Authorization: "Bearer ".concat(publicKey)
19660
- }, language && {
19661
- 'Accept-Language': language
19662
- });
19663
-
19664
- return axiosInstance.post(url, {
19665
- phone: phoneNumber,
19666
- id: cardId
19667
- }, {
19668
- headers: headers
19669
- }).then(function (response) {
19670
- return response.data;
19671
- });
19672
- },
19673
- authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
19674
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
19675
- var language = getLanguage();
19676
-
19677
- var headers = _objectSpread2({
19678
- Authorization: "Bearer ".concat(publicKey)
19679
- }, language && {
19680
- 'Accept-Language': language
19681
- });
19682
-
19683
- return axiosInstance.post(url, {
19684
- phone: phoneNumber,
19685
- otp: otp,
19686
- transaction: transactionId
19687
- }, {
19688
- headers: headers
19689
- }).then(function (response) {
19690
- return response.data;
19691
- });
19692
- },
19693
- authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
19694
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
19695
- var language = getLanguage();
19696
-
19697
- var headers = _objectSpread2({
19698
- Authorization: "Bearer ".concat(publicKey)
19699
- }, language && {
19700
- 'Accept-Language': language
19701
- });
19702
-
19703
- return axiosInstance.post(url, {
19704
- phone: phoneNumber,
19705
- pin: pin,
19706
- transaction: transactionId
19707
- }, {
19708
- headers: headers
19709
- }).then(function (response) {
19710
- return response.data;
19711
- });
19712
- },
19713
- setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
19714
- var language = getLanguage();
19715
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
19716
-
19717
- var headers = _objectSpread2({
19718
- Authorization: "Bearer ".concat(publicKey)
19719
- }, language && {
19720
- 'Accept-Language': language
19721
- });
19722
-
19723
- return axiosInstance.post(url, {
19724
- phone: phoneNumber,
19725
- token: transactionToken,
19726
- transaction: transactionId,
19727
- pin: pin
19728
- }, {
19729
- headers: headers
19730
- }).then(function (response) {
19731
- return response.data;
19732
- });
19733
- },
19734
- charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
19735
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
19736
- var language = getLanguage();
19737
-
19738
- var headers = _objectSpread2({
19739
- Authorization: "Bearer ".concat(publicKey)
19740
- }, language && {
19741
- 'Accept-Language': language
19742
- });
19743
-
19744
- return axiosInstance.post(url, {
19745
- id: authId,
19746
- token: token,
19747
- cvv: cvv,
19748
- transaction: transactionId,
19749
- phone: phoneNumber
19750
- }, {
19751
- headers: headers
19752
- }).then(function (response) {
19753
- return response.data;
19754
- });
19755
- },
19756
- enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
19757
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
19758
- var language = getLanguage();
19759
-
19760
- var headers = _objectSpread2({
19761
- Authorization: "Bearer ".concat(publicKey)
19762
- }, language && {
19763
- 'Accept-Language': language
19764
- });
19765
-
19766
- return axiosInstance.post(url, {
19767
- phone: phoneNumber,
19768
- transaction: transactionId
19769
- }, {
19770
- headers: headers
19771
- }).then(function (response) {
19772
- return response.data;
19773
- });
19774
- }
19775
- };
19776
-
19777
- /*
19778
- TODO:
19779
- Implement analytics for Pay with Phone. Since unique actions are takens here e.g
19780
- user verifies pay with phone account, user charged saved card, etc, these should
19781
- all be reflected as custom analytics actions
19782
- */
19783
-
19784
- function validate(phoneNumber) {
19785
- return new Promise(function (resolve, reject) {
19786
- var validation = PhoneNumber.validate(phoneNumber);
19787
-
19788
- if (!validation.isValid) {
19789
- var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
19790
- reject(Error(errorMessage));
19791
- }
19792
-
19793
- resolve(validation);
19794
- });
19795
- }
19796
-
19797
- var PhoneNumberCharge = {
19798
- setCustomer: function setCustomer(_ref) {
19799
- var _this = this;
19800
-
19801
- var phoneNumber = _ref.phoneNumber;
19802
- return validate(phoneNumber).then(function () {
19803
- _this.customer = phoneNumber;
19804
- });
19805
- },
19806
- verifyCustomer: function verifyCustomer() {
19807
- var _this2 = this;
19808
-
19809
- return validate(this.customer).then(function () {
19810
- return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
19811
- });
19812
- },
19813
- deleteSavedCard: function deleteSavedCard(cardId) {
19814
- var _this3 = this;
19815
-
19816
- return validate(this.customer).then(function () {
19817
- return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
19818
- });
19819
- },
19820
- authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
19821
- var _this4 = this;
19822
-
19823
- return validate(this.customer).then(function () {
19824
- return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
19825
- });
19826
- },
19827
- authenticateCustomerPin: function authenticateCustomerPin(pin) {
19828
- var _this5 = this;
19829
-
19830
- return validate(this.customer).then(function () {
19831
- return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
19832
- });
19833
- },
19834
- setCustomerPin: function setCustomerPin(_ref2) {
19835
- var _this6 = this;
19836
-
19837
- var pin = _ref2.pin,
19838
- token = _ref2.token;
19839
- return validate(this.customer).then(function () {
19840
- return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
19841
- });
19842
- },
19843
- chargeSavedCard: function chargeSavedCard(_ref3) {
19844
- var _this7 = this;
19845
-
19846
- var cardId = _ref3.cardId,
19847
- token = _ref3.token,
19848
- cvv = _ref3.cvv;
19849
- return validate(this.customer).then(function () {
19850
- return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
19851
- });
19852
- },
19853
- enrollPhoneNumber: function enrollPhoneNumber(number) {
19854
- var _this8 = this;
19855
-
19856
- return validate(this.customer).then(function () {
19857
- return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
19858
- });
19859
- }
19860
- };
19861
-
19862
19635
  var DirectDebitAPI = {
19863
19636
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19864
19637
  var email = _ref.email,
@@ -20049,7 +19822,6 @@ var ChargeFunctions = {
20049
19822
  ussd: USSDCharge,
20050
19823
  qr: QRCharge,
20051
19824
  mobile_money: MobileMoneyCharge,
20052
- phone: PhoneNumberCharge,
20053
19825
  direct_debit: DirectDebitCharge,
20054
19826
  bank_transfer: PayWithTransferCharge,
20055
19827
  eft: EFT,