@paystack/checkout-js 1.45.0-dev.4 → 1.45.1-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/lib/checkout.js CHANGED
@@ -6340,22 +6340,19 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6340
6340
  checkoutUrl: 'http://localhost:8080/',
6341
6341
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6342
6342
  paystackApiUrl: 'https://studio-api.paystack.co/',
6343
- pusherKey: '1c7b262ee18455815893',
6344
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6343
+ pusherKey: '1c7b262ee18455815893'
6345
6344
  });
6346
6345
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6347
6346
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6348
6347
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6349
6348
  paystackApiUrl: 'https://studio-api.paystack.co/',
6350
- pusherKey: '1c7b262ee18455815893',
6351
- pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6349
+ pusherKey: '1c7b262ee18455815893'
6352
6350
  });
6353
6351
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6354
6352
  checkoutUrl: 'https://checkout.paystack.com/',
6355
6353
  paymentBaseUrl: 'https://standard.paystack.co/',
6356
6354
  paystackApiUrl: 'https://api.paystack.co/',
6357
- pusherKey: '8e4b9b7ca3418bd5cdc8',
6358
- pusherUrl: 'https://checkout.paystack.com/static/vendor/pusher.min.js'
6355
+ pusherKey: '8e4b9b7ca3418bd5cdc8'
6359
6356
  });
6360
6357
  var configToEnvironmentMapping = {
6361
6358
  dev: devConfig,
@@ -6539,35 +6536,11 @@ var ChargeResponses = {
6539
6536
  }
6540
6537
  };
6541
6538
 
6542
- var pusherScriptId = 'pusher-script';
6543
- var pusherLoaded = function pusherLoaded() {
6544
- return document.getElementById(pusherScriptId);
6545
- };
6546
- var loadPusher = function loadPusher() {
6547
- if (!window) {
6548
- return Promise.reject(new Error('Window object not available'));
6549
- }
6550
- if (pusherLoaded()) {
6551
- return Promise.resolve(true);
6552
- }
6553
- return new Promise(function (resolve, reject) {
6554
- var script = document.createElement('script');
6555
- script.src = configToUse.pusherUrl;
6556
- script.id = pusherScriptId;
6557
- script.onload = function () {
6558
- resolve(true);
6559
- };
6560
- script.onerror = function () {
6561
- script.remove();
6562
- reject(new Error('Failed to load Pusher script'));
6563
- };
6564
- document.head.appendChild(script);
6565
- });
6566
- };
6539
+ /* eslint-env browser */
6567
6540
 
6568
6541
  // `context` is passed through to set the class property of `isListening` to true/false
6569
6542
  // and provide the logAPIResponse analytics function
6570
- // eslint-disable-next-line consistent-return
6543
+ // eslint-disable-next-line consistent-return, import/prefer-default-export
6571
6544
  var subscribeToChargeEvents = function subscribeToChargeEvents(options, context, callback) {
6572
6545
  var channel = options.channel,
6573
6546
  paymentMethod = options.paymentMethod;
@@ -12140,17 +12113,6 @@ var TransactionAPI = {
12140
12113
  }).then(function (response) {
12141
12114
  return response.data;
12142
12115
  });
12143
- },
12144
- initializeCustomerSubscriptionAuthorization: function initializeCustomerSubscriptionAuthorization(params, publicKey) {
12145
- var url = new URL('/customer/authorization/initialize_subscription', configToUse.paystackApiUrl).toString();
12146
- var headers = {
12147
- Authorization: "Bearer ".concat(publicKey)
12148
- };
12149
- return axiosInstance.post(url, params, {
12150
- headers: headers
12151
- }).then(function (response) {
12152
- return response.data;
12153
- });
12154
12116
  }
12155
12117
  };
12156
12118
 
@@ -12168,34 +12130,6 @@ var PayWithTransferAPI = {
12168
12130
  }).then(function (response) {
12169
12131
  return ChargeResponses.parse(response.data);
12170
12132
  });
12171
- },
12172
- incorrectAmountDecision: function incorrectAmountDecision(params, publicKey) {
12173
- var language = getLanguage();
12174
- var headers = _objectSpread2({
12175
- Authorization: "Bearer ".concat(publicKey)
12176
- }, language && {
12177
- 'Accept-Language': language
12178
- });
12179
- var url = new URL('pay-with-transfer/incorrect-amount/decision', configToUse.paystackApiUrl).toString();
12180
- return axiosInstance.post(url, params, {
12181
- headers: headers
12182
- }).then(function (response) {
12183
- return ChargeResponses.parse(response.data);
12184
- });
12185
- },
12186
- authenticatePayer: function authenticatePayer(params, publicKey) {
12187
- var language = getLanguage();
12188
- var headers = _objectSpread2({
12189
- Authorization: "Bearer ".concat(publicKey)
12190
- }, language && {
12191
- 'Accept-Language': language
12192
- });
12193
- var url = new URL('pay-with-transfer/authenticate-payer', configToUse.paystackApiUrl).toString();
12194
- return axiosInstance.post(url, params, {
12195
- headers: headers
12196
- }).then(function (response) {
12197
- return ChargeResponses.parse(response.data);
12198
- });
12199
12133
  }
12200
12134
  };
12201
12135
 
@@ -12224,25 +12158,6 @@ var PayWithTransferCharge = {
12224
12158
  paymentMethod: 'bank_transfer'
12225
12159
  };
12226
12160
  return this.listenForCharge(listenerOptions, callback);
12227
- },
12228
- sendIncorrectAmountDecision: function sendIncorrectAmountDecision(decisionMade) {
12229
- var params = {
12230
- transaction_id: this.id,
12231
- decision: decisionMade
12232
- };
12233
- return PayWithTransferAPI.incorrectAmountDecision(params, this.merchant.key);
12234
- },
12235
- sendAuthenticatePayer: function sendAuthenticatePayer(_ref2) {
12236
- var amountPaid = _ref2.amountPaid,
12237
- payerAccountNumber = _ref2.payerAccountNumber,
12238
- payerBankSlug = _ref2.payerBankSlug;
12239
- var params = {
12240
- transaction_id: this.id,
12241
- amount: amountPaid,
12242
- payer_account_number: payerAccountNumber,
12243
- payer_bank_slug: payerBankSlug
12244
- };
12245
- return PayWithTransferAPI.authenticatePayer(params, this.merchant.key);
12246
12161
  }
12247
12162
  };
12248
12163
 
@@ -21235,10 +21150,6 @@ var AnalyticsFunctions$1 = _objectSpread2(_objectSpread2({}, CapitecPayAnalytics
21235
21150
  },
21236
21151
  saveReferrer: function saveReferrer(referrer) {
21237
21152
  return AnalyticsAPI.saveReferrer(this.id, this.merchant.key, referrer);
21238
- },
21239
- setAmountByChannel: function setAmountByChannel(channelName) {
21240
- var _this$channelFeesConf;
21241
- this.amount = ((_this$channelFeesConf = this.channelFeesConfig[channelName]) === null || _this$channelFeesConf === void 0 ? void 0 : _this$channelFeesConf.amount) || this.originalAmount;
21242
21153
  }
21243
21154
  });
21244
21155
 
@@ -21382,7 +21293,7 @@ var linkAPI = {
21382
21293
  }, _callee4);
21383
21294
  }))();
21384
21295
  },
21385
- generateDirectDebitManagedAccount: function generateDirectDebitManagedAccount(params) {
21296
+ generateLinkManagedAccount: function generateLinkManagedAccount(params) {
21386
21297
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
21387
21298
  var url, language, headers, payload, response;
21388
21299
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -21549,28 +21460,12 @@ var linkChargeFunctions = {
21549
21460
  });
21550
21461
  },
21551
21462
  generateLinkManagedAccount: function generateLinkManagedAccount(params) {
21552
- return this.getDirectDebitManagedAccount(params);
21553
- },
21554
- getDirectDebitManagedAccount: function getDirectDebitManagedAccount(params) {
21555
- return linkAPI.generateDirectDebitManagedAccount(_objectSpread2(_objectSpread2({}, params), {}, {
21463
+ return linkAPI.generateLinkManagedAccount(_objectSpread2(_objectSpread2({}, params), {}, {
21556
21464
  device: this.deviceFingerprint,
21557
21465
  transactionId: this.id
21558
21466
  }));
21559
21467
  },
21560
- getManagedAccount: function getManagedAccount(_ref5) {
21561
- var fulfilLateNotification = _ref5.fulfilLateNotification,
21562
- preferredProvider = _ref5.preferredProvider;
21563
- var params = {
21564
- transaction_id: this.id,
21565
- fulfil_late_notification: fulfilLateNotification,
21566
- preferred_provider: preferredProvider
21567
- };
21568
- return PayWithTransferAPI.generateManagedAccount(params, this.merchant.key);
21569
- },
21570
21468
  listenForLinkBankPayWithTransferCharge: function listenForLinkBankPayWithTransferCharge(pusherChannel, callback) {
21571
- return this.listenForBankPayWithTransferCharge(pusherChannel, callback);
21572
- },
21573
- listenForBankPayWithTransferCharge: function listenForBankPayWithTransferCharge(pusherChannel, callback) {
21574
21469
  var listenerOptions = {
21575
21470
  channel: pusherChannel,
21576
21471
  paymentMethod: 'bank_transfer'
@@ -21604,7 +21499,6 @@ var TransactionInstance = /*#__PURE__*/function () {
21604
21499
  this.status = data.transaction_status || data.status;
21605
21500
  this.accessCode = data.access_code;
21606
21501
  this.amount = data.amount;
21607
- this.originalAmount = data.amount;
21608
21502
  this.domain = data.domain;
21609
21503
  this.isTest = data.domain === 'test';
21610
21504
  this.currency = data.currency;
@@ -21648,15 +21542,6 @@ var TransactionInstance = /*#__PURE__*/function () {
21648
21542
  this.reference = data.reference;
21649
21543
  this.linkConfig = data.link_config || {};
21650
21544
 
21651
- /**
21652
- * We initialize parameters we send to the API as empty strings
21653
- * when we don't have them instead of null because the API expects
21654
- * these parameters as URL params which means parameters are eventually converted to strings
21655
- */
21656
-
21657
- // Load pusher
21658
- loadPusher();
21659
-
21660
21545
  // Analytics
21661
21546
  this.log = null;
21662
21547
  Object.assign(this, AnalyticsFunctions$1);
@@ -21719,13 +21604,6 @@ var TransactionInstance = /*#__PURE__*/function () {
21719
21604
  return response && response.data;
21720
21605
  });
21721
21606
  }
21722
- }, {
21723
- key: "initializeCustomerSubscriptionAuthorization",
21724
- value: function initializeCustomerSubscriptionAuthorization(payload) {
21725
- return TransactionAPI.initializeCustomerSubscriptionAuthorization(payload, this.merchant.key).then(function (response) {
21726
- return response && response.data;
21727
- });
21728
- }
21729
21607
  }]);
21730
21608
  return TransactionInstance;
21731
21609
  }();
@@ -21789,7 +21667,7 @@ var Transaction = {
21789
21667
  }
21790
21668
  throw new Error('This function should be used with transaction data from the API');
21791
21669
  case 5:
21792
- return _context2.abrupt("return", Object.seal(new TransactionInstance(_objectSpread2(_objectSpread2({}, transactionData), {
21670
+ return _context2.abrupt("return", Object.seal(new TransactionInstance(_objectSpread2(_objectSpread2({}, transactionData), {}, {
21793
21671
  deviceFingerprint: deviceFingerprint
21794
21672
  }))));
21795
21673
  case 6:
@@ -21947,19 +21825,6 @@ var ToolkitAPI = {
21947
21825
  resolvedCardBins[bin] = data;
21948
21826
  return data;
21949
21827
  });
21950
- },
21951
- resolveIPAddress: function resolveIPAddress(ipAddress) {
21952
- var url = new URL("decision/resolve_ip/".concat(ipAddress), configToUse.paystackApiUrl).toString();
21953
- var language = getLanguage();
21954
- var headers = _objectSpread2({}, language && {
21955
- 'Accept-Language': language
21956
- });
21957
- return axiosInstance.get(url, {
21958
- headers: headers
21959
- }).then(function (_ref2) {
21960
- var data = _ref2.data;
21961
- return data;
21962
- });
21963
21828
  }
21964
21829
  };
21965
21830
 
@@ -22017,11 +21882,6 @@ var Toolkit = /*#__PURE__*/function () {
22017
21882
  value: function resolveCardBin(bin) {
22018
21883
  return ToolkitAPI.resolveCardBin(bin);
22019
21884
  }
22020
- }, {
22021
- key: "resolveIPAddress",
22022
- value: function resolveIPAddress(ipAddress) {
22023
- return ToolkitAPI.resolveIPAddress(ipAddress);
22024
- }
22025
21885
  }]);
22026
21886
  return Toolkit;
22027
21887
  }();
@@ -22309,7 +22169,6 @@ var AnalyticsFunctions = {
22309
22169
  return this.saveLog();
22310
22170
  },
22311
22171
  logAPIResponse: function logAPIResponse(response, channel) {
22312
- console.log('api response', response);
22313
22172
  switch (response.status) {
22314
22173
  case 'authorized':
22315
22174
  return this.logAuthorized(channel);
@@ -22417,7 +22276,6 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
22417
22276
  key: data.merchant_key
22418
22277
  };
22419
22278
  this.card = {};
22420
- loadPusher();
22421
22279
  this.log = null;
22422
22280
  Object.assign(this, AnalyticsFunctions);
22423
22281
  this.initializeLog(data.log);
@@ -22487,4 +22345,3 @@ exports.Card = Card$1;
22487
22345
  exports.Preauthorization = Preauthorization;
22488
22346
  exports.Toolkit = Toolkit;
22489
22347
  exports.Transaction = Transaction;
22490
- //# sourceMappingURL=checkout.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.45.0-dev.4",
3
+ "version": "1.45.1-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",