@paystack/checkout-js 1.28.0-dev.9 → 1.29.0-dev.1

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/README.md CHANGED
@@ -48,6 +48,6 @@ Checkout JS is deployed to three environments:
48
48
 
49
49
  Checkout JS is automatically packaged and published to the NPM registry on every push to the `master` and `dev` branches.
50
50
 
51
- The `master` branch is publised under the `latest` tag that can be installed by running `npm i @paystack/checkout-js@latest` while the `dev` branch is published under the `dev` tag so it can be installed using `npm i @paystack/checkout-js@dev`
51
+ The `master` branch is publised under the `latest` tag and can be installed by running `npm i @paystack/checkout-js@latest` while the `dev` branch is published under the `dev` tag and can be installed using `npm i @paystack/checkout-js@dev`
52
52
 
53
53
  All published versions are listed here on NPM https://www.npmjs.com/package/@paystack/checkout-js
package/dist/checkout.js CHANGED
@@ -11447,9 +11447,12 @@ var Paystack = (function (exports) {
11447
11447
  var TransactionAPI = {
11448
11448
  requestInline: function requestInline(params) {
11449
11449
  var language = getLanguage();
11450
+ var connectAccount = params.connect_account;
11450
11451
 
11451
- var headers = _objectSpread2({}, language && {
11452
+ var headers = _objectSpread2(_objectSpread2({}, language && {
11452
11453
  'Accept-Language': language
11454
+ }), connectAccount && {
11455
+ 'connect-account': connectAccount
11453
11456
  });
11454
11457
 
11455
11458
  var url = new URL('/checkout/request_inline', configToUse.paystackApiUrl).toString();
@@ -11552,6 +11555,17 @@ var Paystack = (function (exports) {
11552
11555
  }).then(function (response) {
11553
11556
  return response.data;
11554
11557
  });
11558
+ },
11559
+ initializeCustomerAuthorization: function initializeCustomerAuthorization(params, publicKey) {
11560
+ var headers = {
11561
+ Authorization: "Bearer ".concat(publicKey)
11562
+ };
11563
+ var url = new URL('/customer/authorization/initialize', configToUse.paystackApiUrl).toString();
11564
+ return axiosInstance.post(url, params, {
11565
+ headers: headers
11566
+ }).then(function (response) {
11567
+ return response.data;
11568
+ });
11555
11569
  }
11556
11570
  };
11557
11571
 
@@ -18757,21 +18771,23 @@ var Paystack = (function (exports) {
18757
18771
  },
18758
18772
  sendSavedCardsOTP: function sendSavedCardsOTP(_ref6) {
18759
18773
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18760
- var transaction, phone, channels, url, language, headers, data, response;
18774
+ var transaction, phone, channels, email, url, language, headers, data, response;
18761
18775
  return regeneratorRuntime.wrap(function _callee$(_context) {
18762
18776
  while (1) {
18763
18777
  switch (_context.prev = _context.next) {
18764
18778
  case 0:
18765
- transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels;
18779
+ transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels, email = _ref6.email;
18766
18780
  url = new URL('/saved_cards/authorize', configToUse.paystackApiUrl).toString();
18767
18781
  language = getLanguage();
18768
18782
  headers = _objectSpread2({}, language && {
18769
18783
  'Accept-Language': language
18770
18784
  });
18771
- data = _objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18785
+ data = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18772
18786
  phone: phone
18773
18787
  }), channels && {
18774
18788
  channels: channels
18789
+ }), email && {
18790
+ email: email
18775
18791
  }), {}, {
18776
18792
  transaction: transaction
18777
18793
  });
@@ -19116,46 +19132,48 @@ var Paystack = (function (exports) {
19116
19132
  };
19117
19133
  return this.listenForCharge(listenerOptions, callback);
19118
19134
  },
19119
- sendSavedCardsOTP: function sendSavedCardsOTP(phone, channels) {
19135
+ sendSavedCardsOTP: function sendSavedCardsOTP(_ref4) {
19120
19136
  var _this9 = this;
19121
19137
 
19122
19138
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19123
- var response;
19139
+ var phone, channels, email, response;
19124
19140
  return regeneratorRuntime.wrap(function _callee$(_context) {
19125
19141
  while (1) {
19126
19142
  switch (_context.prev = _context.next) {
19127
19143
  case 0:
19128
- _context.prev = 0;
19144
+ phone = _ref4.phone, channels = _ref4.channels, email = _ref4.email;
19145
+ _context.prev = 1;
19129
19146
 
19130
19147
  _this9.logAuth(savedCardMethods.authentication);
19131
19148
 
19132
- _context.next = 4;
19149
+ _context.next = 5;
19133
19150
  return CardAPI$1.sendSavedCardsOTP({
19134
19151
  phone: phone,
19135
19152
  transaction: _this9.id,
19136
- channels: channels
19153
+ channels: channels,
19154
+ email: email
19137
19155
  });
19138
19156
 
19139
- case 4:
19157
+ case 5:
19140
19158
  response = _context.sent;
19141
19159
  _this9.savedCardsTempAuthToken = response.data.token;
19142
19160
  return _context.abrupt("return", response);
19143
19161
 
19144
- case 9:
19145
- _context.prev = 9;
19146
- _context.t0 = _context["catch"](0);
19162
+ case 10:
19163
+ _context.prev = 10;
19164
+ _context.t0 = _context["catch"](1);
19147
19165
  _this9.savedCardsTempAuthToken = null;
19148
19166
  throw _context.t0;
19149
19167
 
19150
- case 13:
19168
+ case 14:
19151
19169
  case "end":
19152
19170
  return _context.stop();
19153
19171
  }
19154
19172
  }
19155
- }, _callee, null, [[0, 9]]);
19173
+ }, _callee, null, [[1, 10]]);
19156
19174
  }))();
19157
19175
  },
19158
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19176
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
19159
19177
  var _this10 = this;
19160
19178
 
19161
19179
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
@@ -19164,7 +19182,7 @@ var Paystack = (function (exports) {
19164
19182
  while (1) {
19165
19183
  switch (_context2.prev = _context2.next) {
19166
19184
  case 0:
19167
- code = _ref4.code;
19185
+ code = _ref5.code;
19168
19186
  payload = {
19169
19187
  code: code,
19170
19188
  transaction: _this10.id,
@@ -19204,10 +19222,10 @@ var Paystack = (function (exports) {
19204
19222
  token: this.savedCardsToken
19205
19223
  });
19206
19224
  },
19207
- chargeSavedCard: function chargeSavedCard(_ref5) {
19208
- var cardCode = _ref5.cardCode,
19209
- _ref5$selectedCurrenc = _ref5.selectedCurrency,
19210
- selectedCurrency = _ref5$selectedCurrenc === void 0 ? this.currency : _ref5$selectedCurrenc;
19225
+ chargeSavedCard: function chargeSavedCard(_ref6) {
19226
+ var cardCode = _ref6.cardCode,
19227
+ _ref6$selectedCurrenc = _ref6.selectedCurrency,
19228
+ selectedCurrency = _ref6$selectedCurrenc === void 0 ? this.currency : _ref6$selectedCurrenc;
19211
19229
  this.logAttempt(savedCardMethods.payment);
19212
19230
  return CardAPI$1.chargeSavedCard({
19213
19231
  cardCode: cardCode,
@@ -20702,6 +20720,13 @@ var Paystack = (function (exports) {
20702
20720
  return response && response.data;
20703
20721
  });
20704
20722
  }
20723
+ }, {
20724
+ key: "initializeCustomerAuthorization",
20725
+ value: function initializeCustomerAuthorization(payload) {
20726
+ return TransactionAPI.initializeCustomerAuthorization(payload, this.merchant.key).then(function (response) {
20727
+ return response && response.data;
20728
+ });
20729
+ }
20705
20730
  }]);
20706
20731
 
20707
20732
  return TransactionInstance;
package/es/checkout.js CHANGED
@@ -11444,9 +11444,12 @@ var getLanguage = function getLanguage() {
11444
11444
  var TransactionAPI = {
11445
11445
  requestInline: function requestInline(params) {
11446
11446
  var language = getLanguage();
11447
+ var connectAccount = params.connect_account;
11447
11448
 
11448
- var headers = _objectSpread2({}, language && {
11449
+ var headers = _objectSpread2(_objectSpread2({}, language && {
11449
11450
  'Accept-Language': language
11451
+ }), connectAccount && {
11452
+ 'connect-account': connectAccount
11450
11453
  });
11451
11454
 
11452
11455
  var url = new URL('/checkout/request_inline', configToUse.paystackApiUrl).toString();
@@ -11549,6 +11552,17 @@ var TransactionAPI = {
11549
11552
  }).then(function (response) {
11550
11553
  return response.data;
11551
11554
  });
11555
+ },
11556
+ initializeCustomerAuthorization: function initializeCustomerAuthorization(params, publicKey) {
11557
+ var headers = {
11558
+ Authorization: "Bearer ".concat(publicKey)
11559
+ };
11560
+ var url = new URL('/customer/authorization/initialize', configToUse.paystackApiUrl).toString();
11561
+ return axiosInstance.post(url, params, {
11562
+ headers: headers
11563
+ }).then(function (response) {
11564
+ return response.data;
11565
+ });
11552
11566
  }
11553
11567
  };
11554
11568
 
@@ -18754,21 +18768,23 @@ var CardAPI$1 = {
18754
18768
  },
18755
18769
  sendSavedCardsOTP: function sendSavedCardsOTP(_ref6) {
18756
18770
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18757
- var transaction, phone, channels, url, language, headers, data, response;
18771
+ var transaction, phone, channels, email, url, language, headers, data, response;
18758
18772
  return regeneratorRuntime.wrap(function _callee$(_context) {
18759
18773
  while (1) {
18760
18774
  switch (_context.prev = _context.next) {
18761
18775
  case 0:
18762
- transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels;
18776
+ transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels, email = _ref6.email;
18763
18777
  url = new URL('/saved_cards/authorize', configToUse.paystackApiUrl).toString();
18764
18778
  language = getLanguage();
18765
18779
  headers = _objectSpread2({}, language && {
18766
18780
  'Accept-Language': language
18767
18781
  });
18768
- data = _objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18782
+ data = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18769
18783
  phone: phone
18770
18784
  }), channels && {
18771
18785
  channels: channels
18786
+ }), email && {
18787
+ email: email
18772
18788
  }), {}, {
18773
18789
  transaction: transaction
18774
18790
  });
@@ -19113,46 +19129,48 @@ var CardCharge = {
19113
19129
  };
19114
19130
  return this.listenForCharge(listenerOptions, callback);
19115
19131
  },
19116
- sendSavedCardsOTP: function sendSavedCardsOTP(phone, channels) {
19132
+ sendSavedCardsOTP: function sendSavedCardsOTP(_ref4) {
19117
19133
  var _this9 = this;
19118
19134
 
19119
19135
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19120
- var response;
19136
+ var phone, channels, email, response;
19121
19137
  return regeneratorRuntime.wrap(function _callee$(_context) {
19122
19138
  while (1) {
19123
19139
  switch (_context.prev = _context.next) {
19124
19140
  case 0:
19125
- _context.prev = 0;
19141
+ phone = _ref4.phone, channels = _ref4.channels, email = _ref4.email;
19142
+ _context.prev = 1;
19126
19143
 
19127
19144
  _this9.logAuth(savedCardMethods.authentication);
19128
19145
 
19129
- _context.next = 4;
19146
+ _context.next = 5;
19130
19147
  return CardAPI$1.sendSavedCardsOTP({
19131
19148
  phone: phone,
19132
19149
  transaction: _this9.id,
19133
- channels: channels
19150
+ channels: channels,
19151
+ email: email
19134
19152
  });
19135
19153
 
19136
- case 4:
19154
+ case 5:
19137
19155
  response = _context.sent;
19138
19156
  _this9.savedCardsTempAuthToken = response.data.token;
19139
19157
  return _context.abrupt("return", response);
19140
19158
 
19141
- case 9:
19142
- _context.prev = 9;
19143
- _context.t0 = _context["catch"](0);
19159
+ case 10:
19160
+ _context.prev = 10;
19161
+ _context.t0 = _context["catch"](1);
19144
19162
  _this9.savedCardsTempAuthToken = null;
19145
19163
  throw _context.t0;
19146
19164
 
19147
- case 13:
19165
+ case 14:
19148
19166
  case "end":
19149
19167
  return _context.stop();
19150
19168
  }
19151
19169
  }
19152
- }, _callee, null, [[0, 9]]);
19170
+ }, _callee, null, [[1, 10]]);
19153
19171
  }))();
19154
19172
  },
19155
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19173
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
19156
19174
  var _this10 = this;
19157
19175
 
19158
19176
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
@@ -19161,7 +19179,7 @@ var CardCharge = {
19161
19179
  while (1) {
19162
19180
  switch (_context2.prev = _context2.next) {
19163
19181
  case 0:
19164
- code = _ref4.code;
19182
+ code = _ref5.code;
19165
19183
  payload = {
19166
19184
  code: code,
19167
19185
  transaction: _this10.id,
@@ -19201,10 +19219,10 @@ var CardCharge = {
19201
19219
  token: this.savedCardsToken
19202
19220
  });
19203
19221
  },
19204
- chargeSavedCard: function chargeSavedCard(_ref5) {
19205
- var cardCode = _ref5.cardCode,
19206
- _ref5$selectedCurrenc = _ref5.selectedCurrency,
19207
- selectedCurrency = _ref5$selectedCurrenc === void 0 ? this.currency : _ref5$selectedCurrenc;
19222
+ chargeSavedCard: function chargeSavedCard(_ref6) {
19223
+ var cardCode = _ref6.cardCode,
19224
+ _ref6$selectedCurrenc = _ref6.selectedCurrency,
19225
+ selectedCurrency = _ref6$selectedCurrenc === void 0 ? this.currency : _ref6$selectedCurrenc;
19208
19226
  this.logAttempt(savedCardMethods.payment);
19209
19227
  return CardAPI$1.chargeSavedCard({
19210
19228
  cardCode: cardCode,
@@ -20699,6 +20717,13 @@ var TransactionInstance = /*#__PURE__*/function () {
20699
20717
  return response && response.data;
20700
20718
  });
20701
20719
  }
20720
+ }, {
20721
+ key: "initializeCustomerAuthorization",
20722
+ value: function initializeCustomerAuthorization(payload) {
20723
+ return TransactionAPI.initializeCustomerAuthorization(payload, this.merchant.key).then(function (response) {
20724
+ return response && response.data;
20725
+ });
20726
+ }
20702
20727
  }]);
20703
20728
 
20704
20729
  return TransactionInstance;
package/lib/checkout.js CHANGED
@@ -11448,9 +11448,12 @@ var getLanguage = function getLanguage() {
11448
11448
  var TransactionAPI = {
11449
11449
  requestInline: function requestInline(params) {
11450
11450
  var language = getLanguage();
11451
+ var connectAccount = params.connect_account;
11451
11452
 
11452
- var headers = _objectSpread2({}, language && {
11453
+ var headers = _objectSpread2(_objectSpread2({}, language && {
11453
11454
  'Accept-Language': language
11455
+ }), connectAccount && {
11456
+ 'connect-account': connectAccount
11454
11457
  });
11455
11458
 
11456
11459
  var url = new URL('/checkout/request_inline', configToUse.paystackApiUrl).toString();
@@ -11553,6 +11556,17 @@ var TransactionAPI = {
11553
11556
  }).then(function (response) {
11554
11557
  return response.data;
11555
11558
  });
11559
+ },
11560
+ initializeCustomerAuthorization: function initializeCustomerAuthorization(params, publicKey) {
11561
+ var headers = {
11562
+ Authorization: "Bearer ".concat(publicKey)
11563
+ };
11564
+ var url = new URL('/customer/authorization/initialize', configToUse.paystackApiUrl).toString();
11565
+ return axiosInstance.post(url, params, {
11566
+ headers: headers
11567
+ }).then(function (response) {
11568
+ return response.data;
11569
+ });
11556
11570
  }
11557
11571
  };
11558
11572
 
@@ -18758,21 +18772,23 @@ var CardAPI$1 = {
18758
18772
  },
18759
18773
  sendSavedCardsOTP: function sendSavedCardsOTP(_ref6) {
18760
18774
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
18761
- var transaction, phone, channels, url, language, headers, data, response;
18775
+ var transaction, phone, channels, email, url, language, headers, data, response;
18762
18776
  return regeneratorRuntime.wrap(function _callee$(_context) {
18763
18777
  while (1) {
18764
18778
  switch (_context.prev = _context.next) {
18765
18779
  case 0:
18766
- transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels;
18780
+ transaction = _ref6.transaction, phone = _ref6.phone, channels = _ref6.channels, email = _ref6.email;
18767
18781
  url = new URL('/saved_cards/authorize', configToUse.paystackApiUrl).toString();
18768
18782
  language = getLanguage();
18769
18783
  headers = _objectSpread2({}, language && {
18770
18784
  'Accept-Language': language
18771
18785
  });
18772
- data = _objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18786
+ data = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, phone && {
18773
18787
  phone: phone
18774
18788
  }), channels && {
18775
18789
  channels: channels
18790
+ }), email && {
18791
+ email: email
18776
18792
  }), {}, {
18777
18793
  transaction: transaction
18778
18794
  });
@@ -19117,46 +19133,48 @@ var CardCharge = {
19117
19133
  };
19118
19134
  return this.listenForCharge(listenerOptions, callback);
19119
19135
  },
19120
- sendSavedCardsOTP: function sendSavedCardsOTP(phone, channels) {
19136
+ sendSavedCardsOTP: function sendSavedCardsOTP(_ref4) {
19121
19137
  var _this9 = this;
19122
19138
 
19123
19139
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
19124
- var response;
19140
+ var phone, channels, email, response;
19125
19141
  return regeneratorRuntime.wrap(function _callee$(_context) {
19126
19142
  while (1) {
19127
19143
  switch (_context.prev = _context.next) {
19128
19144
  case 0:
19129
- _context.prev = 0;
19145
+ phone = _ref4.phone, channels = _ref4.channels, email = _ref4.email;
19146
+ _context.prev = 1;
19130
19147
 
19131
19148
  _this9.logAuth(savedCardMethods.authentication);
19132
19149
 
19133
- _context.next = 4;
19150
+ _context.next = 5;
19134
19151
  return CardAPI$1.sendSavedCardsOTP({
19135
19152
  phone: phone,
19136
19153
  transaction: _this9.id,
19137
- channels: channels
19154
+ channels: channels,
19155
+ email: email
19138
19156
  });
19139
19157
 
19140
- case 4:
19158
+ case 5:
19141
19159
  response = _context.sent;
19142
19160
  _this9.savedCardsTempAuthToken = response.data.token;
19143
19161
  return _context.abrupt("return", response);
19144
19162
 
19145
- case 9:
19146
- _context.prev = 9;
19147
- _context.t0 = _context["catch"](0);
19163
+ case 10:
19164
+ _context.prev = 10;
19165
+ _context.t0 = _context["catch"](1);
19148
19166
  _this9.savedCardsTempAuthToken = null;
19149
19167
  throw _context.t0;
19150
19168
 
19151
- case 13:
19169
+ case 14:
19152
19170
  case "end":
19153
19171
  return _context.stop();
19154
19172
  }
19155
19173
  }
19156
- }, _callee, null, [[0, 9]]);
19174
+ }, _callee, null, [[1, 10]]);
19157
19175
  }))();
19158
19176
  },
19159
- verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
19177
+ verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
19160
19178
  var _this10 = this;
19161
19179
 
19162
19180
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
@@ -19165,7 +19183,7 @@ var CardCharge = {
19165
19183
  while (1) {
19166
19184
  switch (_context2.prev = _context2.next) {
19167
19185
  case 0:
19168
- code = _ref4.code;
19186
+ code = _ref5.code;
19169
19187
  payload = {
19170
19188
  code: code,
19171
19189
  transaction: _this10.id,
@@ -19205,10 +19223,10 @@ var CardCharge = {
19205
19223
  token: this.savedCardsToken
19206
19224
  });
19207
19225
  },
19208
- chargeSavedCard: function chargeSavedCard(_ref5) {
19209
- var cardCode = _ref5.cardCode,
19210
- _ref5$selectedCurrenc = _ref5.selectedCurrency,
19211
- selectedCurrency = _ref5$selectedCurrenc === void 0 ? this.currency : _ref5$selectedCurrenc;
19226
+ chargeSavedCard: function chargeSavedCard(_ref6) {
19227
+ var cardCode = _ref6.cardCode,
19228
+ _ref6$selectedCurrenc = _ref6.selectedCurrency,
19229
+ selectedCurrency = _ref6$selectedCurrenc === void 0 ? this.currency : _ref6$selectedCurrenc;
19212
19230
  this.logAttempt(savedCardMethods.payment);
19213
19231
  return CardAPI$1.chargeSavedCard({
19214
19232
  cardCode: cardCode,
@@ -20703,6 +20721,13 @@ var TransactionInstance = /*#__PURE__*/function () {
20703
20721
  return response && response.data;
20704
20722
  });
20705
20723
  }
20724
+ }, {
20725
+ key: "initializeCustomerAuthorization",
20726
+ value: function initializeCustomerAuthorization(payload) {
20727
+ return TransactionAPI.initializeCustomerAuthorization(payload, this.merchant.key).then(function (response) {
20728
+ return response && response.data;
20729
+ });
20730
+ }
20706
20731
  }]);
20707
20732
 
20708
20733
  return TransactionInstance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.28.0-dev.9",
3
+ "version": "1.29.0-dev.1",
4
4
  "description": "Client-side JS library for billing on Paystack",
5
5
  "main": "lib/checkout.js",
6
6
  "module": "es/checkout.js",