@paystack/checkout-js 1.49.0-dev.2 → 1.49.0-dev.4

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/dist/checkout.js CHANGED
@@ -22065,7 +22065,7 @@ var Paystack = (function (exports) {
22065
22065
  };
22066
22066
 
22067
22067
  var PreauthorizationAPI = {
22068
- getByAccessCode: function getByAccessCode(accessCode) {
22068
+ verifyAccessCode: function verifyAccessCode(accessCode) {
22069
22069
  var language = getLanguage();
22070
22070
  var headers = _objectSpread2({}, language && {
22071
22071
  'Accept-Language': language
@@ -22092,6 +22092,20 @@ var Paystack = (function (exports) {
22092
22092
  }).then(function (response) {
22093
22093
  return ChargeResponses.parse(response.data);
22094
22094
  });
22095
+ },
22096
+ getByAccessCode: function getByAccessCode(accessCode, publicKey) {
22097
+ var language = getLanguage();
22098
+ var headers = _objectSpread2({
22099
+ Authorization: "Bearer ".concat(publicKey)
22100
+ }, language && {
22101
+ 'Accept-Language': language
22102
+ });
22103
+ var url = new URL("preauthorization/get_by_access_code/".concat(accessCode), configToUse.paystackApiUrl).toString();
22104
+ return axiosInstance.get(url, {
22105
+ headers: headers
22106
+ }).then(function (response) {
22107
+ return response.data;
22108
+ });
22095
22109
  }
22096
22110
  };
22097
22111
 
@@ -22277,7 +22291,7 @@ var Paystack = (function (exports) {
22277
22291
  this.isListening = false;
22278
22292
  this.isTest = data.domain === 'test';
22279
22293
  this.deviceFingerprint = data.deviceFingerprint || null;
22280
- this.accessCode = data.access_code;
22294
+ this.accessCode = data.accessCode || null;
22281
22295
  this.merchant = {
22282
22296
  id: data.merchant_id,
22283
22297
  logo: data.merchant_logo,
@@ -22321,23 +22335,23 @@ var Paystack = (function (exports) {
22321
22335
  initialize: function initialize(data) {
22322
22336
  return Object.seal(new PreauthorizationInstance(data));
22323
22337
  },
22324
- getByAccessCode: function getByAccessCode(accessCode) {
22338
+ requestWithAccessCode: function requestWithAccessCode(accessCode) {
22325
22339
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
22326
- var deviceFingerprint, response;
22340
+ var _yield$Promise$all, _yield$Promise$all2, response, deviceFingerprint;
22327
22341
  return regeneratorRuntime.wrap(function _callee$(_context) {
22328
22342
  while (1) {
22329
22343
  switch (_context.prev = _context.next) {
22330
22344
  case 0:
22331
22345
  _context.next = 2;
22332
- return getDeviceFingerprint();
22346
+ return Promise.all([PreauthorizationAPI.verifyAccessCode(accessCode), getDeviceFingerprint()]);
22333
22347
  case 2:
22334
- deviceFingerprint = _context.sent;
22335
- _context.next = 5;
22336
- return PreauthorizationAPI.getByAccessCode(accessCode);
22337
- case 5:
22338
- response = _context.sent;
22348
+ _yield$Promise$all = _context.sent;
22349
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
22350
+ response = _yield$Promise$all2[0];
22351
+ deviceFingerprint = _yield$Promise$all2[1];
22339
22352
  return _context.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {}, {
22340
- deviceFingerprint: deviceFingerprint
22353
+ deviceFingerprint: deviceFingerprint,
22354
+ accessCode: accessCode
22341
22355
  }))));
22342
22356
  case 7:
22343
22357
  case "end":
@@ -22346,6 +22360,32 @@ var Paystack = (function (exports) {
22346
22360
  }
22347
22361
  }, _callee);
22348
22362
  }))();
22363
+ },
22364
+ getByAccessCode: function getByAccessCode(accessCode, publicKey) {
22365
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
22366
+ var _yield$Promise$all3, _yield$Promise$all4, response, deviceFingerprint;
22367
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
22368
+ while (1) {
22369
+ switch (_context2.prev = _context2.next) {
22370
+ case 0:
22371
+ _context2.next = 2;
22372
+ return Promise.all([PreauthorizationAPI.getByAccessCode(accessCode, publicKey), getDeviceFingerprint()]);
22373
+ case 2:
22374
+ _yield$Promise$all3 = _context2.sent;
22375
+ _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
22376
+ response = _yield$Promise$all4[0];
22377
+ deviceFingerprint = _yield$Promise$all4[1];
22378
+ return _context2.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {}, {
22379
+ deviceFingerprint: deviceFingerprint,
22380
+ accessCode: accessCode
22381
+ }))));
22382
+ case 7:
22383
+ case "end":
22384
+ return _context2.stop();
22385
+ }
22386
+ }
22387
+ }, _callee2);
22388
+ }))();
22349
22389
  }
22350
22390
  };
22351
22391
 
package/es/checkout.js CHANGED
@@ -22062,7 +22062,7 @@ var CardPreauthorization = {
22062
22062
  };
22063
22063
 
22064
22064
  var PreauthorizationAPI = {
22065
- getByAccessCode: function getByAccessCode(accessCode) {
22065
+ verifyAccessCode: function verifyAccessCode(accessCode) {
22066
22066
  var language = getLanguage();
22067
22067
  var headers = _objectSpread2({}, language && {
22068
22068
  'Accept-Language': language
@@ -22089,6 +22089,20 @@ var PreauthorizationAPI = {
22089
22089
  }).then(function (response) {
22090
22090
  return ChargeResponses.parse(response.data);
22091
22091
  });
22092
+ },
22093
+ getByAccessCode: function getByAccessCode(accessCode, publicKey) {
22094
+ var language = getLanguage();
22095
+ var headers = _objectSpread2({
22096
+ Authorization: "Bearer ".concat(publicKey)
22097
+ }, language && {
22098
+ 'Accept-Language': language
22099
+ });
22100
+ var url = new URL("preauthorization/get_by_access_code/".concat(accessCode), configToUse.paystackApiUrl).toString();
22101
+ return axiosInstance.get(url, {
22102
+ headers: headers
22103
+ }).then(function (response) {
22104
+ return response.data;
22105
+ });
22092
22106
  }
22093
22107
  };
22094
22108
 
@@ -22274,7 +22288,7 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
22274
22288
  this.isListening = false;
22275
22289
  this.isTest = data.domain === 'test';
22276
22290
  this.deviceFingerprint = data.deviceFingerprint || null;
22277
- this.accessCode = data.access_code;
22291
+ this.accessCode = data.accessCode || null;
22278
22292
  this.merchant = {
22279
22293
  id: data.merchant_id,
22280
22294
  logo: data.merchant_logo,
@@ -22318,23 +22332,23 @@ var Preauthorization = {
22318
22332
  initialize: function initialize(data) {
22319
22333
  return Object.seal(new PreauthorizationInstance(data));
22320
22334
  },
22321
- getByAccessCode: function getByAccessCode(accessCode) {
22335
+ requestWithAccessCode: function requestWithAccessCode(accessCode) {
22322
22336
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
22323
- var deviceFingerprint, response;
22337
+ var _yield$Promise$all, _yield$Promise$all2, response, deviceFingerprint;
22324
22338
  return regeneratorRuntime.wrap(function _callee$(_context) {
22325
22339
  while (1) {
22326
22340
  switch (_context.prev = _context.next) {
22327
22341
  case 0:
22328
22342
  _context.next = 2;
22329
- return getDeviceFingerprint();
22343
+ return Promise.all([PreauthorizationAPI.verifyAccessCode(accessCode), getDeviceFingerprint()]);
22330
22344
  case 2:
22331
- deviceFingerprint = _context.sent;
22332
- _context.next = 5;
22333
- return PreauthorizationAPI.getByAccessCode(accessCode);
22334
- case 5:
22335
- response = _context.sent;
22345
+ _yield$Promise$all = _context.sent;
22346
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
22347
+ response = _yield$Promise$all2[0];
22348
+ deviceFingerprint = _yield$Promise$all2[1];
22336
22349
  return _context.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {}, {
22337
- deviceFingerprint: deviceFingerprint
22350
+ deviceFingerprint: deviceFingerprint,
22351
+ accessCode: accessCode
22338
22352
  }))));
22339
22353
  case 7:
22340
22354
  case "end":
@@ -22343,6 +22357,32 @@ var Preauthorization = {
22343
22357
  }
22344
22358
  }, _callee);
22345
22359
  }))();
22360
+ },
22361
+ getByAccessCode: function getByAccessCode(accessCode, publicKey) {
22362
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
22363
+ var _yield$Promise$all3, _yield$Promise$all4, response, deviceFingerprint;
22364
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
22365
+ while (1) {
22366
+ switch (_context2.prev = _context2.next) {
22367
+ case 0:
22368
+ _context2.next = 2;
22369
+ return Promise.all([PreauthorizationAPI.getByAccessCode(accessCode, publicKey), getDeviceFingerprint()]);
22370
+ case 2:
22371
+ _yield$Promise$all3 = _context2.sent;
22372
+ _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
22373
+ response = _yield$Promise$all4[0];
22374
+ deviceFingerprint = _yield$Promise$all4[1];
22375
+ return _context2.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {}, {
22376
+ deviceFingerprint: deviceFingerprint,
22377
+ accessCode: accessCode
22378
+ }))));
22379
+ case 7:
22380
+ case "end":
22381
+ return _context2.stop();
22382
+ }
22383
+ }
22384
+ }, _callee2);
22385
+ }))();
22346
22386
  }
22347
22387
  };
22348
22388
 
package/lib/checkout.js CHANGED
@@ -22066,7 +22066,7 @@ var CardPreauthorization = {
22066
22066
  };
22067
22067
 
22068
22068
  var PreauthorizationAPI = {
22069
- getByAccessCode: function getByAccessCode(accessCode) {
22069
+ verifyAccessCode: function verifyAccessCode(accessCode) {
22070
22070
  var language = getLanguage();
22071
22071
  var headers = _objectSpread2({}, language && {
22072
22072
  'Accept-Language': language
@@ -22093,6 +22093,20 @@ var PreauthorizationAPI = {
22093
22093
  }).then(function (response) {
22094
22094
  return ChargeResponses.parse(response.data);
22095
22095
  });
22096
+ },
22097
+ getByAccessCode: function getByAccessCode(accessCode, publicKey) {
22098
+ var language = getLanguage();
22099
+ var headers = _objectSpread2({
22100
+ Authorization: "Bearer ".concat(publicKey)
22101
+ }, language && {
22102
+ 'Accept-Language': language
22103
+ });
22104
+ var url = new URL("preauthorization/get_by_access_code/".concat(accessCode), configToUse.paystackApiUrl).toString();
22105
+ return axiosInstance.get(url, {
22106
+ headers: headers
22107
+ }).then(function (response) {
22108
+ return response.data;
22109
+ });
22096
22110
  }
22097
22111
  };
22098
22112
 
@@ -22278,7 +22292,7 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
22278
22292
  this.isListening = false;
22279
22293
  this.isTest = data.domain === 'test';
22280
22294
  this.deviceFingerprint = data.deviceFingerprint || null;
22281
- this.accessCode = data.access_code;
22295
+ this.accessCode = data.accessCode || null;
22282
22296
  this.merchant = {
22283
22297
  id: data.merchant_id,
22284
22298
  logo: data.merchant_logo,
@@ -22322,23 +22336,23 @@ var Preauthorization = {
22322
22336
  initialize: function initialize(data) {
22323
22337
  return Object.seal(new PreauthorizationInstance(data));
22324
22338
  },
22325
- getByAccessCode: function getByAccessCode(accessCode) {
22339
+ requestWithAccessCode: function requestWithAccessCode(accessCode) {
22326
22340
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
22327
- var deviceFingerprint, response;
22341
+ var _yield$Promise$all, _yield$Promise$all2, response, deviceFingerprint;
22328
22342
  return regeneratorRuntime.wrap(function _callee$(_context) {
22329
22343
  while (1) {
22330
22344
  switch (_context.prev = _context.next) {
22331
22345
  case 0:
22332
22346
  _context.next = 2;
22333
- return getDeviceFingerprint();
22347
+ return Promise.all([PreauthorizationAPI.verifyAccessCode(accessCode), getDeviceFingerprint()]);
22334
22348
  case 2:
22335
- deviceFingerprint = _context.sent;
22336
- _context.next = 5;
22337
- return PreauthorizationAPI.getByAccessCode(accessCode);
22338
- case 5:
22339
- response = _context.sent;
22349
+ _yield$Promise$all = _context.sent;
22350
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
22351
+ response = _yield$Promise$all2[0];
22352
+ deviceFingerprint = _yield$Promise$all2[1];
22340
22353
  return _context.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {}, {
22341
- deviceFingerprint: deviceFingerprint
22354
+ deviceFingerprint: deviceFingerprint,
22355
+ accessCode: accessCode
22342
22356
  }))));
22343
22357
  case 7:
22344
22358
  case "end":
@@ -22347,6 +22361,32 @@ var Preauthorization = {
22347
22361
  }
22348
22362
  }, _callee);
22349
22363
  }))();
22364
+ },
22365
+ getByAccessCode: function getByAccessCode(accessCode, publicKey) {
22366
+ return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
22367
+ var _yield$Promise$all3, _yield$Promise$all4, response, deviceFingerprint;
22368
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
22369
+ while (1) {
22370
+ switch (_context2.prev = _context2.next) {
22371
+ case 0:
22372
+ _context2.next = 2;
22373
+ return Promise.all([PreauthorizationAPI.getByAccessCode(accessCode, publicKey), getDeviceFingerprint()]);
22374
+ case 2:
22375
+ _yield$Promise$all3 = _context2.sent;
22376
+ _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
22377
+ response = _yield$Promise$all4[0];
22378
+ deviceFingerprint = _yield$Promise$all4[1];
22379
+ return _context2.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {}, {
22380
+ deviceFingerprint: deviceFingerprint,
22381
+ accessCode: accessCode
22382
+ }))));
22383
+ case 7:
22384
+ case "end":
22385
+ return _context2.stop();
22386
+ }
22387
+ }
22388
+ }, _callee2);
22389
+ }))();
22350
22390
  }
22351
22391
  };
22352
22392
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.49.0-dev.2",
3
+ "version": "1.49.0-dev.4",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",