@paystack/checkout-js 1.20.0-dev.9 → 1.20.0
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 +29 -21089
- package/es/checkout.js +5 -281
- package/lib/checkout.js +5 -281
- package/package.json +1 -1
package/es/checkout.js
CHANGED
|
@@ -6403,16 +6403,14 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
|
6403
6403
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
6404
6404
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6405
6405
|
pusherKey: '1c7b262ee18455815893',
|
|
6406
|
-
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6407
|
-
savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
|
|
6406
|
+
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6408
6407
|
});
|
|
6409
6408
|
var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6410
6409
|
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
6411
6410
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
6412
6411
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6413
6412
|
pusherKey: '1c7b262ee18455815893',
|
|
6414
|
-
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6415
|
-
savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
|
|
6413
|
+
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6416
6414
|
});
|
|
6417
6415
|
var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6418
6416
|
checkoutUrl: 'https://checkout.paystack.com/',
|
|
@@ -18375,7 +18373,7 @@ var Card$2 = {
|
|
|
18375
18373
|
return Card$2.validateCVV(cvv, cardType).isValid;
|
|
18376
18374
|
},
|
|
18377
18375
|
validateExpiry: function validateExpiry(value) {
|
|
18378
|
-
if (_typeof$1(value) === 'object') {
|
|
18376
|
+
if (value !== null && _typeof$1(value) === 'object') {
|
|
18379
18377
|
var month = value.month,
|
|
18380
18378
|
year = value.year;
|
|
18381
18379
|
return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
|
|
@@ -18666,209 +18664,6 @@ var CardAPI$1 = {
|
|
|
18666
18664
|
}).then(function (response) {
|
|
18667
18665
|
return ChargeResponses.parse(response.data);
|
|
18668
18666
|
});
|
|
18669
|
-
},
|
|
18670
|
-
sendSavedCardsOTP: function sendSavedCardsOTP(email) {
|
|
18671
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18672
|
-
var url, language, headers, _yield$axiosInstance$, data;
|
|
18673
|
-
|
|
18674
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18675
|
-
while (1) {
|
|
18676
|
-
switch (_context.prev = _context.next) {
|
|
18677
|
-
case 0:
|
|
18678
|
-
url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
|
|
18679
|
-
language = getLanguage();
|
|
18680
|
-
headers = _objectSpread2({}, language && {
|
|
18681
|
-
'Accept-Language': language
|
|
18682
|
-
});
|
|
18683
|
-
_context.next = 5;
|
|
18684
|
-
return axiosInstance.post(url, {
|
|
18685
|
-
email: email
|
|
18686
|
-
}, {
|
|
18687
|
-
headers: headers
|
|
18688
|
-
});
|
|
18689
|
-
|
|
18690
|
-
case 5:
|
|
18691
|
-
_yield$axiosInstance$ = _context.sent;
|
|
18692
|
-
data = _yield$axiosInstance$.data;
|
|
18693
|
-
return _context.abrupt("return", data);
|
|
18694
|
-
|
|
18695
|
-
case 8:
|
|
18696
|
-
case "end":
|
|
18697
|
-
return _context.stop();
|
|
18698
|
-
}
|
|
18699
|
-
}
|
|
18700
|
-
}, _callee);
|
|
18701
|
-
}))();
|
|
18702
|
-
},
|
|
18703
|
-
addUserToSavedCards: function addUserToSavedCards(_ref6) {
|
|
18704
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
18705
|
-
var phone, email, url, language, headers, data, response;
|
|
18706
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
18707
|
-
while (1) {
|
|
18708
|
-
switch (_context2.prev = _context2.next) {
|
|
18709
|
-
case 0:
|
|
18710
|
-
phone = _ref6.phone, email = _ref6.email;
|
|
18711
|
-
url = new URL('/user', configToUse.savedCardsApiUrl).toString();
|
|
18712
|
-
language = getLanguage();
|
|
18713
|
-
headers = _objectSpread2({}, language && {
|
|
18714
|
-
'Accept-Language': language
|
|
18715
|
-
});
|
|
18716
|
-
data = {
|
|
18717
|
-
phone: phone,
|
|
18718
|
-
email: email
|
|
18719
|
-
};
|
|
18720
|
-
_context2.next = 7;
|
|
18721
|
-
return axiosInstance.post(url, data, {
|
|
18722
|
-
headers: headers
|
|
18723
|
-
});
|
|
18724
|
-
|
|
18725
|
-
case 7:
|
|
18726
|
-
response = _context2.sent;
|
|
18727
|
-
return _context2.abrupt("return", response.data);
|
|
18728
|
-
|
|
18729
|
-
case 9:
|
|
18730
|
-
case "end":
|
|
18731
|
-
return _context2.stop();
|
|
18732
|
-
}
|
|
18733
|
-
}
|
|
18734
|
-
}, _callee2);
|
|
18735
|
-
}))();
|
|
18736
|
-
},
|
|
18737
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
|
|
18738
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
18739
|
-
var code, email, transaction, url, language, headers, data, response;
|
|
18740
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
18741
|
-
while (1) {
|
|
18742
|
-
switch (_context3.prev = _context3.next) {
|
|
18743
|
-
case 0:
|
|
18744
|
-
code = _ref7.code, email = _ref7.email, transaction = _ref7.transaction;
|
|
18745
|
-
url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
|
|
18746
|
-
language = getLanguage();
|
|
18747
|
-
headers = _objectSpread2({}, language && {
|
|
18748
|
-
'Accept-Language': language
|
|
18749
|
-
});
|
|
18750
|
-
data = {
|
|
18751
|
-
code: code,
|
|
18752
|
-
email: email,
|
|
18753
|
-
transaction: transaction
|
|
18754
|
-
};
|
|
18755
|
-
_context3.next = 7;
|
|
18756
|
-
return axiosInstance.post(url, data, {
|
|
18757
|
-
headers: headers
|
|
18758
|
-
});
|
|
18759
|
-
|
|
18760
|
-
case 7:
|
|
18761
|
-
response = _context3.sent;
|
|
18762
|
-
return _context3.abrupt("return", response.data);
|
|
18763
|
-
|
|
18764
|
-
case 9:
|
|
18765
|
-
case "end":
|
|
18766
|
-
return _context3.stop();
|
|
18767
|
-
}
|
|
18768
|
-
}
|
|
18769
|
-
}, _callee3);
|
|
18770
|
-
}))();
|
|
18771
|
-
},
|
|
18772
|
-
getSavedCards: function getSavedCards(_ref8) {
|
|
18773
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
18774
|
-
var token, url, language, headers, response;
|
|
18775
|
-
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
18776
|
-
while (1) {
|
|
18777
|
-
switch (_context4.prev = _context4.next) {
|
|
18778
|
-
case 0:
|
|
18779
|
-
token = _ref8.token;
|
|
18780
|
-
url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
|
|
18781
|
-
language = getLanguage();
|
|
18782
|
-
headers = _objectSpread2({
|
|
18783
|
-
Authorization: "Bearer ".concat(token),
|
|
18784
|
-
'jwt-auth': true
|
|
18785
|
-
}, language && {
|
|
18786
|
-
'Accept-Language': language
|
|
18787
|
-
});
|
|
18788
|
-
_context4.next = 6;
|
|
18789
|
-
return axiosInstance.get(url, {
|
|
18790
|
-
headers: headers
|
|
18791
|
-
});
|
|
18792
|
-
|
|
18793
|
-
case 6:
|
|
18794
|
-
response = _context4.sent;
|
|
18795
|
-
return _context4.abrupt("return", response.data);
|
|
18796
|
-
|
|
18797
|
-
case 8:
|
|
18798
|
-
case "end":
|
|
18799
|
-
return _context4.stop();
|
|
18800
|
-
}
|
|
18801
|
-
}
|
|
18802
|
-
}, _callee4);
|
|
18803
|
-
}))();
|
|
18804
|
-
},
|
|
18805
|
-
deleteSavedCard: function deleteSavedCard(_ref9) {
|
|
18806
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
18807
|
-
var cardCode, token, url, language, headers, response;
|
|
18808
|
-
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
18809
|
-
while (1) {
|
|
18810
|
-
switch (_context5.prev = _context5.next) {
|
|
18811
|
-
case 0:
|
|
18812
|
-
cardCode = _ref9.cardCode, token = _ref9.token;
|
|
18813
|
-
url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
|
|
18814
|
-
language = getLanguage();
|
|
18815
|
-
headers = _objectSpread2({
|
|
18816
|
-
Authorization: "Bearer ".concat(token),
|
|
18817
|
-
'jwt-auth': true
|
|
18818
|
-
}, language && {
|
|
18819
|
-
'Accept-Language': language
|
|
18820
|
-
});
|
|
18821
|
-
_context5.next = 6;
|
|
18822
|
-
return axiosInstance.delete(url, {
|
|
18823
|
-
headers: headers
|
|
18824
|
-
});
|
|
18825
|
-
|
|
18826
|
-
case 6:
|
|
18827
|
-
response = _context5.sent;
|
|
18828
|
-
return _context5.abrupt("return", response.data);
|
|
18829
|
-
|
|
18830
|
-
case 8:
|
|
18831
|
-
case "end":
|
|
18832
|
-
return _context5.stop();
|
|
18833
|
-
}
|
|
18834
|
-
}
|
|
18835
|
-
}, _callee5);
|
|
18836
|
-
}))();
|
|
18837
|
-
},
|
|
18838
|
-
chargeSavedCard: function chargeSavedCard(_ref10) {
|
|
18839
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
18840
|
-
var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
|
|
18841
|
-
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
18842
|
-
while (1) {
|
|
18843
|
-
switch (_context6.prev = _context6.next) {
|
|
18844
|
-
case 0:
|
|
18845
|
-
token = _ref10.token, device = _ref10.device, cardCode = _ref10.cardCode, transaction = _ref10.transaction, selectedCurrency = _ref10.selectedCurrency;
|
|
18846
|
-
url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
|
|
18847
|
-
language = getLanguage();
|
|
18848
|
-
headers = _objectSpread2({
|
|
18849
|
-
Authorization: "Bearer ".concat(token),
|
|
18850
|
-
'jwt-auth': true
|
|
18851
|
-
}, language && {
|
|
18852
|
-
'Accept-Language': language
|
|
18853
|
-
});
|
|
18854
|
-
data = {
|
|
18855
|
-
device: device,
|
|
18856
|
-
transaction: transaction,
|
|
18857
|
-
selectedCurrency: selectedCurrency
|
|
18858
|
-
};
|
|
18859
|
-
return _context6.abrupt("return", axiosInstance.post(url, data, {
|
|
18860
|
-
headers: headers
|
|
18861
|
-
}).then(function (response) {
|
|
18862
|
-
return ChargeResponses.parse(response.data);
|
|
18863
|
-
}));
|
|
18864
|
-
|
|
18865
|
-
case 6:
|
|
18866
|
-
case "end":
|
|
18867
|
-
return _context6.stop();
|
|
18868
|
-
}
|
|
18869
|
-
}
|
|
18870
|
-
}, _callee6);
|
|
18871
|
-
}))();
|
|
18872
18667
|
}
|
|
18873
18668
|
};
|
|
18874
18669
|
|
|
@@ -19049,75 +18844,6 @@ var CardCharge = {
|
|
|
19049
18844
|
paymentMethod: paymentMethod$4
|
|
19050
18845
|
};
|
|
19051
18846
|
return this.listenForCharge(listenerOptions, callback);
|
|
19052
|
-
},
|
|
19053
|
-
sendSavedCardsOTP: function sendSavedCardsOTP() {
|
|
19054
|
-
return CardAPI$1.sendSavedCardsOTP(this.email);
|
|
19055
|
-
},
|
|
19056
|
-
addUserToSavedCards: function addUserToSavedCards(_ref4) {
|
|
19057
|
-
var phone = _ref4.phone;
|
|
19058
|
-
return CardAPI$1.addUserToSavedCards({
|
|
19059
|
-
phone: phone,
|
|
19060
|
-
email: this.email
|
|
19061
|
-
});
|
|
19062
|
-
},
|
|
19063
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
|
|
19064
|
-
var _this9 = this;
|
|
19065
|
-
|
|
19066
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
19067
|
-
var code, payload, response;
|
|
19068
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19069
|
-
while (1) {
|
|
19070
|
-
switch (_context.prev = _context.next) {
|
|
19071
|
-
case 0:
|
|
19072
|
-
code = _ref5.code;
|
|
19073
|
-
payload = {
|
|
19074
|
-
code: code,
|
|
19075
|
-
email: _this9.email,
|
|
19076
|
-
transaction: _this9.id
|
|
19077
|
-
};
|
|
19078
|
-
_context.prev = 2;
|
|
19079
|
-
_context.next = 5;
|
|
19080
|
-
return CardAPI$1.verifySavedCardsOtp(payload);
|
|
19081
|
-
|
|
19082
|
-
case 5:
|
|
19083
|
-
response = _context.sent;
|
|
19084
|
-
_this9.savedCardsToken = response.data.token;
|
|
19085
|
-
return _context.abrupt("return", response);
|
|
19086
|
-
|
|
19087
|
-
case 10:
|
|
19088
|
-
_context.prev = 10;
|
|
19089
|
-
_context.t0 = _context["catch"](2);
|
|
19090
|
-
_this9.savedCardsToken = null;
|
|
19091
|
-
throw _context.t0;
|
|
19092
|
-
|
|
19093
|
-
case 14:
|
|
19094
|
-
case "end":
|
|
19095
|
-
return _context.stop();
|
|
19096
|
-
}
|
|
19097
|
-
}
|
|
19098
|
-
}, _callee, null, [[2, 10]]);
|
|
19099
|
-
}))();
|
|
19100
|
-
},
|
|
19101
|
-
getSavedCards: function getSavedCards() {
|
|
19102
|
-
return CardAPI$1.getSavedCards({
|
|
19103
|
-
token: this.savedCardsToken
|
|
19104
|
-
});
|
|
19105
|
-
},
|
|
19106
|
-
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
19107
|
-
return CardAPI$1.deleteSavedCard({
|
|
19108
|
-
cardCode: cardCode,
|
|
19109
|
-
token: this.savedCardsToken
|
|
19110
|
-
});
|
|
19111
|
-
},
|
|
19112
|
-
chargeSavedCard: function chargeSavedCard(_ref6) {
|
|
19113
|
-
var cardCode = _ref6.cardCode;
|
|
19114
|
-
return CardAPI$1.chargeSavedCard({
|
|
19115
|
-
cardCode: cardCode,
|
|
19116
|
-
transaction: this.id,
|
|
19117
|
-
token: this.savedCardsToken,
|
|
19118
|
-
device: this.deviceFingerprint,
|
|
19119
|
-
selectedCurrency: this.currency
|
|
19120
|
-
});
|
|
19121
18847
|
}
|
|
19122
18848
|
};
|
|
19123
18849
|
|
|
@@ -20446,8 +20172,6 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
20446
20172
|
this.subscription = data.subscription || null;
|
|
20447
20173
|
this.planDetails = data.plan_details || null;
|
|
20448
20174
|
this.exchangeRate = data.exchange_rate || null;
|
|
20449
|
-
this.savedCardsConfig = data.saved_cards || {};
|
|
20450
|
-
this.savedCardsToken = null;
|
|
20451
20175
|
/**
|
|
20452
20176
|
* We initialize parameters we send to the API as empty strings
|
|
20453
20177
|
* when we don't have them instead of null because the API expects
|
|
@@ -20930,7 +20654,7 @@ function validate(card, isSetter) {
|
|
|
20930
20654
|
});
|
|
20931
20655
|
}
|
|
20932
20656
|
|
|
20933
|
-
var
|
|
20657
|
+
var CardPreauthorization = {
|
|
20934
20658
|
setCard: function setCard(params) {
|
|
20935
20659
|
var _this = this;
|
|
20936
20660
|
|
|
@@ -20995,7 +20719,7 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
|
20995
20719
|
loadPusher(); // TODO: Analytics
|
|
20996
20720
|
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20997
20721
|
|
|
20998
|
-
Object.assign(this,
|
|
20722
|
+
Object.assign(this, CardPreauthorization);
|
|
20999
20723
|
}
|
|
21000
20724
|
|
|
21001
20725
|
_createClass(PreauthorizationInstance, [{
|
package/lib/checkout.js
CHANGED
|
@@ -6407,16 +6407,14 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
|
6407
6407
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
6408
6408
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6409
6409
|
pusherKey: '1c7b262ee18455815893',
|
|
6410
|
-
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6411
|
-
savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
|
|
6410
|
+
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6412
6411
|
});
|
|
6413
6412
|
var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6414
6413
|
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
6415
6414
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
6416
6415
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6417
6416
|
pusherKey: '1c7b262ee18455815893',
|
|
6418
|
-
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6419
|
-
savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
|
|
6417
|
+
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js'
|
|
6420
6418
|
});
|
|
6421
6419
|
var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6422
6420
|
checkoutUrl: 'https://checkout.paystack.com/',
|
|
@@ -18379,7 +18377,7 @@ var Card$2 = {
|
|
|
18379
18377
|
return Card$2.validateCVV(cvv, cardType).isValid;
|
|
18380
18378
|
},
|
|
18381
18379
|
validateExpiry: function validateExpiry(value) {
|
|
18382
|
-
if (_typeof$1(value) === 'object') {
|
|
18380
|
+
if (value !== null && _typeof$1(value) === 'object') {
|
|
18383
18381
|
var month = value.month,
|
|
18384
18382
|
year = value.year;
|
|
18385
18383
|
return cardValidator.expirationMonth(month) && cardValidator.expirationYear(year);
|
|
@@ -18670,209 +18668,6 @@ var CardAPI$1 = {
|
|
|
18670
18668
|
}).then(function (response) {
|
|
18671
18669
|
return ChargeResponses.parse(response.data);
|
|
18672
18670
|
});
|
|
18673
|
-
},
|
|
18674
|
-
sendSavedCardsOTP: function sendSavedCardsOTP(email) {
|
|
18675
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18676
|
-
var url, language, headers, _yield$axiosInstance$, data;
|
|
18677
|
-
|
|
18678
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18679
|
-
while (1) {
|
|
18680
|
-
switch (_context.prev = _context.next) {
|
|
18681
|
-
case 0:
|
|
18682
|
-
url = new URL("/authorize", configToUse.savedCardsApiUrl).toString();
|
|
18683
|
-
language = getLanguage();
|
|
18684
|
-
headers = _objectSpread2({}, language && {
|
|
18685
|
-
'Accept-Language': language
|
|
18686
|
-
});
|
|
18687
|
-
_context.next = 5;
|
|
18688
|
-
return axiosInstance.post(url, {
|
|
18689
|
-
email: email
|
|
18690
|
-
}, {
|
|
18691
|
-
headers: headers
|
|
18692
|
-
});
|
|
18693
|
-
|
|
18694
|
-
case 5:
|
|
18695
|
-
_yield$axiosInstance$ = _context.sent;
|
|
18696
|
-
data = _yield$axiosInstance$.data;
|
|
18697
|
-
return _context.abrupt("return", data);
|
|
18698
|
-
|
|
18699
|
-
case 8:
|
|
18700
|
-
case "end":
|
|
18701
|
-
return _context.stop();
|
|
18702
|
-
}
|
|
18703
|
-
}
|
|
18704
|
-
}, _callee);
|
|
18705
|
-
}))();
|
|
18706
|
-
},
|
|
18707
|
-
addUserToSavedCards: function addUserToSavedCards(_ref6) {
|
|
18708
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
18709
|
-
var phone, email, url, language, headers, data, response;
|
|
18710
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
18711
|
-
while (1) {
|
|
18712
|
-
switch (_context2.prev = _context2.next) {
|
|
18713
|
-
case 0:
|
|
18714
|
-
phone = _ref6.phone, email = _ref6.email;
|
|
18715
|
-
url = new URL('/user', configToUse.savedCardsApiUrl).toString();
|
|
18716
|
-
language = getLanguage();
|
|
18717
|
-
headers = _objectSpread2({}, language && {
|
|
18718
|
-
'Accept-Language': language
|
|
18719
|
-
});
|
|
18720
|
-
data = {
|
|
18721
|
-
phone: phone,
|
|
18722
|
-
email: email
|
|
18723
|
-
};
|
|
18724
|
-
_context2.next = 7;
|
|
18725
|
-
return axiosInstance.post(url, data, {
|
|
18726
|
-
headers: headers
|
|
18727
|
-
});
|
|
18728
|
-
|
|
18729
|
-
case 7:
|
|
18730
|
-
response = _context2.sent;
|
|
18731
|
-
return _context2.abrupt("return", response.data);
|
|
18732
|
-
|
|
18733
|
-
case 9:
|
|
18734
|
-
case "end":
|
|
18735
|
-
return _context2.stop();
|
|
18736
|
-
}
|
|
18737
|
-
}
|
|
18738
|
-
}, _callee2);
|
|
18739
|
-
}))();
|
|
18740
|
-
},
|
|
18741
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(_ref7) {
|
|
18742
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
18743
|
-
var code, email, transaction, url, language, headers, data, response;
|
|
18744
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
18745
|
-
while (1) {
|
|
18746
|
-
switch (_context3.prev = _context3.next) {
|
|
18747
|
-
case 0:
|
|
18748
|
-
code = _ref7.code, email = _ref7.email, transaction = _ref7.transaction;
|
|
18749
|
-
url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
|
|
18750
|
-
language = getLanguage();
|
|
18751
|
-
headers = _objectSpread2({}, language && {
|
|
18752
|
-
'Accept-Language': language
|
|
18753
|
-
});
|
|
18754
|
-
data = {
|
|
18755
|
-
code: code,
|
|
18756
|
-
email: email,
|
|
18757
|
-
transaction: transaction
|
|
18758
|
-
};
|
|
18759
|
-
_context3.next = 7;
|
|
18760
|
-
return axiosInstance.post(url, data, {
|
|
18761
|
-
headers: headers
|
|
18762
|
-
});
|
|
18763
|
-
|
|
18764
|
-
case 7:
|
|
18765
|
-
response = _context3.sent;
|
|
18766
|
-
return _context3.abrupt("return", response.data);
|
|
18767
|
-
|
|
18768
|
-
case 9:
|
|
18769
|
-
case "end":
|
|
18770
|
-
return _context3.stop();
|
|
18771
|
-
}
|
|
18772
|
-
}
|
|
18773
|
-
}, _callee3);
|
|
18774
|
-
}))();
|
|
18775
|
-
},
|
|
18776
|
-
getSavedCards: function getSavedCards(_ref8) {
|
|
18777
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
18778
|
-
var token, url, language, headers, response;
|
|
18779
|
-
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
18780
|
-
while (1) {
|
|
18781
|
-
switch (_context4.prev = _context4.next) {
|
|
18782
|
-
case 0:
|
|
18783
|
-
token = _ref8.token;
|
|
18784
|
-
url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
|
|
18785
|
-
language = getLanguage();
|
|
18786
|
-
headers = _objectSpread2({
|
|
18787
|
-
Authorization: "Bearer ".concat(token),
|
|
18788
|
-
'jwt-auth': true
|
|
18789
|
-
}, language && {
|
|
18790
|
-
'Accept-Language': language
|
|
18791
|
-
});
|
|
18792
|
-
_context4.next = 6;
|
|
18793
|
-
return axiosInstance.get(url, {
|
|
18794
|
-
headers: headers
|
|
18795
|
-
});
|
|
18796
|
-
|
|
18797
|
-
case 6:
|
|
18798
|
-
response = _context4.sent;
|
|
18799
|
-
return _context4.abrupt("return", response.data);
|
|
18800
|
-
|
|
18801
|
-
case 8:
|
|
18802
|
-
case "end":
|
|
18803
|
-
return _context4.stop();
|
|
18804
|
-
}
|
|
18805
|
-
}
|
|
18806
|
-
}, _callee4);
|
|
18807
|
-
}))();
|
|
18808
|
-
},
|
|
18809
|
-
deleteSavedCard: function deleteSavedCard(_ref9) {
|
|
18810
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
18811
|
-
var cardCode, token, url, language, headers, response;
|
|
18812
|
-
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
18813
|
-
while (1) {
|
|
18814
|
-
switch (_context5.prev = _context5.next) {
|
|
18815
|
-
case 0:
|
|
18816
|
-
cardCode = _ref9.cardCode, token = _ref9.token;
|
|
18817
|
-
url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
|
|
18818
|
-
language = getLanguage();
|
|
18819
|
-
headers = _objectSpread2({
|
|
18820
|
-
Authorization: "Bearer ".concat(token),
|
|
18821
|
-
'jwt-auth': true
|
|
18822
|
-
}, language && {
|
|
18823
|
-
'Accept-Language': language
|
|
18824
|
-
});
|
|
18825
|
-
_context5.next = 6;
|
|
18826
|
-
return axiosInstance.delete(url, {
|
|
18827
|
-
headers: headers
|
|
18828
|
-
});
|
|
18829
|
-
|
|
18830
|
-
case 6:
|
|
18831
|
-
response = _context5.sent;
|
|
18832
|
-
return _context5.abrupt("return", response.data);
|
|
18833
|
-
|
|
18834
|
-
case 8:
|
|
18835
|
-
case "end":
|
|
18836
|
-
return _context5.stop();
|
|
18837
|
-
}
|
|
18838
|
-
}
|
|
18839
|
-
}, _callee5);
|
|
18840
|
-
}))();
|
|
18841
|
-
},
|
|
18842
|
-
chargeSavedCard: function chargeSavedCard(_ref10) {
|
|
18843
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
18844
|
-
var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
|
|
18845
|
-
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
18846
|
-
while (1) {
|
|
18847
|
-
switch (_context6.prev = _context6.next) {
|
|
18848
|
-
case 0:
|
|
18849
|
-
token = _ref10.token, device = _ref10.device, cardCode = _ref10.cardCode, transaction = _ref10.transaction, selectedCurrency = _ref10.selectedCurrency;
|
|
18850
|
-
url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
|
|
18851
|
-
language = getLanguage();
|
|
18852
|
-
headers = _objectSpread2({
|
|
18853
|
-
Authorization: "Bearer ".concat(token),
|
|
18854
|
-
'jwt-auth': true
|
|
18855
|
-
}, language && {
|
|
18856
|
-
'Accept-Language': language
|
|
18857
|
-
});
|
|
18858
|
-
data = {
|
|
18859
|
-
device: device,
|
|
18860
|
-
transaction: transaction,
|
|
18861
|
-
selectedCurrency: selectedCurrency
|
|
18862
|
-
};
|
|
18863
|
-
return _context6.abrupt("return", axiosInstance.post(url, data, {
|
|
18864
|
-
headers: headers
|
|
18865
|
-
}).then(function (response) {
|
|
18866
|
-
return ChargeResponses.parse(response.data);
|
|
18867
|
-
}));
|
|
18868
|
-
|
|
18869
|
-
case 6:
|
|
18870
|
-
case "end":
|
|
18871
|
-
return _context6.stop();
|
|
18872
|
-
}
|
|
18873
|
-
}
|
|
18874
|
-
}, _callee6);
|
|
18875
|
-
}))();
|
|
18876
18671
|
}
|
|
18877
18672
|
};
|
|
18878
18673
|
|
|
@@ -19053,75 +18848,6 @@ var CardCharge = {
|
|
|
19053
18848
|
paymentMethod: paymentMethod$4
|
|
19054
18849
|
};
|
|
19055
18850
|
return this.listenForCharge(listenerOptions, callback);
|
|
19056
|
-
},
|
|
19057
|
-
sendSavedCardsOTP: function sendSavedCardsOTP() {
|
|
19058
|
-
return CardAPI$1.sendSavedCardsOTP(this.email);
|
|
19059
|
-
},
|
|
19060
|
-
addUserToSavedCards: function addUserToSavedCards(_ref4) {
|
|
19061
|
-
var phone = _ref4.phone;
|
|
19062
|
-
return CardAPI$1.addUserToSavedCards({
|
|
19063
|
-
phone: phone,
|
|
19064
|
-
email: this.email
|
|
19065
|
-
});
|
|
19066
|
-
},
|
|
19067
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(_ref5) {
|
|
19068
|
-
var _this9 = this;
|
|
19069
|
-
|
|
19070
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
19071
|
-
var code, payload, response;
|
|
19072
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19073
|
-
while (1) {
|
|
19074
|
-
switch (_context.prev = _context.next) {
|
|
19075
|
-
case 0:
|
|
19076
|
-
code = _ref5.code;
|
|
19077
|
-
payload = {
|
|
19078
|
-
code: code,
|
|
19079
|
-
email: _this9.email,
|
|
19080
|
-
transaction: _this9.id
|
|
19081
|
-
};
|
|
19082
|
-
_context.prev = 2;
|
|
19083
|
-
_context.next = 5;
|
|
19084
|
-
return CardAPI$1.verifySavedCardsOtp(payload);
|
|
19085
|
-
|
|
19086
|
-
case 5:
|
|
19087
|
-
response = _context.sent;
|
|
19088
|
-
_this9.savedCardsToken = response.data.token;
|
|
19089
|
-
return _context.abrupt("return", response);
|
|
19090
|
-
|
|
19091
|
-
case 10:
|
|
19092
|
-
_context.prev = 10;
|
|
19093
|
-
_context.t0 = _context["catch"](2);
|
|
19094
|
-
_this9.savedCardsToken = null;
|
|
19095
|
-
throw _context.t0;
|
|
19096
|
-
|
|
19097
|
-
case 14:
|
|
19098
|
-
case "end":
|
|
19099
|
-
return _context.stop();
|
|
19100
|
-
}
|
|
19101
|
-
}
|
|
19102
|
-
}, _callee, null, [[2, 10]]);
|
|
19103
|
-
}))();
|
|
19104
|
-
},
|
|
19105
|
-
getSavedCards: function getSavedCards() {
|
|
19106
|
-
return CardAPI$1.getSavedCards({
|
|
19107
|
-
token: this.savedCardsToken
|
|
19108
|
-
});
|
|
19109
|
-
},
|
|
19110
|
-
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
19111
|
-
return CardAPI$1.deleteSavedCard({
|
|
19112
|
-
cardCode: cardCode,
|
|
19113
|
-
token: this.savedCardsToken
|
|
19114
|
-
});
|
|
19115
|
-
},
|
|
19116
|
-
chargeSavedCard: function chargeSavedCard(_ref6) {
|
|
19117
|
-
var cardCode = _ref6.cardCode;
|
|
19118
|
-
return CardAPI$1.chargeSavedCard({
|
|
19119
|
-
cardCode: cardCode,
|
|
19120
|
-
transaction: this.id,
|
|
19121
|
-
token: this.savedCardsToken,
|
|
19122
|
-
device: this.deviceFingerprint,
|
|
19123
|
-
selectedCurrency: this.currency
|
|
19124
|
-
});
|
|
19125
18851
|
}
|
|
19126
18852
|
};
|
|
19127
18853
|
|
|
@@ -20450,8 +20176,6 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
20450
20176
|
this.subscription = data.subscription || null;
|
|
20451
20177
|
this.planDetails = data.plan_details || null;
|
|
20452
20178
|
this.exchangeRate = data.exchange_rate || null;
|
|
20453
|
-
this.savedCardsConfig = data.saved_cards || {};
|
|
20454
|
-
this.savedCardsToken = null;
|
|
20455
20179
|
/**
|
|
20456
20180
|
* We initialize parameters we send to the API as empty strings
|
|
20457
20181
|
* when we don't have them instead of null because the API expects
|
|
@@ -20934,7 +20658,7 @@ function validate(card, isSetter) {
|
|
|
20934
20658
|
});
|
|
20935
20659
|
}
|
|
20936
20660
|
|
|
20937
|
-
var
|
|
20661
|
+
var CardPreauthorization = {
|
|
20938
20662
|
setCard: function setCard(params) {
|
|
20939
20663
|
var _this = this;
|
|
20940
20664
|
|
|
@@ -20999,7 +20723,7 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
|
20999
20723
|
loadPusher(); // TODO: Analytics
|
|
21000
20724
|
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
21001
20725
|
|
|
21002
|
-
Object.assign(this,
|
|
20726
|
+
Object.assign(this, CardPreauthorization);
|
|
21003
20727
|
}
|
|
21004
20728
|
|
|
21005
20729
|
_createClass(PreauthorizationInstance, [{
|