@paystack/checkout-js 1.45.1-dev.1 → 1.46.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/dist/checkout.js CHANGED
@@ -6339,19 +6339,22 @@ var Paystack = (function (exports) {
6339
6339
  checkoutUrl: 'http://localhost:8080/',
6340
6340
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6341
6341
  paystackApiUrl: 'https://studio-api.paystack.co/',
6342
- pusherKey: '1c7b262ee18455815893'
6342
+ pusherKey: '1c7b262ee18455815893',
6343
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6343
6344
  });
6344
6345
  var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6345
6346
  checkoutUrl: 'https://checkout-studio.paystack.com/',
6346
6347
  paymentBaseUrl: 'https://legacy-staging.paystack.co/',
6347
6348
  paystackApiUrl: 'https://studio-api.paystack.co/',
6348
- pusherKey: '1c7b262ee18455815893'
6349
+ pusherKey: '1c7b262ee18455815893',
6350
+ pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
6349
6351
  });
6350
6352
  var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
6351
6353
  checkoutUrl: 'https://checkout.paystack.com/',
6352
6354
  paymentBaseUrl: 'https://standard.paystack.co/',
6353
6355
  paystackApiUrl: 'https://api.paystack.co/',
6354
- pusherKey: '8e4b9b7ca3418bd5cdc8'
6356
+ pusherKey: '8e4b9b7ca3418bd5cdc8',
6357
+ pusherUrl: 'https://checkout.paystack.com/static/vendor/pusher.min.js'
6355
6358
  });
6356
6359
  var configToEnvironmentMapping = {
6357
6360
  dev: devConfig,
@@ -12112,6 +12115,17 @@ var Paystack = (function (exports) {
12112
12115
  }).then(function (response) {
12113
12116
  return response.data;
12114
12117
  });
12118
+ },
12119
+ initializeCustomerSubscriptionAuthorization: function initializeCustomerSubscriptionAuthorization(params, publicKey) {
12120
+ var url = new URL('/customer/authorization/initialize_subscription', configToUse.paystackApiUrl).toString();
12121
+ var headers = {
12122
+ Authorization: "Bearer ".concat(publicKey)
12123
+ };
12124
+ return axiosInstance.post(url, params, {
12125
+ headers: headers
12126
+ }).then(function (response) {
12127
+ return response.data;
12128
+ });
12115
12129
  }
12116
12130
  };
12117
12131
 
@@ -12129,6 +12143,34 @@ var Paystack = (function (exports) {
12129
12143
  }).then(function (response) {
12130
12144
  return ChargeResponses.parse(response.data);
12131
12145
  });
12146
+ },
12147
+ incorrectAmountDecision: function incorrectAmountDecision(params, publicKey) {
12148
+ var language = getLanguage();
12149
+ var headers = _objectSpread2({
12150
+ Authorization: "Bearer ".concat(publicKey)
12151
+ }, language && {
12152
+ 'Accept-Language': language
12153
+ });
12154
+ var url = new URL('pay-with-transfer/incorrect-amount/decision', configToUse.paystackApiUrl).toString();
12155
+ return axiosInstance.post(url, params, {
12156
+ headers: headers
12157
+ }).then(function (response) {
12158
+ return ChargeResponses.parse(response.data);
12159
+ });
12160
+ },
12161
+ authenticatePayer: function authenticatePayer(params, publicKey) {
12162
+ var language = getLanguage();
12163
+ var headers = _objectSpread2({
12164
+ Authorization: "Bearer ".concat(publicKey)
12165
+ }, language && {
12166
+ 'Accept-Language': language
12167
+ });
12168
+ var url = new URL('pay-with-transfer/authenticate-payer', configToUse.paystackApiUrl).toString();
12169
+ return axiosInstance.post(url, params, {
12170
+ headers: headers
12171
+ }).then(function (response) {
12172
+ return ChargeResponses.parse(response.data);
12173
+ });
12132
12174
  }
12133
12175
  };
12134
12176
 
@@ -12157,6 +12199,25 @@ var Paystack = (function (exports) {
12157
12199
  paymentMethod: 'bank_transfer'
12158
12200
  };
12159
12201
  return this.listenForCharge(listenerOptions, callback);
12202
+ },
12203
+ sendIncorrectAmountDecision: function sendIncorrectAmountDecision(decisionMade) {
12204
+ var params = {
12205
+ transaction_id: this.id,
12206
+ decision: decisionMade
12207
+ };
12208
+ return PayWithTransferAPI.incorrectAmountDecision(params, this.merchant.key);
12209
+ },
12210
+ sendAuthenticatePayer: function sendAuthenticatePayer(_ref2) {
12211
+ var amountPaid = _ref2.amountPaid,
12212
+ payerAccountNumber = _ref2.payerAccountNumber,
12213
+ payerBankSlug = _ref2.payerBankSlug;
12214
+ var params = {
12215
+ transaction_id: this.id,
12216
+ amount: amountPaid,
12217
+ payer_account_number: payerAccountNumber,
12218
+ payer_bank_slug: payerBankSlug
12219
+ };
12220
+ return PayWithTransferAPI.authenticatePayer(params, this.merchant.key);
12160
12221
  }
12161
12222
  };
12162
12223
 
@@ -21149,6 +21210,10 @@ var Paystack = (function (exports) {
21149
21210
  },
21150
21211
  saveReferrer: function saveReferrer(referrer) {
21151
21212
  return AnalyticsAPI.saveReferrer(this.id, this.merchant.key, referrer);
21213
+ },
21214
+ setAmountByChannel: function setAmountByChannel(channelName) {
21215
+ var _this$channelFeesConf;
21216
+ this.amount = ((_this$channelFeesConf = this.channelFeesConfig[channelName]) === null || _this$channelFeesConf === void 0 ? void 0 : _this$channelFeesConf.amount) || this.originalAmount;
21152
21217
  }
21153
21218
  });
21154
21219
 
@@ -21292,7 +21357,7 @@ var Paystack = (function (exports) {
21292
21357
  }, _callee4);
21293
21358
  }))();
21294
21359
  },
21295
- generateLinkManagedAccount: function generateLinkManagedAccount(params) {
21360
+ generateDirectDebitManagedAccount: function generateDirectDebitManagedAccount(params) {
21296
21361
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
21297
21362
  var url, language, headers, payload, response;
21298
21363
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
@@ -21459,12 +21524,28 @@ var Paystack = (function (exports) {
21459
21524
  });
21460
21525
  },
21461
21526
  generateLinkManagedAccount: function generateLinkManagedAccount(params) {
21462
- return linkAPI.generateLinkManagedAccount(_objectSpread2(_objectSpread2({}, params), {}, {
21527
+ return this.getDirectDebitManagedAccount(params);
21528
+ },
21529
+ getDirectDebitManagedAccount: function getDirectDebitManagedAccount(params) {
21530
+ return linkAPI.generateDirectDebitManagedAccount(_objectSpread2(_objectSpread2({}, params), {}, {
21463
21531
  device: this.deviceFingerprint,
21464
21532
  transactionId: this.id
21465
21533
  }));
21466
21534
  },
21535
+ getManagedAccount: function getManagedAccount(_ref5) {
21536
+ var fulfilLateNotification = _ref5.fulfilLateNotification,
21537
+ preferredProvider = _ref5.preferredProvider;
21538
+ var params = {
21539
+ transaction_id: this.id,
21540
+ fulfil_late_notification: fulfilLateNotification,
21541
+ preferred_provider: preferredProvider
21542
+ };
21543
+ return PayWithTransferAPI.generateManagedAccount(params, this.merchant.key);
21544
+ },
21467
21545
  listenForLinkBankPayWithTransferCharge: function listenForLinkBankPayWithTransferCharge(pusherChannel, callback) {
21546
+ return this.listenForBankPayWithTransferCharge(pusherChannel, callback);
21547
+ },
21548
+ listenForBankPayWithTransferCharge: function listenForBankPayWithTransferCharge(pusherChannel, callback) {
21468
21549
  var listenerOptions = {
21469
21550
  channel: pusherChannel,
21470
21551
  paymentMethod: 'bank_transfer'
@@ -21498,6 +21579,7 @@ var Paystack = (function (exports) {
21498
21579
  this.status = data.transaction_status || data.status;
21499
21580
  this.accessCode = data.access_code;
21500
21581
  this.amount = data.amount;
21582
+ this.originalAmount = data.amount;
21501
21583
  this.domain = data.domain;
21502
21584
  this.isTest = data.domain === 'test';
21503
21585
  this.currency = data.currency;
@@ -21603,6 +21685,13 @@ var Paystack = (function (exports) {
21603
21685
  return response && response.data;
21604
21686
  });
21605
21687
  }
21688
+ }, {
21689
+ key: "initializeCustomerSubscriptionAuthorization",
21690
+ value: function initializeCustomerSubscriptionAuthorization(payload) {
21691
+ return TransactionAPI.initializeCustomerSubscriptionAuthorization(payload, this.merchant.key).then(function (response) {
21692
+ return response && response.data;
21693
+ });
21694
+ }
21606
21695
  }]);
21607
21696
  return TransactionInstance;
21608
21697
  }();
@@ -21666,7 +21755,7 @@ var Paystack = (function (exports) {
21666
21755
  }
21667
21756
  throw new Error('This function should be used with transaction data from the API');
21668
21757
  case 5:
21669
- return _context2.abrupt("return", Object.seal(new TransactionInstance(_objectSpread2(_objectSpread2({}, transactionData), {}, {
21758
+ return _context2.abrupt("return", Object.seal(new TransactionInstance(_objectSpread2(_objectSpread2({}, transactionData), {
21670
21759
  deviceFingerprint: deviceFingerprint
21671
21760
  }))));
21672
21761
  case 6:
@@ -21824,6 +21913,19 @@ var Paystack = (function (exports) {
21824
21913
  resolvedCardBins[bin] = data;
21825
21914
  return data;
21826
21915
  });
21916
+ },
21917
+ resolveIPAddress: function resolveIPAddress(ipAddress) {
21918
+ var url = new URL("decision/resolve_ip/".concat(ipAddress), configToUse.paystackApiUrl).toString();
21919
+ var language = getLanguage();
21920
+ var headers = _objectSpread2({}, language && {
21921
+ 'Accept-Language': language
21922
+ });
21923
+ return axiosInstance.get(url, {
21924
+ headers: headers
21925
+ }).then(function (_ref2) {
21926
+ var data = _ref2.data;
21927
+ return data;
21928
+ });
21827
21929
  }
21828
21930
  };
21829
21931
 
@@ -21881,6 +21983,11 @@ var Paystack = (function (exports) {
21881
21983
  value: function resolveCardBin(bin) {
21882
21984
  return ToolkitAPI.resolveCardBin(bin);
21883
21985
  }
21986
+ }, {
21987
+ key: "resolveIPAddress",
21988
+ value: function resolveIPAddress(ipAddress) {
21989
+ return ToolkitAPI.resolveIPAddress(ipAddress);
21990
+ }
21884
21991
  }]);
21885
21992
  return Toolkit;
21886
21993
  }();
@@ -22168,6 +22275,7 @@ var Paystack = (function (exports) {
22168
22275
  return this.saveLog();
22169
22276
  },
22170
22277
  logAPIResponse: function logAPIResponse(response, channel) {
22278
+ console.log('api response', response);
22171
22279
  switch (response.status) {
22172
22280
  case 'authorized':
22173
22281
  return this.logAuthorized(channel);
@@ -22350,3 +22458,4 @@ var Paystack = (function (exports) {
22350
22458
  return exports;
22351
22459
 
22352
22460
  })({});
22461
+ //# sourceMappingURL=checkout.js.map