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