@paystack/checkout-js 1.19.0 → 1.20.0-dev.10

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
@@ -6407,14 +6407,16 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6407
6407
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6408
6408
  paystackApiUrl: 'https://studio-api.paystack.co/',
6409
6409
  pusherKey: '1c7b262ee18455815893',
6410
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6410
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6411
+ savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6411
6412
  });
6412
6413
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6413
6414
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6414
6415
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6415
6416
  paystackApiUrl: 'https://studio-api.paystack.co/',
6416
6417
  pusherKey: '1c7b262ee18455815893',
6417
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6418
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6419
+ savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6418
6420
  });
6419
6421
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6420
6422
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -11645,7 +11647,7 @@ var PayattitudeAPI = {
11645
11647
  }
11646
11648
  };
11647
11649
 
11648
- var paymentMethod$6 = 'payattitude';
11650
+ var paymentMethod$7 = 'payattitude';
11649
11651
  var PayattitudeCharge = {
11650
11652
  chargePayattitude: function chargePayattitude(_ref) {
11651
11653
  var _this = this;
@@ -11656,7 +11658,7 @@ var PayattitudeCharge = {
11656
11658
  phoneNumber: phoneNumber
11657
11659
  };
11658
11660
  return PayattitudeAPI.charge(params).then(function (response) {
11659
- _this.logAPIResponse(response, paymentMethod$6);
11661
+ _this.logAPIResponse(response, paymentMethod$7);
11660
11662
 
11661
11663
  return response;
11662
11664
  });
@@ -11664,7 +11666,7 @@ var PayattitudeCharge = {
11664
11666
  listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
11665
11667
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
11666
11668
  var listenerOptions = {
11667
- paymentMethod: paymentMethod$6,
11669
+ paymentMethod: paymentMethod$7,
11668
11670
  channel: pusherChannel
11669
11671
  };
11670
11672
  return this.listenForCharge(listenerOptions, callback);
@@ -11747,7 +11749,7 @@ var ApplePayAPI = {
11747
11749
  }
11748
11750
  };
11749
11751
 
11750
- var paymentMethod$5 = 'apple pay';
11752
+ var paymentMethod$6 = 'apple pay';
11751
11753
  var ApplePayCharge = {
11752
11754
  validateApplePaySession: function validateApplePaySession(_ref) {
11753
11755
  var _this = this;
@@ -11755,7 +11757,7 @@ var ApplePayCharge = {
11755
11757
  var sessionUrl = _ref.sessionUrl,
11756
11758
  displayName = _ref.displayName,
11757
11759
  domainName = _ref.domainName;
11758
- this.logAttempt(paymentMethod$5);
11760
+ this.logAttempt(paymentMethod$6);
11759
11761
  return ApplePayAPI.validateApplePaySession({
11760
11762
  sessionUrl: sessionUrl,
11761
11763
  displayName: displayName,
@@ -11776,7 +11778,7 @@ var ApplePayCharge = {
11776
11778
  device: this.deviceFingerprint,
11777
11779
  paymentObject: paymentObject
11778
11780
  }).then(function (response) {
11779
- _this2.logAPIResponse(response, paymentMethod$5);
11781
+ _this2.logAPIResponse(response, paymentMethod$6);
11780
11782
 
11781
11783
  return response;
11782
11784
  });
@@ -11832,12 +11834,12 @@ var PayPalAPI = {
11832
11834
  }
11833
11835
  };
11834
11836
 
11835
- var paymentMethod$4 = 'paypal';
11837
+ var paymentMethod$5 = 'paypal';
11836
11838
  var PayPalCharge = {
11837
11839
  createPayPalOrder: function createPayPalOrder() {
11838
11840
  var _this = this;
11839
11841
 
11840
- this.logAttempt(paymentMethod$4);
11842
+ this.logAttempt(paymentMethod$5);
11841
11843
  return PayPalAPI.createOrder(this.id).then(function (response) {
11842
11844
  _this.logAPIResponseMessage(response.message);
11843
11845
 
@@ -11848,7 +11850,7 @@ var PayPalCharge = {
11848
11850
  var _this2 = this;
11849
11851
 
11850
11852
  return PayPalAPI.captureOrder(this.id).then(function (response) {
11851
- _this2.logAPIResponse(response, paymentMethod$4);
11853
+ _this2.logAPIResponse(response, paymentMethod$5);
11852
11854
 
11853
11855
  return response;
11854
11856
  });
@@ -18307,8 +18309,96 @@ cardValidator.creditCardType.addCard({
18307
18309
  }
18308
18310
  });
18309
18311
  cardValidator.creditCardType.changeOrder('verve', 0);
18312
+ var Card$2 = {
18313
+ getEncryptedPin: function getEncryptedPin(pin) {
18314
+ return pin ? encrypt(pin) : undefined;
18315
+ },
18316
+ getLast4: function getLast4(number) {
18317
+ return number.substring(number.length - 4);
18318
+ },
18319
+ tokenize: function tokenize(_ref) {
18320
+ var number = _ref.number,
18321
+ cvv = _ref.cvv,
18322
+ month = _ref.month,
18323
+ year = _ref.year;
18324
+ return encrypt("".concat(number, "*").concat(cvv, "*").concat(month, "*").concat(year));
18325
+ },
18326
+ getType: function getType(value) {
18327
+ var response = cardValidator.number(value);
18310
18328
 
18311
- var Card = /*#__PURE__*/function () {
18329
+ if (response && response.card) {
18330
+ return {
18331
+ type: response.card.type,
18332
+ maxLength: Math.max.apply(Math, _toConsumableArray(response.card.lengths)),
18333
+ minLength: Math.min.apply(Math, _toConsumableArray(response.card.lengths))
18334
+ };
18335
+ }
18336
+
18337
+ return {
18338
+ type: null,
18339
+ maxLength: 0
18340
+ };
18341
+ },
18342
+ validate: function validate(_ref2) {
18343
+ var number = _ref2.number,
18344
+ cvv = _ref2.cvv,
18345
+ month = _ref2.month,
18346
+ year = _ref2.year;
18347
+
18348
+ var _this$getType = this.getType(number),
18349
+ cardType = _this$getType.type;
18350
+
18351
+ var result = {
18352
+ number: this.isNumberValid(number),
18353
+ expiry: this.isExpiryValid({
18354
+ month: month,
18355
+ year: year
18356
+ }),
18357
+ cvv: this.isCvvValid(cvv, cardType)
18358
+ };
18359
+ var isValid = Object.values(result).every(function (value) {
18360
+ return value === true;
18361
+ });
18362
+ return {
18363
+ isValid: isValid,
18364
+ result: result
18365
+ };
18366
+ },
18367
+ validateNumber: function validateNumber(value) {
18368
+ return cardValidator.number(value);
18369
+ },
18370
+ isNumberValid: function isNumberValid(value) {
18371
+ return Card$2.validateNumber(value).isValid;
18372
+ },
18373
+ validateCVV: function validateCVV(cvv, cardType) {
18374
+ var isAmexCard = cardType === 'american-express';
18375
+ var cvvLength = isAmexCard ? 4 : 3;
18376
+ return cardValidator.cvv(cvv, cvvLength);
18377
+ },
18378
+ isCvvValid: function isCvvValid(cvv, cardType) {
18379
+ return Card$2.validateCVV(cvv, cardType).isValid;
18380
+ },
18381
+ validateExpiry: function validateExpiry(value) {
18382
+ if (_typeof$1(value) === 'object') {
18383
+ var month = value.month,
18384
+ year = value.year;
18385
+ return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
18386
+ }
18387
+
18388
+ return cardValidator.expirationDate(value);
18389
+ },
18390
+ isExpiryValid: function isExpiryValid(value) {
18391
+ return Card$2.validateExpiry(value).isValid;
18392
+ },
18393
+ findTestCard: function findTestCard(cardType) {
18394
+ var type = cardType || 'default';
18395
+ return testCards.find(function (card) {
18396
+ return card.type === type;
18397
+ });
18398
+ }
18399
+ };
18400
+
18401
+ var Card$1 = /*#__PURE__*/function () {
18312
18402
  function Card(_ref) {
18313
18403
  var number = _ref.number,
18314
18404
  cvv = _ref.cvv,
@@ -18328,35 +18418,27 @@ var Card = /*#__PURE__*/function () {
18328
18418
  _createClass(Card, [{
18329
18419
  key: "getEncryptedPin",
18330
18420
  value: function getEncryptedPin() {
18331
- return this.pin ? encrypt(this.pin) : undefined;
18421
+ return Card$2.getEncryptedPin(this.pin);
18332
18422
  }
18333
18423
  }, {
18334
18424
  key: "getLast4",
18335
18425
  value: function getLast4() {
18336
- return this.number.substring(this.number.length - 4);
18426
+ return Card$2.getLast4(this.number);
18337
18427
  }
18338
18428
  }, {
18339
18429
  key: "tokenize",
18340
18430
  value: function tokenize() {
18341
- return encrypt("".concat(this.number, "*").concat(this.cvv, "*").concat(this.month, "*").concat(this.year));
18431
+ return Card$2.tokenize({
18432
+ number: this.number,
18433
+ cvv: this.cvv,
18434
+ month: this.month,
18435
+ year: this.year
18436
+ });
18342
18437
  }
18343
18438
  }], [{
18344
18439
  key: "getType",
18345
18440
  value: function getType(value) {
18346
- var response = cardValidator.number(value);
18347
-
18348
- if (response && response.card) {
18349
- return {
18350
- type: response.card.type,
18351
- maxLength: Math.max.apply(Math, _toConsumableArray(response.card.lengths)),
18352
- minLength: Math.min.apply(Math, _toConsumableArray(response.card.lengths))
18353
- };
18354
- }
18355
-
18356
- return {
18357
- type: null,
18358
- maxLength: 0
18359
- };
18441
+ return Card$2.getType(value);
18360
18442
  }
18361
18443
  }, {
18362
18444
  key: "validate",
@@ -18365,79 +18447,54 @@ var Card = /*#__PURE__*/function () {
18365
18447
  cvv = _ref2.cvv,
18366
18448
  month = _ref2.month,
18367
18449
  year = _ref2.year;
18368
-
18369
- var _Card$getType = Card.getType(number),
18370
- cardType = _Card$getType.type;
18371
-
18372
- var result = {
18373
- number: Card.isNumberValid(number),
18374
- expiry: Card.isExpiryValid({
18375
- month: month,
18376
- year: year
18377
- }),
18378
- cvv: Card.isCvvValid(cvv, cardType)
18379
- };
18380
- var isValid = Object.values(result).every(function (value) {
18381
- return value === true;
18450
+ return Card$2.validate({
18451
+ number: number,
18452
+ cvv: cvv,
18453
+ month: month,
18454
+ year: year
18382
18455
  });
18383
- return {
18384
- isValid: isValid,
18385
- result: result
18386
- };
18387
18456
  }
18388
18457
  }, {
18389
18458
  key: "validateNumber",
18390
18459
  value: function validateNumber(value) {
18391
- return cardValidator.number(value);
18460
+ return Card$2.validateNumber(value);
18392
18461
  }
18393
18462
  }, {
18394
18463
  key: "isNumberValid",
18395
18464
  value: function isNumberValid(value) {
18396
- return Card.validateNumber(value).isValid;
18465
+ return Card$2.isNumberValid(value);
18397
18466
  }
18398
18467
  }, {
18399
18468
  key: "validateCVV",
18400
18469
  value: function validateCVV(cvv, cardType) {
18401
- var isAmexCard = cardType === 'american-express';
18402
- var cvvLength = isAmexCard ? 4 : 3;
18403
- return cardValidator.cvv(cvv, cvvLength);
18470
+ return Card$2.validateCVV(cvv, cardType);
18404
18471
  }
18405
18472
  }, {
18406
18473
  key: "isCvvValid",
18407
18474
  value: function isCvvValid(cvv, cardType) {
18408
- return Card.validateCVV(cvv, cardType).isValid;
18475
+ return Card$2.isCvvValid(cvv, cardType);
18409
18476
  }
18410
18477
  }, {
18411
18478
  key: "validateExpiry",
18412
18479
  value: function validateExpiry(value) {
18413
- if (_typeof$1(value) === 'object') {
18414
- var month = value.month,
18415
- year = value.year;
18416
- return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
18417
- }
18418
-
18419
- return cardValidator.expirationDate(value);
18480
+ return Card$2.validateExpiry(value);
18420
18481
  }
18421
18482
  }, {
18422
18483
  key: "isExpiryValid",
18423
18484
  value: function isExpiryValid(value) {
18424
- return Card.validateExpiry(value).isValid;
18485
+ return Card$2.isExpiryValid(value);
18425
18486
  }
18426
18487
  }, {
18427
18488
  key: "generateTestCard",
18428
18489
  value: function generateTestCard(cardType) {
18429
- var type = cardType || 'default';
18430
- var cardParams = testCards.find(function (card) {
18431
- return card.type === type;
18432
- });
18433
- return new Card(cardParams);
18490
+ return new Card(Card$2.findTestCard(cardType));
18434
18491
  }
18435
18492
  }]);
18436
18493
 
18437
18494
  return Card;
18438
18495
  }();
18439
18496
 
18440
- var CardAPI = {
18497
+ var CardAPI$1 = {
18441
18498
  charge: function charge(_ref) {
18442
18499
  var clientdata = _ref.clientdata,
18443
18500
  last4 = _ref.last4,
@@ -18613,14 +18670,216 @@ var CardAPI = {
18613
18670
  }).then(function (response) {
18614
18671
  return ChargeResponses.parse(response.data);
18615
18672
  });
18673
+ },
18674
+ sendSavedCardsOTP: function sendSavedCardsOTP(email) {
18675
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18676
+ var url, language, headers, _yield$axiosInstance$, data;
18677
+
18678
+ return regeneratorRuntime.wrap(function _callee$(_context) {
18679
+ while (1) {
18680
+ switch (_context.prev = _context.next) {
18681
+ case 0:
18682
+ url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
18683
+ language = getLanguage();
18684
+ headers = _objectSpread2({}, language && {
18685
+ 'Accept-Language': language
18686
+ });
18687
+ _context.next = 5;
18688
+ return axiosInstance.post(url, {
18689
+ email: email
18690
+ }, {
18691
+ headers: headers
18692
+ });
18693
+
18694
+ case 5:
18695
+ _yield$axiosInstance$ = _context.sent;
18696
+ data = _yield$axiosInstance$.data;
18697
+ return _context.abrupt("return", data);
18698
+
18699
+ case 8:
18700
+ case "end":
18701
+ return _context.stop();
18702
+ }
18703
+ }
18704
+ }, _callee);
18705
+ }))();
18706
+ },
18707
+ addUserToSavedCards: function addUserToSavedCards(_ref6) {
18708
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
18709
+ var phone, email, url, language, headers, data, response;
18710
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
18711
+ while (1) {
18712
+ switch (_context2.prev = _context2.next) {
18713
+ case 0:
18714
+ phone = _ref6.phone, email = _ref6.email;
18715
+ url = new URL('/user', configToUse.savedCardsApiUrl).toString();
18716
+ language = getLanguage();
18717
+ headers = _objectSpread2({}, language && {
18718
+ 'Accept-Language': language
18719
+ });
18720
+ data = {
18721
+ phone: phone,
18722
+ email: email
18723
+ };
18724
+ _context2.next = 7;
18725
+ return axiosInstance.post(url, data, {
18726
+ headers: headers
18727
+ });
18728
+
18729
+ case 7:
18730
+ response = _context2.sent;
18731
+ return _context2.abrupt("return", response.data);
18732
+
18733
+ case 9:
18734
+ case "end":
18735
+ return _context2.stop();
18736
+ }
18737
+ }
18738
+ }, _callee2);
18739
+ }))();
18740
+ },
18741
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18742
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
18743
+ var code, transaction, url, language, headers, data, response;
18744
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
18745
+ while (1) {
18746
+ switch (_context3.prev = _context3.next) {
18747
+ case 0:
18748
+ code = _ref7.code, transaction = _ref7.transaction;
18749
+ url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18750
+ language = getLanguage();
18751
+ headers = _objectSpread2({}, language && {
18752
+ 'Accept-Language': language
18753
+ });
18754
+ data = {
18755
+ code: code,
18756
+ transaction: transaction
18757
+ };
18758
+ _context3.next = 7;
18759
+ return axiosInstance.post(url, data, {
18760
+ headers: headers
18761
+ });
18762
+
18763
+ case 7:
18764
+ response = _context3.sent;
18765
+ return _context3.abrupt("return", response.data);
18766
+
18767
+ case 9:
18768
+ case "end":
18769
+ return _context3.stop();
18770
+ }
18771
+ }
18772
+ }, _callee3);
18773
+ }))();
18774
+ },
18775
+ getSavedCards: function getSavedCards(_ref8) {
18776
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
18777
+ var token, url, language, headers, response;
18778
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
18779
+ while (1) {
18780
+ switch (_context4.prev = _context4.next) {
18781
+ case 0:
18782
+ token = _ref8.token;
18783
+ url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
18784
+ language = getLanguage();
18785
+ headers = _objectSpread2({
18786
+ Authorization: "Bearer ".concat(token),
18787
+ 'jwt-auth': true
18788
+ }, language && {
18789
+ 'Accept-Language': language
18790
+ });
18791
+ _context4.next = 6;
18792
+ return axiosInstance.get(url, {
18793
+ headers: headers
18794
+ });
18795
+
18796
+ case 6:
18797
+ response = _context4.sent;
18798
+ return _context4.abrupt("return", response.data);
18799
+
18800
+ case 8:
18801
+ case "end":
18802
+ return _context4.stop();
18803
+ }
18804
+ }
18805
+ }, _callee4);
18806
+ }))();
18807
+ },
18808
+ deleteSavedCard: function deleteSavedCard(_ref9) {
18809
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
18810
+ var cardCode, token, url, language, headers, response;
18811
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
18812
+ while (1) {
18813
+ switch (_context5.prev = _context5.next) {
18814
+ case 0:
18815
+ cardCode = _ref9.cardCode, token = _ref9.token;
18816
+ url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
18817
+ language = getLanguage();
18818
+ headers = _objectSpread2({
18819
+ Authorization: "Bearer ".concat(token),
18820
+ 'jwt-auth': true
18821
+ }, language && {
18822
+ 'Accept-Language': language
18823
+ });
18824
+ _context5.next = 6;
18825
+ return axiosInstance.delete(url, {
18826
+ headers: headers
18827
+ });
18828
+
18829
+ case 6:
18830
+ response = _context5.sent;
18831
+ return _context5.abrupt("return", response.data);
18832
+
18833
+ case 8:
18834
+ case "end":
18835
+ return _context5.stop();
18836
+ }
18837
+ }
18838
+ }, _callee5);
18839
+ }))();
18840
+ },
18841
+ chargeSavedCard: function chargeSavedCard(_ref10) {
18842
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
18843
+ var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18844
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
18845
+ while (1) {
18846
+ switch (_context6.prev = _context6.next) {
18847
+ case 0:
18848
+ token = _ref10.token, device = _ref10.device, cardCode = _ref10.cardCode, transaction = _ref10.transaction, selectedCurrency = _ref10.selectedCurrency;
18849
+ url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18850
+ language = getLanguage();
18851
+ headers = _objectSpread2({
18852
+ Authorization: "Bearer ".concat(token),
18853
+ 'jwt-auth': true
18854
+ }, language && {
18855
+ 'Accept-Language': language
18856
+ });
18857
+ data = {
18858
+ device: device,
18859
+ transaction: transaction,
18860
+ selectedCurrency: selectedCurrency
18861
+ };
18862
+ return _context6.abrupt("return", axiosInstance.post(url, data, {
18863
+ headers: headers
18864
+ }).then(function (response) {
18865
+ return ChargeResponses.parse(response.data);
18866
+ }));
18867
+
18868
+ case 6:
18869
+ case "end":
18870
+ return _context6.stop();
18871
+ }
18872
+ }
18873
+ }, _callee6);
18874
+ }))();
18616
18875
  }
18617
18876
  };
18618
18877
 
18619
- var paymentMethod$3 = 'card';
18878
+ var paymentMethod$4 = 'card';
18620
18879
 
18621
- function validate$3(card, isSetter) {
18880
+ function validate$4(card, isSetter) {
18622
18881
  return new Promise(function (resolve, reject) {
18623
- var validation = Card.validate(card);
18882
+ var validation = Card$1.validate(card);
18624
18883
 
18625
18884
  if (!validation.isValid) {
18626
18885
  var throwValidation = isSetter || card.number;
@@ -18639,8 +18898,8 @@ var CardCharge = {
18639
18898
  setCard: function setCard(params) {
18640
18899
  var _this = this;
18641
18900
 
18642
- return validate$3(params, true).then(function () {
18643
- _this.card = new Card(params);
18901
+ return validate$4(params, true).then(function () {
18902
+ _this.card = new Card$1(params);
18644
18903
  });
18645
18904
  },
18646
18905
  rememberCard: function rememberCard() {
@@ -18655,8 +18914,8 @@ var CardCharge = {
18655
18914
  return this.chargeCardWithPin(customFields);
18656
18915
  }
18657
18916
 
18658
- return validate$3(this.card).then(function () {
18659
- _this2.logAttempt(paymentMethod$3);
18917
+ return validate$4(this.card).then(function () {
18918
+ _this2.logAttempt(paymentMethod$4);
18660
18919
 
18661
18920
  var chargeParams = {
18662
18921
  clientdata: _this2.card.tokenize(),
@@ -18669,8 +18928,8 @@ var CardCharge = {
18669
18928
  subscription: _this2.subscription,
18670
18929
  customFields: customFields
18671
18930
  };
18672
- return CardAPI.charge(chargeParams).then(function (response) {
18673
- _this2.logAPIResponse(response, paymentMethod$3);
18931
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18932
+ _this2.logAPIResponse(response, paymentMethod$4);
18674
18933
 
18675
18934
  return response;
18676
18935
  });
@@ -18685,7 +18944,7 @@ var CardCharge = {
18685
18944
  var _this3 = this;
18686
18945
 
18687
18946
  var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18688
- this.logAttempt(paymentMethod$3);
18947
+ this.logAttempt(paymentMethod$4);
18689
18948
  var chargeParams = {
18690
18949
  pin: encrypt(this.card.pin),
18691
18950
  trans: this.id,
@@ -18695,8 +18954,8 @@ var CardCharge = {
18695
18954
  subscription: this.subscription,
18696
18955
  customFields: customFields
18697
18956
  };
18698
- return CardAPI.charge(chargeParams).then(function (response) {
18699
- _this3.logAPIResponse(response, paymentMethod$3);
18957
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18958
+ _this3.logAPIResponse(response, paymentMethod$4);
18700
18959
 
18701
18960
  return response;
18702
18961
  });
@@ -18708,7 +18967,7 @@ var CardCharge = {
18708
18967
  authorizationCode = _ref.authorizationCode,
18709
18968
  cardLast4 = _ref.cardLast4,
18710
18969
  pin = _ref.pin;
18711
- this.logAttempt(paymentMethod$3);
18970
+ this.logAttempt(paymentMethod$4);
18712
18971
  var encryptedPin = encrypt(pin);
18713
18972
  var chargeParams = {
18714
18973
  authorizationCode: authorizationCode,
@@ -18720,8 +18979,8 @@ var CardCharge = {
18720
18979
  transactionType: this.transactionType,
18721
18980
  subscription: this.subscription
18722
18981
  };
18723
- return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
18724
- _this4.logAPIResponse(response, paymentMethod$3);
18982
+ return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
18983
+ _this4.logAPIResponse(response, paymentMethod$4);
18725
18984
 
18726
18985
  return response;
18727
18986
  });
@@ -18739,8 +18998,8 @@ var CardCharge = {
18739
18998
  device: this.deviceFingerprint
18740
18999
  });
18741
19000
 
18742
- return CardAPI.resumeCardCharge(params).then(function (response) {
18743
- _this5.logAPIResponse(response, paymentMethod$3);
19001
+ return CardAPI$1.resumeCardCharge(params).then(function (response) {
19002
+ _this5.logAPIResponse(response, paymentMethod$4);
18744
19003
 
18745
19004
  return response;
18746
19005
  });
@@ -18752,8 +19011,8 @@ var CardCharge = {
18752
19011
  authorizationId: authorizationId,
18753
19012
  publicKey: this.merchant.key
18754
19013
  };
18755
- return CardAPI.forgetRememberedCard(params).then(function (response) {
18756
- _this6.logAPIResponse(response, paymentMethod$3);
19014
+ return CardAPI$1.forgetRememberedCard(params).then(function (response) {
19015
+ _this6.logAPIResponse(response, paymentMethod$4);
18757
19016
 
18758
19017
  return response;
18759
19018
  });
@@ -18761,8 +19020,8 @@ var CardCharge = {
18761
19020
  authenticateCard: function authenticateCard(token) {
18762
19021
  var _this7 = this;
18763
19022
 
18764
- return CardAPI.authenticate(this.id, token).then(function (response) {
18765
- _this7.logAPIResponse(response, paymentMethod$3);
19023
+ return CardAPI$1.authenticate(this.id, token).then(function (response) {
19024
+ _this7.logAPIResponse(response, paymentMethod$4);
18766
19025
 
18767
19026
  return response;
18768
19027
  });
@@ -18781,8 +19040,8 @@ var CardCharge = {
18781
19040
  zipCode: zipCode,
18782
19041
  transactionId: this.id
18783
19042
  };
18784
- return CardAPI.verifyAddress(payload).then(function (response) {
18785
- _this8.logAPIResponse(response, paymentMethod$3);
19043
+ return CardAPI$1.verifyAddress(payload).then(function (response) {
19044
+ _this8.logAPIResponse(response, paymentMethod$4);
18786
19045
 
18787
19046
  return response;
18788
19047
  });
@@ -18790,9 +19049,77 @@ var CardCharge = {
18790
19049
  listenFor3DSCharge: function listenFor3DSCharge(callback) {
18791
19050
  var listenerOptions = {
18792
19051
  channel: "3DS_".concat(this.id),
18793
- paymentMethod: paymentMethod$3
19052
+ paymentMethod: paymentMethod$4
18794
19053
  };
18795
19054
  return this.listenForCharge(listenerOptions, callback);
19055
+ },
19056
+ sendSavedCardsOTP: function sendSavedCardsOTP() {
19057
+ return CardAPI$1.sendSavedCardsOTP(this.email);
19058
+ },
19059
+ addUserToSavedCards: function addUserToSavedCards(_ref4) {
19060
+ var phone = _ref4.phone;
19061
+ return CardAPI$1.addUserToSavedCards({
19062
+ phone: phone,
19063
+ email: this.email
19064
+ });
19065
+ },
19066
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
19067
+ var _this9 = this;
19068
+
19069
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19070
+ var code, payload, response;
19071
+ return regeneratorRuntime.wrap(function _callee$(_context) {
19072
+ while (1) {
19073
+ switch (_context.prev = _context.next) {
19074
+ case 0:
19075
+ code = _ref5.code;
19076
+ payload = {
19077
+ code: code,
19078
+ transaction: _this9.id
19079
+ };
19080
+ _context.prev = 2;
19081
+ _context.next = 5;
19082
+ return CardAPI$1.verifySavedCardsOtp(payload);
19083
+
19084
+ case 5:
19085
+ response = _context.sent;
19086
+ _this9.savedCardsToken = response.data.token;
19087
+ return _context.abrupt("return", response);
19088
+
19089
+ case 10:
19090
+ _context.prev = 10;
19091
+ _context.t0 = _context["catch"](2);
19092
+ _this9.savedCardsToken = null;
19093
+ throw _context.t0;
19094
+
19095
+ case 14:
19096
+ case "end":
19097
+ return _context.stop();
19098
+ }
19099
+ }
19100
+ }, _callee, null, [[2, 10]]);
19101
+ }))();
19102
+ },
19103
+ getSavedCards: function getSavedCards() {
19104
+ return CardAPI$1.getSavedCards({
19105
+ token: this.savedCardsToken
19106
+ });
19107
+ },
19108
+ deleteSavedCard: function deleteSavedCard(cardCode) {
19109
+ return CardAPI$1.deleteSavedCard({
19110
+ cardCode: cardCode,
19111
+ token: this.savedCardsToken
19112
+ });
19113
+ },
19114
+ chargeSavedCard: function chargeSavedCard(_ref6) {
19115
+ var cardCode = _ref6.cardCode;
19116
+ return CardAPI$1.chargeSavedCard({
19117
+ cardCode: cardCode,
19118
+ transaction: this.id,
19119
+ token: this.savedCardsToken,
19120
+ device: this.deviceFingerprint,
19121
+ selectedCurrency: this.currency
19122
+ });
18796
19123
  }
18797
19124
  };
18798
19125
 
@@ -18945,9 +19272,9 @@ var EMandateAPI = {
18945
19272
  }
18946
19273
  };
18947
19274
 
18948
- var paymentMethod$2 = 'bank account';
19275
+ var paymentMethod$3 = 'bank account';
18949
19276
 
18950
- function validate$2(bankAccount, isSetter) {
19277
+ function validate$3(bankAccount, isSetter) {
18951
19278
  return new Promise(function (resolve, reject) {
18952
19279
  var validation = BankAccount.validate(bankAccount);
18953
19280
 
@@ -18965,15 +19292,15 @@ var EMandate = {
18965
19292
  setBankAccount: function setBankAccount(params) {
18966
19293
  var _this = this;
18967
19294
 
18968
- return validate$2(params, true).then(function () {
19295
+ return validate$3(params, true).then(function () {
18969
19296
  _this.bankAccount = new BankAccount(params);
18970
19297
  });
18971
19298
  },
18972
19299
  chargeBankAccount: function chargeBankAccount() {
18973
19300
  var _this2 = this;
18974
19301
 
18975
- return validate$2(this.bankAccount).then(function () {
18976
- _this2.logAttempt(paymentMethod$2);
19302
+ return validate$3(this.bankAccount).then(function () {
19303
+ _this2.logAttempt(paymentMethod$3);
18977
19304
 
18978
19305
  var verifyParams = {
18979
19306
  bankId: _this2.bankAccount.bankId,
@@ -18982,7 +19309,7 @@ var EMandate = {
18982
19309
  device: _this2.deviceFingerprint
18983
19310
  };
18984
19311
  return EMandateAPI.verify(verifyParams).then(function (response) {
18985
- _this2.logAPIResponse(response, paymentMethod$2);
19312
+ _this2.logAPIResponse(response, paymentMethod$3);
18986
19313
 
18987
19314
  return response;
18988
19315
  });
@@ -18991,7 +19318,7 @@ var EMandate = {
18991
19318
  registerBankAccount: function registerBankAccount(birthday) {
18992
19319
  var _this3 = this;
18993
19320
 
18994
- return validate$2(this.bankAccount).then(function () {
19321
+ return validate$3(this.bankAccount).then(function () {
18995
19322
  var registerParams = {
18996
19323
  bankId: _this3.bankAccount.bankId,
18997
19324
  transactionId: _this3.id,
@@ -18999,7 +19326,7 @@ var EMandate = {
18999
19326
  birthday: birthday
19000
19327
  };
19001
19328
  return EMandateAPI.register(registerParams).then(function (response) {
19002
- _this3.logAPIResponse(response, paymentMethod$2);
19329
+ _this3.logAPIResponse(response, paymentMethod$3);
19003
19330
 
19004
19331
  return response;
19005
19332
  });
@@ -19008,7 +19335,7 @@ var EMandate = {
19008
19335
  authenticateBankAccount: function authenticateBankAccount(token) {
19009
19336
  var _this4 = this;
19010
19337
 
19011
- return validate$2(this.bankAccount).then(function () {
19338
+ return validate$3(this.bankAccount).then(function () {
19012
19339
  var chargeParams = {
19013
19340
  bankId: _this4.bankAccount.bankId,
19014
19341
  transactionId: _this4.id,
@@ -19016,7 +19343,7 @@ var EMandate = {
19016
19343
  device: _this4.deviceFingerprint
19017
19344
  };
19018
19345
  return EMandateAPI.authenticate(chargeParams).then(function (response) {
19019
- _this4.logAPIResponse(response, paymentMethod$2);
19346
+ _this4.logAPIResponse(response, paymentMethod$3);
19020
19347
 
19021
19348
  return response;
19022
19349
  });
@@ -19077,7 +19404,7 @@ var DigitalBankMandateAPI = {
19077
19404
  }
19078
19405
  };
19079
19406
 
19080
- var paymentMethod$1 = 'bank';
19407
+ var paymentMethod$2 = 'bank';
19081
19408
  var DigitalBankMandate = {
19082
19409
  chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
19083
19410
  var _this = this;
@@ -19092,7 +19419,7 @@ var DigitalBankMandate = {
19092
19419
  bankId: bankId
19093
19420
  };
19094
19421
  return DigitalBankMandateAPI.charge(params).then(function (response) {
19095
- _this.logAPIResponse(response, paymentMethod$1);
19422
+ _this.logAPIResponse(response, paymentMethod$2);
19096
19423
 
19097
19424
  return response;
19098
19425
  });
@@ -19100,7 +19427,7 @@ var DigitalBankMandate = {
19100
19427
  listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
19101
19428
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
19102
19429
  var listenerOptions = {
19103
- paymentMethod: paymentMethod$1,
19430
+ paymentMethod: paymentMethod$2,
19104
19431
  channel: pusherChannel
19105
19432
  };
19106
19433
  return this.listenForCharge(listenerOptions, callback);
@@ -19233,7 +19560,7 @@ var QrAPI = {
19233
19560
  }
19234
19561
  };
19235
19562
 
19236
- function validate$1(channel) {
19563
+ function validate$2(channel) {
19237
19564
  return new Promise(function (resolve, reject) {
19238
19565
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19239
19566
 
@@ -19251,7 +19578,7 @@ var QRCharge = {
19251
19578
  var _this = this;
19252
19579
 
19253
19580
  var channel = _ref.channel;
19254
- return validate$1(channel).then(function () {
19581
+ return validate$2(channel).then(function () {
19255
19582
  if (_this.qr[channel]) {
19256
19583
  return _this.qr[channel];
19257
19584
  }
@@ -19273,7 +19600,7 @@ var QRCharge = {
19273
19600
  var _this2 = this;
19274
19601
 
19275
19602
  var channel = _ref2.channel;
19276
- return validate$1(channel).then(function () {
19603
+ return validate$2(channel).then(function () {
19277
19604
  if (!_this2.qr[channel]) {
19278
19605
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19279
19606
  }
@@ -19394,7 +19721,7 @@ var MobileMoneyAPI = {
19394
19721
  }
19395
19722
  };
19396
19723
 
19397
- function validate(phoneNumber) {
19724
+ function validate$1(phoneNumber) {
19398
19725
  return new Promise(function (resolve, reject) {
19399
19726
  var validation = PhoneNumber.validate(phoneNumber);
19400
19727
 
@@ -19415,7 +19742,7 @@ var MobileMoneyCharge = {
19415
19742
  provider = _ref.provider,
19416
19743
  voucher = _ref.voucher,
19417
19744
  registrationToken = _ref.registrationToken;
19418
- return validate(phoneNumber).then(function () {
19745
+ return validate$1(phoneNumber).then(function () {
19419
19746
  _this.logAttempt('mobile money');
19420
19747
 
19421
19748
  var params = {
@@ -19446,7 +19773,7 @@ var MobileMoneyCharge = {
19446
19773
  var phoneNumber = payload.phoneNumber,
19447
19774
  provider = payload.provider,
19448
19775
  registrationToken = payload.registrationToken;
19449
- return validate(phoneNumber).then(function () {
19776
+ return validate$1(phoneNumber).then(function () {
19450
19777
  _this2.logMobileMoneyActions(payload);
19451
19778
 
19452
19779
  var params = {
@@ -19586,7 +19913,7 @@ var DirectDebitAPI = {
19586
19913
  }
19587
19914
  };
19588
19915
 
19589
- var paymentMethod = 'direct debit';
19916
+ var paymentMethod$1 = 'direct debit';
19590
19917
  var DirectDebitCharge = {
19591
19918
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19592
19919
  var _this = this;
@@ -19632,14 +19959,14 @@ var DirectDebitCharge = {
19632
19959
  return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
19633
19960
  }
19634
19961
 
19635
- this.logAttempt(paymentMethod);
19962
+ this.logAttempt(paymentMethod$1);
19636
19963
  var params = {
19637
19964
  account_code: accountCode,
19638
19965
  transaction: this.id,
19639
19966
  token: this.directDebit.token
19640
19967
  };
19641
19968
  return DirectDebitAPI.charge(params).then(function (response) {
19642
- _this2.logAPIResponse(response, paymentMethod);
19969
+ _this2.logAPIResponse(response, paymentMethod$1);
19643
19970
 
19644
19971
  if (response.status) {
19645
19972
  _this2.directDebit.chargeResponse = response;
@@ -19652,7 +19979,7 @@ var DirectDebitCharge = {
19652
19979
  var _this3 = this;
19653
19980
 
19654
19981
  return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
19655
- _this3.logAPIResponse(response, paymentMethod);
19982
+ _this3.logAPIResponse(response, paymentMethod$1);
19656
19983
 
19657
19984
  var status = response.status,
19658
19985
  data = response.data;
@@ -19677,7 +20004,7 @@ var DirectDebitCharge = {
19677
20004
  token: this.directDebit.token
19678
20005
  };
19679
20006
  return DirectDebitAPI.authenticate(params).then(function (response) {
19680
- _this4.logAPIResponse(response, paymentMethod);
20007
+ _this4.logAPIResponse(response, paymentMethod$1);
19681
20008
 
19682
20009
  return response;
19683
20010
  });
@@ -20121,6 +20448,8 @@ var TransactionInstance = /*#__PURE__*/function () {
20121
20448
  this.subscription = data.subscription || null;
20122
20449
  this.planDetails = data.plan_details || null;
20123
20450
  this.exchangeRate = data.exchange_rate || null;
20451
+ this.savedCardsConfig = data.saved_cards || {};
20452
+ this.savedCardsToken = null;
20124
20453
  /**
20125
20454
  * We initialize parameters we send to the API as empty strings
20126
20455
  * when we don't have them instead of null because the API expects
@@ -20461,10 +20790,194 @@ var Toolkit = /*#__PURE__*/function () {
20461
20790
  return Toolkit;
20462
20791
  }();
20463
20792
 
20793
+ var Card = /*#__PURE__*/function () {
20794
+ function Card(_ref) {
20795
+ var number = _ref.number,
20796
+ cvv = _ref.cvv,
20797
+ month = _ref.month,
20798
+ year = _ref.year,
20799
+ pin = _ref.pin;
20800
+
20801
+ _classCallCheck(this, Card);
20802
+
20803
+ this.number = number;
20804
+ this.cvv = cvv;
20805
+ this.month = month;
20806
+ this.year = year;
20807
+ this.pin = pin;
20808
+ }
20809
+
20810
+ _createClass(Card, [{
20811
+ key: "getEncryptedPin",
20812
+ value: function getEncryptedPin() {
20813
+ return Card$2.getEncryptedPin(this.pin);
20814
+ }
20815
+ }, {
20816
+ key: "getLast4",
20817
+ value: function getLast4() {
20818
+ return Card$2.getLast4(this.number);
20819
+ }
20820
+ }, {
20821
+ key: "tokenize",
20822
+ value: function tokenize() {
20823
+ return Card$2.tokenize({
20824
+ number: this.number,
20825
+ cvv: this.cvv,
20826
+ month: this.month,
20827
+ year: this.year
20828
+ });
20829
+ }
20830
+ }], [{
20831
+ key: "getType",
20832
+ value: function getType(value) {
20833
+ return Card$2.getType(value);
20834
+ }
20835
+ }, {
20836
+ key: "validate",
20837
+ value: function validate(_ref2) {
20838
+ var number = _ref2.number,
20839
+ cvv = _ref2.cvv,
20840
+ month = _ref2.month,
20841
+ year = _ref2.year;
20842
+ return Card$2.validate({
20843
+ number: number,
20844
+ cvv: cvv,
20845
+ month: month,
20846
+ year: year
20847
+ });
20848
+ }
20849
+ }, {
20850
+ key: "validateNumber",
20851
+ value: function validateNumber(value) {
20852
+ return Card$2.validateNumber(value);
20853
+ }
20854
+ }, {
20855
+ key: "isNumberValid",
20856
+ value: function isNumberValid(value) {
20857
+ return Card$2.isNumberValid(value);
20858
+ }
20859
+ }, {
20860
+ key: "validateCVV",
20861
+ value: function validateCVV(cvv, cardType) {
20862
+ return Card$2.validateCVV(cvv, cardType);
20863
+ }
20864
+ }, {
20865
+ key: "isCvvValid",
20866
+ value: function isCvvValid(cvv, cardType) {
20867
+ return Card$2.isCvvValid(cvv, cardType);
20868
+ }
20869
+ }, {
20870
+ key: "validateExpiry",
20871
+ value: function validateExpiry(value) {
20872
+ return Card$2.validateExpiry(value);
20873
+ }
20874
+ }, {
20875
+ key: "isExpiryValid",
20876
+ value: function isExpiryValid(value) {
20877
+ return Card$2.isExpiryValid(value);
20878
+ }
20879
+ }, {
20880
+ key: "generateTestCard",
20881
+ value: function generateTestCard(cardType) {
20882
+ return new Card(Card$2.findTestCard(cardType));
20883
+ }
20884
+ }]);
20885
+
20886
+ return Card;
20887
+ }();
20888
+
20889
+ var CardAPI = {
20890
+ reserve: function reserve(_ref) {
20891
+ var clientdata = _ref.clientdata,
20892
+ last4 = _ref.last4,
20893
+ preauthorizationId = _ref.preauthorizationId,
20894
+ publicKey = _ref.publicKey;
20895
+ var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
20896
+ var language = getLanguage();
20897
+
20898
+ var headers = _objectSpread2({
20899
+ Authorization: "Bearer ".concat(publicKey)
20900
+ }, language && {
20901
+ 'Accept-Language': language
20902
+ });
20903
+
20904
+ return axiosInstance.post(url, {
20905
+ clientdata: clientdata,
20906
+ last4: last4,
20907
+ preauthorization: preauthorizationId
20908
+ }, {
20909
+ headers: headers
20910
+ }).then(function (response) {
20911
+ return ChargeResponses.parse(response.data);
20912
+ });
20913
+ }
20914
+ };
20915
+
20916
+ var paymentMethod = 'card';
20917
+
20918
+ function validate(card, isSetter) {
20919
+ return new Promise(function (resolve, reject) {
20920
+ var validation = Card.validate(card);
20921
+
20922
+ if (!validation.isValid) {
20923
+ var throwValidation = isSetter || card.number;
20924
+ var errors = Object.keys(validation.result).filter(function (value) {
20925
+ return validation.result[value] === false;
20926
+ });
20927
+ var errorMessage = "Invalid card details: ".concat(errors.join(', '));
20928
+ reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
20929
+ }
20930
+
20931
+ resolve();
20932
+ });
20933
+ }
20934
+
20935
+ var ReserveCardFunds = {
20936
+ setCard: function setCard(params) {
20937
+ var _this = this;
20938
+
20939
+ return validate(params, true).then(function () {
20940
+ _this.card = new Card(params);
20941
+ });
20942
+ },
20943
+ reserve: function reserve(_ref) {
20944
+ var _this2 = this;
20945
+
20946
+ var preauthorizationId = _ref.preauthorizationId,
20947
+ publicKey = _ref.publicKey,
20948
+ _ref$customFields = _ref.customFields,
20949
+ customFields = _ref$customFields === void 0 ? {} : _ref$customFields;
20950
+ // TODO: Log payment method
20951
+ // https://paystack.atlassian.net/browse/RAILS-3070
20952
+ return validate(this.card).then(function () {
20953
+ var chargeParams = {
20954
+ clientdata: _this2.card.tokenize(),
20955
+ last4: _this2.card.getLast4(),
20956
+ preauthorizationId: preauthorizationId,
20957
+ publicKey: publicKey,
20958
+ customFields: customFields
20959
+ };
20960
+ return CardAPI.reserve(chargeParams).then(function (response) {
20961
+ // TODO: Log API Response
20962
+ // https://paystack.atlassian.net/browse/RAILS-3070
20963
+ return response;
20964
+ });
20965
+ });
20966
+ },
20967
+ listenFor3DSCharge: function listenFor3DSCharge(callback) {
20968
+ var listenerOptions = {
20969
+ channel: "3DS_".concat(this.id),
20970
+ paymentMethod: paymentMethod
20971
+ };
20972
+ return this.listenForCharge(listenerOptions, callback);
20973
+ }
20974
+ };
20975
+
20464
20976
  var PreauthorizationInstance = /*#__PURE__*/function () {
20465
20977
  function PreauthorizationInstance(data) {
20466
20978
  _classCallCheck(this, PreauthorizationInstance);
20467
20979
 
20980
+ this.id = data.id;
20468
20981
  this.email = data.email;
20469
20982
  this.status = data.status;
20470
20983
  this.reference = data.reference;
@@ -20480,8 +20993,11 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
20480
20993
  name: data.merchant_name,
20481
20994
  key: data.merchant_key
20482
20995
  };
20483
- loadPusher(); // TODO: Bind charge function to card channel
20484
- // https://paystack.atlassian.net/browse/RAILS-2887
20996
+ this.card = {};
20997
+ loadPusher(); // TODO: Analytics
20998
+ // https://paystack.atlassian.net/browse/RAILS-3070
20999
+
21000
+ Object.assign(this, ReserveCardFunds);
20485
21001
  }
20486
21002
 
20487
21003
  _createClass(PreauthorizationInstance, [{
@@ -20515,8 +21031,6 @@ var PreauthorisationAPI = {
20515
21031
  });
20516
21032
  },
20517
21033
  requery: function requery() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
20518
- },
20519
- reserveFunds: function reserveFunds() {// TODO: https://paystack.atlassian.net/browse/RAILS-2887
20520
21034
  }
20521
21035
  };
20522
21036
 
@@ -20563,7 +21077,7 @@ var Preauthorization = {
20563
21077
  };
20564
21078
 
20565
21079
  exports.BankAccount = BankAccount;
20566
- exports.Card = Card;
21080
+ exports.Card = Card$1;
20567
21081
  exports.Preauthorization = Preauthorization;
20568
21082
  exports.Toolkit = Toolkit;
20569
21083
  exports.Transaction = Transaction;