@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/lib/checkout.js CHANGED
@@ -18573,7 +18573,7 @@ var CardAPI = {
18573
18573
 
18574
18574
  var paymentMethod$3 = 'card';
18575
18575
 
18576
- function validate$4(card, isSetter) {
18576
+ function validate$3(card, isSetter) {
18577
18577
  return new Promise(function (resolve, reject) {
18578
18578
  var validation = Card.validate(card);
18579
18579
 
@@ -18594,7 +18594,7 @@ var CardCharge = {
18594
18594
  setCard: function setCard(params) {
18595
18595
  var _this = this;
18596
18596
 
18597
- return validate$4(params, true).then(function () {
18597
+ return validate$3(params, true).then(function () {
18598
18598
  _this.card = new Card(params);
18599
18599
  });
18600
18600
  },
@@ -18610,7 +18610,7 @@ var CardCharge = {
18610
18610
  return this.chargeCardWithPin(customFields);
18611
18611
  }
18612
18612
 
18613
- return validate$4(this.card).then(function () {
18613
+ return validate$3(this.card).then(function () {
18614
18614
  _this2.logAttempt(paymentMethod$3);
18615
18615
 
18616
18616
  var chargeParams = {
@@ -18902,7 +18902,7 @@ var EMandateAPI = {
18902
18902
 
18903
18903
  var paymentMethod$2 = 'bank account';
18904
18904
 
18905
- function validate$3(bankAccount, isSetter) {
18905
+ function validate$2(bankAccount, isSetter) {
18906
18906
  return new Promise(function (resolve, reject) {
18907
18907
  var validation = BankAccount.validate(bankAccount);
18908
18908
 
@@ -18920,14 +18920,14 @@ var EMandate = {
18920
18920
  setBankAccount: function setBankAccount(params) {
18921
18921
  var _this = this;
18922
18922
 
18923
- return validate$3(params, true).then(function () {
18923
+ return validate$2(params, true).then(function () {
18924
18924
  _this.bankAccount = new BankAccount(params);
18925
18925
  });
18926
18926
  },
18927
18927
  chargeBankAccount: function chargeBankAccount() {
18928
18928
  var _this2 = this;
18929
18929
 
18930
- return validate$3(this.bankAccount).then(function () {
18930
+ return validate$2(this.bankAccount).then(function () {
18931
18931
  _this2.logAttempt(paymentMethod$2);
18932
18932
 
18933
18933
  var verifyParams = {
@@ -18946,7 +18946,7 @@ var EMandate = {
18946
18946
  registerBankAccount: function registerBankAccount(birthday) {
18947
18947
  var _this3 = this;
18948
18948
 
18949
- return validate$3(this.bankAccount).then(function () {
18949
+ return validate$2(this.bankAccount).then(function () {
18950
18950
  var registerParams = {
18951
18951
  bankId: _this3.bankAccount.bankId,
18952
18952
  transactionId: _this3.id,
@@ -18963,7 +18963,7 @@ var EMandate = {
18963
18963
  authenticateBankAccount: function authenticateBankAccount(token) {
18964
18964
  var _this4 = this;
18965
18965
 
18966
- return validate$3(this.bankAccount).then(function () {
18966
+ return validate$2(this.bankAccount).then(function () {
18967
18967
  var chargeParams = {
18968
18968
  bankId: _this4.bankAccount.bankId,
18969
18969
  transactionId: _this4.id,
@@ -19188,7 +19188,7 @@ var QrAPI = {
19188
19188
  }
19189
19189
  };
19190
19190
 
19191
- function validate$2(channel) {
19191
+ function validate$1(channel) {
19192
19192
  return new Promise(function (resolve, reject) {
19193
19193
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19194
19194
 
@@ -19206,7 +19206,7 @@ var QRCharge = {
19206
19206
  var _this = this;
19207
19207
 
19208
19208
  var channel = _ref.channel;
19209
- return validate$2(channel).then(function () {
19209
+ return validate$1(channel).then(function () {
19210
19210
  if (_this.qr[channel]) {
19211
19211
  return _this.qr[channel];
19212
19212
  }
@@ -19228,7 +19228,7 @@ var QRCharge = {
19228
19228
  var _this2 = this;
19229
19229
 
19230
19230
  var channel = _ref2.channel;
19231
- return validate$2(channel).then(function () {
19231
+ return validate$1(channel).then(function () {
19232
19232
  if (!_this2.qr[channel]) {
19233
19233
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19234
19234
  }
@@ -19349,7 +19349,7 @@ var MobileMoneyAPI = {
19349
19349
  }
19350
19350
  };
19351
19351
 
19352
- function validate$1(phoneNumber) {
19352
+ function validate(phoneNumber) {
19353
19353
  return new Promise(function (resolve, reject) {
19354
19354
  var validation = PhoneNumber.validate(phoneNumber);
19355
19355
 
@@ -19370,7 +19370,7 @@ var MobileMoneyCharge = {
19370
19370
  provider = _ref.provider,
19371
19371
  voucher = _ref.voucher,
19372
19372
  registrationToken = _ref.registrationToken;
19373
- return validate$1(phoneNumber).then(function () {
19373
+ return validate(phoneNumber).then(function () {
19374
19374
  _this.logAttempt('mobile money');
19375
19375
 
19376
19376
  var params = {
@@ -19401,7 +19401,7 @@ var MobileMoneyCharge = {
19401
19401
  var phoneNumber = payload.phoneNumber,
19402
19402
  provider = payload.provider,
19403
19403
  registrationToken = payload.registrationToken;
19404
- return validate$1(phoneNumber).then(function () {
19404
+ return validate(phoneNumber).then(function () {
19405
19405
  _this2.logMobileMoneyActions(payload);
19406
19406
 
19407
19407
  var params = {
@@ -19457,233 +19457,6 @@ var MobileMoneyCharge = {
19457
19457
  }
19458
19458
  };
19459
19459
 
19460
- var PhoneAPI = {
19461
- verify: function verify(phoneNumber, publicKey) {
19462
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
19463
- var language = getLanguage();
19464
-
19465
- var headers = _objectSpread2({
19466
- Authorization: "Bearer ".concat(publicKey)
19467
- }, language && {
19468
- 'Accept-Language': language
19469
- });
19470
-
19471
- return axiosInstance.post(url, {
19472
- phone: phoneNumber
19473
- }, {
19474
- headers: headers
19475
- }).then(function (response) {
19476
- return response.data;
19477
- });
19478
- },
19479
- deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
19480
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
19481
- var language = getLanguage();
19482
-
19483
- var headers = _objectSpread2({
19484
- Authorization: "Bearer ".concat(publicKey)
19485
- }, language && {
19486
- 'Accept-Language': language
19487
- });
19488
-
19489
- return axiosInstance.post(url, {
19490
- phone: phoneNumber,
19491
- id: cardId
19492
- }, {
19493
- headers: headers
19494
- }).then(function (response) {
19495
- return response.data;
19496
- });
19497
- },
19498
- authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
19499
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
19500
- var language = getLanguage();
19501
-
19502
- var headers = _objectSpread2({
19503
- Authorization: "Bearer ".concat(publicKey)
19504
- }, language && {
19505
- 'Accept-Language': language
19506
- });
19507
-
19508
- return axiosInstance.post(url, {
19509
- phone: phoneNumber,
19510
- otp: otp,
19511
- transaction: transactionId
19512
- }, {
19513
- headers: headers
19514
- }).then(function (response) {
19515
- return response.data;
19516
- });
19517
- },
19518
- authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
19519
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
19520
- var language = getLanguage();
19521
-
19522
- var headers = _objectSpread2({
19523
- Authorization: "Bearer ".concat(publicKey)
19524
- }, language && {
19525
- 'Accept-Language': language
19526
- });
19527
-
19528
- return axiosInstance.post(url, {
19529
- phone: phoneNumber,
19530
- pin: pin,
19531
- transaction: transactionId
19532
- }, {
19533
- headers: headers
19534
- }).then(function (response) {
19535
- return response.data;
19536
- });
19537
- },
19538
- setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
19539
- var language = getLanguage();
19540
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
19541
-
19542
- var headers = _objectSpread2({
19543
- Authorization: "Bearer ".concat(publicKey)
19544
- }, language && {
19545
- 'Accept-Language': language
19546
- });
19547
-
19548
- return axiosInstance.post(url, {
19549
- phone: phoneNumber,
19550
- token: transactionToken,
19551
- transaction: transactionId,
19552
- pin: pin
19553
- }, {
19554
- headers: headers
19555
- }).then(function (response) {
19556
- return response.data;
19557
- });
19558
- },
19559
- charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
19560
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
19561
- var language = getLanguage();
19562
-
19563
- var headers = _objectSpread2({
19564
- Authorization: "Bearer ".concat(publicKey)
19565
- }, language && {
19566
- 'Accept-Language': language
19567
- });
19568
-
19569
- return axiosInstance.post(url, {
19570
- id: authId,
19571
- token: token,
19572
- cvv: cvv,
19573
- transaction: transactionId,
19574
- phone: phoneNumber
19575
- }, {
19576
- headers: headers
19577
- }).then(function (response) {
19578
- return response.data;
19579
- });
19580
- },
19581
- enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
19582
- var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
19583
- var language = getLanguage();
19584
-
19585
- var headers = _objectSpread2({
19586
- Authorization: "Bearer ".concat(publicKey)
19587
- }, language && {
19588
- 'Accept-Language': language
19589
- });
19590
-
19591
- return axiosInstance.post(url, {
19592
- phone: phoneNumber,
19593
- transaction: transactionId
19594
- }, {
19595
- headers: headers
19596
- }).then(function (response) {
19597
- return response.data;
19598
- });
19599
- }
19600
- };
19601
-
19602
- /*
19603
- TODO:
19604
- Implement analytics for Pay with Phone. Since unique actions are takens here e.g
19605
- user verifies pay with phone account, user charged saved card, etc, these should
19606
- all be reflected as custom analytics actions
19607
- */
19608
-
19609
- function validate(phoneNumber) {
19610
- return new Promise(function (resolve, reject) {
19611
- var validation = PhoneNumber.validate(phoneNumber);
19612
-
19613
- if (!validation.isValid) {
19614
- var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
19615
- reject(Error(errorMessage));
19616
- }
19617
-
19618
- resolve(validation);
19619
- });
19620
- }
19621
-
19622
- var PhoneNumberCharge = {
19623
- setCustomer: function setCustomer(_ref) {
19624
- var _this = this;
19625
-
19626
- var phoneNumber = _ref.phoneNumber;
19627
- return validate(phoneNumber).then(function () {
19628
- _this.customer = phoneNumber;
19629
- });
19630
- },
19631
- verifyCustomer: function verifyCustomer() {
19632
- var _this2 = this;
19633
-
19634
- return validate(this.customer).then(function () {
19635
- return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
19636
- });
19637
- },
19638
- deleteSavedCard: function deleteSavedCard(cardId) {
19639
- var _this3 = this;
19640
-
19641
- return validate(this.customer).then(function () {
19642
- return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
19643
- });
19644
- },
19645
- authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
19646
- var _this4 = this;
19647
-
19648
- return validate(this.customer).then(function () {
19649
- return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
19650
- });
19651
- },
19652
- authenticateCustomerPin: function authenticateCustomerPin(pin) {
19653
- var _this5 = this;
19654
-
19655
- return validate(this.customer).then(function () {
19656
- return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
19657
- });
19658
- },
19659
- setCustomerPin: function setCustomerPin(_ref2) {
19660
- var _this6 = this;
19661
-
19662
- var pin = _ref2.pin,
19663
- token = _ref2.token;
19664
- return validate(this.customer).then(function () {
19665
- return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
19666
- });
19667
- },
19668
- chargeSavedCard: function chargeSavedCard(_ref3) {
19669
- var _this7 = this;
19670
-
19671
- var cardId = _ref3.cardId,
19672
- token = _ref3.token,
19673
- cvv = _ref3.cvv;
19674
- return validate(this.customer).then(function () {
19675
- return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
19676
- });
19677
- },
19678
- enrollPhoneNumber: function enrollPhoneNumber(number) {
19679
- var _this8 = this;
19680
-
19681
- return validate(this.customer).then(function () {
19682
- return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
19683
- });
19684
- }
19685
- };
19686
-
19687
19460
  var DirectDebitAPI = {
19688
19461
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19689
19462
  var email = _ref.email,
@@ -19874,7 +19647,6 @@ var ChargeFunctions = {
19874
19647
  ussd: USSDCharge,
19875
19648
  qr: QRCharge,
19876
19649
  mobile_money: MobileMoneyCharge,
19877
- phone: PhoneNumberCharge,
19878
19650
  direct_debit: DirectDebitCharge,
19879
19651
  bank_transfer: PayWithTransferCharge,
19880
19652
  eft: EFT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.18.0",
3
+ "version": "1.18.1",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",