@paystack/checkout-js 1.18.0 → 1.18.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
@@ -18569,7 +18569,7 @@ var CardAPI = {
18569
18569
 
18570
18570
  var paymentMethod$3 = 'card';
18571
18571
 
18572
- function validate$4(card, isSetter) {
18572
+ function validate$3(card, isSetter) {
18573
18573
  return new Promise(function (resolve, reject) {
18574
18574
  var validation = Card.validate(card);
18575
18575
 
@@ -18590,7 +18590,7 @@ var CardCharge = {
18590
18590
  setCard: function setCard(params) {
18591
18591
  var _this = this;
18592
18592
 
18593
- return validate$4(params, true).then(function () {
18593
+ return validate$3(params, true).then(function () {
18594
18594
  _this.card = new Card(params);
18595
18595
  });
18596
18596
  },
@@ -18606,7 +18606,7 @@ var CardCharge = {
18606
18606
  return this.chargeCardWithPin(customFields);
18607
18607
  }
18608
18608
 
18609
- return validate$4(this.card).then(function () {
18609
+ return validate$3(this.card).then(function () {
18610
18610
  _this2.logAttempt(paymentMethod$3);
18611
18611
 
18612
18612
  var chargeParams = {
@@ -18898,7 +18898,7 @@ var EMandateAPI = {
18898
18898
 
18899
18899
  var paymentMethod$2 = 'bank account';
18900
18900
 
18901
- function validate$3(bankAccount, isSetter) {
18901
+ function validate$2(bankAccount, isSetter) {
18902
18902
  return new Promise(function (resolve, reject) {
18903
18903
  var validation = BankAccount.validate(bankAccount);
18904
18904
 
@@ -18916,14 +18916,14 @@ var EMandate = {
18916
18916
  setBankAccount: function setBankAccount(params) {
18917
18917
  var _this = this;
18918
18918
 
18919
- return validate$3(params, true).then(function () {
18919
+ return validate$2(params, true).then(function () {
18920
18920
  _this.bankAccount = new BankAccount(params);
18921
18921
  });
18922
18922
  },
18923
18923
  chargeBankAccount: function chargeBankAccount() {
18924
18924
  var _this2 = this;
18925
18925
 
18926
- return validate$3(this.bankAccount).then(function () {
18926
+ return validate$2(this.bankAccount).then(function () {
18927
18927
  _this2.logAttempt(paymentMethod$2);
18928
18928
 
18929
18929
  var verifyParams = {
@@ -18942,7 +18942,7 @@ var EMandate = {
18942
18942
  registerBankAccount: function registerBankAccount(birthday) {
18943
18943
  var _this3 = this;
18944
18944
 
18945
- return validate$3(this.bankAccount).then(function () {
18945
+ return validate$2(this.bankAccount).then(function () {
18946
18946
  var registerParams = {
18947
18947
  bankId: _this3.bankAccount.bankId,
18948
18948
  transactionId: _this3.id,
@@ -18959,7 +18959,7 @@ var EMandate = {
18959
18959
  authenticateBankAccount: function authenticateBankAccount(token) {
18960
18960
  var _this4 = this;
18961
18961
 
18962
- return validate$3(this.bankAccount).then(function () {
18962
+ return validate$2(this.bankAccount).then(function () {
18963
18963
  var chargeParams = {
18964
18964
  bankId: _this4.bankAccount.bankId,
18965
18965
  transactionId: _this4.id,
@@ -19184,7 +19184,7 @@ var QrAPI = {
19184
19184
  }
19185
19185
  };
19186
19186
 
19187
- function validate$2(channel) {
19187
+ function validate$1(channel) {
19188
19188
  return new Promise(function (resolve, reject) {
19189
19189
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19190
19190
 
@@ -19202,7 +19202,7 @@ var QRCharge = {
19202
19202
  var _this = this;
19203
19203
 
19204
19204
  var channel = _ref.channel;
19205
- return validate$2(channel).then(function () {
19205
+ return validate$1(channel).then(function () {
19206
19206
  if (_this.qr[channel]) {
19207
19207
  return _this.qr[channel];
19208
19208
  }
@@ -19224,7 +19224,7 @@ var QRCharge = {
19224
19224
  var _this2 = this;
19225
19225
 
19226
19226
  var channel = _ref2.channel;
19227
- return validate$2(channel).then(function () {
19227
+ return validate$1(channel).then(function () {
19228
19228
  if (!_this2.qr[channel]) {
19229
19229
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19230
19230
  }
@@ -19345,7 +19345,7 @@ var MobileMoneyAPI = {
19345
19345
  }
19346
19346
  };
19347
19347
 
19348
- function validate$1(phoneNumber) {
19348
+ function validate(phoneNumber) {
19349
19349
  return new Promise(function (resolve, reject) {
19350
19350
  var validation = PhoneNumber.validate(phoneNumber);
19351
19351
 
@@ -19366,7 +19366,7 @@ var MobileMoneyCharge = {
19366
19366
  provider = _ref.provider,
19367
19367
  voucher = _ref.voucher,
19368
19368
  registrationToken = _ref.registrationToken;
19369
- return validate$1(phoneNumber).then(function () {
19369
+ return validate(phoneNumber).then(function () {
19370
19370
  _this.logAttempt('mobile money');
19371
19371
 
19372
19372
  var params = {
@@ -19397,7 +19397,7 @@ var MobileMoneyCharge = {
19397
19397
  var phoneNumber = payload.phoneNumber,
19398
19398
  provider = payload.provider,
19399
19399
  registrationToken = payload.registrationToken;
19400
- return validate$1(phoneNumber).then(function () {
19400
+ return validate(phoneNumber).then(function () {
19401
19401
  _this2.logMobileMoneyActions(payload);
19402
19402
 
19403
19403
  var params = {
@@ -19453,233 +19453,6 @@ var MobileMoneyCharge = {
19453
19453
  }
19454
19454
  };
19455
19455
 
19456
- var PhoneAPI = {
19457
- verify: function verify(phoneNumber, publicKey) {
19458
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
19459
- var language = getLanguage();
19460
-
19461
- var headers = _objectSpread2({
19462
- Authorization: "Bearer ".concat(publicKey)
19463
- }, language && {
19464
- 'Accept-Language': language
19465
- });
19466
-
19467
- return axiosInstance.post(url, {
19468
- phone: phoneNumber
19469
- }, {
19470
- headers: headers
19471
- }).then(function (response) {
19472
- return response.data;
19473
- });
19474
- },
19475
- deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
19476
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
19477
- var language = getLanguage();
19478
-
19479
- var headers = _objectSpread2({
19480
- Authorization: "Bearer ".concat(publicKey)
19481
- }, language && {
19482
- 'Accept-Language': language
19483
- });
19484
-
19485
- return axiosInstance.post(url, {
19486
- phone: phoneNumber,
19487
- id: cardId
19488
- }, {
19489
- headers: headers
19490
- }).then(function (response) {
19491
- return response.data;
19492
- });
19493
- },
19494
- authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
19495
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
19496
- var language = getLanguage();
19497
-
19498
- var headers = _objectSpread2({
19499
- Authorization: "Bearer ".concat(publicKey)
19500
- }, language && {
19501
- 'Accept-Language': language
19502
- });
19503
-
19504
- return axiosInstance.post(url, {
19505
- phone: phoneNumber,
19506
- otp: otp,
19507
- transaction: transactionId
19508
- }, {
19509
- headers: headers
19510
- }).then(function (response) {
19511
- return response.data;
19512
- });
19513
- },
19514
- authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
19515
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
19516
- var language = getLanguage();
19517
-
19518
- var headers = _objectSpread2({
19519
- Authorization: "Bearer ".concat(publicKey)
19520
- }, language && {
19521
- 'Accept-Language': language
19522
- });
19523
-
19524
- return axiosInstance.post(url, {
19525
- phone: phoneNumber,
19526
- pin: pin,
19527
- transaction: transactionId
19528
- }, {
19529
- headers: headers
19530
- }).then(function (response) {
19531
- return response.data;
19532
- });
19533
- },
19534
- setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
19535
- var language = getLanguage();
19536
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
19537
-
19538
- var headers = _objectSpread2({
19539
- Authorization: "Bearer ".concat(publicKey)
19540
- }, language && {
19541
- 'Accept-Language': language
19542
- });
19543
-
19544
- return axiosInstance.post(url, {
19545
- phone: phoneNumber,
19546
- token: transactionToken,
19547
- transaction: transactionId,
19548
- pin: pin
19549
- }, {
19550
- headers: headers
19551
- }).then(function (response) {
19552
- return response.data;
19553
- });
19554
- },
19555
- charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
19556
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
19557
- var language = getLanguage();
19558
-
19559
- var headers = _objectSpread2({
19560
- Authorization: "Bearer ".concat(publicKey)
19561
- }, language && {
19562
- 'Accept-Language': language
19563
- });
19564
-
19565
- return axiosInstance.post(url, {
19566
- id: authId,
19567
- token: token,
19568
- cvv: cvv,
19569
- transaction: transactionId,
19570
- phone: phoneNumber
19571
- }, {
19572
- headers: headers
19573
- }).then(function (response) {
19574
- return response.data;
19575
- });
19576
- },
19577
- enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
19578
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
19579
- var language = getLanguage();
19580
-
19581
- var headers = _objectSpread2({
19582
- Authorization: "Bearer ".concat(publicKey)
19583
- }, language && {
19584
- 'Accept-Language': language
19585
- });
19586
-
19587
- return axiosInstance.post(url, {
19588
- phone: phoneNumber,
19589
- transaction: transactionId
19590
- }, {
19591
- headers: headers
19592
- }).then(function (response) {
19593
- return response.data;
19594
- });
19595
- }
19596
- };
19597
-
19598
- /*
19599
- TODO:
19600
- Implement analytics for Pay with Phone. Since unique actions are takens here e.g
19601
- user verifies pay with phone account, user charged saved card, etc, these should
19602
- all be reflected as custom analytics actions
19603
- */
19604
-
19605
- function validate(phoneNumber) {
19606
- return new Promise(function (resolve, reject) {
19607
- var validation = PhoneNumber.validate(phoneNumber);
19608
-
19609
- if (!validation.isValid) {
19610
- var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
19611
- reject(Error(errorMessage));
19612
- }
19613
-
19614
- resolve(validation);
19615
- });
19616
- }
19617
-
19618
- var PhoneNumberCharge = {
19619
- setCustomer: function setCustomer(_ref) {
19620
- var _this = this;
19621
-
19622
- var phoneNumber = _ref.phoneNumber;
19623
- return validate(phoneNumber).then(function () {
19624
- _this.customer = phoneNumber;
19625
- });
19626
- },
19627
- verifyCustomer: function verifyCustomer() {
19628
- var _this2 = this;
19629
-
19630
- return validate(this.customer).then(function () {
19631
- return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
19632
- });
19633
- },
19634
- deleteSavedCard: function deleteSavedCard(cardId) {
19635
- var _this3 = this;
19636
-
19637
- return validate(this.customer).then(function () {
19638
- return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
19639
- });
19640
- },
19641
- authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
19642
- var _this4 = this;
19643
-
19644
- return validate(this.customer).then(function () {
19645
- return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
19646
- });
19647
- },
19648
- authenticateCustomerPin: function authenticateCustomerPin(pin) {
19649
- var _this5 = this;
19650
-
19651
- return validate(this.customer).then(function () {
19652
- return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
19653
- });
19654
- },
19655
- setCustomerPin: function setCustomerPin(_ref2) {
19656
- var _this6 = this;
19657
-
19658
- var pin = _ref2.pin,
19659
- token = _ref2.token;
19660
- return validate(this.customer).then(function () {
19661
- return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
19662
- });
19663
- },
19664
- chargeSavedCard: function chargeSavedCard(_ref3) {
19665
- var _this7 = this;
19666
-
19667
- var cardId = _ref3.cardId,
19668
- token = _ref3.token,
19669
- cvv = _ref3.cvv;
19670
- return validate(this.customer).then(function () {
19671
- return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
19672
- });
19673
- },
19674
- enrollPhoneNumber: function enrollPhoneNumber(number) {
19675
- var _this8 = this;
19676
-
19677
- return validate(this.customer).then(function () {
19678
- return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
19679
- });
19680
- }
19681
- };
19682
-
19683
19456
  var DirectDebitAPI = {
19684
19457
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19685
19458
  var email = _ref.email,
@@ -19870,7 +19643,6 @@ var ChargeFunctions = {
19870
19643
  ussd: USSDCharge,
19871
19644
  qr: QRCharge,
19872
19645
  mobile_money: MobileMoneyCharge,
19873
- phone: PhoneNumberCharge,
19874
19646
  direct_debit: DirectDebitCharge,
19875
19647
  bank_transfer: PayWithTransferCharge,
19876
19648
  eft: EFT,