@paystack/checkout-js 1.19.0-dev.9 → 1.20.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/checkout.js CHANGED
@@ -6408,7 +6408,7 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6408
6408
  paystackApiUrl: 'https://studio-api.paystack.co/',
6409
6409
  pusherKey: '1c7b262ee18455815893',
6410
6410
  pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6411
- savedCardsApiUrl: 'https://saved-cards-api.private.paystack.studio/'
6411
+ savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6412
6412
  });
6413
6413
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6414
6414
  checkoutUrl: 'https://checkout-studio.paystack.com/',
@@ -6416,7 +6416,7 @@ var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6416
6416
  paystackApiUrl: 'https://studio-api.paystack.co/',
6417
6417
  pusherKey: '1c7b262ee18455815893',
6418
6418
  pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6419
- savedCardsApiUrl: 'https://saved-cards-api.private.paystack.studio/'
6419
+ savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6420
6420
  });
6421
6421
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6422
6422
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -6434,37 +6434,6 @@ var configToEnvironmentMapping = {
6434
6434
  };
6435
6435
  var configToUse = configToEnvironmentMapping[env.paystackEnvironment] || productionConfig;
6436
6436
 
6437
- /* eslint-env browser */
6438
- // We use this function to load pusher.
6439
-
6440
- function loadPusher() {
6441
- if (!window) {
6442
- return Promise.reject(new Error('Window object not available'));
6443
- }
6444
-
6445
- return new Promise(function (resolve, reject) {
6446
- var xhr = new XMLHttpRequest();
6447
- xhr.open('GET', configToUse.pusherUrl);
6448
-
6449
- xhr.onload = function () {
6450
- if (xhr.status >= 200 && xhr.status < 300) {
6451
- var s = document.createElement('script');
6452
- s.appendChild(document.createTextNode(xhr.responseText));
6453
- document.head.appendChild(s);
6454
- resolve();
6455
- } else {
6456
- reject(xhr.statusText);
6457
- }
6458
- };
6459
-
6460
- xhr.onerror = function () {
6461
- return reject(xhr.statusText);
6462
- };
6463
-
6464
- xhr.send(null);
6465
- });
6466
- }
6467
-
6468
6437
  var noOp = function noOp() {
6469
6438
  return undefined;
6470
6439
  };
@@ -6638,6 +6607,82 @@ var ChargeResponses = {
6638
6607
  }
6639
6608
  };
6640
6609
 
6610
+ /* eslint-env browser */
6611
+
6612
+ var loadPusher = function loadPusher() {
6613
+ if (!window) {
6614
+ return Promise.reject(new Error('Window object not available'));
6615
+ }
6616
+
6617
+ return new Promise(function (resolve, reject) {
6618
+ var xhr = new XMLHttpRequest();
6619
+ xhr.open('GET', configToUse.pusherUrl);
6620
+
6621
+ xhr.onload = function () {
6622
+ if (xhr.status >= 200 && xhr.status < 300) {
6623
+ var s = document.createElement('script');
6624
+ s.appendChild(document.createTextNode(xhr.responseText));
6625
+ document.head.appendChild(s);
6626
+ resolve();
6627
+ } else {
6628
+ reject(xhr.statusText);
6629
+ }
6630
+ };
6631
+
6632
+ xhr.onerror = function () {
6633
+ return reject(xhr.statusText);
6634
+ };
6635
+
6636
+ xhr.send(null);
6637
+ });
6638
+ }; // `context` is passed through to set the class property of `isListening` to true/false
6639
+ // and provide the logAPIResponse analytics function
6640
+ // eslint-disable-next-line consistent-return
6641
+
6642
+ var subscribeToChargeEvents = function subscribeToChargeEvents(options, context, callback) {
6643
+ var channel = options.channel,
6644
+ paymentMethod = options.paymentMethod;
6645
+ var pusher;
6646
+
6647
+ if (window && window.Pusher) {
6648
+ pusher = new window.Pusher(configToUse.pusherKey, {
6649
+ cluster: 'eu',
6650
+ disableStats: true
6651
+ });
6652
+ }
6653
+
6654
+ var pusherUndefinedError = {
6655
+ status: 'error',
6656
+ message: 'We could not listen for charge response.'
6657
+ };
6658
+ var pusherSubscriptionError = {
6659
+ status: 'error',
6660
+ message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
6661
+ };
6662
+
6663
+ var unsubscribeFromPusher = function unsubscribeFromPusher() {
6664
+ pusher.unsubscribe(channel);
6665
+ };
6666
+
6667
+ if (!pusher) {
6668
+ return callback(pusherUndefinedError, noOp);
6669
+ }
6670
+
6671
+ var pusherSubscription = pusher.subscribe(channel);
6672
+ pusherSubscription.bind('pusher:subscription_succeeded', function () {
6673
+ context.isListening = true;
6674
+ });
6675
+ pusherSubscription.bind('pusher:subscription_error', function () {
6676
+ context.isListening = false;
6677
+ callback(pusherSubscriptionError, noOp);
6678
+ });
6679
+ pusherSubscription.bind('response', function (response) {
6680
+ var formattedResponse = ChargeResponses.parse(response);
6681
+ context.logAPIResponse(formattedResponse, paymentMethod);
6682
+ callback(formattedResponse, unsubscribeFromPusher);
6683
+ });
6684
+ };
6685
+
6641
6686
  var uncurryThis$6 = functionUncurryThis;
6642
6687
  var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
6643
6688
  var redefine$4 = redefine$a.exports;
@@ -11602,7 +11647,7 @@ var PayattitudeAPI = {
11602
11647
  }
11603
11648
  };
11604
11649
 
11605
- var paymentMethod$6 = 'payattitude';
11650
+ var paymentMethod$7 = 'payattitude';
11606
11651
  var PayattitudeCharge = {
11607
11652
  chargePayattitude: function chargePayattitude(_ref) {
11608
11653
  var _this = this;
@@ -11613,7 +11658,7 @@ var PayattitudeCharge = {
11613
11658
  phoneNumber: phoneNumber
11614
11659
  };
11615
11660
  return PayattitudeAPI.charge(params).then(function (response) {
11616
- _this.logAPIResponse(response, paymentMethod$6);
11661
+ _this.logAPIResponse(response, paymentMethod$7);
11617
11662
 
11618
11663
  return response;
11619
11664
  });
@@ -11621,7 +11666,7 @@ var PayattitudeCharge = {
11621
11666
  listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
11622
11667
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
11623
11668
  var listenerOptions = {
11624
- paymentMethod: paymentMethod$6,
11669
+ paymentMethod: paymentMethod$7,
11625
11670
  channel: pusherChannel
11626
11671
  };
11627
11672
  return this.listenForCharge(listenerOptions, callback);
@@ -11704,7 +11749,7 @@ var ApplePayAPI = {
11704
11749
  }
11705
11750
  };
11706
11751
 
11707
- var paymentMethod$5 = 'apple pay';
11752
+ var paymentMethod$6 = 'apple pay';
11708
11753
  var ApplePayCharge = {
11709
11754
  validateApplePaySession: function validateApplePaySession(_ref) {
11710
11755
  var _this = this;
@@ -11712,7 +11757,7 @@ var ApplePayCharge = {
11712
11757
  var sessionUrl = _ref.sessionUrl,
11713
11758
  displayName = _ref.displayName,
11714
11759
  domainName = _ref.domainName;
11715
- this.logAttempt(paymentMethod$5);
11760
+ this.logAttempt(paymentMethod$6);
11716
11761
  return ApplePayAPI.validateApplePaySession({
11717
11762
  sessionUrl: sessionUrl,
11718
11763
  displayName: displayName,
@@ -11733,7 +11778,7 @@ var ApplePayCharge = {
11733
11778
  device: this.deviceFingerprint,
11734
11779
  paymentObject: paymentObject
11735
11780
  }).then(function (response) {
11736
- _this2.logAPIResponse(response, paymentMethod$5);
11781
+ _this2.logAPIResponse(response, paymentMethod$6);
11737
11782
 
11738
11783
  return response;
11739
11784
  });
@@ -11789,12 +11834,12 @@ var PayPalAPI = {
11789
11834
  }
11790
11835
  };
11791
11836
 
11792
- var paymentMethod$4 = 'paypal';
11837
+ var paymentMethod$5 = 'paypal';
11793
11838
  var PayPalCharge = {
11794
11839
  createPayPalOrder: function createPayPalOrder() {
11795
11840
  var _this = this;
11796
11841
 
11797
- this.logAttempt(paymentMethod$4);
11842
+ this.logAttempt(paymentMethod$5);
11798
11843
  return PayPalAPI.createOrder(this.id).then(function (response) {
11799
11844
  _this.logAPIResponseMessage(response.message);
11800
11845
 
@@ -11805,7 +11850,7 @@ var PayPalCharge = {
11805
11850
  var _this2 = this;
11806
11851
 
11807
11852
  return PayPalAPI.captureOrder(this.id).then(function (response) {
11808
- _this2.logAPIResponse(response, paymentMethod$4);
11853
+ _this2.logAPIResponse(response, paymentMethod$5);
11809
11854
 
11810
11855
  return response;
11811
11856
  });
@@ -17193,55 +17238,7 @@ function encrypt(toEncrypt) {
17193
17238
  return jsEncrypt.encrypt(toEncrypt);
17194
17239
  }
17195
17240
 
17196
- var DESCRIPTORS = descriptors;
17197
- var uncurryThis$1 = functionUncurryThis;
17198
- var objectKeys = objectKeys$3;
17199
- var toIndexedObject = toIndexedObject$8;
17200
- var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
17201
-
17202
- var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
17203
- var push = uncurryThis$1([].push);
17204
-
17205
- // `Object.{ entries, values }` methods implementation
17206
- var createMethod = function (TO_ENTRIES) {
17207
- return function (it) {
17208
- var O = toIndexedObject(it);
17209
- var keys = objectKeys(O);
17210
- var length = keys.length;
17211
- var i = 0;
17212
- var result = [];
17213
- var key;
17214
- while (length > i) {
17215
- key = keys[i++];
17216
- if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
17217
- push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
17218
- }
17219
- }
17220
- return result;
17221
- };
17222
- };
17223
-
17224
- var objectToArray = {
17225
- // `Object.entries` method
17226
- // https://tc39.es/ecma262/#sec-object.entries
17227
- entries: createMethod(true),
17228
- // `Object.values` method
17229
- // https://tc39.es/ecma262/#sec-object.values
17230
- values: createMethod(false)
17231
- };
17232
-
17233
17241
  var $$2 = _export;
17234
- var $values = objectToArray.values;
17235
-
17236
- // `Object.values` method
17237
- // https://tc39.es/ecma262/#sec-object.values
17238
- $$2({ target: 'Object', stat: true }, {
17239
- values: function values(O) {
17240
- return $values(O);
17241
- }
17242
- });
17243
-
17244
- var $$1 = _export;
17245
17242
  var $find = arrayIteration.find;
17246
17243
  var addToUnscopables = addToUnscopables$3;
17247
17244
 
@@ -17253,7 +17250,7 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
17253
17250
 
17254
17251
  // `Array.prototype.find` method
17255
17252
  // https://tc39.es/ecma262/#sec-array.prototype.find
17256
- $$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17253
+ $$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17257
17254
  find: function find(callbackfn /* , that = undefined */) {
17258
17255
  return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
17259
17256
  }
@@ -18201,56 +18198,136 @@ var cardValidator = {
18201
18198
  creditCardType: creditCardType_1
18202
18199
  };
18203
18200
 
18204
- var testCards = [{
18205
- type: 'bank_auth',
18206
- name: 'Bank authorization',
18207
- number: '4084080000000409',
18208
- cvv: '000',
18209
- month: '01',
18210
- year: '30'
18211
- }, {
18212
- type: 'success',
18213
- name: 'Success',
18214
- number: '4084084084084081',
18215
- cvv: '408',
18216
- month: '12',
18217
- year: '30'
18218
- }, {
18219
- type: 'declined',
18220
- name: 'Declined',
18221
- number: '4084080000005408',
18222
- cvv: '001',
18223
- month: '12',
18224
- year: '30'
18225
- }, {
18226
- type: 'pin',
18227
- name: 'Pin only validation',
18228
- number: '507850785078507812',
18229
- cvv: '884',
18230
- month: '01',
18231
- year: '30'
18232
- }, {
18233
- type: 'pin+otp',
18234
- name: 'Pin and OTP validation',
18235
- number: '5060666666666666666',
18236
- cvv: '123',
18237
- month: '01',
18238
- year: '30'
18239
- }, {
18240
- type: 'pin+phone+otp',
18241
- name: 'Pin, phone and OTP validation',
18242
- number: '507850785078507812',
18243
- cvv: '884',
18244
- month: '01',
18245
- year: '30'
18246
- }, {
18247
- type: 'default',
18248
- name: 'No validation',
18249
- number: '4084084084084081',
18250
- cvv: '408',
18251
- month: '01',
18252
- year: '30'
18253
- }];
18201
+ var DESCRIPTORS = descriptors;
18202
+ var uncurryThis$1 = functionUncurryThis;
18203
+ var objectKeys = objectKeys$3;
18204
+ var toIndexedObject = toIndexedObject$8;
18205
+ var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
18206
+
18207
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
18208
+ var push = uncurryThis$1([].push);
18209
+
18210
+ // `Object.{ entries, values }` methods implementation
18211
+ var createMethod = function (TO_ENTRIES) {
18212
+ return function (it) {
18213
+ var O = toIndexedObject(it);
18214
+ var keys = objectKeys(O);
18215
+ var length = keys.length;
18216
+ var i = 0;
18217
+ var result = [];
18218
+ var key;
18219
+ while (length > i) {
18220
+ key = keys[i++];
18221
+ if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
18222
+ push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
18223
+ }
18224
+ }
18225
+ return result;
18226
+ };
18227
+ };
18228
+
18229
+ var objectToArray = {
18230
+ // `Object.entries` method
18231
+ // https://tc39.es/ecma262/#sec-object.entries
18232
+ entries: createMethod(true),
18233
+ // `Object.values` method
18234
+ // https://tc39.es/ecma262/#sec-object.values
18235
+ values: createMethod(false)
18236
+ };
18237
+
18238
+ var $$1 = _export;
18239
+ var $values = objectToArray.values;
18240
+
18241
+ // `Object.values` method
18242
+ // https://tc39.es/ecma262/#sec-object.values
18243
+ $$1({ target: 'Object', stat: true }, {
18244
+ values: function values(O) {
18245
+ return $values(O);
18246
+ }
18247
+ });
18248
+
18249
+ var Card$2 = {
18250
+ getEncryptedPin: function getEncryptedPin(pin) {
18251
+ return pin ? encrypt(pin) : undefined;
18252
+ },
18253
+ getLast4: function getLast4(number) {
18254
+ return number.substring(number.length - 4);
18255
+ },
18256
+ tokenize: function tokenize(_ref) {
18257
+ var number = _ref.number,
18258
+ cvv = _ref.cvv,
18259
+ month = _ref.month,
18260
+ year = _ref.year;
18261
+ return encrypt("".concat(number, "*").concat(cvv, "*").concat(month, "*").concat(year));
18262
+ },
18263
+ getType: function getType(value) {
18264
+ var response = cardValidator.number(value);
18265
+
18266
+ if (response && response.card) {
18267
+ return {
18268
+ type: response.card.type,
18269
+ maxLength: Math.max.apply(Math, _toConsumableArray(response.card.lengths)),
18270
+ minLength: Math.min.apply(Math, _toConsumableArray(response.card.lengths))
18271
+ };
18272
+ }
18273
+
18274
+ return {
18275
+ type: null,
18276
+ maxLength: 0
18277
+ };
18278
+ },
18279
+ validate: function validate(_ref2) {
18280
+ var number = _ref2.number,
18281
+ cvv = _ref2.cvv,
18282
+ month = _ref2.month,
18283
+ year = _ref2.year;
18284
+
18285
+ var _this$getType = this.getType(number),
18286
+ cardType = _this$getType.type;
18287
+
18288
+ var result = {
18289
+ number: this.isNumberValid(number),
18290
+ expiry: this.isExpiryValid({
18291
+ month: month,
18292
+ year: year
18293
+ }),
18294
+ cvv: this.isCvvValid(cvv, cardType)
18295
+ };
18296
+ var isValid = Object.values(result).every(function (value) {
18297
+ return value === true;
18298
+ });
18299
+ return {
18300
+ isValid: isValid,
18301
+ result: result
18302
+ };
18303
+ },
18304
+ validateNumber: function validateNumber(value) {
18305
+ return cardValidator.number(value);
18306
+ },
18307
+ isNumberValid: function isNumberValid(value) {
18308
+ return Card$2.validateNumber(value).isValid;
18309
+ },
18310
+ validateCVV: function validateCVV(cvv, cardType) {
18311
+ var isAmexCard = cardType === 'american-express';
18312
+ var cvvLength = isAmexCard ? 4 : 3;
18313
+ return cardValidator.cvv(cvv, cvvLength);
18314
+ },
18315
+ isCvvValid: function isCvvValid(cvv, cardType) {
18316
+ return Card$2.validateCVV(cvv, cardType).isValid;
18317
+ },
18318
+ validateExpiry: function validateExpiry(value) {
18319
+ if (_typeof$1(value) === 'object') {
18320
+ var month = value.month,
18321
+ year = value.year;
18322
+ return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
18323
+ }
18324
+
18325
+ return cardValidator.expirationDate(value);
18326
+ },
18327
+ isExpiryValid: function isExpiryValid(value) {
18328
+ return Card$2.validateExpiry(value).isValid;
18329
+ }
18330
+ };
18254
18331
 
18255
18332
  cardValidator.creditCardType.addCard({
18256
18333
  niceType: 'Verve',
@@ -18265,7 +18342,7 @@ cardValidator.creditCardType.addCard({
18265
18342
  });
18266
18343
  cardValidator.creditCardType.changeOrder('verve', 0);
18267
18344
 
18268
- var Card = /*#__PURE__*/function () {
18345
+ var Card$1 = /*#__PURE__*/function () {
18269
18346
  function Card(_ref) {
18270
18347
  var number = _ref.number,
18271
18348
  cvv = _ref.cvv,
@@ -18285,35 +18362,27 @@ var Card = /*#__PURE__*/function () {
18285
18362
  _createClass(Card, [{
18286
18363
  key: "getEncryptedPin",
18287
18364
  value: function getEncryptedPin() {
18288
- return this.pin ? encrypt(this.pin) : undefined;
18365
+ return Card$2.getEncryptedPin(this.pin);
18289
18366
  }
18290
18367
  }, {
18291
18368
  key: "getLast4",
18292
18369
  value: function getLast4() {
18293
- return this.number.substring(this.number.length - 4);
18370
+ return Card$2.getLast4(this.number);
18294
18371
  }
18295
18372
  }, {
18296
18373
  key: "tokenize",
18297
18374
  value: function tokenize() {
18298
- return encrypt("".concat(this.number, "*").concat(this.cvv, "*").concat(this.month, "*").concat(this.year));
18375
+ return Card$2.tokenize({
18376
+ number: this.number,
18377
+ cvv: this.cvv,
18378
+ month: this.month,
18379
+ year: this.year
18380
+ });
18299
18381
  }
18300
18382
  }], [{
18301
18383
  key: "getType",
18302
18384
  value: function getType(value) {
18303
- var response = cardValidator.number(value);
18304
-
18305
- if (response && response.card) {
18306
- return {
18307
- type: response.card.type,
18308
- maxLength: Math.max.apply(Math, _toConsumableArray(response.card.lengths)),
18309
- minLength: Math.min.apply(Math, _toConsumableArray(response.card.lengths))
18310
- };
18311
- }
18312
-
18313
- return {
18314
- type: null,
18315
- maxLength: 0
18316
- };
18385
+ return Card$2.getType(value);
18317
18386
  }
18318
18387
  }, {
18319
18388
  key: "validate",
@@ -18322,63 +18391,42 @@ var Card = /*#__PURE__*/function () {
18322
18391
  cvv = _ref2.cvv,
18323
18392
  month = _ref2.month,
18324
18393
  year = _ref2.year;
18325
-
18326
- var _Card$getType = Card.getType(number),
18327
- cardType = _Card$getType.type;
18328
-
18329
- var result = {
18330
- number: Card.isNumberValid(number),
18331
- expiry: Card.isExpiryValid({
18332
- month: month,
18333
- year: year
18334
- }),
18335
- cvv: Card.isCvvValid(cvv, cardType)
18336
- };
18337
- var isValid = Object.values(result).every(function (value) {
18338
- return value === true;
18394
+ return Card$2.validate({
18395
+ number: number,
18396
+ cvv: cvv,
18397
+ month: month,
18398
+ year: year
18339
18399
  });
18340
- return {
18341
- isValid: isValid,
18342
- result: result
18343
- };
18344
18400
  }
18345
18401
  }, {
18346
18402
  key: "validateNumber",
18347
18403
  value: function validateNumber(value) {
18348
- return cardValidator.number(value);
18404
+ return Card$2.validateNumber(value);
18349
18405
  }
18350
18406
  }, {
18351
18407
  key: "isNumberValid",
18352
18408
  value: function isNumberValid(value) {
18353
- return Card.validateNumber(value).isValid;
18409
+ return Card$2.isNumberValid(value);
18354
18410
  }
18355
18411
  }, {
18356
18412
  key: "validateCVV",
18357
18413
  value: function validateCVV(cvv, cardType) {
18358
- var isAmexCard = cardType === 'american-express';
18359
- var cvvLength = isAmexCard ? 4 : 3;
18360
- return cardValidator.cvv(cvv, cvvLength);
18414
+ return Card$2.validateCVV(cvv, cardType);
18361
18415
  }
18362
18416
  }, {
18363
18417
  key: "isCvvValid",
18364
18418
  value: function isCvvValid(cvv, cardType) {
18365
- return Card.validateCVV(cvv, cardType).isValid;
18419
+ return Card$2.isCvvValid(cvv, cardType);
18366
18420
  }
18367
18421
  }, {
18368
18422
  key: "validateExpiry",
18369
18423
  value: function validateExpiry(value) {
18370
- if (_typeof$1(value) === 'object') {
18371
- var month = value.month,
18372
- year = value.year;
18373
- return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
18374
- }
18375
-
18376
- return cardValidator.expirationDate(value);
18424
+ return Card$2.validateExpiry(value);
18377
18425
  }
18378
18426
  }, {
18379
18427
  key: "isExpiryValid",
18380
18428
  value: function isExpiryValid(value) {
18381
- return Card.validateExpiry(value).isValid;
18429
+ return Card$2.isExpiryValid(value);
18382
18430
  }
18383
18431
  }, {
18384
18432
  key: "generateTestCard",
@@ -18394,7 +18442,7 @@ var Card = /*#__PURE__*/function () {
18394
18442
  return Card;
18395
18443
  }();
18396
18444
 
18397
- var CardAPI = {
18445
+ var CardAPI$1 = {
18398
18446
  charge: function charge(_ref) {
18399
18447
  var clientdata = _ref.clientdata,
18400
18448
  last4 = _ref.last4,
@@ -18571,7 +18619,7 @@ var CardAPI = {
18571
18619
  return ChargeResponses.parse(response.data);
18572
18620
  });
18573
18621
  },
18574
- requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
18622
+ requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
18575
18623
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18576
18624
  var url, language, headers, _yield$axiosInstance$, data;
18577
18625
 
@@ -18602,23 +18650,22 @@ var CardAPI = {
18602
18650
  }, _callee);
18603
18651
  }))();
18604
18652
  },
18605
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref6) {
18653
+ addUserToSavedCards: function addUserToSavedCards(_ref6) {
18606
18654
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
18607
- var code, phone, transaction, url, language, headers, data, response;
18655
+ var phone, email, url, language, headers, data, response;
18608
18656
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
18609
18657
  while (1) {
18610
18658
  switch (_context2.prev = _context2.next) {
18611
18659
  case 0:
18612
- code = _ref6.code, phone = _ref6.phone, transaction = _ref6.transaction;
18613
- url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18660
+ phone = _ref6.phone, email = _ref6.email;
18661
+ url = new URL('/user', configToUse.savedCardsApiUrl).toString();
18614
18662
  language = getLanguage();
18615
18663
  headers = _objectSpread2({}, language && {
18616
18664
  'Accept-Language': language
18617
18665
  });
18618
18666
  data = {
18619
- code: code,
18620
18667
  phone: phone,
18621
- transaction: transaction
18668
+ email: email
18622
18669
  };
18623
18670
  _context2.next = 7;
18624
18671
  return axiosInstance.post(url, data, {
@@ -18637,32 +18684,34 @@ var CardAPI = {
18637
18684
  }, _callee2);
18638
18685
  }))();
18639
18686
  },
18640
- getSavedCards: function getSavedCards(_ref7) {
18687
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18641
18688
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
18642
- var token, url, language, headers, response;
18689
+ var code, phone, transaction, url, language, headers, data, response;
18643
18690
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
18644
18691
  while (1) {
18645
18692
  switch (_context3.prev = _context3.next) {
18646
18693
  case 0:
18647
- token = _ref7.token;
18648
- url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
18694
+ code = _ref7.code, phone = _ref7.phone, transaction = _ref7.transaction;
18695
+ url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18649
18696
  language = getLanguage();
18650
- headers = _objectSpread2({
18651
- Authorization: "Bearer ".concat(token),
18652
- 'jwt-auth': true
18653
- }, language && {
18697
+ headers = _objectSpread2({}, language && {
18654
18698
  'Accept-Language': language
18655
18699
  });
18656
- _context3.next = 6;
18657
- return axiosInstance.get(url, {
18700
+ data = {
18701
+ code: code,
18702
+ phone: phone,
18703
+ transaction: transaction
18704
+ };
18705
+ _context3.next = 7;
18706
+ return axiosInstance.post(url, data, {
18658
18707
  headers: headers
18659
18708
  });
18660
18709
 
18661
- case 6:
18710
+ case 7:
18662
18711
  response = _context3.sent;
18663
18712
  return _context3.abrupt("return", response.data);
18664
18713
 
18665
- case 8:
18714
+ case 9:
18666
18715
  case "end":
18667
18716
  return _context3.stop();
18668
18717
  }
@@ -18670,15 +18719,15 @@ var CardAPI = {
18670
18719
  }, _callee3);
18671
18720
  }))();
18672
18721
  },
18673
- deleteSavedCard: function deleteSavedCard(_ref8) {
18722
+ getSavedCards: function getSavedCards(_ref8) {
18674
18723
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
18675
- var cardCode, token, url, language, headers, response;
18724
+ var token, url, language, headers, response;
18676
18725
  return regeneratorRuntime.wrap(function _callee4$(_context4) {
18677
18726
  while (1) {
18678
18727
  switch (_context4.prev = _context4.next) {
18679
18728
  case 0:
18680
- cardCode = _ref8.cardCode, token = _ref8.token;
18681
- url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
18729
+ token = _ref8.token;
18730
+ url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
18682
18731
  language = getLanguage();
18683
18732
  headers = _objectSpread2({
18684
18733
  Authorization: "Bearer ".concat(token),
@@ -18687,7 +18736,7 @@ var CardAPI = {
18687
18736
  'Accept-Language': language
18688
18737
  });
18689
18738
  _context4.next = 6;
18690
- return axiosInstance.delete(url, {
18739
+ return axiosInstance.get(url, {
18691
18740
  headers: headers
18692
18741
  });
18693
18742
 
@@ -18703,15 +18752,15 @@ var CardAPI = {
18703
18752
  }, _callee4);
18704
18753
  }))();
18705
18754
  },
18706
- chargeSavedCard: function chargeSavedCard(_ref9) {
18755
+ deleteSavedCard: function deleteSavedCard(_ref9) {
18707
18756
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
18708
- var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18757
+ var cardCode, token, url, language, headers, response;
18709
18758
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
18710
18759
  while (1) {
18711
18760
  switch (_context5.prev = _context5.next) {
18712
18761
  case 0:
18713
- token = _ref9.token, device = _ref9.device, cardCode = _ref9.cardCode, transaction = _ref9.transaction, selectedCurrency = _ref9.selectedCurrency;
18714
- url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18762
+ cardCode = _ref9.cardCode, token = _ref9.token;
18763
+ url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
18715
18764
  language = getLanguage();
18716
18765
  headers = _objectSpread2({
18717
18766
  Authorization: "Bearer ".concat(token),
@@ -18719,32 +18768,65 @@ var CardAPI = {
18719
18768
  }, language && {
18720
18769
  'Accept-Language': language
18721
18770
  });
18722
- data = {
18723
- device: device,
18724
- transaction: transaction,
18725
- selectedCurrency: selectedCurrency
18726
- };
18727
- return _context5.abrupt("return", axiosInstance.post(url, data, {
18771
+ _context5.next = 6;
18772
+ return axiosInstance.delete(url, {
18728
18773
  headers: headers
18729
- }).then(function (response) {
18730
- return ChargeResponses.parse(response.data);
18731
- }));
18774
+ });
18732
18775
 
18733
18776
  case 6:
18777
+ response = _context5.sent;
18778
+ return _context5.abrupt("return", response.data);
18779
+
18780
+ case 8:
18734
18781
  case "end":
18735
18782
  return _context5.stop();
18736
18783
  }
18737
18784
  }
18738
18785
  }, _callee5);
18739
18786
  }))();
18787
+ },
18788
+ chargeSavedCard: function chargeSavedCard(_ref10) {
18789
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
18790
+ var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18791
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
18792
+ while (1) {
18793
+ switch (_context6.prev = _context6.next) {
18794
+ case 0:
18795
+ token = _ref10.token, device = _ref10.device, cardCode = _ref10.cardCode, transaction = _ref10.transaction, selectedCurrency = _ref10.selectedCurrency;
18796
+ url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18797
+ language = getLanguage();
18798
+ headers = _objectSpread2({
18799
+ Authorization: "Bearer ".concat(token),
18800
+ 'jwt-auth': true
18801
+ }, language && {
18802
+ 'Accept-Language': language
18803
+ });
18804
+ data = {
18805
+ device: device,
18806
+ transaction: transaction,
18807
+ selectedCurrency: selectedCurrency
18808
+ };
18809
+ return _context6.abrupt("return", axiosInstance.post(url, data, {
18810
+ headers: headers
18811
+ }).then(function (response) {
18812
+ return ChargeResponses.parse(response.data);
18813
+ }));
18814
+
18815
+ case 6:
18816
+ case "end":
18817
+ return _context6.stop();
18818
+ }
18819
+ }
18820
+ }, _callee6);
18821
+ }))();
18740
18822
  }
18741
18823
  };
18742
18824
 
18743
- var paymentMethod$3 = 'card';
18825
+ var paymentMethod$4 = 'card';
18744
18826
 
18745
- function validate$3(card, isSetter) {
18827
+ function validate$4(card, isSetter) {
18746
18828
  return new Promise(function (resolve, reject) {
18747
- var validation = Card.validate(card);
18829
+ var validation = Card$1.validate(card);
18748
18830
 
18749
18831
  if (!validation.isValid) {
18750
18832
  var throwValidation = isSetter || card.number;
@@ -18763,8 +18845,8 @@ var CardCharge = {
18763
18845
  setCard: function setCard(params) {
18764
18846
  var _this = this;
18765
18847
 
18766
- return validate$3(params, true).then(function () {
18767
- _this.card = new Card(params);
18848
+ return validate$4(params, true).then(function () {
18849
+ _this.card = new Card$1(params);
18768
18850
  });
18769
18851
  },
18770
18852
  rememberCard: function rememberCard() {
@@ -18779,8 +18861,8 @@ var CardCharge = {
18779
18861
  return this.chargeCardWithPin(customFields);
18780
18862
  }
18781
18863
 
18782
- return validate$3(this.card).then(function () {
18783
- _this2.logAttempt(paymentMethod$3);
18864
+ return validate$4(this.card).then(function () {
18865
+ _this2.logAttempt(paymentMethod$4);
18784
18866
 
18785
18867
  var chargeParams = {
18786
18868
  clientdata: _this2.card.tokenize(),
@@ -18793,8 +18875,8 @@ var CardCharge = {
18793
18875
  subscription: _this2.subscription,
18794
18876
  customFields: customFields
18795
18877
  };
18796
- return CardAPI.charge(chargeParams).then(function (response) {
18797
- _this2.logAPIResponse(response, paymentMethod$3);
18878
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18879
+ _this2.logAPIResponse(response, paymentMethod$4);
18798
18880
 
18799
18881
  return response;
18800
18882
  });
@@ -18809,7 +18891,7 @@ var CardCharge = {
18809
18891
  var _this3 = this;
18810
18892
 
18811
18893
  var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18812
- this.logAttempt(paymentMethod$3);
18894
+ this.logAttempt(paymentMethod$4);
18813
18895
  var chargeParams = {
18814
18896
  pin: encrypt(this.card.pin),
18815
18897
  trans: this.id,
@@ -18819,8 +18901,8 @@ var CardCharge = {
18819
18901
  subscription: this.subscription,
18820
18902
  customFields: customFields
18821
18903
  };
18822
- return CardAPI.charge(chargeParams).then(function (response) {
18823
- _this3.logAPIResponse(response, paymentMethod$3);
18904
+ return CardAPI$1.charge(chargeParams).then(function (response) {
18905
+ _this3.logAPIResponse(response, paymentMethod$4);
18824
18906
 
18825
18907
  return response;
18826
18908
  });
@@ -18832,7 +18914,7 @@ var CardCharge = {
18832
18914
  authorizationCode = _ref.authorizationCode,
18833
18915
  cardLast4 = _ref.cardLast4,
18834
18916
  pin = _ref.pin;
18835
- this.logAttempt(paymentMethod$3);
18917
+ this.logAttempt(paymentMethod$4);
18836
18918
  var encryptedPin = encrypt(pin);
18837
18919
  var chargeParams = {
18838
18920
  authorizationCode: authorizationCode,
@@ -18844,8 +18926,8 @@ var CardCharge = {
18844
18926
  transactionType: this.transactionType,
18845
18927
  subscription: this.subscription
18846
18928
  };
18847
- return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
18848
- _this4.logAPIResponse(response, paymentMethod$3);
18929
+ return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
18930
+ _this4.logAPIResponse(response, paymentMethod$4);
18849
18931
 
18850
18932
  return response;
18851
18933
  });
@@ -18863,8 +18945,8 @@ var CardCharge = {
18863
18945
  device: this.deviceFingerprint
18864
18946
  });
18865
18947
 
18866
- return CardAPI.resumeCardCharge(params).then(function (response) {
18867
- _this5.logAPIResponse(response, paymentMethod$3);
18948
+ return CardAPI$1.resumeCardCharge(params).then(function (response) {
18949
+ _this5.logAPIResponse(response, paymentMethod$4);
18868
18950
 
18869
18951
  return response;
18870
18952
  });
@@ -18876,8 +18958,8 @@ var CardCharge = {
18876
18958
  authorizationId: authorizationId,
18877
18959
  publicKey: this.merchant.key
18878
18960
  };
18879
- return CardAPI.forgetRememberedCard(params).then(function (response) {
18880
- _this6.logAPIResponse(response, paymentMethod$3);
18961
+ return CardAPI$1.forgetRememberedCard(params).then(function (response) {
18962
+ _this6.logAPIResponse(response, paymentMethod$4);
18881
18963
 
18882
18964
  return response;
18883
18965
  });
@@ -18885,8 +18967,8 @@ var CardCharge = {
18885
18967
  authenticateCard: function authenticateCard(token) {
18886
18968
  var _this7 = this;
18887
18969
 
18888
- return CardAPI.authenticate(this.id, token).then(function (response) {
18889
- _this7.logAPIResponse(response, paymentMethod$3);
18970
+ return CardAPI$1.authenticate(this.id, token).then(function (response) {
18971
+ _this7.logAPIResponse(response, paymentMethod$4);
18890
18972
 
18891
18973
  return response;
18892
18974
  });
@@ -18905,8 +18987,8 @@ var CardCharge = {
18905
18987
  zipCode: zipCode,
18906
18988
  transactionId: this.id
18907
18989
  };
18908
- return CardAPI.verifyAddress(payload).then(function (response) {
18909
- _this8.logAPIResponse(response, paymentMethod$3);
18990
+ return CardAPI$1.verifyAddress(payload).then(function (response) {
18991
+ _this8.logAPIResponse(response, paymentMethod$4);
18910
18992
 
18911
18993
  return response;
18912
18994
  });
@@ -18914,14 +18996,21 @@ var CardCharge = {
18914
18996
  listenFor3DSCharge: function listenFor3DSCharge(callback) {
18915
18997
  var listenerOptions = {
18916
18998
  channel: "3DS_".concat(this.id),
18917
- paymentMethod: paymentMethod$3
18999
+ paymentMethod: paymentMethod$4
18918
19000
  };
18919
19001
  return this.listenForCharge(listenerOptions, callback);
18920
19002
  },
18921
- requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
18922
- return CardAPI.requestOtpForSavedCards(phoneNumber);
19003
+ requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
19004
+ return CardAPI$1.requestSavedCardsOTP(phoneNumber);
19005
+ },
19006
+ addUserToSavedCards: function addUserToSavedCards(_ref4) {
19007
+ var phone = _ref4.phone;
19008
+ return CardAPI$1.addUserToSavedCards({
19009
+ phone: phone,
19010
+ email: this.email
19011
+ });
18923
19012
  },
18924
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19013
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
18925
19014
  var _this9 = this;
18926
19015
 
18927
19016
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
@@ -18930,7 +19019,7 @@ var CardCharge = {
18930
19019
  while (1) {
18931
19020
  switch (_context.prev = _context.next) {
18932
19021
  case 0:
18933
- code = _ref4.code, phone = _ref4.phone;
19022
+ code = _ref5.code, phone = _ref5.phone;
18934
19023
  payload = {
18935
19024
  code: code,
18936
19025
  phone: phone,
@@ -18938,7 +19027,7 @@ var CardCharge = {
18938
19027
  };
18939
19028
  _context.prev = 2;
18940
19029
  _context.next = 5;
18941
- return CardAPI.verifySavedCardsOtp(payload);
19030
+ return CardAPI$1.verifySavedCardsOtp(payload);
18942
19031
 
18943
19032
  case 5:
18944
19033
  response = _context.sent;
@@ -18949,7 +19038,7 @@ var CardCharge = {
18949
19038
  _context.prev = 10;
18950
19039
  _context.t0 = _context["catch"](2);
18951
19040
  _this9.savedCardsToken = null;
18952
- return _context.abrupt("return", new Error(_context.t0));
19041
+ throw _context.t0;
18953
19042
 
18954
19043
  case 14:
18955
19044
  case "end":
@@ -18960,19 +19049,19 @@ var CardCharge = {
18960
19049
  }))();
18961
19050
  },
18962
19051
  getSavedCards: function getSavedCards() {
18963
- return CardAPI.getSavedCards({
19052
+ return CardAPI$1.getSavedCards({
18964
19053
  token: this.savedCardsToken
18965
19054
  });
18966
19055
  },
18967
19056
  deleteSavedCard: function deleteSavedCard(cardCode) {
18968
- return CardAPI.deleteSavedCard({
19057
+ return CardAPI$1.deleteSavedCard({
18969
19058
  cardCode: cardCode,
18970
19059
  token: this.savedCardsToken
18971
19060
  });
18972
19061
  },
18973
- chargeSavedCard: function chargeSavedCard(_ref5) {
18974
- var cardCode = _ref5.cardCode;
18975
- return CardAPI.chargeSavedCard({
19062
+ chargeSavedCard: function chargeSavedCard(_ref6) {
19063
+ var cardCode = _ref6.cardCode;
19064
+ return CardAPI$1.chargeSavedCard({
18976
19065
  cardCode: cardCode,
18977
19066
  transaction: this.id,
18978
19067
  token: this.savedCardsToken,
@@ -19131,9 +19220,9 @@ var EMandateAPI = {
19131
19220
  }
19132
19221
  };
19133
19222
 
19134
- var paymentMethod$2 = 'bank account';
19223
+ var paymentMethod$3 = 'bank account';
19135
19224
 
19136
- function validate$2(bankAccount, isSetter) {
19225
+ function validate$3(bankAccount, isSetter) {
19137
19226
  return new Promise(function (resolve, reject) {
19138
19227
  var validation = BankAccount.validate(bankAccount);
19139
19228
 
@@ -19151,15 +19240,15 @@ var EMandate = {
19151
19240
  setBankAccount: function setBankAccount(params) {
19152
19241
  var _this = this;
19153
19242
 
19154
- return validate$2(params, true).then(function () {
19243
+ return validate$3(params, true).then(function () {
19155
19244
  _this.bankAccount = new BankAccount(params);
19156
19245
  });
19157
19246
  },
19158
19247
  chargeBankAccount: function chargeBankAccount() {
19159
19248
  var _this2 = this;
19160
19249
 
19161
- return validate$2(this.bankAccount).then(function () {
19162
- _this2.logAttempt(paymentMethod$2);
19250
+ return validate$3(this.bankAccount).then(function () {
19251
+ _this2.logAttempt(paymentMethod$3);
19163
19252
 
19164
19253
  var verifyParams = {
19165
19254
  bankId: _this2.bankAccount.bankId,
@@ -19168,7 +19257,7 @@ var EMandate = {
19168
19257
  device: _this2.deviceFingerprint
19169
19258
  };
19170
19259
  return EMandateAPI.verify(verifyParams).then(function (response) {
19171
- _this2.logAPIResponse(response, paymentMethod$2);
19260
+ _this2.logAPIResponse(response, paymentMethod$3);
19172
19261
 
19173
19262
  return response;
19174
19263
  });
@@ -19177,7 +19266,7 @@ var EMandate = {
19177
19266
  registerBankAccount: function registerBankAccount(birthday) {
19178
19267
  var _this3 = this;
19179
19268
 
19180
- return validate$2(this.bankAccount).then(function () {
19269
+ return validate$3(this.bankAccount).then(function () {
19181
19270
  var registerParams = {
19182
19271
  bankId: _this3.bankAccount.bankId,
19183
19272
  transactionId: _this3.id,
@@ -19185,7 +19274,7 @@ var EMandate = {
19185
19274
  birthday: birthday
19186
19275
  };
19187
19276
  return EMandateAPI.register(registerParams).then(function (response) {
19188
- _this3.logAPIResponse(response, paymentMethod$2);
19277
+ _this3.logAPIResponse(response, paymentMethod$3);
19189
19278
 
19190
19279
  return response;
19191
19280
  });
@@ -19194,7 +19283,7 @@ var EMandate = {
19194
19283
  authenticateBankAccount: function authenticateBankAccount(token) {
19195
19284
  var _this4 = this;
19196
19285
 
19197
- return validate$2(this.bankAccount).then(function () {
19286
+ return validate$3(this.bankAccount).then(function () {
19198
19287
  var chargeParams = {
19199
19288
  bankId: _this4.bankAccount.bankId,
19200
19289
  transactionId: _this4.id,
@@ -19202,7 +19291,7 @@ var EMandate = {
19202
19291
  device: _this4.deviceFingerprint
19203
19292
  };
19204
19293
  return EMandateAPI.authenticate(chargeParams).then(function (response) {
19205
- _this4.logAPIResponse(response, paymentMethod$2);
19294
+ _this4.logAPIResponse(response, paymentMethod$3);
19206
19295
 
19207
19296
  return response;
19208
19297
  });
@@ -19263,7 +19352,7 @@ var DigitalBankMandateAPI = {
19263
19352
  }
19264
19353
  };
19265
19354
 
19266
- var paymentMethod$1 = 'bank';
19355
+ var paymentMethod$2 = 'bank';
19267
19356
  var DigitalBankMandate = {
19268
19357
  chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
19269
19358
  var _this = this;
@@ -19278,7 +19367,7 @@ var DigitalBankMandate = {
19278
19367
  bankId: bankId
19279
19368
  };
19280
19369
  return DigitalBankMandateAPI.charge(params).then(function (response) {
19281
- _this.logAPIResponse(response, paymentMethod$1);
19370
+ _this.logAPIResponse(response, paymentMethod$2);
19282
19371
 
19283
19372
  return response;
19284
19373
  });
@@ -19286,7 +19375,7 @@ var DigitalBankMandate = {
19286
19375
  listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
19287
19376
  var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
19288
19377
  var listenerOptions = {
19289
- paymentMethod: paymentMethod$1,
19378
+ paymentMethod: paymentMethod$2,
19290
19379
  channel: pusherChannel
19291
19380
  };
19292
19381
  return this.listenForCharge(listenerOptions, callback);
@@ -19419,7 +19508,7 @@ var QrAPI = {
19419
19508
  }
19420
19509
  };
19421
19510
 
19422
- function validate$1(channel) {
19511
+ function validate$2(channel) {
19423
19512
  return new Promise(function (resolve, reject) {
19424
19513
  var allowedChannels = ['visa', 'MPASS_OLTI'];
19425
19514
 
@@ -19437,7 +19526,7 @@ var QRCharge = {
19437
19526
  var _this = this;
19438
19527
 
19439
19528
  var channel = _ref.channel;
19440
- return validate$1(channel).then(function () {
19529
+ return validate$2(channel).then(function () {
19441
19530
  if (_this.qr[channel]) {
19442
19531
  return _this.qr[channel];
19443
19532
  }
@@ -19459,7 +19548,7 @@ var QRCharge = {
19459
19548
  var _this2 = this;
19460
19549
 
19461
19550
  var channel = _ref2.channel;
19462
- return validate$1(channel).then(function () {
19551
+ return validate$2(channel).then(function () {
19463
19552
  if (!_this2.qr[channel]) {
19464
19553
  return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
19465
19554
  }
@@ -19580,7 +19669,7 @@ var MobileMoneyAPI = {
19580
19669
  }
19581
19670
  };
19582
19671
 
19583
- function validate(phoneNumber) {
19672
+ function validate$1(phoneNumber) {
19584
19673
  return new Promise(function (resolve, reject) {
19585
19674
  var validation = PhoneNumber.validate(phoneNumber);
19586
19675
 
@@ -19601,7 +19690,7 @@ var MobileMoneyCharge = {
19601
19690
  provider = _ref.provider,
19602
19691
  voucher = _ref.voucher,
19603
19692
  registrationToken = _ref.registrationToken;
19604
- return validate(phoneNumber).then(function () {
19693
+ return validate$1(phoneNumber).then(function () {
19605
19694
  _this.logAttempt('mobile money');
19606
19695
 
19607
19696
  var params = {
@@ -19632,7 +19721,7 @@ var MobileMoneyCharge = {
19632
19721
  var phoneNumber = payload.phoneNumber,
19633
19722
  provider = payload.provider,
19634
19723
  registrationToken = payload.registrationToken;
19635
- return validate(phoneNumber).then(function () {
19724
+ return validate$1(phoneNumber).then(function () {
19636
19725
  _this2.logMobileMoneyActions(payload);
19637
19726
 
19638
19727
  var params = {
@@ -19772,7 +19861,7 @@ var DirectDebitAPI = {
19772
19861
  }
19773
19862
  };
19774
19863
 
19775
- var paymentMethod = 'direct debit';
19864
+ var paymentMethod$1 = 'direct debit';
19776
19865
  var DirectDebitCharge = {
19777
19866
  loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
19778
19867
  var _this = this;
@@ -19818,14 +19907,14 @@ var DirectDebitCharge = {
19818
19907
  return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
19819
19908
  }
19820
19909
 
19821
- this.logAttempt(paymentMethod);
19910
+ this.logAttempt(paymentMethod$1);
19822
19911
  var params = {
19823
19912
  account_code: accountCode,
19824
19913
  transaction: this.id,
19825
19914
  token: this.directDebit.token
19826
19915
  };
19827
19916
  return DirectDebitAPI.charge(params).then(function (response) {
19828
- _this2.logAPIResponse(response, paymentMethod);
19917
+ _this2.logAPIResponse(response, paymentMethod$1);
19829
19918
 
19830
19919
  if (response.status) {
19831
19920
  _this2.directDebit.chargeResponse = response;
@@ -19838,7 +19927,7 @@ var DirectDebitCharge = {
19838
19927
  var _this3 = this;
19839
19928
 
19840
19929
  return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
19841
- _this3.logAPIResponse(response, paymentMethod);
19930
+ _this3.logAPIResponse(response, paymentMethod$1);
19842
19931
 
19843
19932
  var status = response.status,
19844
19933
  data = response.data;
@@ -19863,7 +19952,7 @@ var DirectDebitCharge = {
19863
19952
  token: this.directDebit.token
19864
19953
  };
19865
19954
  return DirectDebitAPI.authenticate(params).then(function (response) {
19866
- _this4.logAPIResponse(response, paymentMethod);
19955
+ _this4.logAPIResponse(response, paymentMethod$1);
19867
19956
 
19868
19957
  return response;
19869
19958
  });
@@ -20307,8 +20396,8 @@ var TransactionInstance = /*#__PURE__*/function () {
20307
20396
  this.subscription = data.subscription || null;
20308
20397
  this.planDetails = data.plan_details || null;
20309
20398
  this.exchangeRate = data.exchange_rate || null;
20399
+ this.savedCardsConfig = data.saved_cards || {};
20310
20400
  this.savedCardsToken = null;
20311
- this.isSavedCardsEnabled = data.saved_cards && data.saved_cards.enabled || null;
20312
20401
  /**
20313
20402
  * We initialize parameters we send to the API as empty strings
20314
20403
  * when we don't have them instead of null because the API expects
@@ -20351,51 +20440,7 @@ var TransactionInstance = /*#__PURE__*/function () {
20351
20440
  }, {
20352
20441
  key: "listenForCharge",
20353
20442
  value: function listenForCharge(options, callback) {
20354
- var _this2 = this;
20355
-
20356
- var channel = options.channel,
20357
- paymentMethod = options.paymentMethod;
20358
- var pusher;
20359
-
20360
- if (window && window.Pusher) {
20361
- pusher = new window.Pusher(configToUse.pusherKey, {
20362
- cluster: 'eu',
20363
- disableStats: true
20364
- });
20365
- }
20366
-
20367
- var pusherUndefinedError = {
20368
- status: 'error',
20369
- message: 'We could not listen for charge response.'
20370
- };
20371
- var pusherSubscriptionError = {
20372
- status: 'error',
20373
- message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
20374
- };
20375
-
20376
- var unsubscribeFromPusher = function unsubscribeFromPusher() {
20377
- pusher.unsubscribe(channel);
20378
- };
20379
-
20380
- if (!pusher) {
20381
- return callback(pusherUndefinedError, noOp);
20382
- }
20383
-
20384
- var pusherSubscription = pusher.subscribe(channel);
20385
- pusherSubscription.bind('pusher:subscription_succeeded', function () {
20386
- _this2.isListening = true;
20387
- });
20388
- pusherSubscription.bind('pusher:subscription_error', function () {
20389
- _this2.isListening = false;
20390
- callback(pusherSubscriptionError, noOp);
20391
- });
20392
- pusherSubscription.bind('response', function (response) {
20393
- var formattedResponse = ChargeResponses.parse(response);
20394
-
20395
- _this2.logAPIResponse(formattedResponse, paymentMethod);
20396
-
20397
- callback(formattedResponse, unsubscribeFromPusher);
20398
- });
20443
+ return subscribeToChargeEvents(options, this, callback);
20399
20444
  }
20400
20445
  }, {
20401
20446
  key: "requery",
@@ -20693,7 +20738,522 @@ var Toolkit = /*#__PURE__*/function () {
20693
20738
  return Toolkit;
20694
20739
  }();
20695
20740
 
20741
+ cardValidator.creditCardType.addCard({
20742
+ niceType: 'Verve',
20743
+ type: 'verve',
20744
+ patterns: [[506000, 507999], [650000, 650009]],
20745
+ gaps: [4, 8, 12, 16],
20746
+ lengths: [16, 18, 19],
20747
+ code: {
20748
+ name: 'CVV',
20749
+ size: 3
20750
+ }
20751
+ });
20752
+ cardValidator.creditCardType.changeOrder('verve', 0);
20753
+
20754
+ var Card = /*#__PURE__*/function () {
20755
+ function Card(_ref) {
20756
+ var number = _ref.number,
20757
+ cvv = _ref.cvv,
20758
+ month = _ref.month,
20759
+ year = _ref.year,
20760
+ pin = _ref.pin;
20761
+
20762
+ _classCallCheck(this, Card);
20763
+
20764
+ this.number = number;
20765
+ this.cvv = cvv;
20766
+ this.month = month;
20767
+ this.year = year;
20768
+ this.pin = pin;
20769
+ }
20770
+
20771
+ _createClass(Card, [{
20772
+ key: "getEncryptedPin",
20773
+ value: function getEncryptedPin() {
20774
+ return Card$2.getEncryptedPin(this.pin);
20775
+ }
20776
+ }, {
20777
+ key: "getLast4",
20778
+ value: function getLast4() {
20779
+ return Card$2.getLast4(this.number);
20780
+ }
20781
+ }, {
20782
+ key: "tokenize",
20783
+ value: function tokenize() {
20784
+ return Card$2.tokenize({
20785
+ number: this.number,
20786
+ cvv: this.cvv,
20787
+ month: this.month,
20788
+ year: this.year
20789
+ });
20790
+ }
20791
+ }], [{
20792
+ key: "getType",
20793
+ value: function getType(value) {
20794
+ return Card$2.getType(value);
20795
+ }
20796
+ }, {
20797
+ key: "validate",
20798
+ value: function validate(_ref2) {
20799
+ var number = _ref2.number,
20800
+ cvv = _ref2.cvv,
20801
+ month = _ref2.month,
20802
+ year = _ref2.year;
20803
+ return Card$2.validate({
20804
+ number: number,
20805
+ cvv: cvv,
20806
+ month: month,
20807
+ year: year
20808
+ });
20809
+ }
20810
+ }, {
20811
+ key: "validateNumber",
20812
+ value: function validateNumber(value) {
20813
+ return Card$2.validateNumber(value);
20814
+ }
20815
+ }, {
20816
+ key: "isNumberValid",
20817
+ value: function isNumberValid(value) {
20818
+ return Card$2.isNumberValid(value);
20819
+ }
20820
+ }, {
20821
+ key: "validateCVV",
20822
+ value: function validateCVV(cvv, cardType) {
20823
+ return Card$2.validateCVV(cvv, cardType);
20824
+ }
20825
+ }, {
20826
+ key: "isCvvValid",
20827
+ value: function isCvvValid(cvv, cardType) {
20828
+ return Card$2.isCvvValid(cvv, cardType);
20829
+ }
20830
+ }, {
20831
+ key: "validateExpiry",
20832
+ value: function validateExpiry(value) {
20833
+ return Card$2.validateExpiry(value);
20834
+ }
20835
+ }, {
20836
+ key: "isExpiryValid",
20837
+ value: function isExpiryValid(value) {
20838
+ return Card$2.isExpiryValid(value);
20839
+ }
20840
+ }, {
20841
+ key: "generateTestCard",
20842
+ value: function generateTestCard(cardType) {
20843
+ var type = cardType || 'default';
20844
+ var cardParams = testCards.find(function (card) {
20845
+ return card.type === type;
20846
+ });
20847
+ return new Card(cardParams);
20848
+ }
20849
+ }]);
20850
+
20851
+ return Card;
20852
+ }();
20853
+
20854
+ var CardAPI = {
20855
+ reserve: function reserve(_ref) {
20856
+ var clientdata = _ref.clientdata,
20857
+ last4 = _ref.last4,
20858
+ preauthorizationId = _ref.preauthorizationId;
20859
+ var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
20860
+ var language = getLanguage();
20861
+
20862
+ var headers = _objectSpread2({}, language && {
20863
+ 'Accept-Language': language
20864
+ });
20865
+
20866
+ return axiosInstance.post(url, {
20867
+ clientdata: clientdata,
20868
+ last4: last4,
20869
+ preauthorization: preauthorizationId
20870
+ }, {
20871
+ headers: headers
20872
+ }).then(function (response) {
20873
+ return ChargeResponses.parse(response.data);
20874
+ });
20875
+ } // charge({
20876
+ // clientdata,
20877
+ // last4,
20878
+ // pin,
20879
+ // trans,
20880
+ // device,
20881
+ // rememberCard,
20882
+ // transactionType,
20883
+ // subscription,
20884
+ // customFields,
20885
+ // }) {
20886
+ // const url = `${config.paymentBaseUrl}charge/`;
20887
+ // const language = getLanguage();
20888
+ // const headers = {
20889
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20890
+ // ...(language && { 'Accept-Language': language }),
20891
+ // };
20892
+ // const chargeParams = {
20893
+ // clientdata,
20894
+ // last4,
20895
+ // trans,
20896
+ // device,
20897
+ // offset: new Date().getTimezoneOffset(),
20898
+ // remember_card: rememberCard,
20899
+ // ...(transactionType && { transaction_type: transactionType }),
20900
+ // ...(subscription && { subscription }),
20901
+ // ...(customFields && customFields),
20902
+ // };
20903
+ // if (pin) {
20904
+ // chargeParams.handle = pin;
20905
+ // }
20906
+ // const urlEncodedParams = formurlencoded(chargeParams);
20907
+ // return axiosInstance
20908
+ // .post(url, urlEncodedParams, { headers })
20909
+ // .then((response) => ChargeResponses.parse(response.data));
20910
+ // },
20911
+ // resumeCardCharge({ device, accessCode, pin }) {
20912
+ // const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
20913
+ // const language = getLanguage();
20914
+ // const headers = {
20915
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20916
+ // ...(language && { 'Accept-Language': language }),
20917
+ // };
20918
+ // const data = { device, ...(pin && { handle: pin }) };
20919
+ // const urlEncodedData = formurlencoded(data);
20920
+ // return axiosInstance
20921
+ // .post(url, urlEncodedData, { headers })
20922
+ // .then((response) => ChargeResponses.parse(response.data));
20923
+ // },
20924
+ // chargeRememberedCard({
20925
+ // last4,
20926
+ // trans,
20927
+ // device,
20928
+ // authorizationCode,
20929
+ // cvv,
20930
+ // pin,
20931
+ // transactionType,
20932
+ // subscription,
20933
+ // }) {
20934
+ // const url = `${config.paymentBaseUrl}charge/`;
20935
+ // const language = getLanguage();
20936
+ // const headers = {
20937
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20938
+ // ...(language && { 'Accept-Language': language }),
20939
+ // };
20940
+ // const chargeParams = {
20941
+ // last4,
20942
+ // trans,
20943
+ // device,
20944
+ // cvv,
20945
+ // handle: pin,
20946
+ // authorization_code: authorizationCode,
20947
+ // ...(transactionType && { transaction_type: transactionType }),
20948
+ // ...(subscription && { subscription }),
20949
+ // };
20950
+ // const urlEncodedParams = formurlencoded(chargeParams);
20951
+ // return axiosInstance
20952
+ // .post(url, urlEncodedParams, { headers })
20953
+ // .then((response) => ChargeResponses.parse(response.data));
20954
+ // },
20955
+ // verifyAddress({ address, city, state, zipCode, transactionId }) {
20956
+ // const url = `${config.paymentBaseUrl}charge/avs`;
20957
+ // const language = getLanguage();
20958
+ // const headers = {
20959
+ // 'Content-Type': 'application/x-www-form-urlencoded',
20960
+ // ...(language && { 'Accept-Language': language }),
20961
+ // };
20962
+ // const data = {
20963
+ // city,
20964
+ // state,
20965
+ // address,
20966
+ // zip_code: zipCode,
20967
+ // trans: transactionId,
20968
+ // };
20969
+ // const urlEncodedData = formurlencoded(data);
20970
+ // return axiosInstance
20971
+ // .post(url, urlEncodedData, { headers })
20972
+ // .then((response) => ChargeResponses.parse(response.data));
20973
+ // },
20974
+ // forgetRememberedCard({ authorizationId, publicKey }) {
20975
+ // const language = getLanguage();
20976
+ // const headers = {
20977
+ // Authorization: `Bearer ${publicKey}`,
20978
+ // ...(language && { 'Accept-Language': language }),
20979
+ // };
20980
+ // const params = {
20981
+ // authorization_id: authorizationId,
20982
+ // };
20983
+ // const url = `${config.paystackApiUrl}rememberme/forget_card`;
20984
+ // return axiosInstance
20985
+ // .post(url, params, { headers })
20986
+ // .then((response) => ChargeResponses.parse(response.data));
20987
+ // },
20988
+
20989
+ };
20990
+
20991
+ var paymentMethod = 'card';
20992
+
20993
+ function validate(card, isSetter) {
20994
+ return new Promise(function (resolve, reject) {
20995
+ var validation = Card.validate(card);
20996
+
20997
+ if (!validation.isValid) {
20998
+ var throwValidation = isSetter || card.number;
20999
+ var errors = Object.keys(validation.result).filter(function (value) {
21000
+ return validation.result[value] === false;
21001
+ });
21002
+ var errorMessage = "Invalid card details: ".concat(errors.join(', '));
21003
+ reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
21004
+ }
21005
+
21006
+ resolve();
21007
+ });
21008
+ }
21009
+
21010
+ var ReserveCardFunds = {
21011
+ setCard: function setCard(params) {
21012
+ var _this = this;
21013
+
21014
+ return validate(params, true).then(function () {
21015
+ _this.card = new Card(params);
21016
+ });
21017
+ },
21018
+ reserve: function reserve(preauthorizationId) {
21019
+ var _this2 = this;
21020
+
21021
+ var customFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21022
+ // TODO: Log payment method
21023
+ // https://paystack.atlassian.net/browse/RAILS-3070
21024
+ return validate(this.card).then(function () {
21025
+ var chargeParams = {
21026
+ clientdata: _this2.card.tokenize(),
21027
+ last4: _this2.card.getLast4(),
21028
+ preauthorization: preauthorizationId,
21029
+ customFields: customFields
21030
+ };
21031
+ return CardAPI.charge(chargeParams).then(function (response) {
21032
+ // TODO: Log API Response
21033
+ // https://paystack.atlassian.net/browse/RAILS-3070
21034
+ return response;
21035
+ });
21036
+ });
21037
+ },
21038
+ listenFor3DSCharge: function listenFor3DSCharge(callback) {
21039
+ var listenerOptions = {
21040
+ channel: "3DS_".concat(this.id),
21041
+ paymentMethod: paymentMethod
21042
+ };
21043
+ return this.listenForCharge(listenerOptions, callback);
21044
+ } // rememberCard() {
21045
+ // this.remember_card = true;
21046
+ // },
21047
+ // chargeCard(customFields = {}) {
21048
+ // if (!this.card.number && this.card.pin) {
21049
+ // return this.chargeCardWithPin(customFields);
21050
+ // }
21051
+ // return validate(this.card).then(() => {
21052
+ // this.logAttempt(paymentMethod);
21053
+ // const chargeParams = {
21054
+ // clientdata: this.card.tokenize(),
21055
+ // last4: this.card.getLast4(),
21056
+ // pin: this.card.getEncryptedPin(),
21057
+ // trans: this.id,
21058
+ // device: this.deviceFingerprint,
21059
+ // rememberCard: this.remember_card,
21060
+ // transactionType: this.transactionType,
21061
+ // subscription: this.subscription,
21062
+ // customFields,
21063
+ // };
21064
+ // return CardAPI.charge(chargeParams).then((response) => {
21065
+ // this.logAPIResponse(response, paymentMethod);
21066
+ // return response;
21067
+ // });
21068
+ // });
21069
+ // },
21070
+
21071
+ /**
21072
+ * Handles submitting a card pin after
21073
+ * other card details have been previously submitted.
21074
+ */
21075
+ // chargeCardWithPin(customFields = {}) {
21076
+ // this.logAttempt(paymentMethod);
21077
+ // const chargeParams = {
21078
+ // pin: encrypt(this.card.pin),
21079
+ // trans: this.id,
21080
+ // device: this.deviceFingerprint,
21081
+ // rememberCard: this.remember_card,
21082
+ // transactionType: this.transactionType,
21083
+ // subscription: this.subscription,
21084
+ // customFields,
21085
+ // };
21086
+ // return CardAPI.charge(chargeParams).then((response) => {
21087
+ // this.logAPIResponse(response, paymentMethod);
21088
+ // return response;
21089
+ // });
21090
+ // },
21091
+ // chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
21092
+ // this.logAttempt(paymentMethod);
21093
+ // const encryptedPin = encrypt(pin);
21094
+ // const chargeParams = {
21095
+ // authorizationCode,
21096
+ // cvv,
21097
+ // last4: cardLast4,
21098
+ // trans: this.id,
21099
+ // device: this.deviceFingerprint,
21100
+ // pin: encryptedPin,
21101
+ // transactionType: this.transactionType,
21102
+ // subscription: this.subscription,
21103
+ // };
21104
+ // return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
21105
+ // this.logAPIResponse(response, paymentMethod);
21106
+ // return response;
21107
+ // });
21108
+ // },
21109
+ // resumeCardCharge({ accessCode, pin }) {
21110
+ // const params = {
21111
+ // ...(pin && { pin: encrypt(pin) }),
21112
+ // accessCode,
21113
+ // device: this.deviceFingerprint,
21114
+ // };
21115
+ // return CardAPI.resumeCardCharge(params).then((response) => {
21116
+ // this.logAPIResponse(response, paymentMethod);
21117
+ // return response;
21118
+ // });
21119
+ // },
21120
+ // forgetRememberedCard(authorizationId) {
21121
+ // const params = {
21122
+ // authorizationId,
21123
+ // publicKey: this.merchant.key,
21124
+ // };
21125
+ // return CardAPI.forgetRememberedCard(params).then((response) => {
21126
+ // this.logAPIResponse(response, paymentMethod);
21127
+ // return response;
21128
+ // });
21129
+ // },
21130
+ // authenticateCard(token) {
21131
+ // return CardAPI.authenticate(this.id, token).then((response) => {
21132
+ // this.logAPIResponse(response, paymentMethod);
21133
+ // return response;
21134
+ // });
21135
+ // },
21136
+ // verifyAddress({ address, city, state, zipCode }) {
21137
+ // const payload = {
21138
+ // city,
21139
+ // state,
21140
+ // address,
21141
+ // zipCode,
21142
+ // transactionId: this.id,
21143
+ // };
21144
+ // return CardAPI.verifyAddress(payload).then((response) => {
21145
+ // this.logAPIResponse(response, paymentMethod);
21146
+ // return response;
21147
+ // });
21148
+ // },
21149
+
21150
+ };
21151
+
21152
+ var PreauthorizationInstance = /*#__PURE__*/function () {
21153
+ function PreauthorizationInstance(data) {
21154
+ _classCallCheck(this, PreauthorizationInstance);
21155
+
21156
+ this.email = data.email;
21157
+ this.status = data.status;
21158
+ this.reference = data.reference;
21159
+ this.amount = data.amount;
21160
+ this.currency = data.currency;
21161
+ this.metadata = data.metadata || {};
21162
+ this.customer = data.customer;
21163
+ this.channels = data.channels || ['card'];
21164
+ this.isListening = false;
21165
+ this.merchant = {
21166
+ id: data.merchant_id,
21167
+ logo: data.merchant_logo,
21168
+ name: data.merchant_name,
21169
+ key: data.merchant_key
21170
+ };
21171
+ loadPusher(); // TODO: Analytics
21172
+ // https://paystack.atlassian.net/browse/RAILS-3070
21173
+
21174
+ Object.assign(this, ReserveCardFunds);
21175
+ }
21176
+
21177
+ _createClass(PreauthorizationInstance, [{
21178
+ key: "setMetadata",
21179
+ value: function setMetadata(key, value) {
21180
+ this.metadata[key] = value;
21181
+ }
21182
+ }, {
21183
+ key: "listenForCharge",
21184
+ value: function listenForCharge(options, callback) {
21185
+ return subscribeToChargeEvents(options, this, callback);
21186
+ }
21187
+ }]);
21188
+
21189
+ return PreauthorizationInstance;
21190
+ }();
21191
+
21192
+ var PreauthorisationAPI = {
21193
+ getByAccessCode: function getByAccessCode(accessCode) {
21194
+ var language = getLanguage();
21195
+
21196
+ var headers = _objectSpread2({}, language && {
21197
+ 'Accept-Language': language
21198
+ });
21199
+
21200
+ var url = "".concat(configToUse.paystackApiUrl, "preauthorization/verify_access_code/").concat(accessCode);
21201
+ return axiosInstance.get(url, {
21202
+ headers: headers
21203
+ }).then(function (response) {
21204
+ return response.data;
21205
+ });
21206
+ },
21207
+ requery: function requery() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
21208
+ },
21209
+ reserveFunds: function reserveFunds() {// TODO: https://paystack.atlassian.net/browse/RAILS-2887
21210
+ }
21211
+ };
21212
+
21213
+ var Preauthorization = {
21214
+ initialize: function initialize(data) {
21215
+ return Object.seal(new PreauthorizationInstance(data));
21216
+ },
21217
+ getByAccessCode: function getByAccessCode(accessCode) {
21218
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
21219
+ var response;
21220
+ return regeneratorRuntime.wrap(function _callee$(_context) {
21221
+ while (1) {
21222
+ switch (_context.prev = _context.next) {
21223
+ case 0:
21224
+ _context.next = 2;
21225
+ return PreauthorisationAPI.getByAccessCode(accessCode);
21226
+
21227
+ case 2:
21228
+ response = _context.sent;
21229
+ return _context.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2({}, response.data))));
21230
+
21231
+ case 4:
21232
+ case "end":
21233
+ return _context.stop();
21234
+ }
21235
+ }
21236
+ }, _callee);
21237
+ }))();
21238
+ },
21239
+ verify: function verify() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
21240
+
21241
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
21242
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
21243
+ while (1) {
21244
+ switch (_context2.prev = _context2.next) {
21245
+ case 0:
21246
+ case "end":
21247
+ return _context2.stop();
21248
+ }
21249
+ }
21250
+ }, _callee2);
21251
+ }))();
21252
+ }
21253
+ };
21254
+
20696
21255
  exports.BankAccount = BankAccount;
20697
- exports.Card = Card;
21256
+ exports.Card = Card$1;
21257
+ exports.Preauthorization = Preauthorization;
20698
21258
  exports.Toolkit = Toolkit;
20699
21259
  exports.Transaction = Transaction;