@paystack/checkout-js 1.19.0-dev.2 → 1.19.0-dev.4
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 +3 -3
- package/es/checkout.js +166 -40
- package/lib/checkout.js +166 -40
- package/package.json +1 -1
package/es/checkout.js
CHANGED
|
@@ -18568,43 +18568,136 @@ var CardAPI = {
|
|
|
18568
18568
|
});
|
|
18569
18569
|
},
|
|
18570
18570
|
requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
|
|
18571
|
-
|
|
18572
|
-
|
|
18571
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18572
|
+
var url, language, headers, _yield$axiosInstance$, data;
|
|
18573
18573
|
|
|
18574
|
-
|
|
18575
|
-
|
|
18576
|
-
|
|
18574
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18575
|
+
while (1) {
|
|
18576
|
+
switch (_context.prev = _context.next) {
|
|
18577
|
+
case 0:
|
|
18578
|
+
url = new URL("/authorize/".concat(phoneNumber), configToUse.savedCardsApiUrl).toString();
|
|
18579
|
+
language = getLanguage();
|
|
18580
|
+
headers = _objectSpread2({}, language && {
|
|
18581
|
+
'Accept-Language': language
|
|
18582
|
+
});
|
|
18583
|
+
_context.next = 5;
|
|
18584
|
+
return axiosInstance.post(url, {
|
|
18585
|
+
headers: headers
|
|
18586
|
+
});
|
|
18577
18587
|
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18588
|
+
case 5:
|
|
18589
|
+
_yield$axiosInstance$ = _context.sent;
|
|
18590
|
+
data = _yield$axiosInstance$.data;
|
|
18591
|
+
return _context.abrupt("return", data);
|
|
18592
|
+
|
|
18593
|
+
case 8:
|
|
18594
|
+
case "end":
|
|
18595
|
+
return _context.stop();
|
|
18596
|
+
}
|
|
18597
|
+
}
|
|
18598
|
+
}, _callee);
|
|
18599
|
+
}))();
|
|
18584
18600
|
},
|
|
18585
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18601
|
+
verifySavedCardsOtp: function verifySavedCardsOtp(_ref6) {
|
|
18602
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
18603
|
+
var code, phone, transaction, url, language, headers, data, response;
|
|
18604
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
18605
|
+
while (1) {
|
|
18606
|
+
switch (_context2.prev = _context2.next) {
|
|
18607
|
+
case 0:
|
|
18608
|
+
code = _ref6.code, phone = _ref6.phone, transaction = _ref6.transaction;
|
|
18609
|
+
url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
|
|
18610
|
+
language = getLanguage();
|
|
18611
|
+
headers = _objectSpread2({}, language && {
|
|
18612
|
+
'Accept-Language': language
|
|
18613
|
+
});
|
|
18614
|
+
data = {
|
|
18615
|
+
code: code,
|
|
18616
|
+
phone: phone,
|
|
18617
|
+
transaction: transaction
|
|
18618
|
+
};
|
|
18619
|
+
_context2.next = 7;
|
|
18620
|
+
return axiosInstance.post(url, data, {
|
|
18621
|
+
headers: headers
|
|
18622
|
+
});
|
|
18591
18623
|
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
'Accept-Language': language
|
|
18596
|
-
});
|
|
18624
|
+
case 7:
|
|
18625
|
+
response = _context2.sent;
|
|
18626
|
+
return _context2.abrupt("return", response.data);
|
|
18597
18627
|
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18628
|
+
case 9:
|
|
18629
|
+
case "end":
|
|
18630
|
+
return _context2.stop();
|
|
18631
|
+
}
|
|
18632
|
+
}
|
|
18633
|
+
}, _callee2);
|
|
18634
|
+
}))();
|
|
18635
|
+
},
|
|
18636
|
+
getSavedCards: function getSavedCards(_ref7) {
|
|
18637
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
18638
|
+
var token, url, language, headers, response;
|
|
18639
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
18640
|
+
while (1) {
|
|
18641
|
+
switch (_context3.prev = _context3.next) {
|
|
18642
|
+
case 0:
|
|
18643
|
+
token = _ref7.token;
|
|
18644
|
+
url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
|
|
18645
|
+
language = getLanguage();
|
|
18646
|
+
headers = _objectSpread2({
|
|
18647
|
+
Authorization: "Bearer ".concat(token),
|
|
18648
|
+
'jwt-auth': true
|
|
18649
|
+
}, language && {
|
|
18650
|
+
'Accept-Language': language
|
|
18651
|
+
});
|
|
18652
|
+
_context3.next = 6;
|
|
18653
|
+
return axiosInstance.get(url, {
|
|
18654
|
+
headers: headers
|
|
18655
|
+
});
|
|
18656
|
+
|
|
18657
|
+
case 6:
|
|
18658
|
+
response = _context3.sent;
|
|
18659
|
+
return _context3.abrupt("return", response.data);
|
|
18660
|
+
|
|
18661
|
+
case 8:
|
|
18662
|
+
case "end":
|
|
18663
|
+
return _context3.stop();
|
|
18664
|
+
}
|
|
18665
|
+
}
|
|
18666
|
+
}, _callee3);
|
|
18667
|
+
}))();
|
|
18668
|
+
},
|
|
18669
|
+
deleteSavedCard: function deleteSavedCard(_ref8) {
|
|
18670
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
18671
|
+
var cardCode, token, url, language, headers, response;
|
|
18672
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
18673
|
+
while (1) {
|
|
18674
|
+
switch (_context4.prev = _context4.next) {
|
|
18675
|
+
case 0:
|
|
18676
|
+
cardCode = _ref8.cardCode, token = _ref8.token;
|
|
18677
|
+
url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
|
|
18678
|
+
language = getLanguage();
|
|
18679
|
+
headers = _objectSpread2({
|
|
18680
|
+
Authorization: "Bearer ".concat(token),
|
|
18681
|
+
'jwt-auth': true
|
|
18682
|
+
}, language && {
|
|
18683
|
+
'Accept-Language': language
|
|
18684
|
+
});
|
|
18685
|
+
_context4.next = 6;
|
|
18686
|
+
return axiosInstance.delete(url, {
|
|
18687
|
+
headers: headers
|
|
18688
|
+
});
|
|
18689
|
+
|
|
18690
|
+
case 6:
|
|
18691
|
+
response = _context4.sent;
|
|
18692
|
+
return _context4.abrupt("return", response.data);
|
|
18693
|
+
|
|
18694
|
+
case 8:
|
|
18695
|
+
case "end":
|
|
18696
|
+
return _context4.stop();
|
|
18697
|
+
}
|
|
18698
|
+
}
|
|
18699
|
+
}, _callee4);
|
|
18700
|
+
}))();
|
|
18608
18701
|
}
|
|
18609
18702
|
};
|
|
18610
18703
|
|
|
@@ -18790,14 +18883,46 @@ var CardCharge = {
|
|
|
18790
18883
|
return CardAPI.requestOtpForSavedCards(phoneNumber);
|
|
18791
18884
|
},
|
|
18792
18885
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
18793
|
-
var
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18886
|
+
var _this9 = this;
|
|
18887
|
+
|
|
18888
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18889
|
+
var code, phone, payload, response;
|
|
18890
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18891
|
+
while (1) {
|
|
18892
|
+
switch (_context.prev = _context.next) {
|
|
18893
|
+
case 0:
|
|
18894
|
+
code = _ref4.code, phone = _ref4.phone;
|
|
18895
|
+
payload = {
|
|
18896
|
+
code: code,
|
|
18897
|
+
phone: phone,
|
|
18898
|
+
transaction: _this9.id
|
|
18899
|
+
};
|
|
18900
|
+
_context.next = 4;
|
|
18901
|
+
return CardAPI.verifySavedCardsOtp(payload);
|
|
18902
|
+
|
|
18903
|
+
case 4:
|
|
18904
|
+
response = _context.sent;
|
|
18905
|
+
_this9.savedCardsToken = response.data.token;
|
|
18906
|
+
return _context.abrupt("return", response);
|
|
18907
|
+
|
|
18908
|
+
case 7:
|
|
18909
|
+
case "end":
|
|
18910
|
+
return _context.stop();
|
|
18911
|
+
}
|
|
18912
|
+
}
|
|
18913
|
+
}, _callee);
|
|
18914
|
+
}))();
|
|
18915
|
+
},
|
|
18916
|
+
getSavedCards: function getSavedCards() {
|
|
18917
|
+
return CardAPI.getSavedCards({
|
|
18918
|
+
token: this.savedCardsToken
|
|
18919
|
+
});
|
|
18920
|
+
},
|
|
18921
|
+
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
18922
|
+
return CardAPI.deleteSavedCard({
|
|
18923
|
+
cardCode: cardCode,
|
|
18924
|
+
token: this.savedCardsToken
|
|
18925
|
+
});
|
|
18801
18926
|
}
|
|
18802
18927
|
};
|
|
18803
18928
|
|
|
@@ -20354,6 +20479,7 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
20354
20479
|
this.subscription = data.subscription || null;
|
|
20355
20480
|
this.planDetails = data.plan_details || null;
|
|
20356
20481
|
this.exchangeRate = data.exchange_rate || null;
|
|
20482
|
+
this.savedCardsToken = null;
|
|
20357
20483
|
this.isSavedCardsEnabled = data.saved_cards && data.saved_cards.enabled || null;
|
|
20358
20484
|
/**
|
|
20359
20485
|
* We initialize parameters we send to the API as empty strings
|
package/lib/checkout.js
CHANGED
|
@@ -18572,43 +18572,136 @@ var CardAPI = {
|
|
|
18572
18572
|
});
|
|
18573
18573
|
},
|
|
18574
18574
|
requestOtpForSavedCards: function requestOtpForSavedCards(phoneNumber) {
|
|
18575
|
-
|
|
18576
|
-
|
|
18575
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18576
|
+
var url, language, headers, _yield$axiosInstance$, data;
|
|
18577
18577
|
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18578
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18579
|
+
while (1) {
|
|
18580
|
+
switch (_context.prev = _context.next) {
|
|
18581
|
+
case 0:
|
|
18582
|
+
url = new URL("/authorize/".concat(phoneNumber), configToUse.savedCardsApiUrl).toString();
|
|
18583
|
+
language = getLanguage();
|
|
18584
|
+
headers = _objectSpread2({}, language && {
|
|
18585
|
+
'Accept-Language': language
|
|
18586
|
+
});
|
|
18587
|
+
_context.next = 5;
|
|
18588
|
+
return axiosInstance.post(url, {
|
|
18589
|
+
headers: headers
|
|
18590
|
+
});
|
|
18581
18591
|
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18592
|
+
case 5:
|
|
18593
|
+
_yield$axiosInstance$ = _context.sent;
|
|
18594
|
+
data = _yield$axiosInstance$.data;
|
|
18595
|
+
return _context.abrupt("return", data);
|
|
18596
|
+
|
|
18597
|
+
case 8:
|
|
18598
|
+
case "end":
|
|
18599
|
+
return _context.stop();
|
|
18600
|
+
}
|
|
18601
|
+
}
|
|
18602
|
+
}, _callee);
|
|
18603
|
+
}))();
|
|
18588
18604
|
},
|
|
18589
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18605
|
+
verifySavedCardsOtp: function verifySavedCardsOtp(_ref6) {
|
|
18606
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
18607
|
+
var code, phone, transaction, url, language, headers, data, response;
|
|
18608
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
18609
|
+
while (1) {
|
|
18610
|
+
switch (_context2.prev = _context2.next) {
|
|
18611
|
+
case 0:
|
|
18612
|
+
code = _ref6.code, phone = _ref6.phone, transaction = _ref6.transaction;
|
|
18613
|
+
url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
|
|
18614
|
+
language = getLanguage();
|
|
18615
|
+
headers = _objectSpread2({}, language && {
|
|
18616
|
+
'Accept-Language': language
|
|
18617
|
+
});
|
|
18618
|
+
data = {
|
|
18619
|
+
code: code,
|
|
18620
|
+
phone: phone,
|
|
18621
|
+
transaction: transaction
|
|
18622
|
+
};
|
|
18623
|
+
_context2.next = 7;
|
|
18624
|
+
return axiosInstance.post(url, data, {
|
|
18625
|
+
headers: headers
|
|
18626
|
+
});
|
|
18595
18627
|
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
'Accept-Language': language
|
|
18600
|
-
});
|
|
18628
|
+
case 7:
|
|
18629
|
+
response = _context2.sent;
|
|
18630
|
+
return _context2.abrupt("return", response.data);
|
|
18601
18631
|
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18632
|
+
case 9:
|
|
18633
|
+
case "end":
|
|
18634
|
+
return _context2.stop();
|
|
18635
|
+
}
|
|
18636
|
+
}
|
|
18637
|
+
}, _callee2);
|
|
18638
|
+
}))();
|
|
18639
|
+
},
|
|
18640
|
+
getSavedCards: function getSavedCards(_ref7) {
|
|
18641
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
18642
|
+
var token, url, language, headers, response;
|
|
18643
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
18644
|
+
while (1) {
|
|
18645
|
+
switch (_context3.prev = _context3.next) {
|
|
18646
|
+
case 0:
|
|
18647
|
+
token = _ref7.token;
|
|
18648
|
+
url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
|
|
18649
|
+
language = getLanguage();
|
|
18650
|
+
headers = _objectSpread2({
|
|
18651
|
+
Authorization: "Bearer ".concat(token),
|
|
18652
|
+
'jwt-auth': true
|
|
18653
|
+
}, language && {
|
|
18654
|
+
'Accept-Language': language
|
|
18655
|
+
});
|
|
18656
|
+
_context3.next = 6;
|
|
18657
|
+
return axiosInstance.get(url, {
|
|
18658
|
+
headers: headers
|
|
18659
|
+
});
|
|
18660
|
+
|
|
18661
|
+
case 6:
|
|
18662
|
+
response = _context3.sent;
|
|
18663
|
+
return _context3.abrupt("return", response.data);
|
|
18664
|
+
|
|
18665
|
+
case 8:
|
|
18666
|
+
case "end":
|
|
18667
|
+
return _context3.stop();
|
|
18668
|
+
}
|
|
18669
|
+
}
|
|
18670
|
+
}, _callee3);
|
|
18671
|
+
}))();
|
|
18672
|
+
},
|
|
18673
|
+
deleteSavedCard: function deleteSavedCard(_ref8) {
|
|
18674
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
18675
|
+
var cardCode, token, url, language, headers, response;
|
|
18676
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
18677
|
+
while (1) {
|
|
18678
|
+
switch (_context4.prev = _context4.next) {
|
|
18679
|
+
case 0:
|
|
18680
|
+
cardCode = _ref8.cardCode, token = _ref8.token;
|
|
18681
|
+
url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
|
|
18682
|
+
language = getLanguage();
|
|
18683
|
+
headers = _objectSpread2({
|
|
18684
|
+
Authorization: "Bearer ".concat(token),
|
|
18685
|
+
'jwt-auth': true
|
|
18686
|
+
}, language && {
|
|
18687
|
+
'Accept-Language': language
|
|
18688
|
+
});
|
|
18689
|
+
_context4.next = 6;
|
|
18690
|
+
return axiosInstance.delete(url, {
|
|
18691
|
+
headers: headers
|
|
18692
|
+
});
|
|
18693
|
+
|
|
18694
|
+
case 6:
|
|
18695
|
+
response = _context4.sent;
|
|
18696
|
+
return _context4.abrupt("return", response.data);
|
|
18697
|
+
|
|
18698
|
+
case 8:
|
|
18699
|
+
case "end":
|
|
18700
|
+
return _context4.stop();
|
|
18701
|
+
}
|
|
18702
|
+
}
|
|
18703
|
+
}, _callee4);
|
|
18704
|
+
}))();
|
|
18612
18705
|
}
|
|
18613
18706
|
};
|
|
18614
18707
|
|
|
@@ -18794,14 +18887,46 @@ var CardCharge = {
|
|
|
18794
18887
|
return CardAPI.requestOtpForSavedCards(phoneNumber);
|
|
18795
18888
|
},
|
|
18796
18889
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
18797
|
-
var
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18890
|
+
var _this9 = this;
|
|
18891
|
+
|
|
18892
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18893
|
+
var code, phone, payload, response;
|
|
18894
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18895
|
+
while (1) {
|
|
18896
|
+
switch (_context.prev = _context.next) {
|
|
18897
|
+
case 0:
|
|
18898
|
+
code = _ref4.code, phone = _ref4.phone;
|
|
18899
|
+
payload = {
|
|
18900
|
+
code: code,
|
|
18901
|
+
phone: phone,
|
|
18902
|
+
transaction: _this9.id
|
|
18903
|
+
};
|
|
18904
|
+
_context.next = 4;
|
|
18905
|
+
return CardAPI.verifySavedCardsOtp(payload);
|
|
18906
|
+
|
|
18907
|
+
case 4:
|
|
18908
|
+
response = _context.sent;
|
|
18909
|
+
_this9.savedCardsToken = response.data.token;
|
|
18910
|
+
return _context.abrupt("return", response);
|
|
18911
|
+
|
|
18912
|
+
case 7:
|
|
18913
|
+
case "end":
|
|
18914
|
+
return _context.stop();
|
|
18915
|
+
}
|
|
18916
|
+
}
|
|
18917
|
+
}, _callee);
|
|
18918
|
+
}))();
|
|
18919
|
+
},
|
|
18920
|
+
getSavedCards: function getSavedCards() {
|
|
18921
|
+
return CardAPI.getSavedCards({
|
|
18922
|
+
token: this.savedCardsToken
|
|
18923
|
+
});
|
|
18924
|
+
},
|
|
18925
|
+
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
18926
|
+
return CardAPI.deleteSavedCard({
|
|
18927
|
+
cardCode: cardCode,
|
|
18928
|
+
token: this.savedCardsToken
|
|
18929
|
+
});
|
|
18805
18930
|
}
|
|
18806
18931
|
};
|
|
18807
18932
|
|
|
@@ -20358,6 +20483,7 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
20358
20483
|
this.subscription = data.subscription || null;
|
|
20359
20484
|
this.planDetails = data.plan_details || null;
|
|
20360
20485
|
this.exchangeRate = data.exchange_rate || null;
|
|
20486
|
+
this.savedCardsToken = null;
|
|
20361
20487
|
this.isSavedCardsEnabled = data.saved_cards && data.saved_cards.enabled || null;
|
|
20362
20488
|
/**
|
|
20363
20489
|
* We initialize parameters we send to the API as empty strings
|