@paystack/checkout-js 1.19.0-dev.22 → 1.19.0-dev.24

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
@@ -11643,7 +11643,7 @@ var PayattitudeAPI = {
11643
11643
  }
11644
11644
  };
11645
11645
 
11646
- var paymentMethod$6 = 'payattitude';
11646
+ var paymentMethod$7 = 'payattitude';
11647
11647
  var PayattitudeCharge = {
11648
11648
  chargePayattitude: function chargePayattitude(_ref) {
11649
11649
  var _this = this;
@@ -11654,7 +11654,7 @@ var PayattitudeCharge = {
11654
11654
  phoneNumber: phoneNumber
11655
11655
  };
11656
11656
  return PayattitudeAPI.charge(params).then(function (response) {
11657
- _this.logAPIResponse(response, paymentMethod$6);
11657
+ _this.logAPIResponse(response, paymentMethod$7);
11658
11658
 
11659
11659
  return response;
11660
11660
  });
@@ -11662,7 +11662,7 @@ var PayattitudeCharge = {
11662
11662
  listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
11663
11663
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
11664
11664
  var listenerOptions = {
11665
- paymentMethod: paymentMethod$6,
11665
+ paymentMethod: paymentMethod$7,
11666
11666
  channel: pusherChannel
11667
11667
  };
11668
11668
  return this.listenForCharge(listenerOptions, callback);
@@ -11745,7 +11745,7 @@ var ApplePayAPI = {
11745
11745
  }
11746
11746
  };
11747
11747
 
11748
- var paymentMethod$5 = 'apple pay';
11748
+ var paymentMethod$6 = 'apple pay';
11749
11749
  var ApplePayCharge = {
11750
11750
  validateApplePaySession: function validateApplePaySession(_ref) {
11751
11751
  var _this = this;
@@ -11753,7 +11753,7 @@ var ApplePayCharge = {
11753
11753
  var sessionUrl = _ref.sessionUrl,
11754
11754
  displayName = _ref.displayName,
11755
11755
  domainName = _ref.domainName;
11756
- this.logAttempt(paymentMethod$5);
11756
+ this.logAttempt(paymentMethod$6);
11757
11757
  return ApplePayAPI.validateApplePaySession({
11758
11758
  sessionUrl: sessionUrl,
11759
11759
  displayName: displayName,
@@ -11774,7 +11774,7 @@ var ApplePayCharge = {
11774
11774
  device: this.deviceFingerprint,
11775
11775
  paymentObject: paymentObject
11776
11776
  }).then(function (response) {
11777
- _this2.logAPIResponse(response, paymentMethod$5);
11777
+ _this2.logAPIResponse(response, paymentMethod$6);
11778
11778
 
11779
11779
  return response;
11780
11780
  });
@@ -11830,12 +11830,12 @@ var PayPalAPI = {
11830
11830
  }
11831
11831
  };
11832
11832
 
11833
- var paymentMethod$4 = 'paypal';
11833
+ var paymentMethod$5 = 'paypal';
11834
11834
  var PayPalCharge = {
11835
11835
  createPayPalOrder: function createPayPalOrder() {
11836
11836
  var _this = this;
11837
11837
 
11838
- this.logAttempt(paymentMethod$4);
11838
+ this.logAttempt(paymentMethod$5);
11839
11839
  return PayPalAPI.createOrder(this.id).then(function (response) {
11840
11840
  _this.logAPIResponseMessage(response.message);
11841
11841
 
@@ -11846,7 +11846,7 @@ var PayPalCharge = {
11846
11846
  var _this2 = this;
11847
11847
 
11848
11848
  return PayPalAPI.captureOrder(this.id).then(function (response) {
11849
- _this2.logAPIResponse(response, paymentMethod$4);
11849
+ _this2.logAPIResponse(response, paymentMethod$5);
11850
11850
 
11851
11851
  return response;
11852
11852
  });
@@ -18293,7 +18293,7 @@ var testCards = [{
18293
18293
  year: '30'
18294
18294
  }];
18295
18295
 
18296
- var Card$1 = {
18296
+ var Card$2 = {
18297
18297
  getEncryptedPin: function getEncryptedPin(pin) {
18298
18298
  return pin ? encrypt(pin) : undefined;
18299
18299
  },
@@ -18352,7 +18352,7 @@ var Card$1 = {
18352
18352
  return cardValidator.number(value);
18353
18353
  },
18354
18354
  isNumberValid: function isNumberValid(value) {
18355
- return Card$1.validateNumber(value).isValid;
18355
+ return Card$2.validateNumber(value).isValid;
18356
18356
  },
18357
18357
  validateCVV: function validateCVV(cvv, cardType) {
18358
18358
  var isAmexCard = cardType === 'american-express';
@@ -18360,7 +18360,7 @@ var Card$1 = {
18360
18360
  return cardValidator.cvv(cvv, cvvLength);
18361
18361
  },
18362
18362
  isCvvValid: function isCvvValid(cvv, cardType) {
18363
- return Card$1.validateCVV(cvv, cardType).isValid;
18363
+ return Card$2.validateCVV(cvv, cardType).isValid;
18364
18364
  },
18365
18365
  validateExpiry: function validateExpiry(value) {
18366
18366
  if (_typeof$1(value) === 'object') {
@@ -18372,14 +18372,14 @@ var Card$1 = {
18372
18372
  return cardValidator.expirationDate(value);
18373
18373
  },
18374
18374
  isExpiryValid: function isExpiryValid(value) {
18375
- return Card$1.validateExpiry(value).isValid;
18375
+ return Card$2.validateExpiry(value).isValid;
18376
18376
  },
18377
18377
  generateTestCard: function generateTestCard(cardType) {
18378
18378
  var type = cardType || 'default';
18379
18379
  var cardParams = testCards.find(function (card) {
18380
18380
  return card.type === type;
18381
18381
  });
18382
- return new Card$1(cardParams);
18382
+ return new Card$2(cardParams);
18383
18383
  }
18384
18384
  };
18385
18385
 
@@ -18396,7 +18396,7 @@ cardValidator.creditCardType.addCard({
18396
18396
  });
18397
18397
  cardValidator.creditCardType.changeOrder('verve', 0);
18398
18398
 
18399
- var Card = /*#__PURE__*/function () {
18399
+ var Card$1 = /*#__PURE__*/function () {
18400
18400
  function Card(_ref) {
18401
18401
  var number = _ref.number,
18402
18402
  cvv = _ref.cvv,
@@ -18416,17 +18416,17 @@ var Card = /*#__PURE__*/function () {
18416
18416
  _createClass(Card, [{
18417
18417
  key: "getEncryptedPin",
18418
18418
  value: function getEncryptedPin() {
18419
- return Card$1.getEncryptedPin(this.pin);
18419
+ return Card$2.getEncryptedPin(this.pin);
18420
18420
  }
18421
18421
  }, {
18422
18422
  key: "getLast4",
18423
18423
  value: function getLast4() {
18424
- return Card$1.getLast4(this.number);
18424
+ return Card$2.getLast4(this.number);
18425
18425
  }
18426
18426
  }, {
18427
18427
  key: "tokenize",
18428
18428
  value: function tokenize() {
18429
- return Card$1.tokenize({
18429
+ return Card$2.tokenize({
18430
18430
  number: this.number,
18431
18431
  cvv: this.cvv,
18432
18432
  month: this.month,
@@ -18436,7 +18436,7 @@ var Card = /*#__PURE__*/function () {
18436
18436
  }], [{
18437
18437
  key: "getType",
18438
18438
  value: function getType(value) {
18439
- return Card$1.getType(value);
18439
+ return Card$2.getType(value);
18440
18440
  }
18441
18441
  }, {
18442
18442
  key: "validate",
@@ -18445,7 +18445,7 @@ var Card = /*#__PURE__*/function () {
18445
18445
  cvv = _ref2.cvv,
18446
18446
  month = _ref2.month,
18447
18447
  year = _ref2.year;
18448
- return Card$1.validate({
18448
+ return Card$2.validate({
18449
18449
  number: number,
18450
18450
  cvv: cvv,
18451
18451
  month: month,
@@ -18455,44 +18455,44 @@ var Card = /*#__PURE__*/function () {
18455
18455
  }, {
18456
18456
  key: "validateNumber",
18457
18457
  value: function validateNumber(value) {
18458
- return Card$1.validateNumber(value);
18458
+ return Card$2.validateNumber(value);
18459
18459
  }
18460
18460
  }, {
18461
18461
  key: "isNumberValid",
18462
18462
  value: function isNumberValid(value) {
18463
- return Card$1.isNumberValid(value);
18463
+ return Card$2.isNumberValid(value);
18464
18464
  }
18465
18465
  }, {
18466
18466
  key: "validateCVV",
18467
18467
  value: function validateCVV(cvv, cardType) {
18468
- return Card$1.validateCVV(cvv, cardType);
18468
+ return Card$2.validateCVV(cvv, cardType);
18469
18469
  }
18470
18470
  }, {
18471
18471
  key: "isCvvValid",
18472
18472
  value: function isCvvValid(cvv, cardType) {
18473
- return Card$1.isCvvValid(cvv, cardType);
18473
+ return Card$2.isCvvValid(cvv, cardType);
18474
18474
  }
18475
18475
  }, {
18476
18476
  key: "validateExpiry",
18477
18477
  value: function validateExpiry(value) {
18478
- return Card$1.validateExpiry(value);
18478
+ return Card$2.validateExpiry(value);
18479
18479
  }
18480
18480
  }, {
18481
18481
  key: "isExpiryValid",
18482
18482
  value: function isExpiryValid(value) {
18483
- return Card$1.isExpiryValid(value);
18483
+ return Card$2.isExpiryValid(value);
18484
18484
  }
18485
18485
  }, {
18486
18486
  key: "generateTestCard",
18487
18487
  value: function generateTestCard(cardType) {
18488
- return Card$1.generateTestCard(cardType);
18488
+ return Card$2.generateTestCard(cardType);
18489
18489
  }
18490
18490
  }]);
18491
18491
 
18492
18492
  return Card;
18493
18493
  }();
18494
18494
 
18495
- var CardAPI = {
18495
+ var CardAPI$1 = {
18496
18496
  charge: function charge(_ref) {
18497
18497
  var clientdata = _ref.clientdata,
18498
18498
  last4 = _ref.last4,
@@ -18838,11 +18838,11 @@ var CardAPI = {
18838
18838
  }
18839
18839
  };
18840
18840
 
18841
- var paymentMethod$3 = 'card';
18841
+ var paymentMethod$4 = 'card';
18842
18842
 
18843
- function validate$3(card, isSetter) {
18843
+ function validate$4(card, isSetter) {
18844
18844
  return new Promise(function (resolve, reject) {
18845
- var validation = Card.validate(card);
18845
+ var validation = Card$1.validate(card);
18846
18846
 
18847
18847
  if (!validation.isValid) {
18848
18848
  var throwValidation = isSetter || card.number;
@@ -18861,8 +18861,8 @@ var CardCharge = {
18861
18861
  setCard: function setCard(params) {
18862
18862
  var _this = this;
18863
18863
 
18864
- return validate$3(params, true).then(function () {
18865
- _this.card = new Card(params);
18864
+ return validate$4(params, true).then(function () {
18865
+ _this.card = new Card$1(params);
18866
18866
  });
18867
18867
  },
18868
18868
  rememberCard: function rememberCard() {
@@ -18877,8 +18877,8 @@ var CardCharge = {
18877
18877
  return this.chargeCardWithPin(customFields);
18878
18878
  }
18879
18879
 
18880
- return validate$3(this.card).then(function () {
18881
- _this2.logAttempt(paymentMethod$3);
18880
+ return validate$4(this.card).then(function () {
18881
+ _this2.logAttempt(paymentMethod$4);
18882
18882
 
18883
18883
  var chargeParams = {
18884
18884
  clientdata: _this2.card.tokenize(),
@@ -18891,8 +18891,8 @@ var CardCharge = {
18891
18891
  subscription: _this2.subscription,
18892
18892
  customFields: customFields
18893
18893
  };
18894
- return CardAPI.charge(chargeParams).then(function (response) {
18895
- _this2.logAPIResponse(response, paymentMethod$3);
18894
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18895
+ _this2.logAPIResponse(response, paymentMethod$4);
18896
18896
 
18897
18897
  return response;
18898
18898
  });
@@ -18907,7 +18907,7 @@ var CardCharge = {
18907
18907
  var _this3 = this;
18908
18908
 
18909
18909
  var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18910
- this.logAttempt(paymentMethod$3);
18910
+ this.logAttempt(paymentMethod$4);
18911
18911
  var chargeParams = {
18912
18912
  pin: encrypt(this.card.pin),
18913
18913
  trans: this.id,
@@ -18917,8 +18917,8 @@ var CardCharge = {
18917
18917
  subscription: this.subscription,
18918
18918
  customFields: customFields
18919
18919
  };
18920
- return CardAPI.charge(chargeParams).then(function (response) {
18921
- _this3.logAPIResponse(response, paymentMethod$3);
18920
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18921
+ _this3.logAPIResponse(response, paymentMethod$4);
18922
18922
 
18923
18923
  return response;
18924
18924
  });
@@ -18930,7 +18930,7 @@ var CardCharge = {
18930
18930
  authorizationCode = _ref.authorizationCode,
18931
18931
  cardLast4 = _ref.cardLast4,
18932
18932
  pin = _ref.pin;
18933
- this.logAttempt(paymentMethod$3);
18933
+ this.logAttempt(paymentMethod$4);
18934
18934
  var encryptedPin = encrypt(pin);
18935
18935
  var chargeParams = {
18936
18936
  authorizationCode: authorizationCode,
@@ -18942,8 +18942,8 @@ var CardCharge = {
18942
18942
  transactionType: this.transactionType,
18943
18943
  subscription: this.subscription
18944
18944
  };
18945
- return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
18946
- _this4.logAPIResponse(response, paymentMethod$3);
18945
+ return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
18946
+ _this4.logAPIResponse(response, paymentMethod$4);
18947
18947
 
18948
18948
  return response;
18949
18949
  });
@@ -18961,8 +18961,8 @@ var CardCharge = {
18961
18961
  device: this.deviceFingerprint
18962
18962
  });
18963
18963
 
18964
- return CardAPI.resumeCardCharge(params).then(function (response) {
18965
- _this5.logAPIResponse(response, paymentMethod$3);
18964
+ return CardAPI$1.resumeCardCharge(params).then(function (response) {
18965
+ _this5.logAPIResponse(response, paymentMethod$4);
18966
18966
 
18967
18967
  return response;
18968
18968
  });
@@ -18974,8 +18974,8 @@ var CardCharge = {
18974
18974
  authorizationId: authorizationId,
18975
18975
  publicKey: this.merchant.key
18976
18976
  };
18977
- return CardAPI.forgetRememberedCard(params).then(function (response) {
18978
- _this6.logAPIResponse(response, paymentMethod$3);
18977
+ return CardAPI$1.forgetRememberedCard(params).then(function (response) {
18978
+ _this6.logAPIResponse(response, paymentMethod$4);
18979
18979
 
18980
18980
  return response;
18981
18981
  });
@@ -18983,8 +18983,8 @@ var CardCharge = {
18983
18983
  authenticateCard: function authenticateCard(token) {
18984
18984
  var _this7 = this;
18985
18985
 
18986
- return CardAPI.authenticate(this.id, token).then(function (response) {
18987
- _this7.logAPIResponse(response, paymentMethod$3);
18986
+ return CardAPI$1.authenticate(this.id, token).then(function (response) {
18987
+ _this7.logAPIResponse(response, paymentMethod$4);
18988
18988
 
18989
18989
  return response;
18990
18990
  });
@@ -19003,8 +19003,8 @@ var CardCharge = {
19003
19003
  zipCode: zipCode,
19004
19004
  transactionId: this.id
19005
19005
  };
19006
- return CardAPI.verifyAddress(payload).then(function (response) {
19007
- _this8.logAPIResponse(response, paymentMethod$3);
19006
+ return CardAPI$1.verifyAddress(payload).then(function (response) {
19007
+ _this8.logAPIResponse(response, paymentMethod$4);
19008
19008
 
19009
19009
  return response;
19010
19010
  });
@@ -19012,12 +19012,12 @@ var CardCharge = {
19012
19012
  listenFor3DSCharge: function listenFor3DSCharge(callback) {
19013
19013
  var listenerOptions = {
19014
19014
  channel: "3DS_".concat(this.id),
19015
- paymentMethod: paymentMethod$3
19015
+ paymentMethod: paymentMethod$4
19016
19016
  };
19017
19017
  return this.listenForCharge(listenerOptions, callback);
19018
19018
  },
19019
19019
  requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
19020
- return CardAPI.requestSavedCardsOTP(phoneNumber);
19020
+ return CardAPI$1.requestSavedCardsOTP(phoneNumber);
19021
19021
  },
19022
19022
  verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19023
19023
  var _this9 = this;
@@ -19036,7 +19036,7 @@ var CardCharge = {
19036
19036
  };
19037
19037
  _context.prev = 2;
19038
19038
  _context.next = 5;
19039
- return CardAPI.verifySavedCardsOtp(payload);
19039
+ return CardAPI$1.verifySavedCardsOtp(payload);
19040
19040
 
19041
19041
  case 5:
19042
19042
  response = _context.sent;
@@ -19058,19 +19058,19 @@ var CardCharge = {
19058
19058
  }))();
19059
19059
  },
19060
19060
  getSavedCards: function getSavedCards() {
19061
- return CardAPI.getSavedCards({
19061
+ return CardAPI$1.getSavedCards({
19062
19062
  token: this.savedCardsToken
19063
19063
  });
19064
19064
  },
19065
19065
  deleteSavedCard: function deleteSavedCard(cardCode) {
19066
- return CardAPI.deleteSavedCard({
19066
+ return CardAPI$1.deleteSavedCard({
19067
19067
  cardCode: cardCode,
19068
19068
  token: this.savedCardsToken
19069
19069
  });
19070
19070
  },
19071
19071
  chargeSavedCard: function chargeSavedCard(_ref5) {
19072
19072
  var cardCode = _ref5.cardCode;
19073
- return CardAPI.chargeSavedCard({
19073
+ return CardAPI$1.chargeSavedCard({
19074
19074
  cardCode: cardCode,
19075
19075
  transaction: this.id,
19076
19076
  token: this.savedCardsToken,
@@ -19229,9 +19229,9 @@ var EMandateAPI = {
19229
19229
  }
19230
19230
  };
19231
19231
 
19232
- var paymentMethod$2 = 'bank account';
19232
+ var paymentMethod$3 = 'bank account';
19233
19233
 
19234
- function validate$2(bankAccount, isSetter) {
19234
+ function validate$3(bankAccount, isSetter) {
19235
19235
  return new Promise(function (resolve, reject) {
19236
19236
  var validation = BankAccount.validate(bankAccount);
19237
19237
 
@@ -19249,15 +19249,15 @@ var EMandate = {
19249
19249
  setBankAccount: function setBankAccount(params) {
19250
19250
  var _this = this;
19251
19251
 
19252
- return validate$2(params, true).then(function () {
19252
+ return validate$3(params, true).then(function () {
19253
19253
  _this.bankAccount = new BankAccount(params);
19254
19254
  });
19255
19255
  },
19256
19256
  chargeBankAccount: function chargeBankAccount() {
19257
19257
  var _this2 = this;
19258
19258
 
19259
- return validate$2(this.bankAccount).then(function () {
19260
- _this2.logAttempt(paymentMethod$2);
19259
+ return validate$3(this.bankAccount).then(function () {
19260
+ _this2.logAttempt(paymentMethod$3);
19261
19261
 
19262
19262
  var verifyParams = {
19263
19263
  bankId: _this2.bankAccount.bankId,
@@ -19266,7 +19266,7 @@ var EMandate = {
19266
19266
  device: _this2.deviceFingerprint
19267
19267
  };
19268
19268
  return EMandateAPI.verify(verifyParams).then(function (response) {
19269
- _this2.logAPIResponse(response, paymentMethod$2);
19269
+ _this2.logAPIResponse(response, paymentMethod$3);
19270
19270
 
19271
19271
  return response;
19272
19272
  });
@@ -19275,7 +19275,7 @@ var EMandate = {
19275
19275
  registerBankAccount: function registerBankAccount(birthday) {
19276
19276
  var _this3 = this;
19277
19277
 
19278
- return validate$2(this.bankAccount).then(function () {
19278
+ return validate$3(this.bankAccount).then(function () {
19279
19279
  var registerParams = {
19280
19280
  bankId: _this3.bankAccount.bankId,
19281
19281
  transactionId: _this3.id,
@@ -19283,7 +19283,7 @@ var EMandate = {
19283
19283
  birthday: birthday
19284
19284
  };
19285
19285
  return EMandateAPI.register(registerParams).then(function (response) {
19286
- _this3.logAPIResponse(response, paymentMethod$2);
19286
+ _this3.logAPIResponse(response, paymentMethod$3);
19287
19287
 
19288
19288
  return response;
19289
19289
  });
@@ -19292,7 +19292,7 @@ var EMandate = {
19292
19292
  authenticateBankAccount: function authenticateBankAccount(token) {
19293
19293
  var _this4 = this;
19294
19294
 
19295
- return validate$2(this.bankAccount).then(function () {
19295
+ return validate$3(this.bankAccount).then(function () {
19296
19296
  var chargeParams = {
19297
19297
  bankId: _this4.bankAccount.bankId,
19298
19298
  transactionId: _this4.id,
@@ -19300,7 +19300,7 @@ var EMandate = {
19300
19300
  device: _this4.deviceFingerprint
19301
19301
  };
19302
19302
  return EMandateAPI.authenticate(chargeParams).then(function (response) {
19303
- _this4.logAPIResponse(response, paymentMethod$2);
19303
+ _this4.logAPIResponse(response, paymentMethod$3);
19304
19304
 
19305
19305
  return response;
19306
19306
  });
@@ -19361,7 +19361,7 @@ var DigitalBankMandateAPI = {
19361
19361
  }
19362
19362
  };
19363
19363
 
19364
- var paymentMethod$1 = 'bank';
19364
+ var paymentMethod$2 = 'bank';
19365
19365
  var DigitalBankMandate = {
19366
19366
  chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
19367
19367
  var _this = this;
@@ -19376,7 +19376,7 @@ var DigitalBankMandate = {
19376
19376
  bankId: bankId
19377
19377
  };
19378
19378
  return DigitalBankMandateAPI.charge(params).then(function (response) {
19379
- _this.logAPIResponse(response, paymentMethod$1);
19379
+ _this.logAPIResponse(response, paymentMethod$2);
19380
19380
 
19381
19381
  return response;
19382
19382
  });
@@ -19384,7 +19384,7 @@ var DigitalBankMandate = {
19384
19384
  listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
19385
19385
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
19386
19386
  var listenerOptions = {
19387
- paymentMethod: paymentMethod$1,
19387
+ paymentMethod: paymentMethod$2,
19388
19388
  channel: pusherChannel
19389
19389
  };
19390
19390
  return this.listenForCharge(listenerOptions, callback);
@@ -19517,7 +19517,7 @@ var QrAPI = {
19517
19517
  }
19518
19518
  };
19519
19519
 
19520
- function validate$1(channel) {
19520
+ function validate$2(channel) {
19521
19521
  return new Promise(function (resolve, reject) {
19522
19522
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19523
19523
 
@@ -19535,7 +19535,7 @@ var QRCharge = {
19535
19535
  var _this = this;
19536
19536
 
19537
19537
  var channel = _ref.channel;
19538
- return validate$1(channel).then(function () {
19538
+ return validate$2(channel).then(function () {
19539
19539
  if (_this.qr[channel]) {
19540
19540
  return _this.qr[channel];
19541
19541
  }
@@ -19557,7 +19557,7 @@ var QRCharge = {
19557
19557
  var _this2 = this;
19558
19558
 
19559
19559
  var channel = _ref2.channel;
19560
- return validate$1(channel).then(function () {
19560
+ return validate$2(channel).then(function () {
19561
19561
  if (!_this2.qr[channel]) {
19562
19562
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19563
19563
  }
@@ -19678,7 +19678,7 @@ var MobileMoneyAPI = {
19678
19678
  }
19679
19679
  };
19680
19680
 
19681
- function validate(phoneNumber) {
19681
+ function validate$1(phoneNumber) {
19682
19682
  return new Promise(function (resolve, reject) {
19683
19683
  var validation = PhoneNumber.validate(phoneNumber);
19684
19684
 
@@ -19699,7 +19699,7 @@ var MobileMoneyCharge = {
19699
19699
  provider = _ref.provider,
19700
19700
  voucher = _ref.voucher,
19701
19701
  registrationToken = _ref.registrationToken;
19702
- return validate(phoneNumber).then(function () {
19702
+ return validate$1(phoneNumber).then(function () {
19703
19703
  _this.logAttempt('mobile money');
19704
19704
 
19705
19705
  var params = {
@@ -19730,7 +19730,7 @@ var MobileMoneyCharge = {
19730
19730
  var phoneNumber = payload.phoneNumber,
19731
19731
  provider = payload.provider,
19732
19732
  registrationToken = payload.registrationToken;
19733
- return validate(phoneNumber).then(function () {
19733
+ return validate$1(phoneNumber).then(function () {
19734
19734
  _this2.logMobileMoneyActions(payload);
19735
19735
 
19736
19736
  var params = {
@@ -19870,7 +19870,7 @@ var DirectDebitAPI = {
19870
19870
  }
19871
19871
  };
19872
19872
 
19873
- var paymentMethod = 'direct debit';
19873
+ var paymentMethod$1 = 'direct debit';
19874
19874
  var DirectDebitCharge = {
19875
19875
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19876
19876
  var _this = this;
@@ -19916,14 +19916,14 @@ var DirectDebitCharge = {
19916
19916
  return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
19917
19917
  }
19918
19918
 
19919
- this.logAttempt(paymentMethod);
19919
+ this.logAttempt(paymentMethod$1);
19920
19920
  var params = {
19921
19921
  account_code: accountCode,
19922
19922
  transaction: this.id,
19923
19923
  token: this.directDebit.token
19924
19924
  };
19925
19925
  return DirectDebitAPI.charge(params).then(function (response) {
19926
- _this2.logAPIResponse(response, paymentMethod);
19926
+ _this2.logAPIResponse(response, paymentMethod$1);
19927
19927
 
19928
19928
  if (response.status) {
19929
19929
  _this2.directDebit.chargeResponse = response;
@@ -19936,7 +19936,7 @@ var DirectDebitCharge = {
19936
19936
  var _this3 = this;
19937
19937
 
19938
19938
  return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
19939
- _this3.logAPIResponse(response, paymentMethod);
19939
+ _this3.logAPIResponse(response, paymentMethod$1);
19940
19940
 
19941
19941
  var status = response.status,
19942
19942
  data = response.data;
@@ -19961,7 +19961,7 @@ var DirectDebitCharge = {
19961
19961
  token: this.directDebit.token
19962
19962
  };
19963
19963
  return DirectDebitAPI.authenticate(params).then(function (response) {
19964
- _this4.logAPIResponse(response, paymentMethod);
19964
+ _this4.logAPIResponse(response, paymentMethod$1);
19965
19965
 
19966
19966
  return response;
19967
19967
  });
@@ -20747,6 +20747,413 @@ var Toolkit = /*#__PURE__*/function () {
20747
20747
  return Toolkit;
20748
20748
  }();
20749
20749
 
20750
+ cardValidator.creditCardType.addCard({
20751
+ niceType: 'Verve',
20752
+ type: 'verve',
20753
+ patterns: [[506000, 507999], [650000, 650009]],
20754
+ gaps: [4, 8, 12, 16],
20755
+ lengths: [16, 18, 19],
20756
+ code: {
20757
+ name: 'CVV',
20758
+ size: 3
20759
+ }
20760
+ });
20761
+ cardValidator.creditCardType.changeOrder('verve', 0);
20762
+
20763
+ var Card = /*#__PURE__*/function () {
20764
+ function Card(_ref) {
20765
+ var number = _ref.number,
20766
+ cvv = _ref.cvv,
20767
+ month = _ref.month,
20768
+ year = _ref.year,
20769
+ pin = _ref.pin;
20770
+
20771
+ _classCallCheck(this, Card);
20772
+
20773
+ this.number = number;
20774
+ this.cvv = cvv;
20775
+ this.month = month;
20776
+ this.year = year;
20777
+ this.pin = pin;
20778
+ }
20779
+
20780
+ _createClass(Card, [{
20781
+ key: "getEncryptedPin",
20782
+ value: function getEncryptedPin() {
20783
+ return Card$2.getEncryptedPin(this.pin);
20784
+ }
20785
+ }, {
20786
+ key: "getLast4",
20787
+ value: function getLast4() {
20788
+ return Card$2.getLast4(this.number);
20789
+ }
20790
+ }, {
20791
+ key: "tokenize",
20792
+ value: function tokenize() {
20793
+ return Card$2.tokenize({
20794
+ number: this.number,
20795
+ cvv: this.cvv,
20796
+ month: this.month,
20797
+ year: this.year
20798
+ });
20799
+ }
20800
+ }], [{
20801
+ key: "getType",
20802
+ value: function getType(value) {
20803
+ return Card$2.getType(value);
20804
+ }
20805
+ }, {
20806
+ key: "validate",
20807
+ value: function validate(_ref2) {
20808
+ var number = _ref2.number,
20809
+ cvv = _ref2.cvv,
20810
+ month = _ref2.month,
20811
+ year = _ref2.year;
20812
+ return Card$2.validate({
20813
+ number: number,
20814
+ cvv: cvv,
20815
+ month: month,
20816
+ year: year
20817
+ });
20818
+ }
20819
+ }, {
20820
+ key: "validateNumber",
20821
+ value: function validateNumber(value) {
20822
+ return Card$2.validateNumber(value);
20823
+ }
20824
+ }, {
20825
+ key: "isNumberValid",
20826
+ value: function isNumberValid(value) {
20827
+ return Card$2.isNumberValid(value);
20828
+ }
20829
+ }, {
20830
+ key: "validateCVV",
20831
+ value: function validateCVV(cvv, cardType) {
20832
+ return Card$2.validateCVV(cvv, cardType);
20833
+ }
20834
+ }, {
20835
+ key: "isCvvValid",
20836
+ value: function isCvvValid(cvv, cardType) {
20837
+ return Card$2.isCvvValid(cvv, cardType);
20838
+ }
20839
+ }, {
20840
+ key: "validateExpiry",
20841
+ value: function validateExpiry(value) {
20842
+ return Card$2.validateExpiry(value);
20843
+ }
20844
+ }, {
20845
+ key: "isExpiryValid",
20846
+ value: function isExpiryValid(value) {
20847
+ return Card$2.isExpiryValid(value);
20848
+ }
20849
+ }, {
20850
+ key: "generateTestCard",
20851
+ value: function generateTestCard(cardType) {
20852
+ return Card$2.generateTestCard(cardType);
20853
+ }
20854
+ }]);
20855
+
20856
+ return Card;
20857
+ }();
20858
+
20859
+ var CardAPI = {
20860
+ reserve: function reserve(_ref) {
20861
+ var clientdata = _ref.clientdata,
20862
+ last4 = _ref.last4,
20863
+ preauthorizationId = _ref.preauthorizationId;
20864
+ var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
20865
+ var language = getLanguage();
20866
+
20867
+ var headers = _objectSpread2({}, language && {
20868
+ 'Accept-Language': language
20869
+ });
20870
+
20871
+ return axiosInstance.post(url, {
20872
+ clientdata: clientdata,
20873
+ last4: last4,
20874
+ preauthorization: preauthorizationId
20875
+ }, {
20876
+ headers: headers
20877
+ }).then(function (response) {
20878
+ return ChargeResponses.parse(response.data);
20879
+ });
20880
+ } // charge({
20881
+ // clientdata,
20882
+ // last4,
20883
+ // pin,
20884
+ // trans,
20885
+ // device,
20886
+ // rememberCard,
20887
+ // transactionType,
20888
+ // subscription,
20889
+ // customFields,
20890
+ // }) {
20891
+ // const url = `${config.paymentBaseUrl}charge/`;
20892
+ // const language = getLanguage();
20893
+ // const headers = {
20894
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20895
+ // ...(language && { 'Accept-Language': language }),
20896
+ // };
20897
+ // const chargeParams = {
20898
+ // clientdata,
20899
+ // last4,
20900
+ // trans,
20901
+ // device,
20902
+ // offset: new Date().getTimezoneOffset(),
20903
+ // remember_card: rememberCard,
20904
+ // ...(transactionType && { transaction_type: transactionType }),
20905
+ // ...(subscription && { subscription }),
20906
+ // ...(customFields && customFields),
20907
+ // };
20908
+ // if (pin) {
20909
+ // chargeParams.handle = pin;
20910
+ // }
20911
+ // const urlEncodedParams = formurlencoded(chargeParams);
20912
+ // return axiosInstance
20913
+ // .post(url, urlEncodedParams, { headers })
20914
+ // .then((response) => ChargeResponses.parse(response.data));
20915
+ // },
20916
+ // resumeCardCharge({ device, accessCode, pin }) {
20917
+ // const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
20918
+ // const language = getLanguage();
20919
+ // const headers = {
20920
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20921
+ // ...(language && { 'Accept-Language': language }),
20922
+ // };
20923
+ // const data = { device, ...(pin && { handle: pin }) };
20924
+ // const urlEncodedData = formurlencoded(data);
20925
+ // return axiosInstance
20926
+ // .post(url, urlEncodedData, { headers })
20927
+ // .then((response) => ChargeResponses.parse(response.data));
20928
+ // },
20929
+ // chargeRememberedCard({
20930
+ // last4,
20931
+ // trans,
20932
+ // device,
20933
+ // authorizationCode,
20934
+ // cvv,
20935
+ // pin,
20936
+ // transactionType,
20937
+ // subscription,
20938
+ // }) {
20939
+ // const url = `${config.paymentBaseUrl}charge/`;
20940
+ // const language = getLanguage();
20941
+ // const headers = {
20942
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20943
+ // ...(language && { 'Accept-Language': language }),
20944
+ // };
20945
+ // const chargeParams = {
20946
+ // last4,
20947
+ // trans,
20948
+ // device,
20949
+ // cvv,
20950
+ // handle: pin,
20951
+ // authorization_code: authorizationCode,
20952
+ // ...(transactionType && { transaction_type: transactionType }),
20953
+ // ...(subscription && { subscription }),
20954
+ // };
20955
+ // const urlEncodedParams = formurlencoded(chargeParams);
20956
+ // return axiosInstance
20957
+ // .post(url, urlEncodedParams, { headers })
20958
+ // .then((response) => ChargeResponses.parse(response.data));
20959
+ // },
20960
+ // verifyAddress({ address, city, state, zipCode, transactionId }) {
20961
+ // const url = `${config.paymentBaseUrl}charge/avs`;
20962
+ // const language = getLanguage();
20963
+ // const headers = {
20964
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20965
+ // ...(language && { 'Accept-Language': language }),
20966
+ // };
20967
+ // const data = {
20968
+ // city,
20969
+ // state,
20970
+ // address,
20971
+ // zip_code: zipCode,
20972
+ // trans: transactionId,
20973
+ // };
20974
+ // const urlEncodedData = formurlencoded(data);
20975
+ // return axiosInstance
20976
+ // .post(url, urlEncodedData, { headers })
20977
+ // .then((response) => ChargeResponses.parse(response.data));
20978
+ // },
20979
+ // forgetRememberedCard({ authorizationId, publicKey }) {
20980
+ // const language = getLanguage();
20981
+ // const headers = {
20982
+ // Authorization: `Bearer ${publicKey}`,
20983
+ // ...(language && { 'Accept-Language': language }),
20984
+ // };
20985
+ // const params = {
20986
+ // authorization_id: authorizationId,
20987
+ // };
20988
+ // const url = `${config.paystackApiUrl}rememberme/forget_card`;
20989
+ // return axiosInstance
20990
+ // .post(url, params, { headers })
20991
+ // .then((response) => ChargeResponses.parse(response.data));
20992
+ // },
20993
+
20994
+ };
20995
+
20996
+ var paymentMethod = 'card';
20997
+
20998
+ function validate(card, isSetter) {
20999
+ return new Promise(function (resolve, reject) {
21000
+ var validation = Card.validate(card);
21001
+
21002
+ if (!validation.isValid) {
21003
+ var throwValidation = isSetter || card.number;
21004
+ var errors = Object.keys(validation.result).filter(function (value) {
21005
+ return validation.result[value] === false;
21006
+ });
21007
+ var errorMessage = "Invalid card details: ".concat(errors.join(', '));
21008
+ reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
21009
+ }
21010
+
21011
+ resolve();
21012
+ });
21013
+ }
21014
+
21015
+ var ReserveCardFunds = {
21016
+ setCard: function setCard(params) {
21017
+ var _this = this;
21018
+
21019
+ return validate(params, true).then(function () {
21020
+ _this.card = new Card(params);
21021
+ });
21022
+ },
21023
+ reserve: function reserve(preauthorizationId) {
21024
+ var _this2 = this;
21025
+
21026
+ var customFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21027
+ // TODO: Log payment method
21028
+ // https://paystack.atlassian.net/browse/RAILS-3070
21029
+ return validate(this.card).then(function () {
21030
+ var chargeParams = {
21031
+ clientdata: _this2.card.tokenize(),
21032
+ last4: _this2.card.getLast4(),
21033
+ preauthorization: preauthorizationId,
21034
+ customFields: customFields
21035
+ };
21036
+ return CardAPI.charge(chargeParams).then(function (response) {
21037
+ // TODO: Log API Response
21038
+ // https://paystack.atlassian.net/browse/RAILS-3070
21039
+ return response;
21040
+ });
21041
+ });
21042
+ },
21043
+ listenFor3DSCharge: function listenFor3DSCharge(callback) {
21044
+ var listenerOptions = {
21045
+ channel: "3DS_".concat(this.id),
21046
+ paymentMethod: paymentMethod
21047
+ };
21048
+ return this.listenForCharge(listenerOptions, callback);
21049
+ } // rememberCard() {
21050
+ // this.remember_card = true;
21051
+ // },
21052
+ // chargeCard(customFields = {}) {
21053
+ // if (!this.card.number && this.card.pin) {
21054
+ // return this.chargeCardWithPin(customFields);
21055
+ // }
21056
+ // return validate(this.card).then(() => {
21057
+ // this.logAttempt(paymentMethod);
21058
+ // const chargeParams = {
21059
+ // clientdata: this.card.tokenize(),
21060
+ // last4: this.card.getLast4(),
21061
+ // pin: this.card.getEncryptedPin(),
21062
+ // trans: this.id,
21063
+ // device: this.deviceFingerprint,
21064
+ // rememberCard: this.remember_card,
21065
+ // transactionType: this.transactionType,
21066
+ // subscription: this.subscription,
21067
+ // customFields,
21068
+ // };
21069
+ // return CardAPI.charge(chargeParams).then((response) => {
21070
+ // this.logAPIResponse(response, paymentMethod);
21071
+ // return response;
21072
+ // });
21073
+ // });
21074
+ // },
21075
+
21076
+ /**
21077
+ * Handles submitting a card pin after
21078
+ * other card details have been previously submitted.
21079
+ */
21080
+ // chargeCardWithPin(customFields = {}) {
21081
+ // this.logAttempt(paymentMethod);
21082
+ // const chargeParams = {
21083
+ // pin: encrypt(this.card.pin),
21084
+ // trans: this.id,
21085
+ // device: this.deviceFingerprint,
21086
+ // rememberCard: this.remember_card,
21087
+ // transactionType: this.transactionType,
21088
+ // subscription: this.subscription,
21089
+ // customFields,
21090
+ // };
21091
+ // return CardAPI.charge(chargeParams).then((response) => {
21092
+ // this.logAPIResponse(response, paymentMethod);
21093
+ // return response;
21094
+ // });
21095
+ // },
21096
+ // chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
21097
+ // this.logAttempt(paymentMethod);
21098
+ // const encryptedPin = encrypt(pin);
21099
+ // const chargeParams = {
21100
+ // authorizationCode,
21101
+ // cvv,
21102
+ // last4: cardLast4,
21103
+ // trans: this.id,
21104
+ // device: this.deviceFingerprint,
21105
+ // pin: encryptedPin,
21106
+ // transactionType: this.transactionType,
21107
+ // subscription: this.subscription,
21108
+ // };
21109
+ // return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
21110
+ // this.logAPIResponse(response, paymentMethod);
21111
+ // return response;
21112
+ // });
21113
+ // },
21114
+ // resumeCardCharge({ accessCode, pin }) {
21115
+ // const params = {
21116
+ // ...(pin && { pin: encrypt(pin) }),
21117
+ // accessCode,
21118
+ // device: this.deviceFingerprint,
21119
+ // };
21120
+ // return CardAPI.resumeCardCharge(params).then((response) => {
21121
+ // this.logAPIResponse(response, paymentMethod);
21122
+ // return response;
21123
+ // });
21124
+ // },
21125
+ // forgetRememberedCard(authorizationId) {
21126
+ // const params = {
21127
+ // authorizationId,
21128
+ // publicKey: this.merchant.key,
21129
+ // };
21130
+ // return CardAPI.forgetRememberedCard(params).then((response) => {
21131
+ // this.logAPIResponse(response, paymentMethod);
21132
+ // return response;
21133
+ // });
21134
+ // },
21135
+ // authenticateCard(token) {
21136
+ // return CardAPI.authenticate(this.id, token).then((response) => {
21137
+ // this.logAPIResponse(response, paymentMethod);
21138
+ // return response;
21139
+ // });
21140
+ // },
21141
+ // verifyAddress({ address, city, state, zipCode }) {
21142
+ // const payload = {
21143
+ // city,
21144
+ // state,
21145
+ // address,
21146
+ // zipCode,
21147
+ // transactionId: this.id,
21148
+ // };
21149
+ // return CardAPI.verifyAddress(payload).then((response) => {
21150
+ // this.logAPIResponse(response, paymentMethod);
21151
+ // return response;
21152
+ // });
21153
+ // },
21154
+
21155
+ };
21156
+
20750
21157
  var PreauthorizationInstance = /*#__PURE__*/function () {
20751
21158
  function PreauthorizationInstance(data) {
20752
21159
  _classCallCheck(this, PreauthorizationInstance);
@@ -20766,8 +21173,10 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
20766
21173
  name: data.merchant_name,
20767
21174
  key: data.merchant_key
20768
21175
  };
20769
- loadPusher(); // TODO: Bind charge function to card channel
20770
- // https://paystack.atlassian.net/browse/RAILS-2887
21176
+ loadPusher(); // TODO: Analytics
21177
+ // https://paystack.atlassian.net/browse/RAILS-3070
21178
+
21179
+ Object.assign(this, ReserveCardFunds);
20771
21180
  }
20772
21181
 
20773
21182
  _createClass(PreauthorizationInstance, [{
@@ -20848,4 +21257,4 @@ var Preauthorization = {
20848
21257
  }
20849
21258
  };
20850
21259
 
20851
- export { BankAccount, Card, Preauthorization, Toolkit, Transaction };
21260
+ export { BankAccount, Card$1 as Card, Preauthorization, Toolkit, Transaction };