var email = "";
var colourclosediv = "#083154";
var colourbutton = "#083154";
var emailrequest = "Jostkyc";
var mode = "Live";
$(document).on('click', '.jcverify', function () {
if ($(this).data('email') != "" && $(this).data('email') !== undefined) {
email = $(this).data('email');
}
var id = $(this).data('id');
var firstname = $(this).data('firstname');
var lastname = $(this).data('lastname');
var request_id = $(this).data('request_id');
var country = $(this).data('country');
var phone = $(this).data('phone');
var callback = $(this).data('callback');
var type = $(this).data('type');
var option = $(this).data('option');
if ($(this).data('emailrequest') != "" && $(this).data('emailrequest') !== undefined) {
emailrequest = $(this).data('emailrequest');
}
if ($(this).data('footerbackground') != "" && $(this).data('footerbackground') !== undefined) {
colourclosediv = $(this).data('footerbackground');
}
if ($(this).data('button') != "" && $(this).data('button') !== undefined) {
colourbutton = $(this).data('button');
}
if ($(this).data('mode') != "" && $(this).data('mode') !== undefined) {
mode = $(this).data('mode');
}
var jqxhr = $.ajax({
url: 'https://jostkyc.com/api',
timeout: 30000,
data: {
email: email,
id: id,
firstname: firstname,
lastname: lastname,
request_id: request_id,
country: country,
phone: phone,
callback: callback,
type: type,
option: option,
colourbutton: colourbutton,
emailrequest: emailrequest,
jcview: 'mobile',
mode: mode
},
type: 'POST',
beforeSend: function () {
$('#jccontent').html('
No network connection. Try again later
');
}).always(function () { // Do nothing
});
}
});
$(document).on('click', '.jccheck', function () {
jccheck();
})
function jccheck() {
var real = $('.jcrealtoken').html();
var typed = $('.jctypedtoken').val();
if (email == "") {
real = "";
typed = real;
}
if (real != typed && $('.jcskip').val() == "0") {
$('.jcresponse').html('");
jcphoto();
return;
}
}
}
$(document).on('change', '.jcty', function () {
var sel = $('.jcty').val();
if (sel == '') {
$('.jcresponse').html('
Select a verification option!
');
$('.jctypeoption').html('');
} else if (sel == 'Bank') {
$('.jctypeoption').html("
NUBAN Bank Account Number
Bank Name
");
} else if (sel == 'BVN') {
$('.jctypeoption').html("
Bank Verification Number (BVN)
Date of Birth
");
} else if (sel == 'Drivers License') {
$('.jctypeoption').html("
Drivers License Registration Number
Date of Birth (YYYY/MM/DD)
");
}
})
$(document).on('click', '.jctysubmit', function () {
jctysubmit();
})
function jctysubmit() {
if ($('.jccountry').val() == 'Nigeria' && ($('.jctypei').val() == 'Standard' || $('.jctypei').val() == 'Basic')) {
var sel = $('.jcty').val();
if (sel == '') {
$('.jcresponse').html('
Select a verification option!
');
return;
}
if (sel == 'Bank' && ($('.jcbank_account').val() == '' || $('.jcbank_name').val() == '')) {
$('.jcresponse').html('
Supply all details!
');
return;
}
if (sel == 'Bank' && $('.jcbank_account').val().length != 10) {
$('.jcresponse').html('
Supply 10 digits NUBAN account number
');
return;
}
var regEx = /^\d{10}/;
var bank = $('#jctyform .jcbank_account').val();
if (sel == 'Bank' && ! bank.match(regEx)) {
$('.jcresponse').html('
Supply only 10 digits NUBAN account number
');
return;
}
if (sel == 'BVN' && ($('.jcbvn_no').val() == '' || $('.jcbvn_dob').val() == '')) {
$('.jcresponse').html('
Supply all details!
');
return;
}
if (sel == 'BVN' && $('.jcbvn_no').val().length != 11) {
$('.jcresponse').html('
Supply 11 digits Bank Verification Number (BVN)
');
return;
}
var regEx = /^\d{11}/;
var bvn = $('#jctyform .jcbvn_no').val();
if (sel == 'BVN' && ! bvn.match(regEx)) {
$('.jcresponse').html('
Supply only 11 digits Bank Verification Number
');
return;
}
if (sel == 'Drivers License' && ($('.jcdrivers_license').val() == '' || $('.jcdob').val() == '')) {
$('.jcresponse').html('
Supply all details!
');
return;
}
var regEx = /^\d{4}\/\d{2}\/\d{2}$/;
var dob = $('#jctyform .jcdob').val();
if (sel == 'Drivers License' && ! dob.match(regEx)) {
$('.jcresponse').html('
Supply date of birth in the format YYYY/MM/DD
');
return;
}
}
var importdata = document.getElementById('jctyform');
var jqxhr = $.ajax({
url: 'https://jostkyc.com/api_bank_license',
data: new FormData(importdata),
type: 'POST',
timeout: 30000,
contentType: false,
processData: false,
cache: false,
beforeSend: function () {
$('.jctysubmit').attr('disabled');
$('.jcty').attr('readonly');
$('.jcresponse').html('');
$('.jcresponse2').html('
Loading... ');
}
}).done(function () {
$('.jctysubmit').removeAttr('disabled');
var response = jqxhr.responseText;
if (response == '-1') {
$('.jcresponse2').html('
Details could not be verified. Confirm details and try again.
');
$('.jctysubmit').removeAttr('disabled');
$('.jcty').removeAttr('readonly');
} else if (response == '-2') {
$('.jcresponse2').html('
Supply all details correctly and try again
');
$('.jctysubmit').removeAttr('disabled');
$('.jcty').removeAttr('readonly');
} else {
$('.jctysubmit').attr('disabled');
$('.jcresponse2').html('
Details have been fetched. Check below for confirmation
');
$('.jcreply').html(response);
}
}).fail(function () {
$('.jctysubmit').removeAttr('disabled');
$('.jcty').removeAttr('readonly');
$('.jcresponse2').html('
No network connection. Try again later
');
}).always(function () { // Do nothing
});
}
$(document).on('click', '.jcphotocancel', function () {
$('.jcreply').html('');
$('.jctysubmit').removeAttr('disabled');
$('.jcty').attr('readonly');
$('.jcresponse2').html('');
})
$(document).on('click', '.jcphotosubmit', function () {
if ($('.jcskip').val() == "0") {
jcphoto();
} else {
jcskip();
}
})
function jcphoto() {
var importdata = document.getElementById('jctyform');
var form = $('#jctyformi').html();
var jqxhr = $.ajax({
url: 'https://jostkyc.com/api_photo',
data: new FormData(importdata),
type: 'POST',
timeout: 30000,
contentType: false,
processData: false,
cache: false,
beforeSend: function () {
$('#jccontent').html('
Wait while we attempt to load page ');
}
}).done(function () {
var response = jqxhr.responseText;
$('#jccontent').html(response);
var suspend = $('.jcsuspend').val();
if (suspend.indexOf('2') >= 0 || suspend.indexOf('3') >= 0 || suspend == "") {
jcsetcam();
}
}).fail(function () {
$('#jccontent').html(form + '
Network connection error!
Please check your network and try again
');
}).always(function () { // Do nothing
});
}
function jcskip() {
var importdata = document.getElementById('jctyform');
var form = $('#jctyformi').html();
var jqxhr = $.ajax({
url: 'https://jostkyc.com/api_skip',
data: new FormData(importdata),
type: 'POST',
timeout: 30000,
contentType: false,
processData: false,
cache: false,
beforeSend: function () {
$('#jccontent').html('
Wait while we attempt to load page ');
}
}).done(function () {
var response = jqxhr.responseText;
$('#jccontent').html(response);
}).fail(function () {
$('#jccontent').html(form + '
Network connection error!
Please check your network and try again
');
}).always(function () { // Do nothing
});
}
function jcsetcam() {
Webcam.reset();
Webcam.set({
width: 295,
height: 295,
dest_width: 480,
dest_height: 480,
image_format: 'jpeg',
jpeg_quality: 90
});
Webcam.attach('#jccam');
}
$(document).on('click', '#jctakecam', function () {
Webcam.snap(function (data_uri) {
var img = document.getElementById('jcimage');
// img.src = 'data:image/jpeg;base64,'+result;
img.src = "";
img.src = data_uri;
$('.jctemp').val(data_uri);
$('.jcfinishsubmit').css('visibility', 'visible');
});
});
$(document).on('click', '.jcfinishsubmit', function () {
var suspend = $('.jcsuspend').val();
if (suspend.indexOf('2') >= 0 || suspend == "") {
if ($('.jcphotocapture').val() == '') {
$('.jcphotocapture').val($('.jctemp').val());
content = $('#jccontent').html();
if (suspend.indexOf('3') >= 0 || suspend == "") {
$('#jccontent').html('
Wait while we attempt to load page ');
setTimeout(function () {
$('#jccontent').html('
Your live face photo has been captured. It is now time to capture your means of Identification.
We accept only international passport, drivers license, voters card, National ID card.
Make sure you capture a clear ID. We must be able to see the details on the ID and we must also see you holding the ID.
Note: Blurry ID will not be accepted.
Click the "Continue" button below to now proceed to capture your ID card.
');
}, 5000)
return false;
} else {
jcfsubmit();
}
}
}
if (suspend.indexOf('3') >= 0 || suspend == "") {
if ($('.jcidcapture').val() == '') {
$('.jcidcapture').val($('.jctemp').val());
jcfsubmit();
}
}
})
$(document).on('click', '.jcinfo', function () {
$('#jccontent').html(content);
jcsetcam();
$('.jctitle').html('Capture ID in Bright Light
Blurry ID capture will be rejected. We accept international passport, drivers license, voters card, National ID card');
$('.jcfinishsubmit').css('visibility', 'hidden');
var img = document.getElementById('jcimage');
img.src = 'https://jostkyc.com/dist/img/id.jpg';
})
function jcfsubmit() {
var importdata = document.getElementById('jcfinishform');
var jqxhr = $.ajax({
url: 'https://jostkyc.com/api_finish',
data: new FormData(importdata),
type: 'POST',
timeout: 30000,
contentType: false,
processData: false,
cache: false,
beforeSend: function () {
$('.jcfinishsubmit').attr('disabled');
$('.jccapture').attr('disabled');
$('.jcresponse').html('Loading...
');
}
}).done(function () {
var response = jqxhr.responseText;
$('#jccontent').html(response);
}).fail(function () {
$('.jcfinishsubmit').removeAttr('disabled');
$('.jcresponse').html('
No network connection. Try again later
');
}).always(function () { // Do nothing
});
}