@paystack/checkout-js 1.19.0-dev.2 → 1.19.0-dev.20
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/README.md +4 -12
- package/dist/checkout.js +20830 -29
- package/es/checkout.js +440 -364
- package/lib/checkout.js +440 -363
- package/package.json +3 -3
package/lib/checkout.js
CHANGED
|
@@ -6408,7 +6408,7 @@ var devConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
|
6408
6408
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6409
6409
|
pusherKey: '1c7b262ee18455815893',
|
|
6410
6410
|
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
|
|
6411
|
-
savedCardsApiUrl: 'https://saved-cards-api.
|
|
6411
|
+
savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
|
|
6412
6412
|
});
|
|
6413
6413
|
var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6414
6414
|
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
@@ -6416,7 +6416,7 @@ var stagingConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
|
6416
6416
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
6417
6417
|
pusherKey: '1c7b262ee18455815893',
|
|
6418
6418
|
pusherUrl: 'https://s3-eu-west-1.amazonaws.com/pstk-public-files/js/pusher.min.js',
|
|
6419
|
-
savedCardsApiUrl: 'https://saved-cards-api.
|
|
6419
|
+
savedCardsApiUrl: 'https://saved-cards-api.public.paystack.studio/'
|
|
6420
6420
|
});
|
|
6421
6421
|
var productionConfig = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
6422
6422
|
checkoutUrl: 'https://checkout.paystack.com/',
|
|
@@ -6434,37 +6434,6 @@ var configToEnvironmentMapping = {
|
|
|
6434
6434
|
};
|
|
6435
6435
|
var configToUse = configToEnvironmentMapping[env.paystackEnvironment] || productionConfig;
|
|
6436
6436
|
|
|
6437
|
-
/* eslint-env browser */
|
|
6438
|
-
// We use this function to load pusher.
|
|
6439
|
-
|
|
6440
|
-
function loadPusher() {
|
|
6441
|
-
if (!window) {
|
|
6442
|
-
return Promise.reject(new Error('Window object not available'));
|
|
6443
|
-
}
|
|
6444
|
-
|
|
6445
|
-
return new Promise(function (resolve, reject) {
|
|
6446
|
-
var xhr = new XMLHttpRequest();
|
|
6447
|
-
xhr.open('GET', configToUse.pusherUrl);
|
|
6448
|
-
|
|
6449
|
-
xhr.onload = function () {
|
|
6450
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
6451
|
-
var s = document.createElement('script');
|
|
6452
|
-
s.appendChild(document.createTextNode(xhr.responseText));
|
|
6453
|
-
document.head.appendChild(s);
|
|
6454
|
-
resolve();
|
|
6455
|
-
} else {
|
|
6456
|
-
reject(xhr.statusText);
|
|
6457
|
-
}
|
|
6458
|
-
};
|
|
6459
|
-
|
|
6460
|
-
xhr.onerror = function () {
|
|
6461
|
-
return reject(xhr.statusText);
|
|
6462
|
-
};
|
|
6463
|
-
|
|
6464
|
-
xhr.send(null);
|
|
6465
|
-
});
|
|
6466
|
-
}
|
|
6467
|
-
|
|
6468
6437
|
var noOp = function noOp() {
|
|
6469
6438
|
return undefined;
|
|
6470
6439
|
};
|
|
@@ -6638,6 +6607,82 @@ var ChargeResponses = {
|
|
|
6638
6607
|
}
|
|
6639
6608
|
};
|
|
6640
6609
|
|
|
6610
|
+
/* eslint-env browser */
|
|
6611
|
+
|
|
6612
|
+
var loadPusher = function loadPusher() {
|
|
6613
|
+
if (!window) {
|
|
6614
|
+
return Promise.reject(new Error('Window object not available'));
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
return new Promise(function (resolve, reject) {
|
|
6618
|
+
var xhr = new XMLHttpRequest();
|
|
6619
|
+
xhr.open('GET', configToUse.pusherUrl);
|
|
6620
|
+
|
|
6621
|
+
xhr.onload = function () {
|
|
6622
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
6623
|
+
var s = document.createElement('script');
|
|
6624
|
+
s.appendChild(document.createTextNode(xhr.responseText));
|
|
6625
|
+
document.head.appendChild(s);
|
|
6626
|
+
resolve();
|
|
6627
|
+
} else {
|
|
6628
|
+
reject(xhr.statusText);
|
|
6629
|
+
}
|
|
6630
|
+
};
|
|
6631
|
+
|
|
6632
|
+
xhr.onerror = function () {
|
|
6633
|
+
return reject(xhr.statusText);
|
|
6634
|
+
};
|
|
6635
|
+
|
|
6636
|
+
xhr.send(null);
|
|
6637
|
+
});
|
|
6638
|
+
}; // `context` is passed through to set the class property of `isListening` to true/false
|
|
6639
|
+
// and provide the logAPIResponse analytics function
|
|
6640
|
+
// eslint-disable-next-line consistent-return
|
|
6641
|
+
|
|
6642
|
+
var subscribeToChargeEvents = function subscribeToChargeEvents(options, context, callback) {
|
|
6643
|
+
var channel = options.channel,
|
|
6644
|
+
paymentMethod = options.paymentMethod;
|
|
6645
|
+
var pusher;
|
|
6646
|
+
|
|
6647
|
+
if (window && window.Pusher) {
|
|
6648
|
+
pusher = new window.Pusher(configToUse.pusherKey, {
|
|
6649
|
+
cluster: 'eu',
|
|
6650
|
+
disableStats: true
|
|
6651
|
+
});
|
|
6652
|
+
}
|
|
6653
|
+
|
|
6654
|
+
var pusherUndefinedError = {
|
|
6655
|
+
status: 'error',
|
|
6656
|
+
message: 'We could not listen for charge response.'
|
|
6657
|
+
};
|
|
6658
|
+
var pusherSubscriptionError = {
|
|
6659
|
+
status: 'error',
|
|
6660
|
+
message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
|
|
6661
|
+
};
|
|
6662
|
+
|
|
6663
|
+
var unsubscribeFromPusher = function unsubscribeFromPusher() {
|
|
6664
|
+
pusher.unsubscribe(channel);
|
|
6665
|
+
};
|
|
6666
|
+
|
|
6667
|
+
if (!pusher) {
|
|
6668
|
+
return callback(pusherUndefinedError, noOp);
|
|
6669
|
+
}
|
|
6670
|
+
|
|
6671
|
+
var pusherSubscription = pusher.subscribe(channel);
|
|
6672
|
+
pusherSubscription.bind('pusher:subscription_succeeded', function () {
|
|
6673
|
+
context.isListening = true;
|
|
6674
|
+
});
|
|
6675
|
+
pusherSubscription.bind('pusher:subscription_error', function () {
|
|
6676
|
+
context.isListening = false;
|
|
6677
|
+
callback(pusherSubscriptionError, noOp);
|
|
6678
|
+
});
|
|
6679
|
+
pusherSubscription.bind('response', function (response) {
|
|
6680
|
+
var formattedResponse = ChargeResponses.parse(response);
|
|
6681
|
+
context.logAPIResponse(formattedResponse, paymentMethod);
|
|
6682
|
+
callback(formattedResponse, unsubscribeFromPusher);
|
|
6683
|
+
});
|
|
6684
|
+
};
|
|
6685
|
+
|
|
6641
6686
|
var uncurryThis$6 = functionUncurryThis;
|
|
6642
6687
|
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
6643
6688
|
var redefine$4 = redefine$a.exports;
|
|
@@ -18571,50 +18616,178 @@ var CardAPI = {
|
|
|
18571
18616
|
return ChargeResponses.parse(response.data);
|
|
18572
18617
|
});
|
|
18573
18618
|
},
|
|
18574
|
-
|
|
18575
|
-
|
|
18576
|
-
|
|
18619
|
+
requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
|
|
18620
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18621
|
+
var url, language, headers, _yield$axiosInstance$, data;
|
|
18577
18622
|
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18623
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18624
|
+
while (1) {
|
|
18625
|
+
switch (_context.prev = _context.next) {
|
|
18626
|
+
case 0:
|
|
18627
|
+
url = new URL("/authorize/".concat(phoneNumber), configToUse.savedCardsApiUrl).toString();
|
|
18628
|
+
language = getLanguage();
|
|
18629
|
+
headers = _objectSpread2({}, language && {
|
|
18630
|
+
'Accept-Language': language
|
|
18631
|
+
});
|
|
18632
|
+
_context.next = 5;
|
|
18633
|
+
return axiosInstance.post(url, {
|
|
18634
|
+
headers: headers
|
|
18635
|
+
});
|
|
18581
18636
|
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18637
|
+
case 5:
|
|
18638
|
+
_yield$axiosInstance$ = _context.sent;
|
|
18639
|
+
data = _yield$axiosInstance$.data;
|
|
18640
|
+
return _context.abrupt("return", data);
|
|
18641
|
+
|
|
18642
|
+
case 8:
|
|
18643
|
+
case "end":
|
|
18644
|
+
return _context.stop();
|
|
18645
|
+
}
|
|
18646
|
+
}
|
|
18647
|
+
}, _callee);
|
|
18648
|
+
}))();
|
|
18588
18649
|
},
|
|
18589
|
-
verifySavedCardsOtp: function verifySavedCardsOtp(
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18650
|
+
verifySavedCardsOtp: function verifySavedCardsOtp(_ref6) {
|
|
18651
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
18652
|
+
var code, phone, transaction, url, language, headers, data, response;
|
|
18653
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
18654
|
+
while (1) {
|
|
18655
|
+
switch (_context2.prev = _context2.next) {
|
|
18656
|
+
case 0:
|
|
18657
|
+
code = _ref6.code, phone = _ref6.phone, transaction = _ref6.transaction;
|
|
18658
|
+
url = new URL('/authorize/verify', configToUse.savedCardsApiUrl).toString();
|
|
18659
|
+
language = getLanguage();
|
|
18660
|
+
headers = _objectSpread2({}, language && {
|
|
18661
|
+
'Accept-Language': language
|
|
18662
|
+
});
|
|
18663
|
+
data = {
|
|
18664
|
+
code: code,
|
|
18665
|
+
phone: phone,
|
|
18666
|
+
transaction: transaction
|
|
18667
|
+
};
|
|
18668
|
+
_context2.next = 7;
|
|
18669
|
+
return axiosInstance.post(url, data, {
|
|
18670
|
+
headers: headers
|
|
18671
|
+
});
|
|
18595
18672
|
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
'Accept-Language': language
|
|
18600
|
-
});
|
|
18673
|
+
case 7:
|
|
18674
|
+
response = _context2.sent;
|
|
18675
|
+
return _context2.abrupt("return", response.data);
|
|
18601
18676
|
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18677
|
+
case 9:
|
|
18678
|
+
case "end":
|
|
18679
|
+
return _context2.stop();
|
|
18680
|
+
}
|
|
18681
|
+
}
|
|
18682
|
+
}, _callee2);
|
|
18683
|
+
}))();
|
|
18684
|
+
},
|
|
18685
|
+
getSavedCards: function getSavedCards(_ref7) {
|
|
18686
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
18687
|
+
var token, url, language, headers, response;
|
|
18688
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
18689
|
+
while (1) {
|
|
18690
|
+
switch (_context3.prev = _context3.next) {
|
|
18691
|
+
case 0:
|
|
18692
|
+
token = _ref7.token;
|
|
18693
|
+
url = new URL('/cards', configToUse.savedCardsApiUrl).toString();
|
|
18694
|
+
language = getLanguage();
|
|
18695
|
+
headers = _objectSpread2({
|
|
18696
|
+
Authorization: "Bearer ".concat(token),
|
|
18697
|
+
'jwt-auth': true
|
|
18698
|
+
}, language && {
|
|
18699
|
+
'Accept-Language': language
|
|
18700
|
+
});
|
|
18701
|
+
_context3.next = 6;
|
|
18702
|
+
return axiosInstance.get(url, {
|
|
18703
|
+
headers: headers
|
|
18704
|
+
});
|
|
18705
|
+
|
|
18706
|
+
case 6:
|
|
18707
|
+
response = _context3.sent;
|
|
18708
|
+
return _context3.abrupt("return", response.data);
|
|
18709
|
+
|
|
18710
|
+
case 8:
|
|
18711
|
+
case "end":
|
|
18712
|
+
return _context3.stop();
|
|
18713
|
+
}
|
|
18714
|
+
}
|
|
18715
|
+
}, _callee3);
|
|
18716
|
+
}))();
|
|
18717
|
+
},
|
|
18718
|
+
deleteSavedCard: function deleteSavedCard(_ref8) {
|
|
18719
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
18720
|
+
var cardCode, token, url, language, headers, response;
|
|
18721
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
18722
|
+
while (1) {
|
|
18723
|
+
switch (_context4.prev = _context4.next) {
|
|
18724
|
+
case 0:
|
|
18725
|
+
cardCode = _ref8.cardCode, token = _ref8.token;
|
|
18726
|
+
url = new URL("/cards/".concat(cardCode), configToUse.savedCardsApiUrl).toString();
|
|
18727
|
+
language = getLanguage();
|
|
18728
|
+
headers = _objectSpread2({
|
|
18729
|
+
Authorization: "Bearer ".concat(token),
|
|
18730
|
+
'jwt-auth': true
|
|
18731
|
+
}, language && {
|
|
18732
|
+
'Accept-Language': language
|
|
18733
|
+
});
|
|
18734
|
+
_context4.next = 6;
|
|
18735
|
+
return axiosInstance.delete(url, {
|
|
18736
|
+
headers: headers
|
|
18737
|
+
});
|
|
18738
|
+
|
|
18739
|
+
case 6:
|
|
18740
|
+
response = _context4.sent;
|
|
18741
|
+
return _context4.abrupt("return", response.data);
|
|
18742
|
+
|
|
18743
|
+
case 8:
|
|
18744
|
+
case "end":
|
|
18745
|
+
return _context4.stop();
|
|
18746
|
+
}
|
|
18747
|
+
}
|
|
18748
|
+
}, _callee4);
|
|
18749
|
+
}))();
|
|
18750
|
+
},
|
|
18751
|
+
chargeSavedCard: function chargeSavedCard(_ref9) {
|
|
18752
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
18753
|
+
var token, device, cardCode, transaction, selectedCurrency, url, language, headers, data;
|
|
18754
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
18755
|
+
while (1) {
|
|
18756
|
+
switch (_context5.prev = _context5.next) {
|
|
18757
|
+
case 0:
|
|
18758
|
+
token = _ref9.token, device = _ref9.device, cardCode = _ref9.cardCode, transaction = _ref9.transaction, selectedCurrency = _ref9.selectedCurrency;
|
|
18759
|
+
url = new URL("/cards/".concat(cardCode, "/charge"), configToUse.savedCardsApiUrl).toString();
|
|
18760
|
+
language = getLanguage();
|
|
18761
|
+
headers = _objectSpread2({
|
|
18762
|
+
Authorization: "Bearer ".concat(token),
|
|
18763
|
+
'jwt-auth': true
|
|
18764
|
+
}, language && {
|
|
18765
|
+
'Accept-Language': language
|
|
18766
|
+
});
|
|
18767
|
+
data = {
|
|
18768
|
+
device: device,
|
|
18769
|
+
transaction: transaction,
|
|
18770
|
+
selectedCurrency: selectedCurrency
|
|
18771
|
+
};
|
|
18772
|
+
return _context5.abrupt("return", axiosInstance.post(url, data, {
|
|
18773
|
+
headers: headers
|
|
18774
|
+
}).then(function (response) {
|
|
18775
|
+
return ChargeResponses.parse(response.data);
|
|
18776
|
+
}));
|
|
18777
|
+
|
|
18778
|
+
case 6:
|
|
18779
|
+
case "end":
|
|
18780
|
+
return _context5.stop();
|
|
18781
|
+
}
|
|
18782
|
+
}
|
|
18783
|
+
}, _callee5);
|
|
18784
|
+
}))();
|
|
18612
18785
|
}
|
|
18613
18786
|
};
|
|
18614
18787
|
|
|
18615
18788
|
var paymentMethod$3 = 'card';
|
|
18616
18789
|
|
|
18617
|
-
function validate$
|
|
18790
|
+
function validate$3(card, isSetter) {
|
|
18618
18791
|
return new Promise(function (resolve, reject) {
|
|
18619
18792
|
var validation = Card.validate(card);
|
|
18620
18793
|
|
|
@@ -18635,7 +18808,7 @@ var CardCharge = {
|
|
|
18635
18808
|
setCard: function setCard(params) {
|
|
18636
18809
|
var _this = this;
|
|
18637
18810
|
|
|
18638
|
-
return validate$
|
|
18811
|
+
return validate$3(params, true).then(function () {
|
|
18639
18812
|
_this.card = new Card(params);
|
|
18640
18813
|
});
|
|
18641
18814
|
},
|
|
@@ -18651,7 +18824,7 @@ var CardCharge = {
|
|
|
18651
18824
|
return this.chargeCardWithPin(customFields);
|
|
18652
18825
|
}
|
|
18653
18826
|
|
|
18654
|
-
return validate$
|
|
18827
|
+
return validate$3(this.card).then(function () {
|
|
18655
18828
|
_this2.logAttempt(paymentMethod$3);
|
|
18656
18829
|
|
|
18657
18830
|
var chargeParams = {
|
|
@@ -18790,18 +18963,67 @@ var CardCharge = {
|
|
|
18790
18963
|
};
|
|
18791
18964
|
return this.listenForCharge(listenerOptions, callback);
|
|
18792
18965
|
},
|
|
18793
|
-
|
|
18794
|
-
return CardAPI.
|
|
18966
|
+
requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
|
|
18967
|
+
return CardAPI.requestSavedCardsOTP(phoneNumber);
|
|
18795
18968
|
},
|
|
18796
18969
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
18797
|
-
var
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18970
|
+
var _this9 = this;
|
|
18971
|
+
|
|
18972
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
18973
|
+
var code, phone, payload, response;
|
|
18974
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18975
|
+
while (1) {
|
|
18976
|
+
switch (_context.prev = _context.next) {
|
|
18977
|
+
case 0:
|
|
18978
|
+
code = _ref4.code, phone = _ref4.phone;
|
|
18979
|
+
payload = {
|
|
18980
|
+
code: code,
|
|
18981
|
+
phone: phone,
|
|
18982
|
+
transaction: _this9.id
|
|
18983
|
+
};
|
|
18984
|
+
_context.prev = 2;
|
|
18985
|
+
_context.next = 5;
|
|
18986
|
+
return CardAPI.verifySavedCardsOtp(payload);
|
|
18987
|
+
|
|
18988
|
+
case 5:
|
|
18989
|
+
response = _context.sent;
|
|
18990
|
+
_this9.savedCardsToken = response.data.token;
|
|
18991
|
+
return _context.abrupt("return", response);
|
|
18992
|
+
|
|
18993
|
+
case 10:
|
|
18994
|
+
_context.prev = 10;
|
|
18995
|
+
_context.t0 = _context["catch"](2);
|
|
18996
|
+
_this9.savedCardsToken = null;
|
|
18997
|
+
throw _context.t0;
|
|
18998
|
+
|
|
18999
|
+
case 14:
|
|
19000
|
+
case "end":
|
|
19001
|
+
return _context.stop();
|
|
19002
|
+
}
|
|
19003
|
+
}
|
|
19004
|
+
}, _callee, null, [[2, 10]]);
|
|
19005
|
+
}))();
|
|
19006
|
+
},
|
|
19007
|
+
getSavedCards: function getSavedCards() {
|
|
19008
|
+
return CardAPI.getSavedCards({
|
|
19009
|
+
token: this.savedCardsToken
|
|
19010
|
+
});
|
|
19011
|
+
},
|
|
19012
|
+
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
19013
|
+
return CardAPI.deleteSavedCard({
|
|
19014
|
+
cardCode: cardCode,
|
|
19015
|
+
token: this.savedCardsToken
|
|
19016
|
+
});
|
|
19017
|
+
},
|
|
19018
|
+
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19019
|
+
var cardCode = _ref5.cardCode;
|
|
19020
|
+
return CardAPI.chargeSavedCard({
|
|
19021
|
+
cardCode: cardCode,
|
|
19022
|
+
transaction: this.id,
|
|
19023
|
+
token: this.savedCardsToken,
|
|
19024
|
+
device: this.deviceFingerprint,
|
|
19025
|
+
selectedCurrency: this.currency
|
|
19026
|
+
});
|
|
18805
19027
|
}
|
|
18806
19028
|
};
|
|
18807
19029
|
|
|
@@ -18956,7 +19178,7 @@ var EMandateAPI = {
|
|
|
18956
19178
|
|
|
18957
19179
|
var paymentMethod$2 = 'bank account';
|
|
18958
19180
|
|
|
18959
|
-
function validate$
|
|
19181
|
+
function validate$2(bankAccount, isSetter) {
|
|
18960
19182
|
return new Promise(function (resolve, reject) {
|
|
18961
19183
|
var validation = BankAccount.validate(bankAccount);
|
|
18962
19184
|
|
|
@@ -18974,14 +19196,14 @@ var EMandate = {
|
|
|
18974
19196
|
setBankAccount: function setBankAccount(params) {
|
|
18975
19197
|
var _this = this;
|
|
18976
19198
|
|
|
18977
|
-
return validate$
|
|
19199
|
+
return validate$2(params, true).then(function () {
|
|
18978
19200
|
_this.bankAccount = new BankAccount(params);
|
|
18979
19201
|
});
|
|
18980
19202
|
},
|
|
18981
19203
|
chargeBankAccount: function chargeBankAccount() {
|
|
18982
19204
|
var _this2 = this;
|
|
18983
19205
|
|
|
18984
|
-
return validate$
|
|
19206
|
+
return validate$2(this.bankAccount).then(function () {
|
|
18985
19207
|
_this2.logAttempt(paymentMethod$2);
|
|
18986
19208
|
|
|
18987
19209
|
var verifyParams = {
|
|
@@ -19000,7 +19222,7 @@ var EMandate = {
|
|
|
19000
19222
|
registerBankAccount: function registerBankAccount(birthday) {
|
|
19001
19223
|
var _this3 = this;
|
|
19002
19224
|
|
|
19003
|
-
return validate$
|
|
19225
|
+
return validate$2(this.bankAccount).then(function () {
|
|
19004
19226
|
var registerParams = {
|
|
19005
19227
|
bankId: _this3.bankAccount.bankId,
|
|
19006
19228
|
transactionId: _this3.id,
|
|
@@ -19017,7 +19239,7 @@ var EMandate = {
|
|
|
19017
19239
|
authenticateBankAccount: function authenticateBankAccount(token) {
|
|
19018
19240
|
var _this4 = this;
|
|
19019
19241
|
|
|
19020
|
-
return validate$
|
|
19242
|
+
return validate$2(this.bankAccount).then(function () {
|
|
19021
19243
|
var chargeParams = {
|
|
19022
19244
|
bankId: _this4.bankAccount.bankId,
|
|
19023
19245
|
transactionId: _this4.id,
|
|
@@ -19242,7 +19464,7 @@ var QrAPI = {
|
|
|
19242
19464
|
}
|
|
19243
19465
|
};
|
|
19244
19466
|
|
|
19245
|
-
function validate$
|
|
19467
|
+
function validate$1(channel) {
|
|
19246
19468
|
return new Promise(function (resolve, reject) {
|
|
19247
19469
|
var allowedChannels = ['visa', 'MPASS_OLTI'];
|
|
19248
19470
|
|
|
@@ -19260,7 +19482,7 @@ var QRCharge = {
|
|
|
19260
19482
|
var _this = this;
|
|
19261
19483
|
|
|
19262
19484
|
var channel = _ref.channel;
|
|
19263
|
-
return validate$
|
|
19485
|
+
return validate$1(channel).then(function () {
|
|
19264
19486
|
if (_this.qr[channel]) {
|
|
19265
19487
|
return _this.qr[channel];
|
|
19266
19488
|
}
|
|
@@ -19282,7 +19504,7 @@ var QRCharge = {
|
|
|
19282
19504
|
var _this2 = this;
|
|
19283
19505
|
|
|
19284
19506
|
var channel = _ref2.channel;
|
|
19285
|
-
return validate$
|
|
19507
|
+
return validate$1(channel).then(function () {
|
|
19286
19508
|
if (!_this2.qr[channel]) {
|
|
19287
19509
|
return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
|
|
19288
19510
|
}
|
|
@@ -19403,7 +19625,7 @@ var MobileMoneyAPI = {
|
|
|
19403
19625
|
}
|
|
19404
19626
|
};
|
|
19405
19627
|
|
|
19406
|
-
function validate
|
|
19628
|
+
function validate(phoneNumber) {
|
|
19407
19629
|
return new Promise(function (resolve, reject) {
|
|
19408
19630
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
19409
19631
|
|
|
@@ -19424,7 +19646,7 @@ var MobileMoneyCharge = {
|
|
|
19424
19646
|
provider = _ref.provider,
|
|
19425
19647
|
voucher = _ref.voucher,
|
|
19426
19648
|
registrationToken = _ref.registrationToken;
|
|
19427
|
-
return validate
|
|
19649
|
+
return validate(phoneNumber).then(function () {
|
|
19428
19650
|
_this.logAttempt('mobile money');
|
|
19429
19651
|
|
|
19430
19652
|
var params = {
|
|
@@ -19455,7 +19677,7 @@ var MobileMoneyCharge = {
|
|
|
19455
19677
|
var phoneNumber = payload.phoneNumber,
|
|
19456
19678
|
provider = payload.provider,
|
|
19457
19679
|
registrationToken = payload.registrationToken;
|
|
19458
|
-
return validate
|
|
19680
|
+
return validate(phoneNumber).then(function () {
|
|
19459
19681
|
_this2.logMobileMoneyActions(payload);
|
|
19460
19682
|
|
|
19461
19683
|
var params = {
|
|
@@ -19511,233 +19733,6 @@ var MobileMoneyCharge = {
|
|
|
19511
19733
|
}
|
|
19512
19734
|
};
|
|
19513
19735
|
|
|
19514
|
-
var PhoneAPI = {
|
|
19515
|
-
verify: function verify(phoneNumber, publicKey) {
|
|
19516
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/verify");
|
|
19517
|
-
var language = getLanguage();
|
|
19518
|
-
|
|
19519
|
-
var headers = _objectSpread2({
|
|
19520
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19521
|
-
}, language && {
|
|
19522
|
-
'Accept-Language': language
|
|
19523
|
-
});
|
|
19524
|
-
|
|
19525
|
-
return axiosInstance.post(url, {
|
|
19526
|
-
phone: phoneNumber
|
|
19527
|
-
}, {
|
|
19528
|
-
headers: headers
|
|
19529
|
-
}).then(function (response) {
|
|
19530
|
-
return response.data;
|
|
19531
|
-
});
|
|
19532
|
-
},
|
|
19533
|
-
deleteCard: function deleteCard(phoneNumber, publicKey, cardId) {
|
|
19534
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/remove_card");
|
|
19535
|
-
var language = getLanguage();
|
|
19536
|
-
|
|
19537
|
-
var headers = _objectSpread2({
|
|
19538
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19539
|
-
}, language && {
|
|
19540
|
-
'Accept-Language': language
|
|
19541
|
-
});
|
|
19542
|
-
|
|
19543
|
-
return axiosInstance.post(url, {
|
|
19544
|
-
phone: phoneNumber,
|
|
19545
|
-
id: cardId
|
|
19546
|
-
}, {
|
|
19547
|
-
headers: headers
|
|
19548
|
-
}).then(function (response) {
|
|
19549
|
-
return response.data;
|
|
19550
|
-
});
|
|
19551
|
-
},
|
|
19552
|
-
authenticateOtp: function authenticateOtp(phoneNumber, publicKey, otp, transactionId) {
|
|
19553
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_otp");
|
|
19554
|
-
var language = getLanguage();
|
|
19555
|
-
|
|
19556
|
-
var headers = _objectSpread2({
|
|
19557
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19558
|
-
}, language && {
|
|
19559
|
-
'Accept-Language': language
|
|
19560
|
-
});
|
|
19561
|
-
|
|
19562
|
-
return axiosInstance.post(url, {
|
|
19563
|
-
phone: phoneNumber,
|
|
19564
|
-
otp: otp,
|
|
19565
|
-
transaction: transactionId
|
|
19566
|
-
}, {
|
|
19567
|
-
headers: headers
|
|
19568
|
-
}).then(function (response) {
|
|
19569
|
-
return response.data;
|
|
19570
|
-
});
|
|
19571
|
-
},
|
|
19572
|
-
authenticatePin: function authenticatePin(phoneNumber, publicKey, pin, transactionId) {
|
|
19573
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/validate_pin");
|
|
19574
|
-
var language = getLanguage();
|
|
19575
|
-
|
|
19576
|
-
var headers = _objectSpread2({
|
|
19577
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19578
|
-
}, language && {
|
|
19579
|
-
'Accept-Language': language
|
|
19580
|
-
});
|
|
19581
|
-
|
|
19582
|
-
return axiosInstance.post(url, {
|
|
19583
|
-
phone: phoneNumber,
|
|
19584
|
-
pin: pin,
|
|
19585
|
-
transaction: transactionId
|
|
19586
|
-
}, {
|
|
19587
|
-
headers: headers
|
|
19588
|
-
}).then(function (response) {
|
|
19589
|
-
return response.data;
|
|
19590
|
-
});
|
|
19591
|
-
},
|
|
19592
|
-
setPin: function setPin(phoneNumber, publicKey, transactionToken, transactionId, pin) {
|
|
19593
|
-
var language = getLanguage();
|
|
19594
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/set_pin");
|
|
19595
|
-
|
|
19596
|
-
var headers = _objectSpread2({
|
|
19597
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19598
|
-
}, language && {
|
|
19599
|
-
'Accept-Language': language
|
|
19600
|
-
});
|
|
19601
|
-
|
|
19602
|
-
return axiosInstance.post(url, {
|
|
19603
|
-
phone: phoneNumber,
|
|
19604
|
-
token: transactionToken,
|
|
19605
|
-
transaction: transactionId,
|
|
19606
|
-
pin: pin
|
|
19607
|
-
}, {
|
|
19608
|
-
headers: headers
|
|
19609
|
-
}).then(function (response) {
|
|
19610
|
-
return response.data;
|
|
19611
|
-
});
|
|
19612
|
-
},
|
|
19613
|
-
charge: function charge(authId, publicKey, token, transactionId, cvv, phoneNumber) {
|
|
19614
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/charge");
|
|
19615
|
-
var language = getLanguage();
|
|
19616
|
-
|
|
19617
|
-
var headers = _objectSpread2({
|
|
19618
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19619
|
-
}, language && {
|
|
19620
|
-
'Accept-Language': language
|
|
19621
|
-
});
|
|
19622
|
-
|
|
19623
|
-
return axiosInstance.post(url, {
|
|
19624
|
-
id: authId,
|
|
19625
|
-
token: token,
|
|
19626
|
-
cvv: cvv,
|
|
19627
|
-
transaction: transactionId,
|
|
19628
|
-
phone: phoneNumber
|
|
19629
|
-
}, {
|
|
19630
|
-
headers: headers
|
|
19631
|
-
}).then(function (response) {
|
|
19632
|
-
return response.data;
|
|
19633
|
-
});
|
|
19634
|
-
},
|
|
19635
|
-
enrollPhoneNumber: function enrollPhoneNumber(phoneNumber, publicKey, transactionId) {
|
|
19636
|
-
var url = "".concat(configToUse.paystackApiUrl, "checkout/pay_with_phone/enroll");
|
|
19637
|
-
var language = getLanguage();
|
|
19638
|
-
|
|
19639
|
-
var headers = _objectSpread2({
|
|
19640
|
-
Authorization: "Bearer ".concat(publicKey)
|
|
19641
|
-
}, language && {
|
|
19642
|
-
'Accept-Language': language
|
|
19643
|
-
});
|
|
19644
|
-
|
|
19645
|
-
return axiosInstance.post(url, {
|
|
19646
|
-
phone: phoneNumber,
|
|
19647
|
-
transaction: transactionId
|
|
19648
|
-
}, {
|
|
19649
|
-
headers: headers
|
|
19650
|
-
}).then(function (response) {
|
|
19651
|
-
return response.data;
|
|
19652
|
-
});
|
|
19653
|
-
}
|
|
19654
|
-
};
|
|
19655
|
-
|
|
19656
|
-
/*
|
|
19657
|
-
TODO:
|
|
19658
|
-
Implement analytics for Pay with Phone. Since unique actions are takens here e.g
|
|
19659
|
-
user verifies pay with phone account, user charged saved card, etc, these should
|
|
19660
|
-
all be reflected as custom analytics actions
|
|
19661
|
-
*/
|
|
19662
|
-
|
|
19663
|
-
function validate(phoneNumber) {
|
|
19664
|
-
return new Promise(function (resolve, reject) {
|
|
19665
|
-
var validation = PhoneNumber.validate(phoneNumber);
|
|
19666
|
-
|
|
19667
|
-
if (!validation.isValid) {
|
|
19668
|
-
var errorMessage = phoneNumber ? validation.errors[0] : 'Please set a valid customer with Transaction.setCustomer()';
|
|
19669
|
-
reject(Error(errorMessage));
|
|
19670
|
-
}
|
|
19671
|
-
|
|
19672
|
-
resolve(validation);
|
|
19673
|
-
});
|
|
19674
|
-
}
|
|
19675
|
-
|
|
19676
|
-
var PhoneNumberCharge = {
|
|
19677
|
-
setCustomer: function setCustomer(_ref) {
|
|
19678
|
-
var _this = this;
|
|
19679
|
-
|
|
19680
|
-
var phoneNumber = _ref.phoneNumber;
|
|
19681
|
-
return validate(phoneNumber).then(function () {
|
|
19682
|
-
_this.customer = phoneNumber;
|
|
19683
|
-
});
|
|
19684
|
-
},
|
|
19685
|
-
verifyCustomer: function verifyCustomer() {
|
|
19686
|
-
var _this2 = this;
|
|
19687
|
-
|
|
19688
|
-
return validate(this.customer).then(function () {
|
|
19689
|
-
return PhoneAPI.verify(_this2.customer, _this2.merchant.key);
|
|
19690
|
-
});
|
|
19691
|
-
},
|
|
19692
|
-
deleteSavedCard: function deleteSavedCard(cardId) {
|
|
19693
|
-
var _this3 = this;
|
|
19694
|
-
|
|
19695
|
-
return validate(this.customer).then(function () {
|
|
19696
|
-
return PhoneAPI.deleteCard(_this3.customer, _this3.merchant.key, cardId);
|
|
19697
|
-
});
|
|
19698
|
-
},
|
|
19699
|
-
authenticateCustomerOtp: function authenticateCustomerOtp(otp) {
|
|
19700
|
-
var _this4 = this;
|
|
19701
|
-
|
|
19702
|
-
return validate(this.customer).then(function () {
|
|
19703
|
-
return PhoneAPI.authenticateOtp(_this4.customer, _this4.merchant.key, otp, _this4.id);
|
|
19704
|
-
});
|
|
19705
|
-
},
|
|
19706
|
-
authenticateCustomerPin: function authenticateCustomerPin(pin) {
|
|
19707
|
-
var _this5 = this;
|
|
19708
|
-
|
|
19709
|
-
return validate(this.customer).then(function () {
|
|
19710
|
-
return PhoneAPI.authenticatePin(_this5.customer, _this5.merchant.key, pin, _this5.id);
|
|
19711
|
-
});
|
|
19712
|
-
},
|
|
19713
|
-
setCustomerPin: function setCustomerPin(_ref2) {
|
|
19714
|
-
var _this6 = this;
|
|
19715
|
-
|
|
19716
|
-
var pin = _ref2.pin,
|
|
19717
|
-
token = _ref2.token;
|
|
19718
|
-
return validate(this.customer).then(function () {
|
|
19719
|
-
return PhoneAPI.setPin(_this6.customer, _this6.merchant.key, token, _this6.id, pin);
|
|
19720
|
-
});
|
|
19721
|
-
},
|
|
19722
|
-
chargeSavedCard: function chargeSavedCard(_ref3) {
|
|
19723
|
-
var _this7 = this;
|
|
19724
|
-
|
|
19725
|
-
var cardId = _ref3.cardId,
|
|
19726
|
-
token = _ref3.token,
|
|
19727
|
-
cvv = _ref3.cvv;
|
|
19728
|
-
return validate(this.customer).then(function () {
|
|
19729
|
-
return PhoneAPI.charge(cardId, _this7.merchant.key, token, _this7.id, cvv, _this7.customer);
|
|
19730
|
-
});
|
|
19731
|
-
},
|
|
19732
|
-
enrollPhoneNumber: function enrollPhoneNumber(number) {
|
|
19733
|
-
var _this8 = this;
|
|
19734
|
-
|
|
19735
|
-
return validate(this.customer).then(function () {
|
|
19736
|
-
return PhoneAPI.enrollPhoneNumber(number, _this8.merchant.key, _this8.id);
|
|
19737
|
-
});
|
|
19738
|
-
}
|
|
19739
|
-
};
|
|
19740
|
-
|
|
19741
19736
|
var DirectDebitAPI = {
|
|
19742
19737
|
loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
|
|
19743
19738
|
var email = _ref.email,
|
|
@@ -19928,7 +19923,6 @@ var ChargeFunctions = {
|
|
|
19928
19923
|
ussd: USSDCharge,
|
|
19929
19924
|
qr: QRCharge,
|
|
19930
19925
|
mobile_money: MobileMoneyCharge,
|
|
19931
|
-
phone: PhoneNumberCharge,
|
|
19932
19926
|
direct_debit: DirectDebitCharge,
|
|
19933
19927
|
bank_transfer: PayWithTransferCharge,
|
|
19934
19928
|
eft: EFT,
|
|
@@ -20358,6 +20352,7 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
20358
20352
|
this.subscription = data.subscription || null;
|
|
20359
20353
|
this.planDetails = data.plan_details || null;
|
|
20360
20354
|
this.exchangeRate = data.exchange_rate || null;
|
|
20355
|
+
this.savedCardsToken = null;
|
|
20361
20356
|
this.isSavedCardsEnabled = data.saved_cards && data.saved_cards.enabled || null;
|
|
20362
20357
|
/**
|
|
20363
20358
|
* We initialize parameters we send to the API as empty strings
|
|
@@ -20401,51 +20396,7 @@ var TransactionInstance = /*#__PURE__*/function () {
|
|
|
20401
20396
|
}, {
|
|
20402
20397
|
key: "listenForCharge",
|
|
20403
20398
|
value: function listenForCharge(options, callback) {
|
|
20404
|
-
|
|
20405
|
-
|
|
20406
|
-
var channel = options.channel,
|
|
20407
|
-
paymentMethod = options.paymentMethod;
|
|
20408
|
-
var pusher;
|
|
20409
|
-
|
|
20410
|
-
if (window && window.Pusher) {
|
|
20411
|
-
pusher = new window.Pusher(configToUse.pusherKey, {
|
|
20412
|
-
cluster: 'eu',
|
|
20413
|
-
disableStats: true
|
|
20414
|
-
});
|
|
20415
|
-
}
|
|
20416
|
-
|
|
20417
|
-
var pusherUndefinedError = {
|
|
20418
|
-
status: 'error',
|
|
20419
|
-
message: 'We could not listen for charge response.'
|
|
20420
|
-
};
|
|
20421
|
-
var pusherSubscriptionError = {
|
|
20422
|
-
status: 'error',
|
|
20423
|
-
message: 'We could not listen for charge response. Use transaction.requery() to check the status.'
|
|
20424
|
-
};
|
|
20425
|
-
|
|
20426
|
-
var unsubscribeFromPusher = function unsubscribeFromPusher() {
|
|
20427
|
-
pusher.unsubscribe(channel);
|
|
20428
|
-
};
|
|
20429
|
-
|
|
20430
|
-
if (!pusher) {
|
|
20431
|
-
return callback(pusherUndefinedError, noOp);
|
|
20432
|
-
}
|
|
20433
|
-
|
|
20434
|
-
var pusherSubscription = pusher.subscribe(channel);
|
|
20435
|
-
pusherSubscription.bind('pusher:subscription_succeeded', function () {
|
|
20436
|
-
_this2.isListening = true;
|
|
20437
|
-
});
|
|
20438
|
-
pusherSubscription.bind('pusher:subscription_error', function () {
|
|
20439
|
-
_this2.isListening = false;
|
|
20440
|
-
callback(pusherSubscriptionError, noOp);
|
|
20441
|
-
});
|
|
20442
|
-
pusherSubscription.bind('response', function (response) {
|
|
20443
|
-
var formattedResponse = ChargeResponses.parse(response);
|
|
20444
|
-
|
|
20445
|
-
_this2.logAPIResponse(formattedResponse, paymentMethod);
|
|
20446
|
-
|
|
20447
|
-
callback(formattedResponse, unsubscribeFromPusher);
|
|
20448
|
-
});
|
|
20399
|
+
return subscribeToChargeEvents(options, this, callback);
|
|
20449
20400
|
}
|
|
20450
20401
|
}, {
|
|
20451
20402
|
key: "requery",
|
|
@@ -20743,7 +20694,133 @@ var Toolkit = /*#__PURE__*/function () {
|
|
|
20743
20694
|
return Toolkit;
|
|
20744
20695
|
}();
|
|
20745
20696
|
|
|
20697
|
+
var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
20698
|
+
function PreauthorizationInstance(data) {
|
|
20699
|
+
_classCallCheck(this, PreauthorizationInstance);
|
|
20700
|
+
|
|
20701
|
+
this.email = data.email;
|
|
20702
|
+
this.status = data.status;
|
|
20703
|
+
this.reference = data.reference;
|
|
20704
|
+
this.amount = data.amount;
|
|
20705
|
+
this.currency = data.currency;
|
|
20706
|
+
this.metadata = data.metadata || {};
|
|
20707
|
+
this.customer = data.customer;
|
|
20708
|
+
this.channels = data.channels || ['card'];
|
|
20709
|
+
this.deviceFingerprint = data.deviceFingerprint || null;
|
|
20710
|
+
this.isListening = false;
|
|
20711
|
+
this.merchant = {
|
|
20712
|
+
id: data.merchant_id,
|
|
20713
|
+
logo: data.merchant_logo,
|
|
20714
|
+
name: data.merchant_name,
|
|
20715
|
+
key: data.merchant_key
|
|
20716
|
+
};
|
|
20717
|
+
loadPusher();
|
|
20718
|
+
/**
|
|
20719
|
+
* We initialize parameters we send to the API as empty strings
|
|
20720
|
+
* when we don't have them instead of null because the API expects
|
|
20721
|
+
* these parameters as URL params which means parameters are eventually converted to strings
|
|
20722
|
+
*/
|
|
20723
|
+
// TODO: Bind charge function to card channel
|
|
20724
|
+
// https://paystack.atlassian.net/browse/RAILS-2887
|
|
20725
|
+
}
|
|
20726
|
+
|
|
20727
|
+
_createClass(PreauthorizationInstance, [{
|
|
20728
|
+
key: "setMetadata",
|
|
20729
|
+
value: function setMetadata(key, value) {
|
|
20730
|
+
this.metadata[key] = value;
|
|
20731
|
+
}
|
|
20732
|
+
}, {
|
|
20733
|
+
key: "setDevice",
|
|
20734
|
+
value: function setDevice(uuid) {
|
|
20735
|
+
if (this.deviceFingerprint) {
|
|
20736
|
+
logMessage("Device ID has already been set by Checkout JS so there's no need to set this again");
|
|
20737
|
+
} else {
|
|
20738
|
+
this.deviceFingerprint = uuid;
|
|
20739
|
+
}
|
|
20740
|
+
} // eslint-disable-next-line consistent-return
|
|
20741
|
+
|
|
20742
|
+
}, {
|
|
20743
|
+
key: "listenForCharge",
|
|
20744
|
+
value: function listenForCharge(options, callback) {
|
|
20745
|
+
return subscribeToChargeEvents(options, this, callback);
|
|
20746
|
+
}
|
|
20747
|
+
}]);
|
|
20748
|
+
|
|
20749
|
+
return PreauthorizationInstance;
|
|
20750
|
+
}();
|
|
20751
|
+
|
|
20752
|
+
var PreauthorisationAPI = {
|
|
20753
|
+
getByAccessCode: function getByAccessCode(accessCode) {
|
|
20754
|
+
var language = getLanguage();
|
|
20755
|
+
|
|
20756
|
+
var headers = _objectSpread2({}, language && {
|
|
20757
|
+
'Accept-Language': language
|
|
20758
|
+
});
|
|
20759
|
+
|
|
20760
|
+
var url = "".concat(configToUse.paystackApiUrl, "preauthorization/verify_access_code/").concat(accessCode);
|
|
20761
|
+
return axiosInstance.get(url, {
|
|
20762
|
+
headers: headers
|
|
20763
|
+
}).then(function (response) {
|
|
20764
|
+
return response.data;
|
|
20765
|
+
});
|
|
20766
|
+
},
|
|
20767
|
+
requery: function requery() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
|
|
20768
|
+
},
|
|
20769
|
+
reserveFunds: function reserveFunds() {// TODO: https://paystack.atlassian.net/browse/RAILS-2887
|
|
20770
|
+
}
|
|
20771
|
+
};
|
|
20772
|
+
|
|
20773
|
+
var Preauthorization = {
|
|
20774
|
+
initialize: function initialize(data) {
|
|
20775
|
+
return Object.seal(new PreauthorizationInstance(data));
|
|
20776
|
+
},
|
|
20777
|
+
getByAccessCode: function getByAccessCode(accessCode) {
|
|
20778
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
20779
|
+
var deviceFingerprint, response;
|
|
20780
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20781
|
+
while (1) {
|
|
20782
|
+
switch (_context.prev = _context.next) {
|
|
20783
|
+
case 0:
|
|
20784
|
+
_context.next = 2;
|
|
20785
|
+
return getDeviceFingerprint();
|
|
20786
|
+
|
|
20787
|
+
case 2:
|
|
20788
|
+
deviceFingerprint = _context.sent;
|
|
20789
|
+
_context.next = 5;
|
|
20790
|
+
return PreauthorisationAPI.getByAccessCode(accessCode);
|
|
20791
|
+
|
|
20792
|
+
case 5:
|
|
20793
|
+
response = _context.sent;
|
|
20794
|
+
return _context.abrupt("return", response && Object.seal(new PreauthorizationInstance(_objectSpread2(_objectSpread2({}, response.data), {
|
|
20795
|
+
deviceFingerprint: deviceFingerprint
|
|
20796
|
+
}))));
|
|
20797
|
+
|
|
20798
|
+
case 7:
|
|
20799
|
+
case "end":
|
|
20800
|
+
return _context.stop();
|
|
20801
|
+
}
|
|
20802
|
+
}
|
|
20803
|
+
}, _callee);
|
|
20804
|
+
}))();
|
|
20805
|
+
},
|
|
20806
|
+
verify: function verify() {// TODO: https://paystack.atlassian.net/browse/RAILS-2890
|
|
20807
|
+
|
|
20808
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
20809
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
20810
|
+
while (1) {
|
|
20811
|
+
switch (_context2.prev = _context2.next) {
|
|
20812
|
+
case 0:
|
|
20813
|
+
case "end":
|
|
20814
|
+
return _context2.stop();
|
|
20815
|
+
}
|
|
20816
|
+
}
|
|
20817
|
+
}, _callee2);
|
|
20818
|
+
}))();
|
|
20819
|
+
}
|
|
20820
|
+
};
|
|
20821
|
+
|
|
20746
20822
|
exports.BankAccount = BankAccount;
|
|
20747
20823
|
exports.Card = Card;
|
|
20824
|
+
exports.Preauthorization = Preauthorization;
|
|
20748
20825
|
exports.Toolkit = Toolkit;
|
|
20749
20826
|
exports.Transaction = Transaction;
|