@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/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
 
@@ -20787,19 +20788,6 @@ var Toolkit = /*#__PURE__*/function () {
20787
20788
  return Toolkit;
20788
20789
  }();
20789
20790
 
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
20791
  var Card = /*#__PURE__*/function () {
20804
20792
  function Card(_ref) {
20805
20793
  var number = _ref.number,
@@ -20889,11 +20877,7 @@ var Card = /*#__PURE__*/function () {
20889
20877
  }, {
20890
20878
  key: "generateTestCard",
20891
20879
  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);
20880
+ return new Card(Card$2.findTestCard(cardType));
20897
20881
  }
20898
20882
  }]);
20899
20883
 
@@ -20924,120 +20908,7 @@ var CardAPI = {
20924
20908
  }).then(function (response) {
20925
20909
  return ChargeResponses.parse(response.data);
20926
20910
  });
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
-
20911
+ }
21041
20912
  };
21042
20913
 
21043
20914
  var paymentMethod = 'card';
@@ -21097,112 +20968,7 @@ var ReserveCardFunds = {
21097
20968
  paymentMethod: paymentMethod
21098
20969
  };
21099
20970
  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
-
20971
+ }
21206
20972
  };
21207
20973
 
21208
20974
  var PreauthorizationInstance = /*#__PURE__*/function () {
@@ -21263,8 +21029,6 @@ var PreauthorisationAPI = {
21263
21029
  });
21264
21030
  },
21265
21031
  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
21032
  }
21269
21033
  };
21270
21034