@paystack/checkout-js 1.20.0-dev.7 → 1.20.0-dev.9

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
@@ -17234,7 +17234,55 @@ function encrypt(toEncrypt) {
17234
17234
  return jsEncrypt.encrypt(toEncrypt);
17235
17235
  }
17236
17236
 
17237
+ var DESCRIPTORS = descriptors;
17238
+ var uncurryThis$1 = functionUncurryThis;
17239
+ var objectKeys = objectKeys$3;
17240
+ var toIndexedObject = toIndexedObject$8;
17241
+ var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
17242
+
17243
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
17244
+ var push = uncurryThis$1([].push);
17245
+
17246
+ // `Object.{ entries, values }` methods implementation
17247
+ var createMethod = function (TO_ENTRIES) {
17248
+ return function (it) {
17249
+ var O = toIndexedObject(it);
17250
+ var keys = objectKeys(O);
17251
+ var length = keys.length;
17252
+ var i = 0;
17253
+ var result = [];
17254
+ var key;
17255
+ while (length > i) {
17256
+ key = keys[i++];
17257
+ if (!DESCRIPTORS || propertyIsEnumerable(O, key)) {
17258
+ push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
17259
+ }
17260
+ }
17261
+ return result;
17262
+ };
17263
+ };
17264
+
17265
+ var objectToArray = {
17266
+ // `Object.entries` method
17267
+ // https://tc39.es/ecma262/#sec-object.entries
17268
+ entries: createMethod(true),
17269
+ // `Object.values` method
17270
+ // https://tc39.es/ecma262/#sec-object.values
17271
+ values: createMethod(false)
17272
+ };
17273
+
17237
17274
  var $$2 = _export;
17275
+ var $values = objectToArray.values;
17276
+
17277
+ // `Object.values` method
17278
+ // https://tc39.es/ecma262/#sec-object.values
17279
+ $$2({ target: 'Object', stat: true }, {
17280
+ values: function values(O) {
17281
+ return $values(O);
17282
+ }
17283
+ });
17284
+
17285
+ var $$1 = _export;
17238
17286
  var $find = arrayIteration.find;
17239
17287
  var addToUnscopables = addToUnscopables$3;
17240
17288
 
@@ -17246,7 +17294,7 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
17246
17294
 
17247
17295
  // `Array.prototype.find` method
17248
17296
  // https://tc39.es/ecma262/#sec-array.prototype.find
17249
- $$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17297
+ $$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
17250
17298
  find: function find(callbackfn /* , that = undefined */) {
17251
17299
  return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
17252
17300
  }
@@ -18194,54 +18242,69 @@ var cardValidator = {
18194
18242
  creditCardType: creditCardType_1
18195
18243
  };
18196
18244
 
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;
18245
+ var testCards = [{
18246
+ type: 'bank_auth',
18247
+ name: 'Bank authorization',
18248
+ number: '4084080000000409',
18249
+ cvv: '000',
18250
+ month: '01',
18251
+ year: '30'
18252
+ }, {
18253
+ type: 'success',
18254
+ name: 'Success',
18255
+ number: '4084084084084081',
18256
+ cvv: '408',
18257
+ month: '12',
18258
+ year: '30'
18259
+ }, {
18260
+ type: 'declined',
18261
+ name: 'Declined',
18262
+ number: '4084080000005408',
18263
+ cvv: '001',
18264
+ month: '12',
18265
+ year: '30'
18266
+ }, {
18267
+ type: 'pin',
18268
+ name: 'Pin only validation',
18269
+ number: '507850785078507812',
18270
+ cvv: '884',
18271
+ month: '01',
18272
+ year: '30'
18273
+ }, {
18274
+ type: 'pin+otp',
18275
+ name: 'Pin and OTP validation',
18276
+ number: '5060666666666666666',
18277
+ cvv: '123',
18278
+ month: '01',
18279
+ year: '30'
18280
+ }, {
18281
+ type: 'pin+phone+otp',
18282
+ name: 'Pin, phone and OTP validation',
18283
+ number: '507850785078507812',
18284
+ cvv: '884',
18285
+ month: '01',
18286
+ year: '30'
18287
+ }, {
18288
+ type: 'default',
18289
+ name: 'No validation',
18290
+ number: '4084084084084081',
18291
+ cvv: '408',
18292
+ month: '01',
18293
+ year: '30'
18294
+ }];
18236
18295
 
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);
18296
+ cardValidator.creditCardType.addCard({
18297
+ niceType: 'Verve',
18298
+ type: 'verve',
18299
+ patterns: [[506000, 507999], [650000, 650009]],
18300
+ gaps: [4, 8, 12, 16],
18301
+ lengths: [16, 18, 19],
18302
+ code: {
18303
+ name: 'CVV',
18304
+ size: 3
18242
18305
  }
18243
18306
  });
18244
-
18307
+ cardValidator.creditCardType.changeOrder('verve', 0);
18245
18308
  var Card$2 = {
18246
18309
  getEncryptedPin: function getEncryptedPin(pin) {
18247
18310
  return pin ? encrypt(pin) : undefined;
@@ -18322,73 +18385,15 @@ var Card$2 = {
18322
18385
  },
18323
18386
  isExpiryValid: function isExpiryValid(value) {
18324
18387
  return Card$2.validateExpiry(value).isValid;
18388
+ },
18389
+ findTestCard: function findTestCard(cardType) {
18390
+ var type = cardType || 'default';
18391
+ return testCards.find(function (card) {
18392
+ return card.type === type;
18393
+ });
18325
18394
  }
18326
18395
  };
18327
18396
 
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
18397
  var Card$1 = /*#__PURE__*/function () {
18393
18398
  function Card(_ref) {
18394
18399
  var number = _ref.number,
@@ -18478,11 +18483,7 @@ var Card$1 = /*#__PURE__*/function () {
18478
18483
  }, {
18479
18484
  key: "generateTestCard",
18480
18485
  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);
18486
+ return new Card(Card$2.findTestCard(cardType));
18486
18487
  }
18487
18488
  }]);
18488
18489
 
@@ -18666,7 +18667,7 @@ var CardAPI$1 = {
18666
18667
  return ChargeResponses.parse(response.data);
18667
18668
  });
18668
18669
  },
18669
- requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
18670
+ sendSavedCardsOTP: function sendSavedCardsOTP(email) {
18670
18671
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18671
18672
  var url, language, headers, _yield$axiosInstance$, data;
18672
18673
 
@@ -18674,13 +18675,15 @@ var CardAPI$1 = {
18674
18675
  while (1) {
18675
18676
  switch (_context.prev = _context.next) {
18676
18677
  case 0:
18677
- url = new URL("/authorize/".concat(phoneNumber), configToUse.savedCardsApiUrl).toString();
18678
+ url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
18678
18679
  language = getLanguage();
18679
18680
  headers = _objectSpread2({}, language && {
18680
18681
  'Accept-Language': language
18681
18682
  });
18682
18683
  _context.next = 5;
18683
18684
  return axiosInstance.post(url, {
18685
+ email: email
18686
+ }, {
18684
18687
  headers: headers
18685
18688
  });
18686
18689
 
@@ -19047,8 +19050,8 @@ var CardCharge = {
19047
19050
  };
19048
19051
  return this.listenForCharge(listenerOptions, callback);
19049
19052
  },
19050
- requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
19051
- return CardAPI$1.requestSavedCardsOTP(phoneNumber);
19053
+ sendSavedCardsOTP: function sendSavedCardsOTP() {
19054
+ return CardAPI$1.sendSavedCardsOTP(this.email);
19052
19055
  },
19053
19056
  addUserToSavedCards: function addUserToSavedCards(_ref4) {
19054
19057
  var phone = _ref4.phone;
@@ -20785,19 +20788,6 @@ var Toolkit = /*#__PURE__*/function () {
20785
20788
  return Toolkit;
20786
20789
  }();
20787
20790
 
20788
- cardValidator.creditCardType.addCard({
20789
- niceType: 'Verve',
20790
- type: 'verve',
20791
- patterns: [[506000, 507999], [650000, 650009]],
20792
- gaps: [4, 8, 12, 16],
20793
- lengths: [16, 18, 19],
20794
- code: {
20795
- name: 'CVV',
20796
- size: 3
20797
- }
20798
- });
20799
- cardValidator.creditCardType.changeOrder('verve', 0);
20800
-
20801
20791
  var Card = /*#__PURE__*/function () {
20802
20792
  function Card(_ref) {
20803
20793
  var number = _ref.number,
@@ -20887,11 +20877,7 @@ var Card = /*#__PURE__*/function () {
20887
20877
  }, {
20888
20878
  key: "generateTestCard",
20889
20879
  value: function generateTestCard(cardType) {
20890
- var type = cardType || 'default';
20891
- var cardParams = testCards.find(function (card) {
20892
- return card.type === type;
20893
- });
20894
- return new Card(cardParams);
20880
+ return new Card(Card$2.findTestCard(cardType));
20895
20881
  }
20896
20882
  }]);
20897
20883
 
@@ -20922,120 +20908,7 @@ var CardAPI = {
20922
20908
  }).then(function (response) {
20923
20909
  return ChargeResponses.parse(response.data);
20924
20910
  });
20925
- } // charge({
20926
- // clientdata,
20927
- // last4,
20928
- // pin,
20929
- // trans,
20930
- // device,
20931
- // rememberCard,
20932
- // transactionType,
20933
- // subscription,
20934
- // customFields,
20935
- // }) {
20936
- // const url = `${config.paymentBaseUrl}charge/`;
20937
- // const language = getLanguage();
20938
- // const headers = {
20939
- // 'Content-Type': 'application/x-www-form-urlencoded',
20940
- // ...(language && { 'Accept-Language': language }),
20941
- // };
20942
- // const chargeParams = {
20943
- // clientdata,
20944
- // last4,
20945
- // trans,
20946
- // device,
20947
- // offset: new Date().getTimezoneOffset(),
20948
- // remember_card: rememberCard,
20949
- // ...(transactionType && { transaction_type: transactionType }),
20950
- // ...(subscription && { subscription }),
20951
- // ...(customFields && customFields),
20952
- // };
20953
- // if (pin) {
20954
- // chargeParams.handle = pin;
20955
- // }
20956
- // const urlEncodedParams = formurlencoded(chargeParams);
20957
- // return axiosInstance
20958
- // .post(url, urlEncodedParams, { headers })
20959
- // .then((response) => ChargeResponses.parse(response.data));
20960
- // },
20961
- // resumeCardCharge({ device, accessCode, pin }) {
20962
- // const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
20963
- // const language = getLanguage();
20964
- // const headers = {
20965
- // 'Content-Type': 'application/x-www-form-urlencoded',
20966
- // ...(language && { 'Accept-Language': language }),
20967
- // };
20968
- // const data = { device, ...(pin && { handle: pin }) };
20969
- // const urlEncodedData = formurlencoded(data);
20970
- // return axiosInstance
20971
- // .post(url, urlEncodedData, { headers })
20972
- // .then((response) => ChargeResponses.parse(response.data));
20973
- // },
20974
- // chargeRememberedCard({
20975
- // last4,
20976
- // trans,
20977
- // device,
20978
- // authorizationCode,
20979
- // cvv,
20980
- // pin,
20981
- // transactionType,
20982
- // subscription,
20983
- // }) {
20984
- // const url = `${config.paymentBaseUrl}charge/`;
20985
- // const language = getLanguage();
20986
- // const headers = {
20987
- // 'Content-Type': 'application/x-www-form-urlencoded',
20988
- // ...(language && { 'Accept-Language': language }),
20989
- // };
20990
- // const chargeParams = {
20991
- // last4,
20992
- // trans,
20993
- // device,
20994
- // cvv,
20995
- // handle: pin,
20996
- // authorization_code: authorizationCode,
20997
- // ...(transactionType && { transaction_type: transactionType }),
20998
- // ...(subscription && { subscription }),
20999
- // };
21000
- // const urlEncodedParams = formurlencoded(chargeParams);
21001
- // return axiosInstance
21002
- // .post(url, urlEncodedParams, { headers })
21003
- // .then((response) => ChargeResponses.parse(response.data));
21004
- // },
21005
- // verifyAddress({ address, city, state, zipCode, transactionId }) {
21006
- // const url = `${config.paymentBaseUrl}charge/avs`;
21007
- // const language = getLanguage();
21008
- // const headers = {
21009
- // 'Content-Type': 'application/x-www-form-urlencoded',
21010
- // ...(language && { 'Accept-Language': language }),
21011
- // };
21012
- // const data = {
21013
- // city,
21014
- // state,
21015
- // address,
21016
- // zip_code: zipCode,
21017
- // trans: transactionId,
21018
- // };
21019
- // const urlEncodedData = formurlencoded(data);
21020
- // return axiosInstance
21021
- // .post(url, urlEncodedData, { headers })
21022
- // .then((response) => ChargeResponses.parse(response.data));
21023
- // },
21024
- // forgetRememberedCard({ authorizationId, publicKey }) {
21025
- // const language = getLanguage();
21026
- // const headers = {
21027
- // Authorization: `Bearer ${publicKey}`,
21028
- // ...(language && { 'Accept-Language': language }),
21029
- // };
21030
- // const params = {
21031
- // authorization_id: authorizationId,
21032
- // };
21033
- // const url = `${config.paystackApiUrl}rememberme/forget_card`;
21034
- // return axiosInstance
21035
- // .post(url, params, { headers })
21036
- // .then((response) => ChargeResponses.parse(response.data));
21037
- // },
21038
-
20911
+ }
21039
20912
  };
21040
20913
 
21041
20914
  var paymentMethod = 'card';
@@ -21095,112 +20968,7 @@ var ReserveCardFunds = {
21095
20968
  paymentMethod: paymentMethod
21096
20969
  };
21097
20970
  return this.listenForCharge(listenerOptions, callback);
21098
- } // rememberCard() {
21099
- // this.remember_card = true;
21100
- // },
21101
- // chargeCard(customFields = {}) {
21102
- // if (!this.card.number && this.card.pin) {
21103
- // return this.chargeCardWithPin(customFields);
21104
- // }
21105
- // return validate(this.card).then(() => {
21106
- // this.logAttempt(paymentMethod);
21107
- // const chargeParams = {
21108
- // clientdata: this.card.tokenize(),
21109
- // last4: this.card.getLast4(),
21110
- // pin: this.card.getEncryptedPin(),
21111
- // trans: this.id,
21112
- // device: this.deviceFingerprint,
21113
- // rememberCard: this.remember_card,
21114
- // transactionType: this.transactionType,
21115
- // subscription: this.subscription,
21116
- // customFields,
21117
- // };
21118
- // return CardAPI.charge(chargeParams).then((response) => {
21119
- // this.logAPIResponse(response, paymentMethod);
21120
- // return response;
21121
- // });
21122
- // });
21123
- // },
21124
-
21125
- /**
21126
- * Handles submitting a card pin after
21127
- * other card details have been previously submitted.
21128
- */
21129
- // chargeCardWithPin(customFields = {}) {
21130
- // this.logAttempt(paymentMethod);
21131
- // const chargeParams = {
21132
- // pin: encrypt(this.card.pin),
21133
- // trans: this.id,
21134
- // device: this.deviceFingerprint,
21135
- // rememberCard: this.remember_card,
21136
- // transactionType: this.transactionType,
21137
- // subscription: this.subscription,
21138
- // customFields,
21139
- // };
21140
- // return CardAPI.charge(chargeParams).then((response) => {
21141
- // this.logAPIResponse(response, paymentMethod);
21142
- // return response;
21143
- // });
21144
- // },
21145
- // chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
21146
- // this.logAttempt(paymentMethod);
21147
- // const encryptedPin = encrypt(pin);
21148
- // const chargeParams = {
21149
- // authorizationCode,
21150
- // cvv,
21151
- // last4: cardLast4,
21152
- // trans: this.id,
21153
- // device: this.deviceFingerprint,
21154
- // pin: encryptedPin,
21155
- // transactionType: this.transactionType,
21156
- // subscription: this.subscription,
21157
- // };
21158
- // return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
21159
- // this.logAPIResponse(response, paymentMethod);
21160
- // return response;
21161
- // });
21162
- // },
21163
- // resumeCardCharge({ accessCode, pin }) {
21164
- // const params = {
21165
- // ...(pin && { pin: encrypt(pin) }),
21166
- // accessCode,
21167
- // device: this.deviceFingerprint,
21168
- // };
21169
- // return CardAPI.resumeCardCharge(params).then((response) => {
21170
- // this.logAPIResponse(response, paymentMethod);
21171
- // return response;
21172
- // });
21173
- // },
21174
- // forgetRememberedCard(authorizationId) {
21175
- // const params = {
21176
- // authorizationId,
21177
- // publicKey: this.merchant.key,
21178
- // };
21179
- // return CardAPI.forgetRememberedCard(params).then((response) => {
21180
- // this.logAPIResponse(response, paymentMethod);
21181
- // return response;
21182
- // });
21183
- // },
21184
- // authenticateCard(token) {
21185
- // return CardAPI.authenticate(this.id, token).then((response) => {
21186
- // this.logAPIResponse(response, paymentMethod);
21187
- // return response;
21188
- // });
21189
- // },
21190
- // verifyAddress({ address, city, state, zipCode }) {
21191
- // const payload = {
21192
- // city,
21193
- // state,
21194
- // address,
21195
- // zipCode,
21196
- // transactionId: this.id,
21197
- // };
21198
- // return CardAPI.verifyAddress(payload).then((response) => {
21199
- // this.logAPIResponse(response, paymentMethod);
21200
- // return response;
21201
- // });
21202
- // },
21203
-
20971
+ }
21204
20972
  };
21205
20973
 
21206
20974
  var PreauthorizationInstance = /*#__PURE__*/function () {
@@ -21261,8 +21029,6 @@ var PreauthorisationAPI = {
21261
21029
  });
21262
21030
  },
21263
21031
  requery: function requery() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
21264
- },
21265
- reserveFunds: function reserveFunds() {// TODO: https://paystack.atlassian.net/browse/RAILS-2887
21266
21032
  }
21267
21033
  };
21268
21034