@paystack/checkout-js 1.20.0-dev.8 → 1.20.0

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,16 +6407,14 @@ 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',
6411
- savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6410
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6412
6411
  });
6413
6412
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6414
6413
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6415
6414
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6416
6415
  paystackApiUrl: 'https://studio-api.paystack.co/',
6417
6416
  pusherKey: '1c7b262ee18455815893',
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/'
6417
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6420
6418
  });
6421
6419
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6422
6420
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -17238,7 +17236,55 @@ function encrypt(toEncrypt) {
17238
17236
  return jsEncrypt.encrypt(toEncrypt);
17239
17237
  }
17240
17238
 
17239
+ var DESCRIPTORS = descriptors;
17240
+ var uncurryThis$1 = functionUncurryThis;
17241
+ var objectKeys = objectKeys$3;
17242
+ var toIndexedObject = toIndexedObject$8;
17243
+ var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
17244
+
17245
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
17246
+ var push = uncurryThis$1([].push);
17247
+
17248
+ // `Object.{ entries, values }` methods implementation
17249
+ var createMethod = function (TO_ENTRIES) {
17250
+ return function (it) {
17251
+ var O = toIndexedObject(it);
17252
+ var keys = objectKeys(O);
17253
+ var length = keys.length;
17254
+ var i = 0;
17255
+ var result = [];
17256
+ var key;
17257
+ while (length > i) {
17258
+ key = keys[i++];
17259
+ if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
17260
+ push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
17261
+ }
17262
+ }
17263
+ return result;
17264
+ };
17265
+ };
17266
+
17267
+ var objectToArray = {
17268
+ // `Object.entries` method
17269
+ // https://tc39.es/ecma262/#sec-object.entries
17270
+ entries: createMethod(true),
17271
+ // `Object.values` method
17272
+ // https://tc39.es/ecma262/#sec-object.values
17273
+ values: createMethod(false)
17274
+ };
17275
+
17241
17276
  var $$2 = _export;
17277
+ var $values = objectToArray.values;
17278
+
17279
+ // `Object.values` method
17280
+ // https://tc39.es/ecma262/#sec-object.values
17281
+ $$2({ target: 'Object', stat: true }, {
17282
+ values: function values(O) {
17283
+ return $values(O);
17284
+ }
17285
+ });
17286
+
17287
+ var $$1 = _export;
17242
17288
  var $find = arrayIteration.find;
17243
17289
  var addToUnscopables = addToUnscopables$3;
17244
17290
 
@@ -17250,7 +17296,7 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
17250
17296
 
17251
17297
  // `Array.prototype.find` method
17252
17298
  // https://tc39.es/ecma262/#sec-array.prototype.find
17253
- $$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17299
+ $$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17254
17300
  find: function find(callbackfn /* , that = undefined */) {
17255
17301
  return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
17256
17302
  }
@@ -18198,54 +18244,69 @@ var cardValidator = {
18198
18244
  creditCardType: creditCardType_1
18199
18245
  };
18200
18246
 
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;
18247
+ var testCards = [{
18248
+ type: 'bank_auth',
18249
+ name: 'Bank authorization',
18250
+ number: '4084080000000409',
18251
+ cvv: '000',
18252
+ month: '01',
18253
+ year: '30'
18254
+ }, {
18255
+ type: 'success',
18256
+ name: 'Success',
18257
+ number: '4084084084084081',
18258
+ cvv: '408',
18259
+ month: '12',
18260
+ year: '30'
18261
+ }, {
18262
+ type: 'declined',
18263
+ name: 'Declined',
18264
+ number: '4084080000005408',
18265
+ cvv: '001',
18266
+ month: '12',
18267
+ year: '30'
18268
+ }, {
18269
+ type: 'pin',
18270
+ name: 'Pin only validation',
18271
+ number: '507850785078507812',
18272
+ cvv: '884',
18273
+ month: '01',
18274
+ year: '30'
18275
+ }, {
18276
+ type: 'pin+otp',
18277
+ name: 'Pin and OTP validation',
18278
+ number: '5060666666666666666',
18279
+ cvv: '123',
18280
+ month: '01',
18281
+ year: '30'
18282
+ }, {
18283
+ type: 'pin+phone+otp',
18284
+ name: 'Pin, phone and OTP validation',
18285
+ number: '507850785078507812',
18286
+ cvv: '884',
18287
+ month: '01',
18288
+ year: '30'
18289
+ }, {
18290
+ type: 'default',
18291
+ name: 'No validation',
18292
+ number: '4084084084084081',
18293
+ cvv: '408',
18294
+ month: '01',
18295
+ year: '30'
18296
+ }];
18240
18297
 
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);
18298
+ cardValidator.creditCardType.addCard({
18299
+ niceType: 'Verve',
18300
+ type: 'verve',
18301
+ patterns: [[506000, 507999], [650000, 650009]],
18302
+ gaps: [4, 8, 12, 16],
18303
+ lengths: [16, 18, 19],
18304
+ code: {
18305
+ name: 'CVV',
18306
+ size: 3
18246
18307
  }
18247
18308
  });
18248
-
18309
+ cardValidator.creditCardType.changeOrder('verve', 0);
18249
18310
  var Card$2 = {
18250
18311
  getEncryptedPin: function getEncryptedPin(pin) {
18251
18312
  return pin ? encrypt(pin) : undefined;
@@ -18316,7 +18377,7 @@ var Card$2 = {
18316
18377
  return Card$2.validateCVV(cvv, cardType).isValid;
18317
18378
  },
18318
18379
  validateExpiry: function validateExpiry(value) {
18319
- if (_typeof$1(value) === 'object') {
18380
+ if (value !== null && _typeof$1(value) === 'object') {
18320
18381
  var month = value.month,
18321
18382
  year = value.year;
18322
18383
  return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
@@ -18326,73 +18387,15 @@ var Card$2 = {
18326
18387
  },
18327
18388
  isExpiryValid: function isExpiryValid(value) {
18328
18389
  return Card$2.validateExpiry(value).isValid;
18390
+ },
18391
+ findTestCard: function findTestCard(cardType) {
18392
+ var type = cardType || 'default';
18393
+ return testCards.find(function (card) {
18394
+ return card.type === type;
18395
+ });
18329
18396
  }
18330
18397
  };
18331
18398
 
18332
- var testCards = [{
18333
- type: 'bank_auth',
18334
- name: 'Bank authorization',
18335
- number: '4084080000000409',
18336
- cvv: '000',
18337
- month: '01',
18338
- year: '30'
18339
- }, {
18340
- type: 'success',
18341
- name: 'Success',
18342
- number: '4084084084084081',
18343
- cvv: '408',
18344
- month: '12',
18345
- year: '30'
18346
- }, {
18347
- type: 'declined',
18348
- name: 'Declined',
18349
- number: '4084080000005408',
18350
- cvv: '001',
18351
- month: '12',
18352
- year: '30'
18353
- }, {
18354
- type: 'pin',
18355
- name: 'Pin only validation',
18356
- number: '507850785078507812',
18357
- cvv: '884',
18358
- month: '01',
18359
- year: '30'
18360
- }, {
18361
- type: 'pin+otp',
18362
- name: 'Pin and OTP validation',
18363
- number: '5060666666666666666',
18364
- cvv: '123',
18365
- month: '01',
18366
- year: '30'
18367
- }, {
18368
- type: 'pin+phone+otp',
18369
- name: 'Pin, phone and OTP validation',
18370
- number: '507850785078507812',
18371
- cvv: '884',
18372
- month: '01',
18373
- year: '30'
18374
- }, {
18375
- type: 'default',
18376
- name: 'No validation',
18377
- number: '4084084084084081',
18378
- cvv: '408',
18379
- month: '01',
18380
- year: '30'
18381
- }];
18382
-
18383
- cardValidator.creditCardType.addCard({
18384
- niceType: 'Verve',
18385
- type: 'verve',
18386
- patterns: [[506000, 507999], [650000, 650009]],
18387
- gaps: [4, 8, 12, 16],
18388
- lengths: [16, 18, 19],
18389
- code: {
18390
- name: 'CVV',
18391
- size: 3
18392
- }
18393
- });
18394
- cardValidator.creditCardType.changeOrder('verve', 0);
18395
-
18396
18399
  var Card$1 = /*#__PURE__*/function () {
18397
18400
  function Card(_ref) {
18398
18401
  var number = _ref.number,
@@ -18482,11 +18485,7 @@ var Card$1 = /*#__PURE__*/function () {
18482
18485
  }, {
18483
18486
  key: "generateTestCard",
18484
18487
  value: function generateTestCard(cardType) {
18485
- var type = cardType || 'default';
18486
- var cardParams = testCards.find(function (card) {
18487
- return card.type === type;
18488
- });
18489
- return new Card(cardParams);
18488
+ return new Card(Card$2.findTestCard(cardType));
18490
18489
  }
18491
18490
  }]);
18492
18491
 
@@ -18669,209 +18668,6 @@ var CardAPI$1 = {
18669
18668
  }).then(function (response) {
18670
18669
  return ChargeResponses.parse(response.data);
18671
18670
  });
18672
- },
18673
- sendSavedCardsOTP: function sendSavedCardsOTP(email) {
18674
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18675
- var url, language, headers, _yield$axiosInstance$, data;
18676
-
18677
- return regeneratorRuntime.wrap(function _callee$(_context) {
18678
- while (1) {
18679
- switch (_context.prev = _context.next) {
18680
- case 0:
18681
- url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
18682
- language = getLanguage();
18683
- headers = _objectSpread2({}, language && {
18684
- 'Accept-Language': language
18685
- });
18686
- _context.next = 5;
18687
- return axiosInstance.post(url, {
18688
- email: email
18689
- }, {
18690
- headers: headers
18691
- });
18692
-
18693
- case 5:
18694
- _yield$axiosInstance$ = _context.sent;
18695
- data = _yield$axiosInstance$.data;
18696
- return _context.abrupt("return", data);
18697
-
18698
- case 8:
18699
- case "end":
18700
- return _context.stop();
18701
- }
18702
- }
18703
- }, _callee);
18704
- }))();
18705
- },
18706
- addUserToSavedCards: function addUserToSavedCards(_ref6) {
18707
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
18708
- var phone, email, url, language, headers, data, response;
18709
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
18710
- while (1) {
18711
- switch (_context2.prev = _context2.next) {
18712
- case 0:
18713
- phone = _ref6.phone, email = _ref6.email;
18714
- url = new URL('/user', configToUse.savedCardsApiUrl).toString();
18715
- language = getLanguage();
18716
- headers = _objectSpread2({}, language && {
18717
- 'Accept-Language': language
18718
- });
18719
- data = {
18720
- phone: phone,
18721
- email: email
18722
- };
18723
- _context2.next = 7;
18724
- return axiosInstance.post(url, data, {
18725
- headers: headers
18726
- });
18727
-
18728
- case 7:
18729
- response = _context2.sent;
18730
- return _context2.abrupt("return", response.data);
18731
-
18732
- case 9:
18733
- case "end":
18734
- return _context2.stop();
18735
- }
18736
- }
18737
- }, _callee2);
18738
- }))();
18739
- },
18740
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18741
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
18742
- var code, email, transaction, url, language, headers, data, response;
18743
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
18744
- while (1) {
18745
- switch (_context3.prev = _context3.next) {
18746
- case 0:
18747
- code = _ref7.code, email = _ref7.email, transaction = _ref7.transaction;
18748
- url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18749
- language = getLanguage();
18750
- headers = _objectSpread2({}, language && {
18751
- 'Accept-Language': language
18752
- });
18753
- data = {
18754
- code: code,
18755
- email: email,
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
- }))();
18875
18671
  }
18876
18672
  };
18877
18673
 
@@ -19052,75 +18848,6 @@ var CardCharge = {
19052
18848
  paymentMethod: paymentMethod$4
19053
18849
  };
19054
18850
  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
- email: _this9.email,
19079
- transaction: _this9.id
19080
- };
19081
- _context.prev = 2;
19082
- _context.next = 5;
19083
- return CardAPI$1.verifySavedCardsOtp(payload);
19084
-
19085
- case 5:
19086
- response = _context.sent;
19087
- _this9.savedCardsToken = response.data.token;
19088
- return _context.abrupt("return", response);
19089
-
19090
- case 10:
19091
- _context.prev = 10;
19092
- _context.t0 = _context["catch"](2);
19093
- _this9.savedCardsToken = null;
19094
- throw _context.t0;
19095
-
19096
- case 14:
19097
- case "end":
19098
- return _context.stop();
19099
- }
19100
- }
19101
- }, _callee, null, [[2, 10]]);
19102
- }))();
19103
- },
19104
- getSavedCards: function getSavedCards() {
19105
- return CardAPI$1.getSavedCards({
19106
- token: this.savedCardsToken
19107
- });
19108
- },
19109
- deleteSavedCard: function deleteSavedCard(cardCode) {
19110
- return CardAPI$1.deleteSavedCard({
19111
- cardCode: cardCode,
19112
- token: this.savedCardsToken
19113
- });
19114
- },
19115
- chargeSavedCard: function chargeSavedCard(_ref6) {
19116
- var cardCode = _ref6.cardCode;
19117
- return CardAPI$1.chargeSavedCard({
19118
- cardCode: cardCode,
19119
- transaction: this.id,
19120
- token: this.savedCardsToken,
19121
- device: this.deviceFingerprint,
19122
- selectedCurrency: this.currency
19123
- });
19124
18851
  }
19125
18852
  };
19126
18853
 
@@ -20449,8 +20176,6 @@ var TransactionInstance = /*#__PURE__*/function () {
20449
20176
  this.subscription = data.subscription || null;
20450
20177
  this.planDetails = data.plan_details || null;
20451
20178
  this.exchangeRate = data.exchange_rate || null;
20452
- this.savedCardsConfig = data.saved_cards || {};
20453
- this.savedCardsToken = null;
20454
20179
  /**
20455
20180
  * We initialize parameters we send to the API as empty strings
20456
20181
  * when we don't have them instead of null because the API expects
@@ -20791,19 +20516,6 @@ var Toolkit = /*#__PURE__*/function () {
20791
20516
  return Toolkit;
20792
20517
  }();
20793
20518
 
20794
- cardValidator.creditCardType.addCard({
20795
- niceType: 'Verve',
20796
- type: 'verve',
20797
- patterns: [[506000, 507999], [650000, 650009]],
20798
- gaps: [4, 8, 12, 16],
20799
- lengths: [16, 18, 19],
20800
- code: {
20801
- name: 'CVV',
20802
- size: 3
20803
- }
20804
- });
20805
- cardValidator.creditCardType.changeOrder('verve', 0);
20806
-
20807
20519
  var Card = /*#__PURE__*/function () {
20808
20520
  function Card(_ref) {
20809
20521
  var number = _ref.number,
@@ -20893,11 +20605,7 @@ var Card = /*#__PURE__*/function () {
20893
20605
  }, {
20894
20606
  key: "generateTestCard",
20895
20607
  value: function generateTestCard(cardType) {
20896
- var type = cardType || 'default';
20897
- var cardParams = testCards.find(function (card) {
20898
- return card.type === type;
20899
- });
20900
- return new Card(cardParams);
20608
+ return new Card(Card$2.findTestCard(cardType));
20901
20609
  }
20902
20610
  }]);
20903
20611
 
@@ -20928,120 +20636,7 @@ var CardAPI = {
20928
20636
  }).then(function (response) {
20929
20637
  return ChargeResponses.parse(response.data);
20930
20638
  });
20931
- } // charge({
20932
- // clientdata,
20933
- // last4,
20934
- // pin,
20935
- // trans,
20936
- // device,
20937
- // rememberCard,
20938
- // transactionType,
20939
- // subscription,
20940
- // customFields,
20941
- // }) {
20942
- // const url = `${config.paymentBaseUrl}charge/`;
20943
- // const language = getLanguage();
20944
- // const headers = {
20945
- // 'Content-Type': 'application/x-www-form-urlencoded',
20946
- // ...(language && { 'Accept-Language': language }),
20947
- // };
20948
- // const chargeParams = {
20949
- // clientdata,
20950
- // last4,
20951
- // trans,
20952
- // device,
20953
- // offset: new Date().getTimezoneOffset(),
20954
- // remember_card: rememberCard,
20955
- // ...(transactionType && { transaction_type: transactionType }),
20956
- // ...(subscription && { subscription }),
20957
- // ...(customFields && customFields),
20958
- // };
20959
- // if (pin) {
20960
- // chargeParams.handle = pin;
20961
- // }
20962
- // const urlEncodedParams = formurlencoded(chargeParams);
20963
- // return axiosInstance
20964
- // .post(url, urlEncodedParams, { headers })
20965
- // .then((response) => ChargeResponses.parse(response.data));
20966
- // },
20967
- // resumeCardCharge({ device, accessCode, pin }) {
20968
- // const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
20969
- // const language = getLanguage();
20970
- // const headers = {
20971
- // 'Content-Type': 'application/x-www-form-urlencoded',
20972
- // ...(language && { 'Accept-Language': language }),
20973
- // };
20974
- // const data = { device, ...(pin && { handle: pin }) };
20975
- // const urlEncodedData = formurlencoded(data);
20976
- // return axiosInstance
20977
- // .post(url, urlEncodedData, { headers })
20978
- // .then((response) => ChargeResponses.parse(response.data));
20979
- // },
20980
- // chargeRememberedCard({
20981
- // last4,
20982
- // trans,
20983
- // device,
20984
- // authorizationCode,
20985
- // cvv,
20986
- // pin,
20987
- // transactionType,
20988
- // subscription,
20989
- // }) {
20990
- // const url = `${config.paymentBaseUrl}charge/`;
20991
- // const language = getLanguage();
20992
- // const headers = {
20993
- // 'Content-Type': 'application/x-www-form-urlencoded',
20994
- // ...(language && { 'Accept-Language': language }),
20995
- // };
20996
- // const chargeParams = {
20997
- // last4,
20998
- // trans,
20999
- // device,
21000
- // cvv,
21001
- // handle: pin,
21002
- // authorization_code: authorizationCode,
21003
- // ...(transactionType && { transaction_type: transactionType }),
21004
- // ...(subscription && { subscription }),
21005
- // };
21006
- // const urlEncodedParams = formurlencoded(chargeParams);
21007
- // return axiosInstance
21008
- // .post(url, urlEncodedParams, { headers })
21009
- // .then((response) => ChargeResponses.parse(response.data));
21010
- // },
21011
- // verifyAddress({ address, city, state, zipCode, transactionId }) {
21012
- // const url = `${config.paymentBaseUrl}charge/avs`;
21013
- // const language = getLanguage();
21014
- // const headers = {
21015
- // 'Content-Type': 'application/x-www-form-urlencoded',
21016
- // ...(language && { 'Accept-Language': language }),
21017
- // };
21018
- // const data = {
21019
- // city,
21020
- // state,
21021
- // address,
21022
- // zip_code: zipCode,
21023
- // trans: transactionId,
21024
- // };
21025
- // const urlEncodedData = formurlencoded(data);
21026
- // return axiosInstance
21027
- // .post(url, urlEncodedData, { headers })
21028
- // .then((response) => ChargeResponses.parse(response.data));
21029
- // },
21030
- // forgetRememberedCard({ authorizationId, publicKey }) {
21031
- // const language = getLanguage();
21032
- // const headers = {
21033
- // Authorization: `Bearer ${publicKey}`,
21034
- // ...(language && { 'Accept-Language': language }),
21035
- // };
21036
- // const params = {
21037
- // authorization_id: authorizationId,
21038
- // };
21039
- // const url = `${config.paystackApiUrl}rememberme/forget_card`;
21040
- // return axiosInstance
21041
- // .post(url, params, { headers })
21042
- // .then((response) => ChargeResponses.parse(response.data));
21043
- // },
21044
-
20639
+ }
21045
20640
  };
21046
20641
 
21047
20642
  var paymentMethod = 'card';
@@ -21063,7 +20658,7 @@ function validate(card, isSetter) {
21063
20658
  });
21064
20659
  }
21065
20660
 
21066
- var ReserveCardFunds = {
20661
+ var CardPreauthorization = {
21067
20662
  setCard: function setCard(params) {
21068
20663
  var _this = this;
21069
20664
 
@@ -21101,112 +20696,7 @@ var ReserveCardFunds = {
21101
20696
  paymentMethod: paymentMethod
21102
20697
  };
21103
20698
  return this.listenForCharge(listenerOptions, callback);
21104
- } // rememberCard() {
21105
- // this.remember_card = true;
21106
- // },
21107
- // chargeCard(customFields = {}) {
21108
- // if (!this.card.number && this.card.pin) {
21109
- // return this.chargeCardWithPin(customFields);
21110
- // }
21111
- // return validate(this.card).then(() => {
21112
- // this.logAttempt(paymentMethod);
21113
- // const chargeParams = {
21114
- // clientdata: this.card.tokenize(),
21115
- // last4: this.card.getLast4(),
21116
- // pin: this.card.getEncryptedPin(),
21117
- // trans: this.id,
21118
- // device: this.deviceFingerprint,
21119
- // rememberCard: this.remember_card,
21120
- // transactionType: this.transactionType,
21121
- // subscription: this.subscription,
21122
- // customFields,
21123
- // };
21124
- // return CardAPI.charge(chargeParams).then((response) => {
21125
- // this.logAPIResponse(response, paymentMethod);
21126
- // return response;
21127
- // });
21128
- // });
21129
- // },
21130
-
21131
- /**
21132
- * Handles submitting a card pin after
21133
- * other card details have been previously submitted.
21134
- */
21135
- // chargeCardWithPin(customFields = {}) {
21136
- // this.logAttempt(paymentMethod);
21137
- // const chargeParams = {
21138
- // pin: encrypt(this.card.pin),
21139
- // trans: this.id,
21140
- // device: this.deviceFingerprint,
21141
- // rememberCard: this.remember_card,
21142
- // transactionType: this.transactionType,
21143
- // subscription: this.subscription,
21144
- // customFields,
21145
- // };
21146
- // return CardAPI.charge(chargeParams).then((response) => {
21147
- // this.logAPIResponse(response, paymentMethod);
21148
- // return response;
21149
- // });
21150
- // },
21151
- // chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
21152
- // this.logAttempt(paymentMethod);
21153
- // const encryptedPin = encrypt(pin);
21154
- // const chargeParams = {
21155
- // authorizationCode,
21156
- // cvv,
21157
- // last4: cardLast4,
21158
- // trans: this.id,
21159
- // device: this.deviceFingerprint,
21160
- // pin: encryptedPin,
21161
- // transactionType: this.transactionType,
21162
- // subscription: this.subscription,
21163
- // };
21164
- // return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
21165
- // this.logAPIResponse(response, paymentMethod);
21166
- // return response;
21167
- // });
21168
- // },
21169
- // resumeCardCharge({ accessCode, pin }) {
21170
- // const params = {
21171
- // ...(pin && { pin: encrypt(pin) }),
21172
- // accessCode,
21173
- // device: this.deviceFingerprint,
21174
- // };
21175
- // return CardAPI.resumeCardCharge(params).then((response) => {
21176
- // this.logAPIResponse(response, paymentMethod);
21177
- // return response;
21178
- // });
21179
- // },
21180
- // forgetRememberedCard(authorizationId) {
21181
- // const params = {
21182
- // authorizationId,
21183
- // publicKey: this.merchant.key,
21184
- // };
21185
- // return CardAPI.forgetRememberedCard(params).then((response) => {
21186
- // this.logAPIResponse(response, paymentMethod);
21187
- // return response;
21188
- // });
21189
- // },
21190
- // authenticateCard(token) {
21191
- // return CardAPI.authenticate(this.id, token).then((response) => {
21192
- // this.logAPIResponse(response, paymentMethod);
21193
- // return response;
21194
- // });
21195
- // },
21196
- // verifyAddress({ address, city, state, zipCode }) {
21197
- // const payload = {
21198
- // city,
21199
- // state,
21200
- // address,
21201
- // zipCode,
21202
- // transactionId: this.id,
21203
- // };
21204
- // return CardAPI.verifyAddress(payload).then((response) => {
21205
- // this.logAPIResponse(response, paymentMethod);
21206
- // return response;
21207
- // });
21208
- // },
21209
-
20699
+ }
21210
20700
  };
21211
20701
 
21212
20702
  var PreauthorizationInstance = /*#__PURE__*/function () {
@@ -21233,7 +20723,7 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
21233
20723
  loadPusher(); // TODO: Analytics
21234
20724
  // https://paystack.atlassian.net/browse/RAILS-3070
21235
20725
 
21236
- Object.assign(this, ReserveCardFunds);
20726
+ Object.assign(this, CardPreauthorization);
21237
20727
  }
21238
20728
 
21239
20729
  _createClass(PreauthorizationInstance, [{
@@ -21267,8 +20757,6 @@ var PreauthorisationAPI = {
21267
20757
  });
21268
20758
  },
21269
20759
  requery: function requery() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
21270
- },
21271
- reserveFunds: function reserveFunds() {// TODO: https://paystack.atlassian.net/browse/RAILS-2887
21272
20760
  }
21273
20761
  };
21274
20762