@paystack/checkout-js 1.20.0-dev.8 → 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
 
@@ -20791,19 +20792,6 @@ var Toolkit = /*#__PURE__*/function () {
20791
20792
  return Toolkit;
20792
20793
  }();
20793
20794
 
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
20795
  var Card = /*#__PURE__*/function () {
20808
20796
  function Card(_ref) {
20809
20797
  var number = _ref.number,
@@ -20893,11 +20881,7 @@ var Card = /*#__PURE__*/function () {
20893
20881
  }, {
20894
20882
  key: "generateTestCard",
20895
20883
  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);
20884
+ return new Card(Card$2.findTestCard(cardType));
20901
20885
  }
20902
20886
  }]);
20903
20887
 
@@ -20928,120 +20912,7 @@ var CardAPI = {
20928
20912
  }).then(function (response) {
20929
20913
  return ChargeResponses.parse(response.data);
20930
20914
  });
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
-
20915
+ }
21045
20916
  };
21046
20917
 
21047
20918
  var paymentMethod = 'card';
@@ -21101,112 +20972,7 @@ var ReserveCardFunds = {
21101
20972
  paymentMethod: paymentMethod
21102
20973
  };
21103
20974
  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
-
20975
+ }
21210
20976
  };
21211
20977
 
21212
20978
  var PreauthorizationInstance = /*#__PURE__*/function () {
@@ -21267,8 +21033,6 @@ var PreauthorisationAPI = {
21267
21033
  });
21268
21034
  },
21269
21035
  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
21036
  }
21273
21037
  };
21274
21038
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.20.0-dev.8",
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",