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