@paystack/checkout-js 1.16.0 → 1.17.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/es/checkout.js CHANGED
@@ -11493,10 +11493,12 @@ var PayWithTransferCharge = {
11493
11493
  getManagedAccount: function getManagedAccount(_ref) {
11494
11494
  var _this = this;
11495
11495
 
11496
- var fulfilLateNotification = _ref.fulfilLateNotification;
11496
+ var fulfilLateNotification = _ref.fulfilLateNotification,
11497
+ preferredProvider = _ref.preferredProvider;
11497
11498
  var params = {
11498
11499
  transaction_id: this.id,
11499
- fulfil_late_notification: fulfilLateNotification
11500
+ fulfil_late_notification: fulfilLateNotification,
11501
+ preferred_provider: preferredProvider
11500
11502
  };
11501
11503
  return PayWithTransferAPI.generateManagedAccount(params, this.merchant.key).then(function (response) {
11502
11504
  if (response.status === 'success') {
@@ -18598,6 +18600,11 @@ var CardCharge = {
18598
18600
  var _this2 = this;
18599
18601
 
18600
18602
  var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18603
+
18604
+ if (!this.card.number && this.card.pin) {
18605
+ return this.chargeCardWithPin(customFields);
18606
+ }
18607
+
18601
18608
  return validate$4(this.card).then(function () {
18602
18609
  _this2.logAttempt(paymentMethod$3);
18603
18610
 
@@ -18619,9 +18626,34 @@ var CardCharge = {
18619
18626
  });
18620
18627
  });
18621
18628
  },
18622
- chargeRememberedCard: function chargeRememberedCard(_ref) {
18629
+
18630
+ /**
18631
+ * Handles submitting a card pin after
18632
+ * other card details have been previously submitted.
18633
+ */
18634
+ chargeCardWithPin: function chargeCardWithPin() {
18623
18635
  var _this3 = this;
18624
18636
 
18637
+ var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18638
+ this.logAttempt(paymentMethod$3);
18639
+ var chargeParams = {
18640
+ pin: encrypt(this.card.pin),
18641
+ trans: this.id,
18642
+ device: this.deviceFingerprint,
18643
+ rememberCard: this.remember_card,
18644
+ transactionType: this.transactionType,
18645
+ subscription: this.subscription,
18646
+ customFields: customFields
18647
+ };
18648
+ return CardAPI.charge(chargeParams).then(function (response) {
18649
+ _this3.logAPIResponse(response, paymentMethod$3);
18650
+
18651
+ return response;
18652
+ });
18653
+ },
18654
+ chargeRememberedCard: function chargeRememberedCard(_ref) {
18655
+ var _this4 = this;
18656
+
18625
18657
  var cvv = _ref.cvv,
18626
18658
  authorizationCode = _ref.authorizationCode,
18627
18659
  cardLast4 = _ref.cardLast4,
@@ -18639,13 +18671,13 @@ var CardCharge = {
18639
18671
  subscription: this.subscription
18640
18672
  };
18641
18673
  return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
18642
- _this3.logAPIResponse(response, paymentMethod$3);
18674
+ _this4.logAPIResponse(response, paymentMethod$3);
18643
18675
 
18644
18676
  return response;
18645
18677
  });
18646
18678
  },
18647
18679
  resumeCardCharge: function resumeCardCharge(_ref2) {
18648
- var _this4 = this;
18680
+ var _this5 = this;
18649
18681
 
18650
18682
  var accessCode = _ref2.accessCode,
18651
18683
  pin = _ref2.pin;
@@ -18658,35 +18690,35 @@ var CardCharge = {
18658
18690
  });
18659
18691
 
18660
18692
  return CardAPI.resumeCardCharge(params).then(function (response) {
18661
- _this4.logAPIResponse(response, paymentMethod$3);
18693
+ _this5.logAPIResponse(response, paymentMethod$3);
18662
18694
 
18663
18695
  return response;
18664
18696
  });
18665
18697
  },
18666
18698
  forgetRememberedCard: function forgetRememberedCard(authorizationId) {
18667
- var _this5 = this;
18699
+ var _this6 = this;
18668
18700
 
18669
18701
  var params = {
18670
18702
  authorizationId: authorizationId,
18671
18703
  publicKey: this.merchant.key
18672
18704
  };
18673
18705
  return CardAPI.forgetRememberedCard(params).then(function (response) {
18674
- _this5.logAPIResponse(response, paymentMethod$3);
18706
+ _this6.logAPIResponse(response, paymentMethod$3);
18675
18707
 
18676
18708
  return response;
18677
18709
  });
18678
18710
  },
18679
18711
  authenticateCard: function authenticateCard(token) {
18680
- var _this6 = this;
18712
+ var _this7 = this;
18681
18713
 
18682
18714
  return CardAPI.authenticate(this.id, token).then(function (response) {
18683
- _this6.logAPIResponse(response, paymentMethod$3);
18715
+ _this7.logAPIResponse(response, paymentMethod$3);
18684
18716
 
18685
18717
  return response;
18686
18718
  });
18687
18719
  },
18688
18720
  verifyAddress: function verifyAddress(_ref3) {
18689
- var _this7 = this;
18721
+ var _this8 = this;
18690
18722
 
18691
18723
  var address = _ref3.address,
18692
18724
  city = _ref3.city,
@@ -18700,7 +18732,7 @@ var CardCharge = {
18700
18732
  transactionId: this.id
18701
18733
  };
18702
18734
  return CardAPI.verifyAddress(payload).then(function (response) {
18703
- _this7.logAPIResponse(response, paymentMethod$3);
18735
+ _this8.logAPIResponse(response, paymentMethod$3);
18704
18736
 
18705
18737
  return response;
18706
18738
  });
package/lib/checkout.js CHANGED
@@ -11497,10 +11497,12 @@ var PayWithTransferCharge = {
11497
11497
  getManagedAccount: function getManagedAccount(_ref) {
11498
11498
  var _this = this;
11499
11499
 
11500
- var fulfilLateNotification = _ref.fulfilLateNotification;
11500
+ var fulfilLateNotification = _ref.fulfilLateNotification,
11501
+ preferredProvider = _ref.preferredProvider;
11501
11502
  var params = {
11502
11503
  transaction_id: this.id,
11503
- fulfil_late_notification: fulfilLateNotification
11504
+ fulfil_late_notification: fulfilLateNotification,
11505
+ preferred_provider: preferredProvider
11504
11506
  };
11505
11507
  return PayWithTransferAPI.generateManagedAccount(params, this.merchant.key).then(function (response) {
11506
11508
  if (response.status === 'success') {
@@ -18602,6 +18604,11 @@ var CardCharge = {
18602
18604
  var _this2 = this;
18603
18605
 
18604
18606
  var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18607
+
18608
+ if (!this.card.number && this.card.pin) {
18609
+ return this.chargeCardWithPin(customFields);
18610
+ }
18611
+
18605
18612
  return validate$4(this.card).then(function () {
18606
18613
  _this2.logAttempt(paymentMethod$3);
18607
18614
 
@@ -18623,9 +18630,34 @@ var CardCharge = {
18623
18630
  });
18624
18631
  });
18625
18632
  },
18626
- chargeRememberedCard: function chargeRememberedCard(_ref) {
18633
+
18634
+ /**
18635
+ * Handles submitting a card pin after
18636
+ * other card details have been previously submitted.
18637
+ */
18638
+ chargeCardWithPin: function chargeCardWithPin() {
18627
18639
  var _this3 = this;
18628
18640
 
18641
+ var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18642
+ this.logAttempt(paymentMethod$3);
18643
+ var chargeParams = {
18644
+ pin: encrypt(this.card.pin),
18645
+ trans: this.id,
18646
+ device: this.deviceFingerprint,
18647
+ rememberCard: this.remember_card,
18648
+ transactionType: this.transactionType,
18649
+ subscription: this.subscription,
18650
+ customFields: customFields
18651
+ };
18652
+ return CardAPI.charge(chargeParams).then(function (response) {
18653
+ _this3.logAPIResponse(response, paymentMethod$3);
18654
+
18655
+ return response;
18656
+ });
18657
+ },
18658
+ chargeRememberedCard: function chargeRememberedCard(_ref) {
18659
+ var _this4 = this;
18660
+
18629
18661
  var cvv = _ref.cvv,
18630
18662
  authorizationCode = _ref.authorizationCode,
18631
18663
  cardLast4 = _ref.cardLast4,
@@ -18643,13 +18675,13 @@ var CardCharge = {
18643
18675
  subscription: this.subscription
18644
18676
  };
18645
18677
  return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
18646
- _this3.logAPIResponse(response, paymentMethod$3);
18678
+ _this4.logAPIResponse(response, paymentMethod$3);
18647
18679
 
18648
18680
  return response;
18649
18681
  });
18650
18682
  },
18651
18683
  resumeCardCharge: function resumeCardCharge(_ref2) {
18652
- var _this4 = this;
18684
+ var _this5 = this;
18653
18685
 
18654
18686
  var accessCode = _ref2.accessCode,
18655
18687
  pin = _ref2.pin;
@@ -18662,35 +18694,35 @@ var CardCharge = {
18662
18694
  });
18663
18695
 
18664
18696
  return CardAPI.resumeCardCharge(params).then(function (response) {
18665
- _this4.logAPIResponse(response, paymentMethod$3);
18697
+ _this5.logAPIResponse(response, paymentMethod$3);
18666
18698
 
18667
18699
  return response;
18668
18700
  });
18669
18701
  },
18670
18702
  forgetRememberedCard: function forgetRememberedCard(authorizationId) {
18671
- var _this5 = this;
18703
+ var _this6 = this;
18672
18704
 
18673
18705
  var params = {
18674
18706
  authorizationId: authorizationId,
18675
18707
  publicKey: this.merchant.key
18676
18708
  };
18677
18709
  return CardAPI.forgetRememberedCard(params).then(function (response) {
18678
- _this5.logAPIResponse(response, paymentMethod$3);
18710
+ _this6.logAPIResponse(response, paymentMethod$3);
18679
18711
 
18680
18712
  return response;
18681
18713
  });
18682
18714
  },
18683
18715
  authenticateCard: function authenticateCard(token) {
18684
- var _this6 = this;
18716
+ var _this7 = this;
18685
18717
 
18686
18718
  return CardAPI.authenticate(this.id, token).then(function (response) {
18687
- _this6.logAPIResponse(response, paymentMethod$3);
18719
+ _this7.logAPIResponse(response, paymentMethod$3);
18688
18720
 
18689
18721
  return response;
18690
18722
  });
18691
18723
  },
18692
18724
  verifyAddress: function verifyAddress(_ref3) {
18693
- var _this7 = this;
18725
+ var _this8 = this;
18694
18726
 
18695
18727
  var address = _ref3.address,
18696
18728
  city = _ref3.city,
@@ -18704,7 +18736,7 @@ var CardCharge = {
18704
18736
  transactionId: this.id
18705
18737
  };
18706
18738
  return CardAPI.verifyAddress(payload).then(function (response) {
18707
- _this7.logAPIResponse(response, paymentMethod$3);
18739
+ _this8.logAPIResponse(response, paymentMethod$3);
18708
18740
 
18709
18741
  return response;
18710
18742
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/checkout-js",
3
- "version": "1.16.0",
3
+ "version": "1.17.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",