@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/es/checkout.js CHANGED
@@ -6403,16 +6403,14 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6403
6403
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6404
6404
  paystackApiUrl: 'https://studio-api.paystack.co/',
6405
6405
  pusherKey: '1c7b262ee18455815893',
6406
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6407
- savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6406
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6408
6407
  });
6409
6408
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6410
6409
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6411
6410
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6412
6411
  paystackApiUrl: 'https://studio-api.paystack.co/',
6413
6412
  pusherKey: '1c7b262ee18455815893',
6414
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
6415
- savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
6413
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6416
6414
  });
6417
6415
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6418
6416
  checkoutUrl: 'https://checkout.paystack.com/',
@@ -17234,7 +17232,55 @@ function encrypt(toEncrypt) {
17234
17232
  return jsEncrypt.encrypt(toEncrypt);
17235
17233
  }
17236
17234
 
17235
+ var DESCRIPTORS = descriptors;
17236
+ var uncurryThis$1 = functionUncurryThis;
17237
+ var objectKeys = objectKeys$3;
17238
+ var toIndexedObject = toIndexedObject$8;
17239
+ var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
17240
+
17241
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
17242
+ var push = uncurryThis$1([].push);
17243
+
17244
+ // `Object.{ entries, values }` methods implementation
17245
+ var createMethod = function (TO_ENTRIES) {
17246
+ return function (it) {
17247
+ var O = toIndexedObject(it);
17248
+ var keys = objectKeys(O);
17249
+ var length = keys.length;
17250
+ var i = 0;
17251
+ var result = [];
17252
+ var key;
17253
+ while (length > i) {
17254
+ key = keys[i++];
17255
+ if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
17256
+ push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
17257
+ }
17258
+ }
17259
+ return result;
17260
+ };
17261
+ };
17262
+
17263
+ var objectToArray = {
17264
+ // `Object.entries` method
17265
+ // https://tc39.es/ecma262/#sec-object.entries
17266
+ entries: createMethod(true),
17267
+ // `Object.values` method
17268
+ // https://tc39.es/ecma262/#sec-object.values
17269
+ values: createMethod(false)
17270
+ };
17271
+
17237
17272
  var $$2 = _export;
17273
+ var $values = objectToArray.values;
17274
+
17275
+ // `Object.values` method
17276
+ // https://tc39.es/ecma262/#sec-object.values
17277
+ $$2({ target: 'Object', stat: true }, {
17278
+ values: function values(O) {
17279
+ return $values(O);
17280
+ }
17281
+ });
17282
+
17283
+ var $$1 = _export;
17238
17284
  var $find = arrayIteration.find;
17239
17285
  var addToUnscopables = addToUnscopables$3;
17240
17286
 
@@ -17246,7 +17292,7 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
17246
17292
 
17247
17293
  // `Array.prototype.find` method
17248
17294
  // https://tc39.es/ecma262/#sec-array.prototype.find
17249
- $$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17295
+ $$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17250
17296
  find: function find(callbackfn /* , that = undefined */) {
17251
17297
  return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
17252
17298
  }
@@ -18194,54 +18240,69 @@ var cardValidator = {
18194
18240
  creditCardType: creditCardType_1
18195
18241
  };
18196
18242
 
18197
- var DESCRIPTORS = descriptors;
18198
- var uncurryThis$1 = functionUncurryThis;
18199
- var objectKeys = objectKeys$3;
18200
- var toIndexedObject = toIndexedObject$8;
18201
- var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
18202
-
18203
- var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
18204
- var push = uncurryThis$1([].push);
18205
-
18206
- // `Object.{ entries, values }` methods implementation
18207
- var createMethod = function (TO_ENTRIES) {
18208
- return function (it) {
18209
- var O = toIndexedObject(it);
18210
- var keys = objectKeys(O);
18211
- var length = keys.length;
18212
- var i = 0;
18213
- var result = [];
18214
- var key;
18215
- while (length > i) {
18216
- key = keys[i++];
18217
- if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
18218
- push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
18219
- }
18220
- }
18221
- return result;
18222
- };
18223
- };
18224
-
18225
- var objectToArray = {
18226
- // `Object.entries` method
18227
- // https://tc39.es/ecma262/#sec-object.entries
18228
- entries: createMethod(true),
18229
- // `Object.values` method
18230
- // https://tc39.es/ecma262/#sec-object.values
18231
- values: createMethod(false)
18232
- };
18233
-
18234
- var $$1 = _export;
18235
- var $values = objectToArray.values;
18243
+ var testCards = [{
18244
+ type: 'bank_auth',
18245
+ name: 'Bank authorization',
18246
+ number: '4084080000000409',
18247
+ cvv: '000',
18248
+ month: '01',
18249
+ year: '30'
18250
+ }, {
18251
+ type: 'success',
18252
+ name: 'Success',
18253
+ number: '4084084084084081',
18254
+ cvv: '408',
18255
+ month: '12',
18256
+ year: '30'
18257
+ }, {
18258
+ type: 'declined',
18259
+ name: 'Declined',
18260
+ number: '4084080000005408',
18261
+ cvv: '001',
18262
+ month: '12',
18263
+ year: '30'
18264
+ }, {
18265
+ type: 'pin',
18266
+ name: 'Pin only validation',
18267
+ number: '507850785078507812',
18268
+ cvv: '884',
18269
+ month: '01',
18270
+ year: '30'
18271
+ }, {
18272
+ type: 'pin+otp',
18273
+ name: 'Pin and OTP validation',
18274
+ number: '5060666666666666666',
18275
+ cvv: '123',
18276
+ month: '01',
18277
+ year: '30'
18278
+ }, {
18279
+ type: 'pin+phone+otp',
18280
+ name: 'Pin, phone and OTP validation',
18281
+ number: '507850785078507812',
18282
+ cvv: '884',
18283
+ month: '01',
18284
+ year: '30'
18285
+ }, {
18286
+ type: 'default',
18287
+ name: 'No validation',
18288
+ number: '4084084084084081',
18289
+ cvv: '408',
18290
+ month: '01',
18291
+ year: '30'
18292
+ }];
18236
18293
 
18237
- // `Object.values` method
18238
- // https://tc39.es/ecma262/#sec-object.values
18239
- $$1({ target: 'Object', stat: true }, {
18240
- values: function values(O) {
18241
- return $values(O);
18294
+ cardValidator.creditCardType.addCard({
18295
+ niceType: 'Verve',
18296
+ type: 'verve',
18297
+ patterns: [[506000, 507999], [650000, 650009]],
18298
+ gaps: [4, 8, 12, 16],
18299
+ lengths: [16, 18, 19],
18300
+ code: {
18301
+ name: 'CVV',
18302
+ size: 3
18242
18303
  }
18243
18304
  });
18244
-
18305
+ cardValidator.creditCardType.changeOrder('verve', 0);
18245
18306
  var Card$2 = {
18246
18307
  getEncryptedPin: function getEncryptedPin(pin) {
18247
18308
  return pin ? encrypt(pin) : undefined;
@@ -18312,7 +18373,7 @@ var Card$2 = {
18312
18373
  return Card$2.validateCVV(cvv, cardType).isValid;
18313
18374
  },
18314
18375
  validateExpiry: function validateExpiry(value) {
18315
- if (_typeof$1(value) === 'object') {
18376
+ if (value !== null && _typeof$1(value) === 'object') {
18316
18377
  var month = value.month,
18317
18378
  year = value.year;
18318
18379
  return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
@@ -18322,73 +18383,15 @@ var Card$2 = {
18322
18383
  },
18323
18384
  isExpiryValid: function isExpiryValid(value) {
18324
18385
  return Card$2.validateExpiry(value).isValid;
18386
+ },
18387
+ findTestCard: function findTestCard(cardType) {
18388
+ var type = cardType || 'default';
18389
+ return testCards.find(function (card) {
18390
+ return card.type === type;
18391
+ });
18325
18392
  }
18326
18393
  };
18327
18394
 
18328
- var testCards = [{
18329
- type: 'bank_auth',
18330
- name: 'Bank authorization',
18331
- number: '4084080000000409',
18332
- cvv: '000',
18333
- month: '01',
18334
- year: '30'
18335
- }, {
18336
- type: 'success',
18337
- name: 'Success',
18338
- number: '4084084084084081',
18339
- cvv: '408',
18340
- month: '12',
18341
- year: '30'
18342
- }, {
18343
- type: 'declined',
18344
- name: 'Declined',
18345
- number: '4084080000005408',
18346
- cvv: '001',
18347
- month: '12',
18348
- year: '30'
18349
- }, {
18350
- type: 'pin',
18351
- name: 'Pin only validation',
18352
- number: '507850785078507812',
18353
- cvv: '884',
18354
- month: '01',
18355
- year: '30'
18356
- }, {
18357
- type: 'pin+otp',
18358
- name: 'Pin and OTP validation',
18359
- number: '5060666666666666666',
18360
- cvv: '123',
18361
- month: '01',
18362
- year: '30'
18363
- }, {
18364
- type: 'pin+phone+otp',
18365
- name: 'Pin, phone and OTP validation',
18366
- number: '507850785078507812',
18367
- cvv: '884',
18368
- month: '01',
18369
- year: '30'
18370
- }, {
18371
- type: 'default',
18372
- name: 'No validation',
18373
- number: '4084084084084081',
18374
- cvv: '408',
18375
- month: '01',
18376
- year: '30'
18377
- }];
18378
-
18379
- cardValidator.creditCardType.addCard({
18380
- niceType: 'Verve',
18381
- type: 'verve',
18382
- patterns: [[506000, 507999], [650000, 650009]],
18383
- gaps: [4, 8, 12, 16],
18384
- lengths: [16, 18, 19],
18385
- code: {
18386
- name: 'CVV',
18387
- size: 3
18388
- }
18389
- });
18390
- cardValidator.creditCardType.changeOrder('verve', 0);
18391
-
18392
18395
  var Card$1 = /*#__PURE__*/function () {
18393
18396
  function Card(_ref) {
18394
18397
  var number = _ref.number,
@@ -18478,11 +18481,7 @@ var Card$1 = /*#__PURE__*/function () {
18478
18481
  }, {
18479
18482
  key: "generateTestCard",
18480
18483
  value: function generateTestCard(cardType) {
18481
- var type = cardType || 'default';
18482
- var cardParams = testCards.find(function (card) {
18483
- return card.type === type;
18484
- });
18485
- return new Card(cardParams);
18484
+ return new Card(Card$2.findTestCard(cardType));
18486
18485
  }
18487
18486
  }]);
18488
18487
 
@@ -18665,209 +18664,6 @@ var CardAPI$1 = {
18665
18664
  }).then(function (response) {
18666
18665
  return ChargeResponses.parse(response.data);
18667
18666
  });
18668
- },
18669
- sendSavedCardsOTP: function sendSavedCardsOTP(email) {
18670
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18671
- var url, language, headers, _yield$axiosInstance$, data;
18672
-
18673
- return regeneratorRuntime.wrap(function _callee$(_context) {
18674
- while (1) {
18675
- switch (_context.prev = _context.next) {
18676
- case 0:
18677
- url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
18678
- language = getLanguage();
18679
- headers = _objectSpread2({}, language && {
18680
- 'Accept-Language': language
18681
- });
18682
- _context.next = 5;
18683
- return axiosInstance.post(url, {
18684
- email: email
18685
- }, {
18686
- headers: headers
18687
- });
18688
-
18689
- case 5:
18690
- _yield$axiosInstance$ = _context.sent;
18691
- data = _yield$axiosInstance$.data;
18692
- return _context.abrupt("return", data);
18693
-
18694
- case 8:
18695
- case "end":
18696
- return _context.stop();
18697
- }
18698
- }
18699
- }, _callee);
18700
- }))();
18701
- },
18702
- addUserToSavedCards: function addUserToSavedCards(_ref6) {
18703
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
18704
- var phone, email, url, language, headers, data, response;
18705
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
18706
- while (1) {
18707
- switch (_context2.prev = _context2.next) {
18708
- case 0:
18709
- phone = _ref6.phone, email = _ref6.email;
18710
- url = new URL('/user', configToUse.savedCardsApiUrl).toString();
18711
- language = getLanguage();
18712
- headers = _objectSpread2({}, language && {
18713
- 'Accept-Language': language
18714
- });
18715
- data = {
18716
- phone: phone,
18717
- email: email
18718
- };
18719
- _context2.next = 7;
18720
- return axiosInstance.post(url, data, {
18721
- headers: headers
18722
- });
18723
-
18724
- case 7:
18725
- response = _context2.sent;
18726
- return _context2.abrupt("return", response.data);
18727
-
18728
- case 9:
18729
- case "end":
18730
- return _context2.stop();
18731
- }
18732
- }
18733
- }, _callee2);
18734
- }))();
18735
- },
18736
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
18737
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
18738
- var code, email, transaction, url, language, headers, data, response;
18739
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
18740
- while (1) {
18741
- switch (_context3.prev = _context3.next) {
18742
- case 0:
18743
- code = _ref7.code, email = _ref7.email, transaction = _ref7.transaction;
18744
- url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
18745
- language = getLanguage();
18746
- headers = _objectSpread2({}, language && {
18747
- 'Accept-Language': language
18748
- });
18749
- data = {
18750
- code: code,
18751
- email: email,
18752
- transaction: transaction
18753
- };
18754
- _context3.next = 7;
18755
- return axiosInstance.post(url, data, {
18756
- headers: headers
18757
- });
18758
-
18759
- case 7:
18760
- response = _context3.sent;
18761
- return _context3.abrupt("return", response.data);
18762
-
18763
- case 9:
18764
- case "end":
18765
- return _context3.stop();
18766
- }
18767
- }
18768
- }, _callee3);
18769
- }))();
18770
- },
18771
- getSavedCards: function getSavedCards(_ref8) {
18772
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
18773
- var token, url, language, headers, response;
18774
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
18775
- while (1) {
18776
- switch (_context4.prev = _context4.next) {
18777
- case 0:
18778
- token = _ref8.token;
18779
- url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
18780
- language = getLanguage();
18781
- headers = _objectSpread2({
18782
- Authorization: "Bearer ".concat(token),
18783
- 'jwt-auth': true
18784
- }, language && {
18785
- 'Accept-Language': language
18786
- });
18787
- _context4.next = 6;
18788
- return axiosInstance.get(url, {
18789
- headers: headers
18790
- });
18791
-
18792
- case 6:
18793
- response = _context4.sent;
18794
- return _context4.abrupt("return", response.data);
18795
-
18796
- case 8:
18797
- case "end":
18798
- return _context4.stop();
18799
- }
18800
- }
18801
- }, _callee4);
18802
- }))();
18803
- },
18804
- deleteSavedCard: function deleteSavedCard(_ref9) {
18805
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
18806
- var cardCode, token, url, language, headers, response;
18807
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
18808
- while (1) {
18809
- switch (_context5.prev = _context5.next) {
18810
- case 0:
18811
- cardCode = _ref9.cardCode, token = _ref9.token;
18812
- url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
18813
- language = getLanguage();
18814
- headers = _objectSpread2({
18815
- Authorization: "Bearer ".concat(token),
18816
- 'jwt-auth': true
18817
- }, language && {
18818
- 'Accept-Language': language
18819
- });
18820
- _context5.next = 6;
18821
- return axiosInstance.delete(url, {
18822
- headers: headers
18823
- });
18824
-
18825
- case 6:
18826
- response = _context5.sent;
18827
- return _context5.abrupt("return", response.data);
18828
-
18829
- case 8:
18830
- case "end":
18831
- return _context5.stop();
18832
- }
18833
- }
18834
- }, _callee5);
18835
- }))();
18836
- },
18837
- chargeSavedCard: function chargeSavedCard(_ref10) {
18838
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
18839
- var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
18840
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
18841
- while (1) {
18842
- switch (_context6.prev = _context6.next) {
18843
- case 0:
18844
- token = _ref10.token, device = _ref10.device, cardCode = _ref10.cardCode, transaction = _ref10.transaction, selectedCurrency = _ref10.selectedCurrency;
18845
- url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
18846
- language = getLanguage();
18847
- headers = _objectSpread2({
18848
- Authorization: "Bearer ".concat(token),
18849
- 'jwt-auth': true
18850
- }, language && {
18851
- 'Accept-Language': language
18852
- });
18853
- data = {
18854
- device: device,
18855
- transaction: transaction,
18856
- selectedCurrency: selectedCurrency
18857
- };
18858
- return _context6.abrupt("return", axiosInstance.post(url, data, {
18859
- headers: headers
18860
- }).then(function (response) {
18861
- return ChargeResponses.parse(response.data);
18862
- }));
18863
-
18864
- case 6:
18865
- case "end":
18866
- return _context6.stop();
18867
- }
18868
- }
18869
- }, _callee6);
18870
- }))();
18871
18667
  }
18872
18668
  };
18873
18669
 
@@ -19048,75 +18844,6 @@ var CardCharge = {
19048
18844
  paymentMethod: paymentMethod$4
19049
18845
  };
19050
18846
  return this.listenForCharge(listenerOptions, callback);
19051
- },
19052
- sendSavedCardsOTP: function sendSavedCardsOTP() {
19053
- return CardAPI$1.sendSavedCardsOTP(this.email);
19054
- },
19055
- addUserToSavedCards: function addUserToSavedCards(_ref4) {
19056
- var phone = _ref4.phone;
19057
- return CardAPI$1.addUserToSavedCards({
19058
- phone: phone,
19059
- email: this.email
19060
- });
19061
- },
19062
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
19063
- var _this9 = this;
19064
-
19065
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19066
- var code, payload, response;
19067
- return regeneratorRuntime.wrap(function _callee$(_context) {
19068
- while (1) {
19069
- switch (_context.prev = _context.next) {
19070
- case 0:
19071
- code = _ref5.code;
19072
- payload = {
19073
- code: code,
19074
- email: _this9.email,
19075
- transaction: _this9.id
19076
- };
19077
- _context.prev = 2;
19078
- _context.next = 5;
19079
- return CardAPI$1.verifySavedCardsOtp(payload);
19080
-
19081
- case 5:
19082
- response = _context.sent;
19083
- _this9.savedCardsToken = response.data.token;
19084
- return _context.abrupt("return", response);
19085
-
19086
- case 10:
19087
- _context.prev = 10;
19088
- _context.t0 = _context["catch"](2);
19089
- _this9.savedCardsToken = null;
19090
- throw _context.t0;
19091
-
19092
- case 14:
19093
- case "end":
19094
- return _context.stop();
19095
- }
19096
- }
19097
- }, _callee, null, [[2, 10]]);
19098
- }))();
19099
- },
19100
- getSavedCards: function getSavedCards() {
19101
- return CardAPI$1.getSavedCards({
19102
- token: this.savedCardsToken
19103
- });
19104
- },
19105
- deleteSavedCard: function deleteSavedCard(cardCode) {
19106
- return CardAPI$1.deleteSavedCard({
19107
- cardCode: cardCode,
19108
- token: this.savedCardsToken
19109
- });
19110
- },
19111
- chargeSavedCard: function chargeSavedCard(_ref6) {
19112
- var cardCode = _ref6.cardCode;
19113
- return CardAPI$1.chargeSavedCard({
19114
- cardCode: cardCode,
19115
- transaction: this.id,
19116
- token: this.savedCardsToken,
19117
- device: this.deviceFingerprint,
19118
- selectedCurrency: this.currency
19119
- });
19120
18847
  }
19121
18848
  };
19122
18849
 
@@ -20445,8 +20172,6 @@ var TransactionInstance = /*#__PURE__*/function () {
20445
20172
  this.subscription = data.subscription || null;
20446
20173
  this.planDetails = data.plan_details || null;
20447
20174
  this.exchangeRate = data.exchange_rate || null;
20448
- this.savedCardsConfig = data.saved_cards || {};
20449
- this.savedCardsToken = null;
20450
20175
  /**
20451
20176
  * We initialize parameters we send to the API as empty strings
20452
20177
  * when we don't have them instead of null because the API expects
@@ -20787,19 +20512,6 @@ var Toolkit = /*#__PURE__*/function () {
20787
20512
  return Toolkit;
20788
20513
  }();
20789
20514
 
20790
- cardValidator.creditCardType.addCard({
20791
- niceType: 'Verve',
20792
- type: 'verve',
20793
- patterns: [[506000, 507999], [650000, 650009]],
20794
- gaps: [4, 8, 12, 16],
20795
- lengths: [16, 18, 19],
20796
- code: {
20797
- name: 'CVV',
20798
- size: 3
20799
- }
20800
- });
20801
- cardValidator.creditCardType.changeOrder('verve', 0);
20802
-
20803
20515
  var Card = /*#__PURE__*/function () {
20804
20516
  function Card(_ref) {
20805
20517
  var number = _ref.number,
@@ -20889,11 +20601,7 @@ var Card = /*#__PURE__*/function () {
20889
20601
  }, {
20890
20602
  key: "generateTestCard",
20891
20603
  value: function generateTestCard(cardType) {
20892
- var type = cardType || 'default';
20893
- var cardParams = testCards.find(function (card) {
20894
- return card.type === type;
20895
- });
20896
- return new Card(cardParams);
20604
+ return new Card(Card$2.findTestCard(cardType));
20897
20605
  }
20898
20606
  }]);
20899
20607
 
@@ -20924,120 +20632,7 @@ var CardAPI = {
20924
20632
  }).then(function (response) {
20925
20633
  return ChargeResponses.parse(response.data);
20926
20634
  });
20927
- } // charge({
20928
- // clientdata,
20929
- // last4,
20930
- // pin,
20931
- // trans,
20932
- // device,
20933
- // rememberCard,
20934
- // transactionType,
20935
- // subscription,
20936
- // customFields,
20937
- // }) {
20938
- // const url = `${config.paymentBaseUrl}charge/`;
20939
- // const language = getLanguage();
20940
- // const headers = {
20941
- // 'Content-Type': 'application/x-www-form-urlencoded',
20942
- // ...(language && { 'Accept-Language': language }),
20943
- // };
20944
- // const chargeParams = {
20945
- // clientdata,
20946
- // last4,
20947
- // trans,
20948
- // device,
20949
- // offset: new Date().getTimezoneOffset(),
20950
- // remember_card: rememberCard,
20951
- // ...(transactionType && { transaction_type: transactionType }),
20952
- // ...(subscription && { subscription }),
20953
- // ...(customFields && customFields),
20954
- // };
20955
- // if (pin) {
20956
- // chargeParams.handle = pin;
20957
- // }
20958
- // const urlEncodedParams = formurlencoded(chargeParams);
20959
- // return axiosInstance
20960
- // .post(url, urlEncodedParams, { headers })
20961
- // .then((response) => ChargeResponses.parse(response.data));
20962
- // },
20963
- // resumeCardCharge({ device, accessCode, pin }) {
20964
- // const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
20965
- // const language = getLanguage();
20966
- // const headers = {
20967
- // 'Content-Type': 'application/x-www-form-urlencoded',
20968
- // ...(language && { 'Accept-Language': language }),
20969
- // };
20970
- // const data = { device, ...(pin && { handle: pin }) };
20971
- // const urlEncodedData = formurlencoded(data);
20972
- // return axiosInstance
20973
- // .post(url, urlEncodedData, { headers })
20974
- // .then((response) => ChargeResponses.parse(response.data));
20975
- // },
20976
- // chargeRememberedCard({
20977
- // last4,
20978
- // trans,
20979
- // device,
20980
- // authorizationCode,
20981
- // cvv,
20982
- // pin,
20983
- // transactionType,
20984
- // subscription,
20985
- // }) {
20986
- // const url = `${config.paymentBaseUrl}charge/`;
20987
- // const language = getLanguage();
20988
- // const headers = {
20989
- // 'Content-Type': 'application/x-www-form-urlencoded',
20990
- // ...(language && { 'Accept-Language': language }),
20991
- // };
20992
- // const chargeParams = {
20993
- // last4,
20994
- // trans,
20995
- // device,
20996
- // cvv,
20997
- // handle: pin,
20998
- // authorization_code: authorizationCode,
20999
- // ...(transactionType && { transaction_type: transactionType }),
21000
- // ...(subscription && { subscription }),
21001
- // };
21002
- // const urlEncodedParams = formurlencoded(chargeParams);
21003
- // return axiosInstance
21004
- // .post(url, urlEncodedParams, { headers })
21005
- // .then((response) => ChargeResponses.parse(response.data));
21006
- // },
21007
- // verifyAddress({ address, city, state, zipCode, transactionId }) {
21008
- // const url = `${config.paymentBaseUrl}charge/avs`;
21009
- // const language = getLanguage();
21010
- // const headers = {
21011
- // 'Content-Type': 'application/x-www-form-urlencoded',
21012
- // ...(language && { 'Accept-Language': language }),
21013
- // };
21014
- // const data = {
21015
- // city,
21016
- // state,
21017
- // address,
21018
- // zip_code: zipCode,
21019
- // trans: transactionId,
21020
- // };
21021
- // const urlEncodedData = formurlencoded(data);
21022
- // return axiosInstance
21023
- // .post(url, urlEncodedData, { headers })
21024
- // .then((response) => ChargeResponses.parse(response.data));
21025
- // },
21026
- // forgetRememberedCard({ authorizationId, publicKey }) {
21027
- // const language = getLanguage();
21028
- // const headers = {
21029
- // Authorization: `Bearer ${publicKey}`,
21030
- // ...(language && { 'Accept-Language': language }),
21031
- // };
21032
- // const params = {
21033
- // authorization_id: authorizationId,
21034
- // };
21035
- // const url = `${config.paystackApiUrl}rememberme/forget_card`;
21036
- // return axiosInstance
21037
- // .post(url, params, { headers })
21038
- // .then((response) => ChargeResponses.parse(response.data));
21039
- // },
21040
-
20635
+ }
21041
20636
  };
21042
20637
 
21043
20638
  var paymentMethod = 'card';
@@ -21059,7 +20654,7 @@ function validate(card, isSetter) {
21059
20654
  });
21060
20655
  }
21061
20656
 
21062
- var ReserveCardFunds = {
20657
+ var CardPreauthorization = {
21063
20658
  setCard: function setCard(params) {
21064
20659
  var _this = this;
21065
20660
 
@@ -21097,112 +20692,7 @@ var ReserveCardFunds = {
21097
20692
  paymentMethod: paymentMethod
21098
20693
  };
21099
20694
  return this.listenForCharge(listenerOptions, callback);
21100
- } // rememberCard() {
21101
- // this.remember_card = true;
21102
- // },
21103
- // chargeCard(customFields = {}) {
21104
- // if (!this.card.number && this.card.pin) {
21105
- // return this.chargeCardWithPin(customFields);
21106
- // }
21107
- // return validate(this.card).then(() => {
21108
- // this.logAttempt(paymentMethod);
21109
- // const chargeParams = {
21110
- // clientdata: this.card.tokenize(),
21111
- // last4: this.card.getLast4(),
21112
- // pin: this.card.getEncryptedPin(),
21113
- // trans: this.id,
21114
- // device: this.deviceFingerprint,
21115
- // rememberCard: this.remember_card,
21116
- // transactionType: this.transactionType,
21117
- // subscription: this.subscription,
21118
- // customFields,
21119
- // };
21120
- // return CardAPI.charge(chargeParams).then((response) => {
21121
- // this.logAPIResponse(response, paymentMethod);
21122
- // return response;
21123
- // });
21124
- // });
21125
- // },
21126
-
21127
- /**
21128
- * Handles submitting a card pin after
21129
- * other card details have been previously submitted.
21130
- */
21131
- // chargeCardWithPin(customFields = {}) {
21132
- // this.logAttempt(paymentMethod);
21133
- // const chargeParams = {
21134
- // pin: encrypt(this.card.pin),
21135
- // trans: this.id,
21136
- // device: this.deviceFingerprint,
21137
- // rememberCard: this.remember_card,
21138
- // transactionType: this.transactionType,
21139
- // subscription: this.subscription,
21140
- // customFields,
21141
- // };
21142
- // return CardAPI.charge(chargeParams).then((response) => {
21143
- // this.logAPIResponse(response, paymentMethod);
21144
- // return response;
21145
- // });
21146
- // },
21147
- // chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
21148
- // this.logAttempt(paymentMethod);
21149
- // const encryptedPin = encrypt(pin);
21150
- // const chargeParams = {
21151
- // authorizationCode,
21152
- // cvv,
21153
- // last4: cardLast4,
21154
- // trans: this.id,
21155
- // device: this.deviceFingerprint,
21156
- // pin: encryptedPin,
21157
- // transactionType: this.transactionType,
21158
- // subscription: this.subscription,
21159
- // };
21160
- // return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
21161
- // this.logAPIResponse(response, paymentMethod);
21162
- // return response;
21163
- // });
21164
- // },
21165
- // resumeCardCharge({ accessCode, pin }) {
21166
- // const params = {
21167
- // ...(pin && { pin: encrypt(pin) }),
21168
- // accessCode,
21169
- // device: this.deviceFingerprint,
21170
- // };
21171
- // return CardAPI.resumeCardCharge(params).then((response) => {
21172
- // this.logAPIResponse(response, paymentMethod);
21173
- // return response;
21174
- // });
21175
- // },
21176
- // forgetRememberedCard(authorizationId) {
21177
- // const params = {
21178
- // authorizationId,
21179
- // publicKey: this.merchant.key,
21180
- // };
21181
- // return CardAPI.forgetRememberedCard(params).then((response) => {
21182
- // this.logAPIResponse(response, paymentMethod);
21183
- // return response;
21184
- // });
21185
- // },
21186
- // authenticateCard(token) {
21187
- // return CardAPI.authenticate(this.id, token).then((response) => {
21188
- // this.logAPIResponse(response, paymentMethod);
21189
- // return response;
21190
- // });
21191
- // },
21192
- // verifyAddress({ address, city, state, zipCode }) {
21193
- // const payload = {
21194
- // city,
21195
- // state,
21196
- // address,
21197
- // zipCode,
21198
- // transactionId: this.id,
21199
- // };
21200
- // return CardAPI.verifyAddress(payload).then((response) => {
21201
- // this.logAPIResponse(response, paymentMethod);
21202
- // return response;
21203
- // });
21204
- // },
21205
-
20695
+ }
21206
20696
  };
21207
20697
 
21208
20698
  var PreauthorizationInstance = /*#__PURE__*/function () {
@@ -21229,7 +20719,7 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
21229
20719
  loadPusher(); // TODO: Analytics
21230
20720
  // https://paystack.atlassian.net/browse/RAILS-3070
21231
20721
 
21232
- Object.assign(this, ReserveCardFunds);
20722
+ Object.assign(this, CardPreauthorization);
21233
20723
  }
21234
20724
 
21235
20725
  _createClass(PreauthorizationInstance, [{
@@ -21263,8 +20753,6 @@ var PreauthorisationAPI = {
21263
20753
  });
21264
20754
  },
21265
20755
  requery: function requery() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
21266
- },
21267
- reserveFunds: function reserveFunds() {// TODO: https://paystack.atlassian.net/browse/RAILS-2887
21268
20756
  }
21269
20757
  };
21270
20758