@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/lib/checkout.js CHANGED
@@ -11647,7 +11647,7 @@ var PayattitudeAPI = {
11647
11647
  }
11648
11648
  };
11649
11649
 
11650
- var paymentMethod$6 = 'payattitude';
11650
+ var paymentMethod$7 = 'payattitude';
11651
11651
  var PayattitudeCharge = {
11652
11652
  chargePayattitude: function chargePayattitude(_ref) {
11653
11653
  var _this = this;
@@ -11658,7 +11658,7 @@ var PayattitudeCharge = {
11658
11658
  phoneNumber: phoneNumber
11659
11659
  };
11660
11660
  return PayattitudeAPI.charge(params).then(function (response) {
11661
- _this.logAPIResponse(response, paymentMethod$6);
11661
+ _this.logAPIResponse(response, paymentMethod$7);
11662
11662
 
11663
11663
  return response;
11664
11664
  });
@@ -11666,7 +11666,7 @@ var PayattitudeCharge = {
11666
11666
  listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
11667
11667
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
11668
11668
  var listenerOptions = {
11669
- paymentMethod: paymentMethod$6,
11669
+ paymentMethod: paymentMethod$7,
11670
11670
  channel: pusherChannel
11671
11671
  };
11672
11672
  return this.listenForCharge(listenerOptions, callback);
@@ -11749,7 +11749,7 @@ var ApplePayAPI = {
11749
11749
  }
11750
11750
  };
11751
11751
 
11752
- var paymentMethod$5 = 'apple pay';
11752
+ var paymentMethod$6 = 'apple pay';
11753
11753
  var ApplePayCharge = {
11754
11754
  validateApplePaySession: function validateApplePaySession(_ref) {
11755
11755
  var _this = this;
@@ -11757,7 +11757,7 @@ var ApplePayCharge = {
11757
11757
  var sessionUrl = _ref.sessionUrl,
11758
11758
  displayName = _ref.displayName,
11759
11759
  domainName = _ref.domainName;
11760
- this.logAttempt(paymentMethod$5);
11760
+ this.logAttempt(paymentMethod$6);
11761
11761
  return ApplePayAPI.validateApplePaySession({
11762
11762
  sessionUrl: sessionUrl,
11763
11763
  displayName: displayName,
@@ -11778,7 +11778,7 @@ var ApplePayCharge = {
11778
11778
  device: this.deviceFingerprint,
11779
11779
  paymentObject: paymentObject
11780
11780
  }).then(function (response) {
11781
- _this2.logAPIResponse(response, paymentMethod$5);
11781
+ _this2.logAPIResponse(response, paymentMethod$6);
11782
11782
 
11783
11783
  return response;
11784
11784
  });
@@ -11834,12 +11834,12 @@ var PayPalAPI = {
11834
11834
  }
11835
11835
  };
11836
11836
 
11837
- var paymentMethod$4 = 'paypal';
11837
+ var paymentMethod$5 = 'paypal';
11838
11838
  var PayPalCharge = {
11839
11839
  createPayPalOrder: function createPayPalOrder() {
11840
11840
  var _this = this;
11841
11841
 
11842
- this.logAttempt(paymentMethod$4);
11842
+ this.logAttempt(paymentMethod$5);
11843
11843
  return PayPalAPI.createOrder(this.id).then(function (response) {
11844
11844
  _this.logAPIResponseMessage(response.message);
11845
11845
 
@@ -11850,7 +11850,7 @@ var PayPalCharge = {
11850
11850
  var _this2 = this;
11851
11851
 
11852
11852
  return PayPalAPI.captureOrder(this.id).then(function (response) {
11853
- _this2.logAPIResponse(response, paymentMethod$4);
11853
+ _this2.logAPIResponse(response, paymentMethod$5);
11854
11854
 
11855
11855
  return response;
11856
11856
  });
@@ -18297,7 +18297,7 @@ var testCards = [{
18297
18297
  year: '30'
18298
18298
  }];
18299
18299
 
18300
- var Card$1 = {
18300
+ var Card$2 = {
18301
18301
  getEncryptedPin: function getEncryptedPin(pin) {
18302
18302
  return pin ? encrypt(pin) : undefined;
18303
18303
  },
@@ -18356,7 +18356,7 @@ var Card$1 = {
18356
18356
  return cardValidator.number(value);
18357
18357
  },
18358
18358
  isNumberValid: function isNumberValid(value) {
18359
- return Card$1.validateNumber(value).isValid;
18359
+ return Card$2.validateNumber(value).isValid;
18360
18360
  },
18361
18361
  validateCVV: function validateCVV(cvv, cardType) {
18362
18362
  var isAmexCard = cardType === 'american-express';
@@ -18364,7 +18364,7 @@ var Card$1 = {
18364
18364
  return cardValidator.cvv(cvv, cvvLength);
18365
18365
  },
18366
18366
  isCvvValid: function isCvvValid(cvv, cardType) {
18367
- return Card$1.validateCVV(cvv, cardType).isValid;
18367
+ return Card$2.validateCVV(cvv, cardType).isValid;
18368
18368
  },
18369
18369
  validateExpiry: function validateExpiry(value) {
18370
18370
  if (_typeof$1(value) === 'object') {
@@ -18376,14 +18376,14 @@ var Card$1 = {
18376
18376
  return cardValidator.expirationDate(value);
18377
18377
  },
18378
18378
  isExpiryValid: function isExpiryValid(value) {
18379
- return Card$1.validateExpiry(value).isValid;
18379
+ return Card$2.validateExpiry(value).isValid;
18380
18380
  },
18381
18381
  generateTestCard: function generateTestCard(cardType) {
18382
18382
  var type = cardType || 'default';
18383
18383
  var cardParams = testCards.find(function (card) {
18384
18384
  return card.type === type;
18385
18385
  });
18386
- return new Card$1(cardParams);
18386
+ return new Card$2(cardParams);
18387
18387
  }
18388
18388
  };
18389
18389
 
@@ -18400,7 +18400,7 @@ cardValidator.creditCardType.addCard({
18400
18400
  });
18401
18401
  cardValidator.creditCardType.changeOrder('verve', 0);
18402
18402
 
18403
- var Card = /*#__PURE__*/function () {
18403
+ var Card$1 = /*#__PURE__*/function () {
18404
18404
  function Card(_ref) {
18405
18405
  var number = _ref.number,
18406
18406
  cvv = _ref.cvv,
@@ -18420,17 +18420,17 @@ var Card = /*#__PURE__*/function () {
18420
18420
  _createClass(Card, [{
18421
18421
  key: "getEncryptedPin",
18422
18422
  value: function getEncryptedPin() {
18423
- return Card$1.getEncryptedPin(this.pin);
18423
+ return Card$2.getEncryptedPin(this.pin);
18424
18424
  }
18425
18425
  }, {
18426
18426
  key: "getLast4",
18427
18427
  value: function getLast4() {
18428
- return Card$1.getLast4(this.number);
18428
+ return Card$2.getLast4(this.number);
18429
18429
  }
18430
18430
  }, {
18431
18431
  key: "tokenize",
18432
18432
  value: function tokenize() {
18433
- return Card$1.tokenize({
18433
+ return Card$2.tokenize({
18434
18434
  number: this.number,
18435
18435
  cvv: this.cvv,
18436
18436
  month: this.month,
@@ -18440,7 +18440,7 @@ var Card = /*#__PURE__*/function () {
18440
18440
  }], [{
18441
18441
  key: "getType",
18442
18442
  value: function getType(value) {
18443
- return Card$1.getType(value);
18443
+ return Card$2.getType(value);
18444
18444
  }
18445
18445
  }, {
18446
18446
  key: "validate",
@@ -18449,7 +18449,7 @@ var Card = /*#__PURE__*/function () {
18449
18449
  cvv = _ref2.cvv,
18450
18450
  month = _ref2.month,
18451
18451
  year = _ref2.year;
18452
- return Card$1.validate({
18452
+ return Card$2.validate({
18453
18453
  number: number,
18454
18454
  cvv: cvv,
18455
18455
  month: month,
@@ -18459,44 +18459,44 @@ var Card = /*#__PURE__*/function () {
18459
18459
  }, {
18460
18460
  key: "validateNumber",
18461
18461
  value: function validateNumber(value) {
18462
- return Card$1.validateNumber(value);
18462
+ return Card$2.validateNumber(value);
18463
18463
  }
18464
18464
  }, {
18465
18465
  key: "isNumberValid",
18466
18466
  value: function isNumberValid(value) {
18467
- return Card$1.isNumberValid(value);
18467
+ return Card$2.isNumberValid(value);
18468
18468
  }
18469
18469
  }, {
18470
18470
  key: "validateCVV",
18471
18471
  value: function validateCVV(cvv, cardType) {
18472
- return Card$1.validateCVV(cvv, cardType);
18472
+ return Card$2.validateCVV(cvv, cardType);
18473
18473
  }
18474
18474
  }, {
18475
18475
  key: "isCvvValid",
18476
18476
  value: function isCvvValid(cvv, cardType) {
18477
- return Card$1.isCvvValid(cvv, cardType);
18477
+ return Card$2.isCvvValid(cvv, cardType);
18478
18478
  }
18479
18479
  }, {
18480
18480
  key: "validateExpiry",
18481
18481
  value: function validateExpiry(value) {
18482
- return Card$1.validateExpiry(value);
18482
+ return Card$2.validateExpiry(value);
18483
18483
  }
18484
18484
  }, {
18485
18485
  key: "isExpiryValid",
18486
18486
  value: function isExpiryValid(value) {
18487
- return Card$1.isExpiryValid(value);
18487
+ return Card$2.isExpiryValid(value);
18488
18488
  }
18489
18489
  }, {
18490
18490
  key: "generateTestCard",
18491
18491
  value: function generateTestCard(cardType) {
18492
- return Card$1.generateTestCard(cardType);
18492
+ return Card$2.generateTestCard(cardType);
18493
18493
  }
18494
18494
  }]);
18495
18495
 
18496
18496
  return Card;
18497
18497
  }();
18498
18498
 
18499
- var CardAPI = {
18499
+ var CardAPI$1 = {
18500
18500
  charge: function charge(_ref) {
18501
18501
  var clientdata = _ref.clientdata,
18502
18502
  last4 = _ref.last4,
@@ -18842,11 +18842,11 @@ var CardAPI = {
18842
18842
  }
18843
18843
  };
18844
18844
 
18845
- var paymentMethod$3 = 'card';
18845
+ var paymentMethod$4 = 'card';
18846
18846
 
18847
- function validate$3(card, isSetter) {
18847
+ function validate$4(card, isSetter) {
18848
18848
  return new Promise(function (resolve, reject) {
18849
- var validation = Card.validate(card);
18849
+ var validation = Card$1.validate(card);
18850
18850
 
18851
18851
  if (!validation.isValid) {
18852
18852
  var throwValidation = isSetter || card.number;
@@ -18865,8 +18865,8 @@ var CardCharge = {
18865
18865
  setCard: function setCard(params) {
18866
18866
  var _this = this;
18867
18867
 
18868
- return validate$3(params, true).then(function () {
18869
- _this.card = new Card(params);
18868
+ return validate$4(params, true).then(function () {
18869
+ _this.card = new Card$1(params);
18870
18870
  });
18871
18871
  },
18872
18872
  rememberCard: function rememberCard() {
@@ -18881,8 +18881,8 @@ var CardCharge = {
18881
18881
  return this.chargeCardWithPin(customFields);
18882
18882
  }
18883
18883
 
18884
- return validate$3(this.card).then(function () {
18885
- _this2.logAttempt(paymentMethod$3);
18884
+ return validate$4(this.card).then(function () {
18885
+ _this2.logAttempt(paymentMethod$4);
18886
18886
 
18887
18887
  var chargeParams = {
18888
18888
  clientdata: _this2.card.tokenize(),
@@ -18895,8 +18895,8 @@ var CardCharge = {
18895
18895
  subscription: _this2.subscription,
18896
18896
  customFields: customFields
18897
18897
  };
18898
- return CardAPI.charge(chargeParams).then(function (response) {
18899
- _this2.logAPIResponse(response, paymentMethod$3);
18898
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18899
+ _this2.logAPIResponse(response, paymentMethod$4);
18900
18900
 
18901
18901
  return response;
18902
18902
  });
@@ -18911,7 +18911,7 @@ var CardCharge = {
18911
18911
  var _this3 = this;
18912
18912
 
18913
18913
  var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18914
- this.logAttempt(paymentMethod$3);
18914
+ this.logAttempt(paymentMethod$4);
18915
18915
  var chargeParams = {
18916
18916
  pin: encrypt(this.card.pin),
18917
18917
  trans: this.id,
@@ -18921,8 +18921,8 @@ var CardCharge = {
18921
18921
  subscription: this.subscription,
18922
18922
  customFields: customFields
18923
18923
  };
18924
- return CardAPI.charge(chargeParams).then(function (response) {
18925
- _this3.logAPIResponse(response, paymentMethod$3);
18924
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18925
+ _this3.logAPIResponse(response, paymentMethod$4);
18926
18926
 
18927
18927
  return response;
18928
18928
  });
@@ -18934,7 +18934,7 @@ var CardCharge = {
18934
18934
  authorizationCode = _ref.authorizationCode,
18935
18935
  cardLast4 = _ref.cardLast4,
18936
18936
  pin = _ref.pin;
18937
- this.logAttempt(paymentMethod$3);
18937
+ this.logAttempt(paymentMethod$4);
18938
18938
  var encryptedPin = encrypt(pin);
18939
18939
  var chargeParams = {
18940
18940
  authorizationCode: authorizationCode,
@@ -18946,8 +18946,8 @@ var CardCharge = {
18946
18946
  transactionType: this.transactionType,
18947
18947
  subscription: this.subscription
18948
18948
  };
18949
- return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
18950
- _this4.logAPIResponse(response, paymentMethod$3);
18949
+ return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
18950
+ _this4.logAPIResponse(response, paymentMethod$4);
18951
18951
 
18952
18952
  return response;
18953
18953
  });
@@ -18965,8 +18965,8 @@ var CardCharge = {
18965
18965
  device: this.deviceFingerprint
18966
18966
  });
18967
18967
 
18968
- return CardAPI.resumeCardCharge(params).then(function (response) {
18969
- _this5.logAPIResponse(response, paymentMethod$3);
18968
+ return CardAPI$1.resumeCardCharge(params).then(function (response) {
18969
+ _this5.logAPIResponse(response, paymentMethod$4);
18970
18970
 
18971
18971
  return response;
18972
18972
  });
@@ -18978,8 +18978,8 @@ var CardCharge = {
18978
18978
  authorizationId: authorizationId,
18979
18979
  publicKey: this.merchant.key
18980
18980
  };
18981
- return CardAPI.forgetRememberedCard(params).then(function (response) {
18982
- _this6.logAPIResponse(response, paymentMethod$3);
18981
+ return CardAPI$1.forgetRememberedCard(params).then(function (response) {
18982
+ _this6.logAPIResponse(response, paymentMethod$4);
18983
18983
 
18984
18984
  return response;
18985
18985
  });
@@ -18987,8 +18987,8 @@ var CardCharge = {
18987
18987
  authenticateCard: function authenticateCard(token) {
18988
18988
  var _this7 = this;
18989
18989
 
18990
- return CardAPI.authenticate(this.id, token).then(function (response) {
18991
- _this7.logAPIResponse(response, paymentMethod$3);
18990
+ return CardAPI$1.authenticate(this.id, token).then(function (response) {
18991
+ _this7.logAPIResponse(response, paymentMethod$4);
18992
18992
 
18993
18993
  return response;
18994
18994
  });
@@ -19007,8 +19007,8 @@ var CardCharge = {
19007
19007
  zipCode: zipCode,
19008
19008
  transactionId: this.id
19009
19009
  };
19010
- return CardAPI.verifyAddress(payload).then(function (response) {
19011
- _this8.logAPIResponse(response, paymentMethod$3);
19010
+ return CardAPI$1.verifyAddress(payload).then(function (response) {
19011
+ _this8.logAPIResponse(response, paymentMethod$4);
19012
19012
 
19013
19013
  return response;
19014
19014
  });
@@ -19016,12 +19016,12 @@ var CardCharge = {
19016
19016
  listenFor3DSCharge: function listenFor3DSCharge(callback) {
19017
19017
  var listenerOptions = {
19018
19018
  channel: "3DS_".concat(this.id),
19019
- paymentMethod: paymentMethod$3
19019
+ paymentMethod: paymentMethod$4
19020
19020
  };
19021
19021
  return this.listenForCharge(listenerOptions, callback);
19022
19022
  },
19023
19023
  requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
19024
- return CardAPI.requestSavedCardsOTP(phoneNumber);
19024
+ return CardAPI$1.requestSavedCardsOTP(phoneNumber);
19025
19025
  },
19026
19026
  verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19027
19027
  var _this9 = this;
@@ -19040,7 +19040,7 @@ var CardCharge = {
19040
19040
  };
19041
19041
  _context.prev = 2;
19042
19042
  _context.next = 5;
19043
- return CardAPI.verifySavedCardsOtp(payload);
19043
+ return CardAPI$1.verifySavedCardsOtp(payload);
19044
19044
 
19045
19045
  case 5:
19046
19046
  response = _context.sent;
@@ -19062,19 +19062,19 @@ var CardCharge = {
19062
19062
  }))();
19063
19063
  },
19064
19064
  getSavedCards: function getSavedCards() {
19065
- return CardAPI.getSavedCards({
19065
+ return CardAPI$1.getSavedCards({
19066
19066
  token: this.savedCardsToken
19067
19067
  });
19068
19068
  },
19069
19069
  deleteSavedCard: function deleteSavedCard(cardCode) {
19070
- return CardAPI.deleteSavedCard({
19070
+ return CardAPI$1.deleteSavedCard({
19071
19071
  cardCode: cardCode,
19072
19072
  token: this.savedCardsToken
19073
19073
  });
19074
19074
  },
19075
19075
  chargeSavedCard: function chargeSavedCard(_ref5) {
19076
19076
  var cardCode = _ref5.cardCode;
19077
- return CardAPI.chargeSavedCard({
19077
+ return CardAPI$1.chargeSavedCard({
19078
19078
  cardCode: cardCode,
19079
19079
  transaction: this.id,
19080
19080
  token: this.savedCardsToken,
@@ -19233,9 +19233,9 @@ var EMandateAPI = {
19233
19233
  }
19234
19234
  };
19235
19235
 
19236
- var paymentMethod$2 = 'bank account';
19236
+ var paymentMethod$3 = 'bank account';
19237
19237
 
19238
- function validate$2(bankAccount, isSetter) {
19238
+ function validate$3(bankAccount, isSetter) {
19239
19239
  return new Promise(function (resolve, reject) {
19240
19240
  var validation = BankAccount.validate(bankAccount);
19241
19241
 
@@ -19253,15 +19253,15 @@ var EMandate = {
19253
19253
  setBankAccount: function setBankAccount(params) {
19254
19254
  var _this = this;
19255
19255
 
19256
- return validate$2(params, true).then(function () {
19256
+ return validate$3(params, true).then(function () {
19257
19257
  _this.bankAccount = new BankAccount(params);
19258
19258
  });
19259
19259
  },
19260
19260
  chargeBankAccount: function chargeBankAccount() {
19261
19261
  var _this2 = this;
19262
19262
 
19263
- return validate$2(this.bankAccount).then(function () {
19264
- _this2.logAttempt(paymentMethod$2);
19263
+ return validate$3(this.bankAccount).then(function () {
19264
+ _this2.logAttempt(paymentMethod$3);
19265
19265
 
19266
19266
  var verifyParams = {
19267
19267
  bankId: _this2.bankAccount.bankId,
@@ -19270,7 +19270,7 @@ var EMandate = {
19270
19270
  device: _this2.deviceFingerprint
19271
19271
  };
19272
19272
  return EMandateAPI.verify(verifyParams).then(function (response) {
19273
- _this2.logAPIResponse(response, paymentMethod$2);
19273
+ _this2.logAPIResponse(response, paymentMethod$3);
19274
19274
 
19275
19275
  return response;
19276
19276
  });
@@ -19279,7 +19279,7 @@ var EMandate = {
19279
19279
  registerBankAccount: function registerBankAccount(birthday) {
19280
19280
  var _this3 = this;
19281
19281
 
19282
- return validate$2(this.bankAccount).then(function () {
19282
+ return validate$3(this.bankAccount).then(function () {
19283
19283
  var registerParams = {
19284
19284
  bankId: _this3.bankAccount.bankId,
19285
19285
  transactionId: _this3.id,
@@ -19287,7 +19287,7 @@ var EMandate = {
19287
19287
  birthday: birthday
19288
19288
  };
19289
19289
  return EMandateAPI.register(registerParams).then(function (response) {
19290
- _this3.logAPIResponse(response, paymentMethod$2);
19290
+ _this3.logAPIResponse(response, paymentMethod$3);
19291
19291
 
19292
19292
  return response;
19293
19293
  });
@@ -19296,7 +19296,7 @@ var EMandate = {
19296
19296
  authenticateBankAccount: function authenticateBankAccount(token) {
19297
19297
  var _this4 = this;
19298
19298
 
19299
- return validate$2(this.bankAccount).then(function () {
19299
+ return validate$3(this.bankAccount).then(function () {
19300
19300
  var chargeParams = {
19301
19301
  bankId: _this4.bankAccount.bankId,
19302
19302
  transactionId: _this4.id,
@@ -19304,7 +19304,7 @@ var EMandate = {
19304
19304
  device: _this4.deviceFingerprint
19305
19305
  };
19306
19306
  return EMandateAPI.authenticate(chargeParams).then(function (response) {
19307
- _this4.logAPIResponse(response, paymentMethod$2);
19307
+ _this4.logAPIResponse(response, paymentMethod$3);
19308
19308
 
19309
19309
  return response;
19310
19310
  });
@@ -19365,7 +19365,7 @@ var DigitalBankMandateAPI = {
19365
19365
  }
19366
19366
  };
19367
19367
 
19368
- var paymentMethod$1 = 'bank';
19368
+ var paymentMethod$2 = 'bank';
19369
19369
  var DigitalBankMandate = {
19370
19370
  chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
19371
19371
  var _this = this;
@@ -19380,7 +19380,7 @@ var DigitalBankMandate = {
19380
19380
  bankId: bankId
19381
19381
  };
19382
19382
  return DigitalBankMandateAPI.charge(params).then(function (response) {
19383
- _this.logAPIResponse(response, paymentMethod$1);
19383
+ _this.logAPIResponse(response, paymentMethod$2);
19384
19384
 
19385
19385
  return response;
19386
19386
  });
@@ -19388,7 +19388,7 @@ var DigitalBankMandate = {
19388
19388
  listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
19389
19389
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
19390
19390
  var listenerOptions = {
19391
- paymentMethod: paymentMethod$1,
19391
+ paymentMethod: paymentMethod$2,
19392
19392
  channel: pusherChannel
19393
19393
  };
19394
19394
  return this.listenForCharge(listenerOptions, callback);
@@ -19521,7 +19521,7 @@ var QrAPI = {
19521
19521
  }
19522
19522
  };
19523
19523
 
19524
- function validate$1(channel) {
19524
+ function validate$2(channel) {
19525
19525
  return new Promise(function (resolve, reject) {
19526
19526
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19527
19527
 
@@ -19539,7 +19539,7 @@ var QRCharge = {
19539
19539
  var _this = this;
19540
19540
 
19541
19541
  var channel = _ref.channel;
19542
- return validate$1(channel).then(function () {
19542
+ return validate$2(channel).then(function () {
19543
19543
  if (_this.qr[channel]) {
19544
19544
  return _this.qr[channel];
19545
19545
  }
@@ -19561,7 +19561,7 @@ var QRCharge = {
19561
19561
  var _this2 = this;
19562
19562
 
19563
19563
  var channel = _ref2.channel;
19564
- return validate$1(channel).then(function () {
19564
+ return validate$2(channel).then(function () {
19565
19565
  if (!_this2.qr[channel]) {
19566
19566
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19567
19567
  }
@@ -19682,7 +19682,7 @@ var MobileMoneyAPI = {
19682
19682
  }
19683
19683
  };
19684
19684
 
19685
- function validate(phoneNumber) {
19685
+ function validate$1(phoneNumber) {
19686
19686
  return new Promise(function (resolve, reject) {
19687
19687
  var validation = PhoneNumber.validate(phoneNumber);
19688
19688
 
@@ -19703,7 +19703,7 @@ var MobileMoneyCharge = {
19703
19703
  provider = _ref.provider,
19704
19704
  voucher = _ref.voucher,
19705
19705
  registrationToken = _ref.registrationToken;
19706
- return validate(phoneNumber).then(function () {
19706
+ return validate$1(phoneNumber).then(function () {
19707
19707
  _this.logAttempt('mobile money');
19708
19708
 
19709
19709
  var params = {
@@ -19734,7 +19734,7 @@ var MobileMoneyCharge = {
19734
19734
  var phoneNumber = payload.phoneNumber,
19735
19735
  provider = payload.provider,
19736
19736
  registrationToken = payload.registrationToken;
19737
- return validate(phoneNumber).then(function () {
19737
+ return validate$1(phoneNumber).then(function () {
19738
19738
  _this2.logMobileMoneyActions(payload);
19739
19739
 
19740
19740
  var params = {
@@ -19874,7 +19874,7 @@ var DirectDebitAPI = {
19874
19874
  }
19875
19875
  };
19876
19876
 
19877
- var paymentMethod = 'direct debit';
19877
+ var paymentMethod$1 = 'direct debit';
19878
19878
  var DirectDebitCharge = {
19879
19879
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19880
19880
  var _this = this;
@@ -19920,14 +19920,14 @@ var DirectDebitCharge = {
19920
19920
  return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
19921
19921
  }
19922
19922
 
19923
- this.logAttempt(paymentMethod);
19923
+ this.logAttempt(paymentMethod$1);
19924
19924
  var params = {
19925
19925
  account_code: accountCode,
19926
19926
  transaction: this.id,
19927
19927
  token: this.directDebit.token
19928
19928
  };
19929
19929
  return DirectDebitAPI.charge(params).then(function (response) {
19930
- _this2.logAPIResponse(response, paymentMethod);
19930
+ _this2.logAPIResponse(response, paymentMethod$1);
19931
19931
 
19932
19932
  if (response.status) {
19933
19933
  _this2.directDebit.chargeResponse = response;
@@ -19940,7 +19940,7 @@ var DirectDebitCharge = {
19940
19940
  var _this3 = this;
19941
19941
 
19942
19942
  return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
19943
- _this3.logAPIResponse(response, paymentMethod);
19943
+ _this3.logAPIResponse(response, paymentMethod$1);
19944
19944
 
19945
19945
  var status = response.status,
19946
19946
  data = response.data;
@@ -19965,7 +19965,7 @@ var DirectDebitCharge = {
19965
19965
  token: this.directDebit.token
19966
19966
  };
19967
19967
  return DirectDebitAPI.authenticate(params).then(function (response) {
19968
- _this4.logAPIResponse(response, paymentMethod);
19968
+ _this4.logAPIResponse(response, paymentMethod$1);
19969
19969
 
19970
19970
  return response;
19971
19971
  });
@@ -20751,6 +20751,413 @@ var Toolkit = /*#__PURE__*/function () {
20751
20751
  return Toolkit;
20752
20752
  }();
20753
20753
 
20754
+ cardValidator.creditCardType.addCard({
20755
+ niceType: 'Verve',
20756
+ type: 'verve',
20757
+ patterns: [[506000, 507999], [650000, 650009]],
20758
+ gaps: [4, 8, 12, 16],
20759
+ lengths: [16, 18, 19],
20760
+ code: {
20761
+ name: 'CVV',
20762
+ size: 3
20763
+ }
20764
+ });
20765
+ cardValidator.creditCardType.changeOrder('verve', 0);
20766
+
20767
+ var Card = /*#__PURE__*/function () {
20768
+ function Card(_ref) {
20769
+ var number = _ref.number,
20770
+ cvv = _ref.cvv,
20771
+ month = _ref.month,
20772
+ year = _ref.year,
20773
+ pin = _ref.pin;
20774
+
20775
+ _classCallCheck(this, Card);
20776
+
20777
+ this.number = number;
20778
+ this.cvv = cvv;
20779
+ this.month = month;
20780
+ this.year = year;
20781
+ this.pin = pin;
20782
+ }
20783
+
20784
+ _createClass(Card, [{
20785
+ key: "getEncryptedPin",
20786
+ value: function getEncryptedPin() {
20787
+ return Card$2.getEncryptedPin(this.pin);
20788
+ }
20789
+ }, {
20790
+ key: "getLast4",
20791
+ value: function getLast4() {
20792
+ return Card$2.getLast4(this.number);
20793
+ }
20794
+ }, {
20795
+ key: "tokenize",
20796
+ value: function tokenize() {
20797
+ return Card$2.tokenize({
20798
+ number: this.number,
20799
+ cvv: this.cvv,
20800
+ month: this.month,
20801
+ year: this.year
20802
+ });
20803
+ }
20804
+ }], [{
20805
+ key: "getType",
20806
+ value: function getType(value) {
20807
+ return Card$2.getType(value);
20808
+ }
20809
+ }, {
20810
+ key: "validate",
20811
+ value: function validate(_ref2) {
20812
+ var number = _ref2.number,
20813
+ cvv = _ref2.cvv,
20814
+ month = _ref2.month,
20815
+ year = _ref2.year;
20816
+ return Card$2.validate({
20817
+ number: number,
20818
+ cvv: cvv,
20819
+ month: month,
20820
+ year: year
20821
+ });
20822
+ }
20823
+ }, {
20824
+ key: "validateNumber",
20825
+ value: function validateNumber(value) {
20826
+ return Card$2.validateNumber(value);
20827
+ }
20828
+ }, {
20829
+ key: "isNumberValid",
20830
+ value: function isNumberValid(value) {
20831
+ return Card$2.isNumberValid(value);
20832
+ }
20833
+ }, {
20834
+ key: "validateCVV",
20835
+ value: function validateCVV(cvv, cardType) {
20836
+ return Card$2.validateCVV(cvv, cardType);
20837
+ }
20838
+ }, {
20839
+ key: "isCvvValid",
20840
+ value: function isCvvValid(cvv, cardType) {
20841
+ return Card$2.isCvvValid(cvv, cardType);
20842
+ }
20843
+ }, {
20844
+ key: "validateExpiry",
20845
+ value: function validateExpiry(value) {
20846
+ return Card$2.validateExpiry(value);
20847
+ }
20848
+ }, {
20849
+ key: "isExpiryValid",
20850
+ value: function isExpiryValid(value) {
20851
+ return Card$2.isExpiryValid(value);
20852
+ }
20853
+ }, {
20854
+ key: "generateTestCard",
20855
+ value: function generateTestCard(cardType) {
20856
+ return Card$2.generateTestCard(cardType);
20857
+ }
20858
+ }]);
20859
+
20860
+ return Card;
20861
+ }();
20862
+
20863
+ var CardAPI = {
20864
+ reserve: function reserve(_ref) {
20865
+ var clientdata = _ref.clientdata,
20866
+ last4 = _ref.last4,
20867
+ preauthorizationId = _ref.preauthorizationId;
20868
+ var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
20869
+ var language = getLanguage();
20870
+
20871
+ var headers = _objectSpread2({}, language && {
20872
+ 'Accept-Language': language
20873
+ });
20874
+
20875
+ return axiosInstance.post(url, {
20876
+ clientdata: clientdata,
20877
+ last4: last4,
20878
+ preauthorization: preauthorizationId
20879
+ }, {
20880
+ headers: headers
20881
+ }).then(function (response) {
20882
+ return ChargeResponses.parse(response.data);
20883
+ });
20884
+ } // charge({
20885
+ // clientdata,
20886
+ // last4,
20887
+ // pin,
20888
+ // trans,
20889
+ // device,
20890
+ // rememberCard,
20891
+ // transactionType,
20892
+ // subscription,
20893
+ // customFields,
20894
+ // }) {
20895
+ // const url = `${config.paymentBaseUrl}charge/`;
20896
+ // const language = getLanguage();
20897
+ // const headers = {
20898
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20899
+ // ...(language && { 'Accept-Language': language }),
20900
+ // };
20901
+ // const chargeParams = {
20902
+ // clientdata,
20903
+ // last4,
20904
+ // trans,
20905
+ // device,
20906
+ // offset: new Date().getTimezoneOffset(),
20907
+ // remember_card: rememberCard,
20908
+ // ...(transactionType && { transaction_type: transactionType }),
20909
+ // ...(subscription && { subscription }),
20910
+ // ...(customFields && customFields),
20911
+ // };
20912
+ // if (pin) {
20913
+ // chargeParams.handle = pin;
20914
+ // }
20915
+ // const urlEncodedParams = formurlencoded(chargeParams);
20916
+ // return axiosInstance
20917
+ // .post(url, urlEncodedParams, { headers })
20918
+ // .then((response) => ChargeResponses.parse(response.data));
20919
+ // },
20920
+ // resumeCardCharge({ device, accessCode, pin }) {
20921
+ // const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
20922
+ // const language = getLanguage();
20923
+ // const headers = {
20924
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20925
+ // ...(language && { 'Accept-Language': language }),
20926
+ // };
20927
+ // const data = { device, ...(pin && { handle: pin }) };
20928
+ // const urlEncodedData = formurlencoded(data);
20929
+ // return axiosInstance
20930
+ // .post(url, urlEncodedData, { headers })
20931
+ // .then((response) => ChargeResponses.parse(response.data));
20932
+ // },
20933
+ // chargeRememberedCard({
20934
+ // last4,
20935
+ // trans,
20936
+ // device,
20937
+ // authorizationCode,
20938
+ // cvv,
20939
+ // pin,
20940
+ // transactionType,
20941
+ // subscription,
20942
+ // }) {
20943
+ // const url = `${config.paymentBaseUrl}charge/`;
20944
+ // const language = getLanguage();
20945
+ // const headers = {
20946
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20947
+ // ...(language && { 'Accept-Language': language }),
20948
+ // };
20949
+ // const chargeParams = {
20950
+ // last4,
20951
+ // trans,
20952
+ // device,
20953
+ // cvv,
20954
+ // handle: pin,
20955
+ // authorization_code: authorizationCode,
20956
+ // ...(transactionType && { transaction_type: transactionType }),
20957
+ // ...(subscription && { subscription }),
20958
+ // };
20959
+ // const urlEncodedParams = formurlencoded(chargeParams);
20960
+ // return axiosInstance
20961
+ // .post(url, urlEncodedParams, { headers })
20962
+ // .then((response) => ChargeResponses.parse(response.data));
20963
+ // },
20964
+ // verifyAddress({ address, city, state, zipCode, transactionId }) {
20965
+ // const url = `${config.paymentBaseUrl}charge/avs`;
20966
+ // const language = getLanguage();
20967
+ // const headers = {
20968
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20969
+ // ...(language && { 'Accept-Language': language }),
20970
+ // };
20971
+ // const data = {
20972
+ // city,
20973
+ // state,
20974
+ // address,
20975
+ // zip_code: zipCode,
20976
+ // trans: transactionId,
20977
+ // };
20978
+ // const urlEncodedData = formurlencoded(data);
20979
+ // return axiosInstance
20980
+ // .post(url, urlEncodedData, { headers })
20981
+ // .then((response) => ChargeResponses.parse(response.data));
20982
+ // },
20983
+ // forgetRememberedCard({ authorizationId, publicKey }) {
20984
+ // const language = getLanguage();
20985
+ // const headers = {
20986
+ // Authorization: `Bearer ${publicKey}`,
20987
+ // ...(language && { 'Accept-Language': language }),
20988
+ // };
20989
+ // const params = {
20990
+ // authorization_id: authorizationId,
20991
+ // };
20992
+ // const url = `${config.paystackApiUrl}rememberme/forget_card`;
20993
+ // return axiosInstance
20994
+ // .post(url, params, { headers })
20995
+ // .then((response) => ChargeResponses.parse(response.data));
20996
+ // },
20997
+
20998
+ };
20999
+
21000
+ var paymentMethod = 'card';
21001
+
21002
+ function validate(card, isSetter) {
21003
+ return new Promise(function (resolve, reject) {
21004
+ var validation = Card.validate(card);
21005
+
21006
+ if (!validation.isValid) {
21007
+ var throwValidation = isSetter || card.number;
21008
+ var errors = Object.keys(validation.result).filter(function (value) {
21009
+ return validation.result[value] === false;
21010
+ });
21011
+ var errorMessage = "Invalid card details: ".concat(errors.join(', '));
21012
+ reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
21013
+ }
21014
+
21015
+ resolve();
21016
+ });
21017
+ }
21018
+
21019
+ var ReserveCardFunds = {
21020
+ setCard: function setCard(params) {
21021
+ var _this = this;
21022
+
21023
+ return validate(params, true).then(function () {
21024
+ _this.card = new Card(params);
21025
+ });
21026
+ },
21027
+ reserve: function reserve(preauthorizationId) {
21028
+ var _this2 = this;
21029
+
21030
+ var customFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21031
+ // TODO: Log payment method
21032
+ // https://paystack.atlassian.net/browse/RAILS-3070
21033
+ return validate(this.card).then(function () {
21034
+ var chargeParams = {
21035
+ clientdata: _this2.card.tokenize(),
21036
+ last4: _this2.card.getLast4(),
21037
+ preauthorization: preauthorizationId,
21038
+ customFields: customFields
21039
+ };
21040
+ return CardAPI.charge(chargeParams).then(function (response) {
21041
+ // TODO: Log API Response
21042
+ // https://paystack.atlassian.net/browse/RAILS-3070
21043
+ return response;
21044
+ });
21045
+ });
21046
+ },
21047
+ listenFor3DSCharge: function listenFor3DSCharge(callback) {
21048
+ var listenerOptions = {
21049
+ channel: "3DS_".concat(this.id),
21050
+ paymentMethod: paymentMethod
21051
+ };
21052
+ return this.listenForCharge(listenerOptions, callback);
21053
+ } // rememberCard() {
21054
+ // this.remember_card = true;
21055
+ // },
21056
+ // chargeCard(customFields = {}) {
21057
+ // if (!this.card.number && this.card.pin) {
21058
+ // return this.chargeCardWithPin(customFields);
21059
+ // }
21060
+ // return validate(this.card).then(() => {
21061
+ // this.logAttempt(paymentMethod);
21062
+ // const chargeParams = {
21063
+ // clientdata: this.card.tokenize(),
21064
+ // last4: this.card.getLast4(),
21065
+ // pin: this.card.getEncryptedPin(),
21066
+ // trans: this.id,
21067
+ // device: this.deviceFingerprint,
21068
+ // rememberCard: this.remember_card,
21069
+ // transactionType: this.transactionType,
21070
+ // subscription: this.subscription,
21071
+ // customFields,
21072
+ // };
21073
+ // return CardAPI.charge(chargeParams).then((response) => {
21074
+ // this.logAPIResponse(response, paymentMethod);
21075
+ // return response;
21076
+ // });
21077
+ // });
21078
+ // },
21079
+
21080
+ /**
21081
+ * Handles submitting a card pin after
21082
+ * other card details have been previously submitted.
21083
+ */
21084
+ // chargeCardWithPin(customFields = {}) {
21085
+ // this.logAttempt(paymentMethod);
21086
+ // const chargeParams = {
21087
+ // pin: encrypt(this.card.pin),
21088
+ // trans: this.id,
21089
+ // device: this.deviceFingerprint,
21090
+ // rememberCard: this.remember_card,
21091
+ // transactionType: this.transactionType,
21092
+ // subscription: this.subscription,
21093
+ // customFields,
21094
+ // };
21095
+ // return CardAPI.charge(chargeParams).then((response) => {
21096
+ // this.logAPIResponse(response, paymentMethod);
21097
+ // return response;
21098
+ // });
21099
+ // },
21100
+ // chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
21101
+ // this.logAttempt(paymentMethod);
21102
+ // const encryptedPin = encrypt(pin);
21103
+ // const chargeParams = {
21104
+ // authorizationCode,
21105
+ // cvv,
21106
+ // last4: cardLast4,
21107
+ // trans: this.id,
21108
+ // device: this.deviceFingerprint,
21109
+ // pin: encryptedPin,
21110
+ // transactionType: this.transactionType,
21111
+ // subscription: this.subscription,
21112
+ // };
21113
+ // return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
21114
+ // this.logAPIResponse(response, paymentMethod);
21115
+ // return response;
21116
+ // });
21117
+ // },
21118
+ // resumeCardCharge({ accessCode, pin }) {
21119
+ // const params = {
21120
+ // ...(pin && { pin: encrypt(pin) }),
21121
+ // accessCode,
21122
+ // device: this.deviceFingerprint,
21123
+ // };
21124
+ // return CardAPI.resumeCardCharge(params).then((response) => {
21125
+ // this.logAPIResponse(response, paymentMethod);
21126
+ // return response;
21127
+ // });
21128
+ // },
21129
+ // forgetRememberedCard(authorizationId) {
21130
+ // const params = {
21131
+ // authorizationId,
21132
+ // publicKey: this.merchant.key,
21133
+ // };
21134
+ // return CardAPI.forgetRememberedCard(params).then((response) => {
21135
+ // this.logAPIResponse(response, paymentMethod);
21136
+ // return response;
21137
+ // });
21138
+ // },
21139
+ // authenticateCard(token) {
21140
+ // return CardAPI.authenticate(this.id, token).then((response) => {
21141
+ // this.logAPIResponse(response, paymentMethod);
21142
+ // return response;
21143
+ // });
21144
+ // },
21145
+ // verifyAddress({ address, city, state, zipCode }) {
21146
+ // const payload = {
21147
+ // city,
21148
+ // state,
21149
+ // address,
21150
+ // zipCode,
21151
+ // transactionId: this.id,
21152
+ // };
21153
+ // return CardAPI.verifyAddress(payload).then((response) => {
21154
+ // this.logAPIResponse(response, paymentMethod);
21155
+ // return response;
21156
+ // });
21157
+ // },
21158
+
21159
+ };
21160
+
20754
21161
  var PreauthorizationInstance = /*#__PURE__*/function () {
20755
21162
  function PreauthorizationInstance(data) {
20756
21163
  _classCallCheck(this, PreauthorizationInstance);
@@ -20770,8 +21177,10 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
20770
21177
  name: data.merchant_name,
20771
21178
  key: data.merchant_key
20772
21179
  };
20773
- loadPusher(); // TODO: Bind charge function to card channel
20774
- // https://paystack.atlassian.net/browse/RAILS-2887
21180
+ loadPusher(); // TODO: Analytics
21181
+ // https://paystack.atlassian.net/browse/RAILS-3070
21182
+
21183
+ Object.assign(this, ReserveCardFunds);
20775
21184
  }
20776
21185
 
20777
21186
  _createClass(PreauthorizationInstance, [{
@@ -20853,7 +21262,7 @@ var Preauthorization = {
20853
21262
  };
20854
21263
 
20855
21264
  exports.BankAccount = BankAccount;
20856
- exports.Card = Card;
21265
+ exports.Card = Card$1;
20857
21266
  exports.Preauthorization = Preauthorization;
20858
21267
  exports.Toolkit = Toolkit;
20859
21268
  exports.Transaction = Transaction;