var globalErrorMessage = "Temporary network communication issues prevented us from reaching your contact. Please try again..."; var siteProtocol = "https:"; function showLoginScreen(){ } function clearErrors(){ $('.errors').css('display', 'none'); $('.errors').html(''); } function displayErrors(error){ $('.errors').css('display', 'block'); $('.errors').html(error); } function updateContent(html){ showHideLoader(false); if(html=='invalid'){ displayErrors("Invalid session data, please try again."); } else{ clearErrors(); $('#content').html(html); } } function getFormDataSerialized(formid) { return $(formid).serialize(); } function edit_resend_email() { /// don't do this is the PROFILE_EMAIL_ADDRESS is set if(!window.PROFILE_EMAIL_ADDRESS) { $("#inputEmail").prop('disabled', false); $("#inputEmail").val(""); } $("#PIN_VERIFICATION_FIELD").html(''); var tmp_button_text = "Click to Continue..."; $("#display_submit_bitton").html(''); } /* var xmlDoc; // For IE based browsers (tested under IE6 and IE7): if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); // Turn off asynchronus download. // Load the entire file before trying to do anything with it. xmlDoc.async=false; //load the country/state XML file windows only xmlDoc.load("country_state.xml"); } // For other browsers (Netsacpe/Firefox/Chrome): else if (document.implementation && document.implementation.createDocument) { //Removed line to fix Google Chrome bug (26/01/2009):- xmlDoc = document.implementation.createDocument("","doc",null); //Replaced with below script var xmlhttp = new window.XMLHttpRequest(); //load the country/state XML file other browsers xmlhttp.open("GET","country_state.xml",false); xmlhttp.send(null); xmlDoc = xmlhttp.responseXML.documentElement; } else { // The 'something fails' alert! alert('Your browser is unable to handle this script'); } */ // Populate selected dropdown list with data from XML file // () // Function used for both Country Fill and State Fill function fillList(selectbox,text,value, is_selected) { if(empty(selectbox)) return; is_selected = typeof is_selected !== 'undefined' ? is_selected : false; var optionValue = document.createElement("option"); optionValue.text = text; optionValue.value = value; optionValue.selected = is_selected; selectbox.options.add(optionValue); } // Populate Country list on page load // Requires: on HTML page function fillCountryList (id, selected_country) { selected_country = typeof selected_country !== 'undefined' ? selected_country : ""; // Get country element ID var countryList = document.getElementById(id); // Clear any current values in select box // If JavaScript isn't working existing text will remain if(!empty(countryList)){ for (var x = countryList.options.length-1; x >-1; x--) { countryList.options[x] = null; } } // Fill Country name Array from XML file var countryNames = xmlDoc.getElementsByTagName("country"); // Gets total Number of countries in XML file var numberOfCountries = countryNames.length; // Loop through Country name Array and populate country select for (var i=0; i -1; x--) { stateList.options[x] = null; } // Get currently selected ID from country element ID var countryListSelected = document.getElementById(countryID).selectedIndex; // Get number of states for current selected Country (populates Array) var numberStates = xmlDoc.getElementsByTagName("country")[countryListSelected].getElementsByTagName("state").length; // Loop through States/Province Array and populate State/Province selection for current Country for (var i=0; i < numberStates; i++) { if(!empty(xmlDoc.getElementsByTagName("country")[countryListSelected].getElementsByTagName("state")[i].firstChild)){ var currentState = xmlDoc.getElementsByTagName("country")[countryListSelected].getElementsByTagName("state")[i].firstChild.nodeValue; var is_selected = false; if(currentState==selected_state) is_selected = true; fillList(stateList,currentState,currentState,is_selected); } } } var countryStatesXml = null; function loadCountryStateList(){ $.ajax({ type: "GET", url: "business_registered_region.xml", dataType: "xml", success: function(xml) { countryStatesXml = xml; fillCountryStateList(); } //sucess close }); } function fillCountryStateList(){ if(!empty(countryStatesXml)){ console.log('countryStatesXml State', $('#verification_region option:selected').text()); var verification_region = $('#verification_region').val(); //$('#verification_region option:selected').text(); //'United States'; //$('#verification_region').val(); var states = $(countryStatesXml).find('country[name="' + verification_region + '"]'); //fillSelectOptions('#business_registered_region', states); //$('#business_registered_region').html(''); $('#business_registered_region').html(""); //$.each(states, function(i, val){ $(states).find('state').each(function(){ //var value = $(this).attr('value'); var label = $(this).text(); if(!empty(label)){ $('#business_registered_region').append(""); } }); //}); } } function validateText(field, callerEvent) { if(field.value) { var fieldValue = field.value.trim(); } if(typeof(callerEvent) != 'undefined') { if(callerEvent.toUpperCase() == "ONFOCUS") { showEmptyImg(field); return; } } if(typeof(callerEvent) != 'undefined') { if(callerEvent.toUpperCase() == "ONKEYUP") { if( (fieldValue == "") || (fieldValue == null) || (!fieldValue) ) { showErrorImg(field); return; } else { showValidImg(field); return; } } } if(typeof(callerEvent) != 'undefined') { if(callerEvent.toUpperCase() == "ONCHANGE") { if( (fieldValue == "") || (fieldValue == null) || (!fieldValue) ) { showErrorImg(field); return; } else { showValidImg(field); return; } } } if(typeof(callerEvent) != 'undefined') { if(callerEvent.toUpperCase() == "ONBLUR") { if( (fieldValue == "") || (fieldValue == null) || (!fieldValue) || (fieldValue=='Select a country...') || (fieldValue=='Select One...') ) { showErrorImg(field); return; } else { showValidImg(field); return; } } } // if(callerEvent.toUpperCase() == "ONLOAD") { // if((fieldValue == "") || (fieldValue == null)) { // showErrorImg(field); // return; // } else { // showValidImg(field); // return; // } // } // } function validateCheckbox(field) { if($(field).prop("checked")){ showValidImg(field); } else{ showErrorImg(field); } return; } function validateSelectDOB(field) { // validateBirthdate(this,''); var prefix = ""; var birthdateStatus = checkBirthdateCompletion(prefix); //if(callerEvent != "onfocus") alert(birthdateStatus); if(birthdateStatus == "none") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "some") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "all") { //alert('window.regPaymeBirthdate: ' + window.regPaymeBirthdate); showBirthdateValidImg(prefix); //checkAccountBasics(); //toggleVoiceAuth(); //alert(window.regBDAY); return; } } function validateTSYSDOB(field) { // validateBirthdate(this,''); var prefix = "tsys_"; var birthdateStatus = checkBirthdateCompletion(prefix); //if(callerEvent != "onfocus") alert(birthdateStatus); if(birthdateStatus == "none") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "some") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "all") { //alert('window.regPaymeBirthdate: ' + window.regPaymeBirthdate); showBirthdateValidImg(prefix); //checkAccountBasics(); //toggleVoiceAuth(); //alert(window.regBDAY); return; } } function validateTSYSUSDirectDOB(field) { // validateBirthdate(this,''); var prefix = "tsys_us_direct_"; var birthdateStatus = checkBirthdateCompletion(prefix); //if(callerEvent != "onfocus") alert(birthdateStatus); if(birthdateStatus == "none") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "some") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "all") { //alert('window.regPaymeBirthdate: ' + window.regPaymeBirthdate); showBirthdateValidImg(prefix); //checkAccountBasics(); //toggleVoiceAuth(); //alert(window.regBDAY); return; } } function validateOfficialDOB(field) { // validateBirthdate(this,''); var prefix = "official_"; var birthdateStatus = checkBirthdateCompletion(prefix); //if(callerEvent != "onfocus") alert(birthdateStatus); if(birthdateStatus == "none") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "some") { showBirthdateWaitingImg(prefix); return; } else if(birthdateStatus == "all") { //alert('window.regPaymeBirthdate: ' + window.regPaymeBirthdate); showBirthdateValidImg(prefix); //checkAccountBasics(); //toggleVoiceAuth(); //alert(window.regBDAY); return; } } function checkBirthdateCompletion(prefix) { // had and removed "personalRegistration2" as a variable??? var validBirthday = new Array(); validBirthday[0] = true; validBirthday[1] = true; validBirthday[2] = true; validBirthday[3] = true; var selectFields = new Array(); selectFields[1] = prefix + "birth_year"; selectFields[2] = prefix + "birth_month"; selectFields[3] = prefix + "birth_day"; for (var i=1; i < selectFields.length; i++) { //alert('i: ' + i); //alert(document.bangkForm[selectFields[i]].value); if (document.frmPayment[selectFields[i]].value.trim() == '') { validBirthday[0] = false; validBirthday[i] = false; } else { validBirthday[i] = document.frmPayment[selectFields[i]].value; } } if((validBirthday[1] != false) && (validBirthday[2] != false) && (validBirthday[3] != false)) { window.confirmBirthDay = validBirthday[3]; window.confirmBirthMonth = validBirthday[2]; window.confirmBirthYear = validBirthday[1]; return "all"; } else if((validBirthday[1] == false) && (validBirthday[2] == false) && (validBirthday[3] == false)) { return "none"; } else { return "some"; } } function displayTheirFee(field) { //payme function? //alert("field.value: "+field.value); var amountToPay = parseFloat(field.value).toFixed(2); //alert("amountToPay: "+amountToPay); var thierFeePercentage = "0.000"; //alert("thierFeePercentage: "+thierFeePercentage); // THEIR ACTUAL FEE var theirfee = parseFloat(amountToPay * thierFeePercentage).toFixed(2); //alert("0. theirfee: "+theirfee); if ( isNaN(theirfee) ) { theirfee = "0.00"; } //alert("1. theirfee: "+theirfee); /// transactionFeeTheir if( (typeof document.getElementById('transactionFeeTheir') != 'undefined') && (document.getElementById('transactionFeeTheir') != null) ) { document.getElementById('transactionFeeTheir').innerHTML = theirfee; } /// printCurrency0fee if( (typeof document.getElementById('printCurrency0fee') != 'undefined') && (document.getElementById('printCurrency0fee') != null) ) { document.getElementById('printCurrency0fee').innerHTML = theirfee; } //alert(theirfee); //alert(amountToPay); var theirtotal = parseFloat(amountToPay) + parseFloat(theirfee); //alert(theirtotal); if ( (isNaN(theirtotal)) || (theirtotal == null) ) { theirtotal = "0"; } if( (typeof document.getElementById('theirTotalCharge') != 'undefined') && (document.getElementById('theirTotalCharge') != null) ) { document.getElementById('theirTotalCharge').innerHTML = theirtotal.toFixed(2); } if( (typeof document.getElementById('printCurrency0total') != 'undefined') && (document.getElementById('printCurrency0total') != null) ) { document.getElementById('printCurrency0total').innerHTML = theirtotal.toFixed(2); } } function displayPersonalIdentity(e, id){ //console.log('id, value', id , $(e).val()); if(id=='#lbl_personal_identity_date_of_bith'){ var prefix = "tsys_"; var birthdateStatus = checkBirthdateCompletion(prefix); if(birthdateStatus == "all") { $(id).html(window.confirmBirthYear + '-' + window.confirmBirthMonth + '-' + window.confirmBirthDay); } } else if(id == '#tsys_us_direct_business_name'){ //if(empty($('#tsys_us_direct_business_name').val())){ //var full_name = $.trim($('#tsys_us_direct_first_name').val() + ' ' + $('#tsys_us_direct_last_name').val()); var b_name = decodeURIComponent($('#tsys_us_direct_business_name').val()); var b_type = decodeURIComponent($('#tsys_us_direct_business_type').val()); $('.display_business_name').html(b_name); var unregistered_business_type = b_type.indexOf("unregistered"); if( (unregistered_business_type == -1) || (b_type == null) ) { var insert_b_type = " " + b_type; } else { var insert_b_type = ""; } if(b_type.indexOf("SOLE PROPRIATOR") > -1) { insert_b_type = ""; } if(insert_b_type == " " + null) { insert_b_type = ""; } // WAHETVER!!!! f'ing hate js //alert("b_type: "+b_type); //alert("insert_b_type: "+insert_b_type); $('.display_business_type').html(insert_b_type); //} } else if(id == '#tsys_us_direct_business_website'){ if(empty($('#tsys_us_direct_business_website').val())){ document.configureAccount3['is_advertise_website'].checked = false; } } else{ $(id).html($(e).val()); } } function TOGGLE_BUSINESS_BANKING(e){ $('.PERSONAL_business_type_block').css('display', 'none'); $('.BUSINESS_business_type_block').css('display', 'none'); $('#banking_type1').parent().parent().removeClass('has-success has-error has-feedback'); $('#banking_type2').parent().parent().removeClass('has-success has-error has-feedback'); $('.'+$(e).val() + '_business_type_block').css('display', 'block'); fillPhotoIdForm(); } function displayPersonalBusinessType(e){ fillPhotoIdForm(); } function displayRegisteredBusinessType(e){ $('.registered_business_type_display').html($(e).val()); fillPhotoIdForm(); } function displayBusinessName(field, el_class){ var text_to_display = field.value; text_to_display = text_to_display.replace(/ /g, "-"); text_to_display = text_to_display.replace(/\./g, "-"); $('.' + el_class).html(text_to_display); fillPhotoIdForm(); } /// STATUS ICONS //////////////////////////////////////////////////////////// function showDefaultImg(field) { } function showErrorImg(field) { $(field).parent().removeClass('has-success has-error has-feedback'); $(field).parent().addClass('has-error has-feedback'); $(field).next('.glyphicon').remove(); $(field).after(''); showDocumentValidImg(field, false); } function showWorkingImg(field) { } function showValidImg(field) { $(field).parent().removeClass('has-success has-error has-feedback'); $(field).parent().addClass('has-success has-feedback'); $(field).next('.glyphicon').remove(); $(field).after(''); showDocumentValidImg(field, true); } function showEmptyImg(field) { } function showDocumentValidImg(field, isDisplay){ var option_val = $(field).val(); var option_id = $(field).attr('id'); $(field).removeClass('completed'); $(field).closest('fieldset').removeClass('completed'); $(field).closest('.ui-body').removeClass('completed'); //console.log('>>', option_id, option_val); if( !empty(option_id) && ( option_id == 'slefie_document_type' || option_id == 'personal_document_type' || option_id == 'business_document_type' || option_id == 'pricing_document_type' || option_id == 'processing_document_type' || option_id == 'residence_document_type' || option_id == 'tax_returns_document_type') ){ var uploaded = 0; $(field).closest('div.ui-body').find('.photo-container').each(function(){ if($(this).attr('upload-status') == "uploaded"){ uploaded++; } }); //console.log('>>', uploaded); if(!empty(option_val) && uploaded > 0){ $(field).addClass('completed'); $(field).closest('fieldset').addClass('completed'); $(field).closest('.ui-body').addClass('completed'); } } else{ if(isDisplay){ $(field).addClass('completed'); $(field).closest('fieldset').addClass('completed'); $(field).closest('.ui-body').addClass('completed'); } } } function showBirthdateValidImg(prefix) { $('#' + prefix + 'birth_year').parent().removeClass('has-success has-error has-feedback'); $('#' + prefix + 'birth_year').parent().addClass('has-success has-feedback'); } function showBirthdateEmptyImg(prefix) { } function showBirthdateErrorImg(prefix) { $('#' + prefix + 'birth_year').parent().removeClass('has-success has-error has-feedback'); $('#' + prefix + 'birth_year').parent().addClass('has-error has-feedback'); } function showBirthdateWaitingImg(prefix) { $('#' + prefix + 'birth_year').parent().removeClass('has-success has-error has-feedback'); $('#' + prefix + 'birth_year').parent().addClass('has-error has-feedback'); } function fillCallingCode(country){ country = $('#cboCountry').val(); $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/country_to_callingcode.gate' ,data: { country_name: country } ,dataType: 'json' ,success:function(data){ if(data!=null){ $('#telephone_country_iso3').val(data.country_iso3); $('#telephone_calling_code').val('+' + data.calling_code); } } ,error:function(){ } ,complete:function(){ } }); return false; } var CUSTOMER_IP = '0.0.0.0'; var viewport = null; $(document) .ready(function () { //alert('loaded'); //goLogin(); viewport = { width : $(window).width(), height : $(window).height() }; //AGENT_ACCOUNT_HASH if(empty(agent_account_hash)){ $('#agentLogin').show(); $('#agentLogout').hide(); } else{ $('#agentLogin').hide(); $('#agentLogout').show(); } $('body').css('height', viewport.height); //CLIENT IP $.ajax({ type: "GET" ,async: true ,url: siteProtocol + '//'+API_DOMAIN+'/link_gateway/mobile_client_ip.gate' ,data: {} ,success:function(data){ CUSTOMER_IP = data; console.log('CUSTOMER_IP', CUSTOMER_IP); } ,error:function(jqXHR, errorText){ console.log('CUSTOMER_IP>ERROR', errorText); } }); loadCountryStateList(); //fillCountryList('cboCountry', '');fillStateList('cboCountry', 'cboState', ''); //getTermsAndConditionsAggreementText(); //getMemberEmailAddress(); // $.ajax({ // type: "GET" // ,url: '//h-api.online-metrix.net/api/session-query?org_id=aohuqk6o&api_key=ezgonqbva6s44p68&session_id=' + token() + '&service_type=session-policy&event_type=ACCOUNT_CREATION&account_email=shea.writer@nsdb.com&ssn_hash=7eb6603566ad2fa44d1e7092d1dab2af4ac20bbd164ec9bb4f015fc193bffc1d&input_ip_address=67.29.138.7&policy=' // ,data: {} // ,success:function(data){ // console.log('TM >', data); // } // ,error:function( jqXHR, textStatus, errorThrown){ // console.log('TM > ERROR ' + 'textStatus=' + textStatus + ' errorThrown=' + errorThrown); // } // }); }); var rand = function() { return Math.random().toString(36).substr(2); // remove `0.` }; var token = function() { return rand() + rand() + rand(); // to make it longer }; function showProgressDialog(msg){ var processingMessage = "Working..."; if(!empty(msg)) processingMessage = msg; //window.location.href = SITE_SCHEMA+'://showProgressDialog?processingMessage=' + processingMessage; showLoader(processingMessage); } function hideProgressDialog(){ //window.location.href = SITE_SCHEMA+'://hideProgressDialog'; hideLoader(); } function checkAmountLimit(){ var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/get_account_limits.gate?member_hash=' + member_hash + '&account_hash=' + selected_account_hash; $('#recipient_requested_amount').parent().append('
Checking limit...
'); $('#email_invoice_form button').attr('disabled', 'disabled'); $.ajax({ type: "GET" ,url:url ,data: { } ,dataType: 'json' ,success:function(data){ if(data!=null){ var field = document.frmPayment['recipient_requested_amount']; var recipient_requested_amount = parseFloat($('#recipient_requested_amount').val()); var minimum_amount = parseFloat(data.minimum); var maximum_amount = parseFloat(data.maximum); if(recipient_requested_amount < minimum_amount || recipient_requested_amount > maximum_amount){ var device_alert = 'The Requested Amount must within ' + data.minimum + ' and ' + data.maximum + '.'; //show_device_alert('ERROR', ""+device_alert+""); showErrorImg(field); } else { showValidImg(field); } } } ,error:function(){ } ,complete:function(){ $('#recipient_requested_amount').parent().find('.loading-img').remove(); $('#email_invoice_form button').removeAttr('disabled'); } }); } function processEmailInvoiceForm(){ validateText(document.frmPayment['recipient_first_name'], 'onBlur'); validateText(document.frmPayment['recipient_last_name'], 'onBlur'); validateText(document.frmPayment['recipient_email_address'], 'onBlur'); //validateText(document.frmPayment['recipient_invoice_no'], 'onBlur'); //validateText(document.frmPayment['recipient_extra_note'], 'onBlur'); validateText(document.frmPayment['recipient_requested_amount'], 'onBlur'); if($('.form-group.has-error').length>0){ show_device_alert('ERROR', "Please complete the form."); } else{ showProgressDialog("Working..."); setTimeout(function(){ var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/start_email_invoice.gate'; var post_data = 'member_hash=' + member_hash + '&account_hash=' + selected_account_hash + '&CUSTOMER_SESSION_ID=' + token() + '&CUSTOMER_IP=' + CUSTOMER_IP ; var recipient_first_name = $('#recipient_first_name').val(); var recipient_last_name = $('#recipient_last_name').val(); var recipient_email_address = $('#recipient_email_address').val(); var recipient_invoice_no = $('#recipient_invoice_no').val(); var recipient_extra_note = $('#recipient_extra_note').val(); var recipient_requested_amount = $('#recipient_requested_amount').val(); post_data += "&firstname=" + recipient_first_name; post_data += "&lastname=" + recipient_last_name; post_data += "&emailaddress=" + recipient_email_address; post_data += "&invoice_reference=" + recipient_invoice_no; post_data += "¬e=" + $('#recipient_extra_note').val(); post_data += "&amount=" + $('#recipient_requested_amount').val(); console.log('post_data', post_data); $.ajax({ type: "POST" ,url: url ,data: post_data ,success:function(data){ hideProgressDialog(); setTimeout(function(){ console.log(data); if (data.indexOf("<") == -1){ if($.trim(data) == "OK"){ //fill receipt form var selected_account_details = getSelectAccountDetails(); $('#PAYYAP_email_invoice_amount').html(selected_account_details.amount); $('#PAYYAP_email_invoice_business_accountname').html(selected_account_details.account_name); $('#PAYYAP_email_invoice_payment_from').html(recipient_email_address); $('#PAYYAP_email_invoice_status').html("Success! (Your payment request has been sent.)"); showStepPage('#email_invoice_form_receipt'); } else{ show_device_alert('ERROR', "Failed to send Email Invoice! Please try again!" ); } } else{ show_device_alert('ERROR', globalErrorMessage ); } }, 1000); } ,error:function(){ console.log('error'); hideProgressDialog(); setTimeout(function(){ show_device_alert('ERROR', globalErrorMessage ); }, 1000); } ,complete:function(){ hideProgressDialog(); } }); }, 1000); } return false; } function processVerificationForm(){ validateText(document.frmPayment['official_first_name'], 'onBlur'); validateText(document.frmPayment['official_last_name'], 'onBlur'); validateOfficialDOB(document.frmPayment['official_birth_year']); validateOfficialDOB(document.frmPayment['official_birth_month']); validateOfficialDOB(document.frmPayment['official_birth_day']); validateText(document.frmPayment['official_country_of_citizenship'], 'onBlur'); validateText(document.frmPayment['goverment_id_number'], 'onBlur'); // // validateText(document.frmPayment['residential_country'], 'onBlur'); // validateText(document.frmPayment['residential_state'], 'onBlur'); // validateText(document.frmPayment['residential_postalcode'], 'onBlur'); // validateText(document.frmPayment['residential_city'], 'onBlur'); // validateText(document.frmPayment['residential_street_1'], 'onBlur'); // // // if($('#banking_type1').is(':checked') || $('#banking_type2').is(':checked') ){ // $('.PERSONAL_business_type_block').removeClass('has-success has-error has-feedback'); // $('.BUSINESS_business_type_block').removeClass('has-success has-error has-feedback'); // // if($('#banking_type1').is(':checked')){ // $('.PERSONAL_business_type_block').addClass('has-success has-feedback'); // // validateText(document.frmPayment['personal_business_type'], 'onBlur'); // validateText(document.frmPayment['personal_business_name'], 'onBlur'); // validateText(document.frmPayment['personal_business_web_address'], 'onBlur'); // } // if($('#banking_type2').is(':checked') ){ // $('.BUSINESS_business_type_block').addClass('has-success has-feedback'); // // validateText(document.frmPayment['registered_business_type'], 'onBlur'); // validateText(document.frmPayment['registered_business_name'], 'onBlur'); // validateText(document.frmPayment['registered_business_tax_id_number'], 'onBlur'); // validateText(document.frmPayment['registered_business_web_address'], 'onBlur'); // // validateText(document.frmPayment['business_country'], 'onBlur'); // validateText(document.frmPayment['business_state'], 'onBlur'); // validateText(document.frmPayment['business_postalcode'], 'onBlur'); // validateText(document.frmPayment['business_city'], 'onBlur'); // validateText(document.frmPayment['business_street_1'], 'onBlur'); // } // } // else{ // $('#banking_type1').parent().parent().addClass('has-error has-feedback'); // $('#banking_type2').parent().parent().addClass('has-error has-feedback'); // } // // validateText(document.frmPayment['bank_name'], 'onBlur'); // validateText(document.frmPayment['account_number'], 'onBlur'); // validateText(document.frmPayment['local_routing_number'], 'onBlur'); // validateText(document.frmPayment['swift_code'], 'onBlur'); // // validateText(document.frmPayment['banking_country'], 'onBlur'); // validateText(document.frmPayment['banking_state'], 'onBlur'); // validateText(document.frmPayment['banking_postalcode'], 'onBlur'); // validateText(document.frmPayment['banking_city'], 'onBlur'); // validateText(document.frmPayment['banking_street_1'], 'onBlur'); // validateText(document.frmPayment['banking_phone_number'], 'onBlur'); if($('.form-group.has-error').length>0){ show_device_alert('ERROR', "Please complete the form."); } else{ // showStepPage('#identity_verification_photo_form'); // // fillPhotoIdForm(); showStepPage('#verification_form_advanced'); fillPhotoIdForm(); } return false; } function fillPhotoIdForm(){ if($('#banking_type1').is(':checked')){ $('.personal-block').css('display', 'block'); $('.business-block').css('display', 'none'); } else if($('#banking_type2').is(':checked')){ $('.personal-block').css('display', 'none'); $('.business-block').css('display', 'block'); } var official_first_name = $('#official_first_name').val(); var official_middle_name = $('#official_middle_name').val(); var official_last_name = $('#official_last_name').val(); var birth_date = $('#official_birth_year').val() + '-' + $('#official_birth_month').val() + '-' + $('#official_birth_day').val(); var official_country_of_citizenship = $('#official_country_of_citizenship').val(); var goverment_id_number = $('#goverment_id_number').val(); $('.lbl_personal_identity_firstname').html(official_first_name); $('.lbl_personal_identity_middlename').html(official_middle_name); $('.lbl_personal_identity_lastname').html(official_last_name); $('#lbl_personal_identity_date_of_bith').html(birth_date); $('#lbl_personal_identity_country').html(official_country_of_citizenship); $('#lbl_personal_identity_id_number').html(goverment_id_number); var residential_country = $('#residential_country').val(); var residential_street_1 = $('#residential_street_1').val(); $('#lbl_residential_street_address').html(residential_street_1); $('#lbl_residential_country').html(residential_country); var personal_business_name = $('#personal_business_name').val(); $('.lbl_personal_business_name').html(personal_business_name); var registered_business_name = $('#registered_business_name').val(); var registered_business_tax_id_number = $('#registered_business_tax_id_number').val(); var business_country = $('#business_country').val(); var business_street_1 = $('#business_street_1').val(); $('.lbl_business_name').html(registered_business_name); $('#lbl_business_tax_id').html(registered_business_tax_id_number); $('.lbl_business_country').html(business_country); var account_number = $('#account_number').val(); $('#lbl_business_address').html(business_street_1); $('.lbl_bank_account_number').html(account_number); } function displayAccountNumber(){ var account_number = $('#account_number').val(); $('.lbl_bank_account_number').html(account_number); } function displayAdvancedFieldValues(e, id){ $(id).html($(e).val()); } function saveVerificationForm(formType){ if(formType == 'advanced'){ // validateText(document.frmPayment['residential_country'], 'onBlur'); // validateText(document.frmPayment['residential_state'], 'onBlur'); // validateText(document.frmPayment['residential_postalcode'], 'onBlur'); // validateText(document.frmPayment['residential_city'], 'onBlur'); // validateText(document.frmPayment['residential_street_1'], 'onBlur'); if($('#banking_type1').is(':checked') || $('#banking_type2').is(':checked') ){ $('.PERSONAL_business_type_block').removeClass('has-success has-error has-feedback'); $('.BUSINESS_business_type_block').removeClass('has-success has-error has-feedback'); if($('#banking_type1').is(':checked')){ $('.PERSONAL_business_type_block').addClass('has-success has-feedback'); validateText(document.frmPayment['personal_business_type'], 'onBlur'); validateText(document.frmPayment['personal_business_name'], 'onBlur'); //validateText(document.frmPayment['personal_business_web_address'], 'onBlur'); } if($('#banking_type2').is(':checked') ){ $('.BUSINESS_business_type_block').addClass('has-success has-feedback'); validateText(document.frmPayment['registered_business_type'], 'onBlur'); validateText(document.frmPayment['registered_business_name'], 'onBlur'); validateText(document.frmPayment['registered_business_tax_id_number'], 'onBlur'); //validateText(document.frmPayment['registered_business_web_address'], 'onBlur'); // validateText(document.frmPayment['business_country'], 'onBlur'); // validateText(document.frmPayment['business_state'], 'onBlur'); // validateText(document.frmPayment['business_postalcode'], 'onBlur'); // validateText(document.frmPayment['business_city'], 'onBlur'); // validateText(document.frmPayment['business_street_1'], 'onBlur'); } } else{ $('#banking_type1').parent().parent().addClass('has-error has-feedback'); $('#banking_type2').parent().parent().addClass('has-error has-feedback'); } // validateText(document.frmPayment['bank_name'], 'onBlur'); // validateText(document.frmPayment['account_number'], 'onBlur'); // validateText(document.frmPayment['local_routing_number'], 'onBlur'); // validateText(document.frmPayment['swift_code'], 'onBlur'); // // validateText(document.frmPayment['banking_country'], 'onBlur'); // validateText(document.frmPayment['banking_state'], 'onBlur'); // validateText(document.frmPayment['banking_postalcode'], 'onBlur'); // validateText(document.frmPayment['banking_city'], 'onBlur'); // validateText(document.frmPayment['banking_street_1'], 'onBlur'); // validateText(document.frmPayment['banking_phone_number'], 'onBlur'); if($('.form-group.has-error').length>0){ show_device_alert('ERROR', "Please complete the form."); return false; } //fillPhotoIdForm(); } showProgressDialog("Working..."); // populates forms with session data: setTimeout(function() { var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_Wizard.gate'; url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/QUALIFY_Wizard.gate'; // alert("QUALIFY_Wizard "+3); //alert("1-url: "+url); var post_data = 'member_hash=' + member_hash + '&BUSINESS_ACCOUNT_ID=' + selected_account_hash + '&CUSTOMER_SESSION_ID=' + token() + '&CUSTOMER_IP=' + CUSTOMER_IP ; var official_first_name = $('#official_first_name').val(); var official_middle_name = $('#official_middle_name').val(); var official_last_name = $('#official_last_name').val(); var birth_date = $('#official_birth_year').val() + '-' + $('#official_birth_month').val() + '-' + $('#official_birth_day').val(); var official_country_of_citizenship = $('#official_country_of_citizenship').val(); var goverment_id_number = $('#goverment_id_number').val(); var business_category = 'SERVICE:Other'; //$('#business_category').val(); var verification_region = $('#verification_region').val(); post_data += "&business_category=" + business_category; post_data += "®ion=" + verification_region; post_data += "&official_first_name=" + official_first_name; post_data += "&official_middle_name=" + official_middle_name; post_data += "&official_last_name=" + official_last_name; post_data += "&official_birth_date=" + birth_date; post_data += "&official_birth_year=" + $('#official_birth_year').val(); post_data += "&official_birth_month=" + $('#official_birth_month').val(); post_data += "&official_birth_day=" + $('#official_birth_day').val(); post_data += "&official_country_of_citizenship=" + official_country_of_citizenship; post_data += "&goverment_id_number=" + goverment_id_number; if(formType == 'advanced') { var residential_country = $('#residential_country').val(); var residential_state = $('#residential_state').val(); var residential_postalcode = $('#residential_postalcode').val(); var residential_city = $('#residential_city').val(); var residential_street_1 = $('#residential_street_1').val(); var residential_street_2 = $('#residential_street_2').val(); post_data += "&residential_country=" + residential_country; post_data += "&residential_state=" + residential_state; post_data += "&residential_postalcode=" + residential_postalcode; post_data += "&residential_city=" + residential_city; post_data += "&residential_street_1=" + residential_street_1; post_data += "&residential_street_2=" + residential_street_2; var business_type = "PERSONAL"; if($('#banking_type1').is(':checked')) { business_type = "PERSONAL"; var personal_business_type = $('#personal_business_type').val(); var personal_business_name = $('#personal_business_name').val(); //var personal_business_web_address = $('#personal_business_web_address').val(); post_data += "&personal_business_type=" + personal_business_type; post_data += "&personal_business_name=" + personal_business_name; //post_data += "&personal_business_web_address=" + personal_business_web_address; } if($('#banking_type2').is(':checked') ) { business_type = "BUSINESS"; var registered_business_type = $('#registered_business_type').val(); var registered_business_name = $('#registered_business_name').val(); var registered_business_tax_id_number = $('#registered_business_tax_id_number').val(); //var registered_business_web_address = $('#registered_business_web_address').val(); post_data += "®istered_business_type=" + registered_business_type; post_data += "®istered_business_name=" + registered_business_name; post_data += "®istered_business_tax_id_number=" + registered_business_tax_id_number; //post_data += "®istered_business_web_address=" + registered_business_web_address; // var business_country = $('#business_country').val(); // var business_state = $('#business_state').val(); // var business_postalcode = $('#business_postalcode').val(); // var business_city = $('#business_city').val(); // var business_street_1 = $('#business_street_1').val(); // var business_street_2 = $('#business_street_2').val(); // post_data += "&business_country=" + business_country; // post_data += "&business_state=" + business_state; // post_data += "&business_postalcode=" + business_postalcode; // post_data += "&business_city=" + business_city; // post_data += "&business_street_1=" + business_street_1; // post_data += "&business_street_2=" + business_street_2; } post_data += "&business_type=" + business_type; // var bank_name = $('#bank_name').val(); // var account_number = $('#account_number').val(); // var local_routing_number = $('#local_routing_number').val(); // var swift_code = $('#swift_code').val(); // var banking_country = $('#banking_country').val(); // var banking_state = $('#banking_state').val(); // var banking_postalcode = $('#banking_postalcode').val(); // var banking_city = $('#banking_city').val(); // var banking_street_1 = $('#banking_street_1').val(); // var banking_phone_number = $('#banking_phone_number').val(); // post_data += "&bank_name=" + bank_name; // post_data += "&account_number=" + account_number; // post_data += "&local_routing_number=" + local_routing_number; // post_data += "&swift_code=" + swift_code; // post_data += "&banking_country=" + banking_country; // post_data += "&banking_state=" + banking_state; // post_data += "&banking_city=" + banking_city; // post_data += "&banking_postalcode=" + banking_postalcode; // post_data += "&banking_street_1=" + banking_street_1; // post_data += "&banking_phone_number=" + banking_phone_number; } console.log('post_data', post_data); $.ajax({ type: "POST" ,url: url ,data: post_data ,success:function(data){ hideProgressDialog(); setTimeout(function(){ console.log(data); //alert("formType: "+formType); //if (data.indexOf("<") == -1){ //if($.trim(data) == "OK"){ if(formType == 'personal'){ //showStepPage('#verification_form_advanced'); showStepPage('#identity_verification_form_result'); } else if(formType == 'advanced'){ showStepPage('#identity_verification_form_result'); } // } else{ show_device_alert('ERROR', "Account verification failed! Please try again!" ); } // } // else{ // show_device_alert('ERROR', globalErrorMessage ); // } }, 1000); } ,error:function(){ console.log('error'); hideProgressDialog(); setTimeout(function(){ show_device_alert('ERROR', globalErrorMessage ); }, 1000); } ,complete:function(){ hideProgressDialog(); } }); }, 1000); return false; } function autoCompletePaymentInBackground(){ window.location.href = SITE_SCHEMA+'://confirmAutoCompletePaymentInBackground?msg=Backgrounding will not cancel the payment. The payment will continue in the background, and you will be notified when the payment process has completed.'; return false; } var intervalRefreshTransactionHistory; function confirmAutoCompletePaymentInBackground(){ is_payment_in_background = true; if(!empty(paymentStatusAnimationTimer)) clearTimeout(paymentStatusAnimationTimer); showStepPage('#selected_account_form'); intervalRefreshTransactionHistory = setInterval(function(){ showTransactionHistory(false); }, 1000); return false; } function processPayment1(){ validateText(document.frmPayment['amount'], 'onBlur'); validateText(document.frmPayment['name_on_card'], 'onBlur'); validateText(document.frmPayment['telephone_country_iso3'], 'onBlur'); validateText(document.frmPayment['telephone_number'], 'onBlur'); if($('.form-group.has-error').length>0){ show_device_alert('ERROR', "Please complete payment form."); return false; } var enable_high_security_chargeback_protection = document.frmPayment['enable_high_security_chargeback_protection'].checked; if(enable_high_security_chargeback_protection){ showStepPage('#enable_high_security_chargeback_protection_page1'); } else processPayment2(); return false; } function chargebackProtection(step){ showStepPage('#enable_high_security_chargeback_protection_page' + (step + 1)); return false } var freeeswitch_uuid = ''; function processPayment2(){ clearPaymentMessages(); var selected_account_details = getSelectAccountDetails(); is_payment_cancelled = false; is_payment_in_background = false; $('.processPayment1-error-message').html(''); validateText(document.frmPayment['amount'], 'onBlur'); validateText(document.frmPayment['name_on_card'], 'onBlur'); validateSelectDOB(document.frmPayment['birth_year']); validateSelectDOB(document.frmPayment['birth_month']); validateSelectDOB(document.frmPayment['birth_day']); validateText(document.frmPayment['cardholder_email_address'], 'onBlur'); validateText(document.frmPayment['billing_country'], 'onBlur'); validateText(document.frmPayment['billing_state'], 'onBlur'); validateText(document.frmPayment['billing_postalcode'], 'onBlur'); validateText(document.frmPayment['billing_city'], 'onBlur'); validateText(document.frmPayment['billing_street_1'], 'onBlur'); //validateText(document.frmPayment['telephone_calling_code'], 'onBlur'); validateText(document.frmPayment['telephone_country_iso3'], 'onBlur'); validateText(document.frmPayment['telephone_number'], 'onBlur'); if(document.frmPayment['agreement_ACK1'].checked == false){ var field = document.frmPayment['agreement_ACK1']; $(field).parent().parent().removeClass('has-success has-error has-feedback'); $(field).parent().parent().addClass('has-error has-feedback'); } else{ var field = document.frmPayment['agreement_ACK1']; $(field).parent().parent().removeClass('has-success has-error has-feedback'); $(field).parent().parent().addClass('has-success has-feedback'); } if(document.frmPayment['agreement_ACK2'].checked == false){ var field = document.frmPayment['agreement_ACK2']; $(field).parent().parent().removeClass('has-success has-error has-feedback'); $(field).parent().parent().addClass('has-error has-feedback'); } else{ var field = document.frmPayment['agreement_ACK2']; $(field).parent().parent().removeClass('has-success has-error has-feedback'); $(field).parent().parent().addClass('has-success has-feedback'); } if($('.form-group.has-error').length>0){ show_device_alert('ERROR', "Please complete payment form."); return false; } else{ console.log('additionalParameters', additionalParameters); var devicePhone = additionalParameters.PAYYAP_device_telephone_number; var customerPhone = $('#telephone_number').val(); console.log('devicePhone, customerPhone', devicePhone , customerPhone); if(!empty(devicePhone) && !empty(customerPhone)){ if(devicePhone.length>7) devicePhone = devicePhone.substr(devicePhone.length - 7); if(customerPhone.length>7) customerPhone = customerPhone.substr(customerPhone.length - 7); console.log('devicePhone, customerPhone', devicePhone , customerPhone); if(devicePhone == customerPhone){ show_device_alert('ERROR', "Do not bill yourself. (Do not use your own telephone number.) Please provide the card holder's telephone number."); return false; } } showProgressDialog("Working..."); setTimeout(function(){ //show_device_alert('SUCCESS', 'Success'); //var form_data = $('#frmPayment').serialize(); var amount = $('#amount').val(); var name_on_card = $('#name_on_card').val(); var cardholder_email_address = $('#cardholder_email_address').val(); var telephone_country_iso3 = $('#telephone_country_iso3').val(); var telephone_number = $('#telephone_number').val(); //var telephone_calling_code = $('#telephone_calling_code').val(); var telephone_calling_code_text = $('#telephone_country_iso3 option:selected').text(); var telephone_calling_code = telephone_calling_code_text.substr(telephone_calling_code_text.indexOf('|')+2); var birth_date = $('#birth_year').val() + '-' + $('#birth_month').val() + '-' + $('#birth_day').val(); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/voice_authorization.api'; var post_data = 'API_VERSION=vSIGN_For_payBANGK&member_hash=' + member_hash + '&BUSINESS_ACCOUNT_ID=' + selected_account_hash + '&CUSTOMER_SESSION_ID=' + token() + '&CUSTOMER_IP=' + CUSTOMER_IP + '&AUTHORIZATION_CATEGORY=PAYMENT&CUSTOMER_CANCEL_URL=mobile&CUSTOMER_APPROVED_URL=mobile&CUSTOMER_STATUS_URL=mobile&AUTHORIZATION_AMOUNT=' + amount + '&CUSTOMER_NAME=' + name_on_card + '&CUSTOMER_EMAIL_ADDRESS=' + cardholder_email_address + '&CUSTOMER_TELEPHONE_COUNTRY_ISO3=' + telephone_country_iso3; post_data += '&CUSTOMER_TELEPHONE_COUNTRY_CODE=' + telephone_calling_code; post_data += '&CUSTOMER_TELEPHONE_NUMBER=' + telephone_number; var isCustomerExpectingCall = $('input[name=isCustomerExpectingCall]:checked').val(); if(isCustomerExpectingCall == 'Yes' && !empty(selected_account_details.merchant_telephone_number)){ post_data += '&PAYYAP_precall_number=' + selected_account_details.merchant_telephone_number; } else post_data += '&PAYYAP_precall_number='; post_data += "&CUSTOMER_BILLING_COUNTRY_ISO3=" + telephone_country_iso3; post_data += "&CUSTOMER_BILLING_STATE_ISO2=" + $('#billing_state').val(); post_data += "&CUSTOMER_BILLING_CITY=" + $('#billing_city').val(); post_data += "&CUSTOMER_BILLING_POSTALCODE=" + $('#billing_postalcode').val(); post_data += "&CUSTOMER_BILLING_STREET_1=" + $('#billing_street_1').val(); post_data += "&CUSTOMER_BILLING_STREET_2=" + $('#billing_street_2').val(); post_data += "&CUSTOMER_BIRTH_DATE=" + birth_date; post_data += "&CUSTOMER_BIRTH_YEAR=" + $('#birth_year').val(); post_data += "&CUSTOMER_BIRTH_MONTH=" + $('#birth_month').val(); post_data += "&CUSTOMER_BIRTH_DAY=" + $('#birth_day').val(); $.ajax({ type: "POST" //,url:'//pay.'+API_DOMAIN+'/processing_secured_payment_authorization_mobile.nsdb' ,url: url ,data: post_data ,success:function(data){ hideProgressDialog(); console.log(data); setTimeout(function(){ if (data.indexOf("<") == -1){ freeeswitch_uuid = data; get_payBANGK_authorization_status(); var phone_number_full = telephone_number; if(phone_number_full.indexOf('+')===-1 && phone_number_full.indexOf('/')===-1) phone_number_full = telephone_calling_code + '/' + telephone_number; $('#phone_number_called').html(phone_number_full); showStepPage('#payment_result'); paymentStatusAnimation(); } else{ $('.processPayment1-error-message').html(data); show_device_alert('ERROR', globalErrorMessage ); } }, 1000); } ,error:function(){ console.log('error'); hideProgressDialog(); setTimeout(function(){ show_device_alert('ERROR', globalErrorMessage ); }, 1000); } ,complete:function(){ hideProgressDialog(); } }); }, 1000); } return false; } var paymentStatusAnimationTimer = null; function paymentStatusAnimation(){ if(is_payment_cancelled){ paymentStatusAnimationTimer = null; return false; } var total_rows = $('.row_status').length; var payment_row_completed = 0; var payment_row_pending = 0; var paymentStatusAnimationRow = -1; //if(empty(paymentStatusAnimationRow)) paymentStatusAnimationRow = $('.row_status').length; $('.row_status').each(function(i, row){ //$(row).parent().parent().css('background-color', '#ff0000'); if($(row).find('img').attr('src')=='PAYYAP_status_GREEN.png') payment_row_completed += 1; else if($(row).find('img').attr('src')=='PAYYAP_status_MEDIUMGRAY.png') { /*payment_row_pending += 1;*/ } else paymentStatusAnimationRow = i; }); payment_row_pending = total_rows - payment_row_completed; console.log('total_rows:', total_rows, ', payment_row_completed:', payment_row_completed, ', payment_row_pending:', payment_row_pending, ', paymentStatusAnimationRow:', paymentStatusAnimationRow); var need_to_clear = false; if(payment_row_pending>0){ if($('.row_status').eq(paymentStatusAnimationRow).find('img').attr('src')=='PAYYAP_status_MEDIUMGRAY.png') need_to_clear = true; if($('.row_status').eq(paymentStatusAnimationRow).find('img').attr('src')!='PAYYAP_status_GREEN.png'){ $('.row_status').eq(paymentStatusAnimationRow).html(""); } paymentStatusAnimationTimer = setTimeout(function(){ paymentStatusAnimation(); }, 500); //setTimeout(function(){ paymentStatusAnimationTestFill(); }, 4000); } if(paymentStatusAnimationRow < payment_row_completed){ if(need_to_clear){ clearStatusIcons(); paymentStatusAnimationRow = total_rows; } } } function paymentStatusAnimationTestFill(){ var total_rows = $('.row_status').length; var payment_row_completed = 0; var payment_row_pending = 0; var paymentStatusAnimationRow = -1; $('.row_status').each(function(i, row){ if($(row).find('img').attr('src')=='PAYYAP_status_GREEN.png') payment_row_completed += 1; }); payment_row_pending = total_rows - payment_row_completed; console.log('2. total_rows:', total_rows, ', payment_row_completed:', payment_row_completed, ', payment_row_pending:', payment_row_pending, ', paymentStatusAnimationRow:', paymentStatusAnimationRow); $('.row_status').eq(payment_row_completed).html(""); blinkGreenStatus($('.row_status').eq(payment_row_completed)); } function clearStatusIcons(){ $('.row_status').each(function(i, row){ if($(row).find('img').attr('src')=='PAYYAP_status_MEDIUMGRAY.png'){ $(row).html(""); } }); } function blinkGreenStatus(el){ if($(el).find('img').attr('src')=='PAYYAP_status_MEDIUMGRAY.png' || $(el).find('img').attr('src')=='PAYYAP_status_DEFAULT.png'){ if(!empty(paymentStatusAnimationTimer)) clearTimeout(paymentStatusAnimationTimer); clearStatusIcons(); $(el).html(""); $(el).addClass('blink-status'); setTimeout(function(){ $(el).removeClass('blink-status'); paymentStatusAnimation(); }, 4000); } } var xhr_status = null; function get_payBANGK_authorization_status() { window.authorization_status_current = ""; window.authorization_status_new = ""; var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/payBANGK_authorization_status_update.gate?fuuid=' + freeeswitch_uuid; xhr_status = $.ajax({ method: "GET", url: url, data: { }, /* dataType: "json" */ }) .done(function( status_new ) { //console.log( "Data saved: " + msg ); /// if( (status_new == "Calling") || (status_new == "Call Made") ) { /// /// status_new = "status: CALLING ()"; /// $('.authorization_status').html(status_new); if(status_new == "CONNECTED") { //$('.status_CONNECTED').html(""); blinkGreenStatus($('.status_CONNECTED')); } if(status_new == "IDENTITY") { //$('.status_IDENTITY').html(""); blinkGreenStatus($('.status_IDENTITY')); } if(status_new == "NAME_ON_CARD") { //$('.status_NAME_ON_CARD').html(""); blinkGreenStatus($('.status_NAME_ON_CARD')); } if(status_new == "CARD_NUMBER") { //$('.status_CARD_NUMBER').html(""); blinkGreenStatus($('.status_CARD_NUMBER')); } if(status_new == "CARD_EXPIRATION") { //$('.status_CARD_EXPIRATION').html(""); blinkGreenStatus($('.status_CARD_EXPIRATION')); } if(status_new == "CARD_CVV") { //$('.status_CARD_CVV').html(""); blinkGreenStatus($('.status_CARD_CVV')); } if(status_new == "AMOUNT") { //$('.status_AMOUNT').html(""); blinkGreenStatus($('.status_AMOUNT')); } if(status_new == "TERMS") { $('.status_TERMS').html(""); //$('.status_PROCESSING').html(""); blinkGreenStatus($('.status_PROCESSING')); } window.authorization_status_current = status_new; if( (window.authorization_status_current == "APPROVED") || (window.authorization_status_current == "DECLINED") || (window.authorization_status_current == "CANCELED") ) { setTimeout(makeTheJump, 3000); } else{ get_payBANGK_authorization_status(); } }) .fail(function( jqXHR, textStatus ) { //console.log( "Data not saved: " + textStatus ); //setTimeout(makeTheJump, 3000); }); function makeTheJump() { if(is_payment_in_background) return false; //window.location = "//pay.payyap.network/transaction_receipt.nsdb"; $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/PAYYAP_receipt.php?freeswitch_uuid=' + freeeswitch_uuid ,data: {} ,success:function(data){ $('#payment_receipt').html(data); if(!empty(paymentStatusAnimationTimer)) clearTimeout(paymentStatusAnimationTimer); showStepPage('#payment_receipt'); } ,error:function(){ } ,complete:function(){ } }); } } var is_payment_in_background = false; var is_payment_cancelled = false; function cancel_hangup() { if(!empty(xhr_status)) xhr_status.abort(); is_payment_cancelled = true; showStepPage('#payment_form'); $('#payment_form #amount').focus(); $('.form-group').removeClass('has-error has-success has-feedback'); $('.form-group .glyphicon').remove(); if(!empty(freeeswitch_uuid)){ //freeeswitch_uuid = ''; $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_authorizations/freeswitch.auth' ,data: { command: 'kill', uuid: freeeswitch_uuid } //,dataType: 'json' ,success:function(data){ console.log('FreeSwitch Hangup', freeeswitch_uuid, data); } ,error:function(){ } ,complete:function(){ } }); } clearPaymentMessages(); return false; } function startNewBillingAddress(){ cancel_hangup(); resetPaymentForm(); showStepPage('#account_form'); return false; } function startSameBillingAddress(){ cancel_hangup(); clearPaymentMessages(); return false; } function sendNewEmailInvoice(){ resetPaymentForm(); showStepPage('#account_form'); return false; } function resetPaymentForm(){ document.getElementById("frmSignIn").reset(); document.getElementById("frmPayment").reset(); clearPaymentMessages(); } function clearPaymentMessages(){ freeeswitch_uuid = ''; if(!empty(paymentStatusAnimationTimer)) clearTimeout(paymentStatusAnimationTimer); clearStatusIcons(); $('#phone_number_called').html(""); $('.status_CONNECTED').html(''); $('.status_IDENTITY').html(''); $('.status_NAME_ON_CARD').html(''); $('.status_CARD_NUMBER').html(''); $('.status_CARD_EXPIRATION').html(''); $('.status_CARD_CVV').html(''); $('.status_AMOUNT').html(''); $('.status_TERMS').html(''); $('.status_PROCESSING').html(''); $('.form-group').removeClass('has-error has-success has-feedback'); $('.form-group .glyphicon').remove(); } function fillDemoForm(){ $('#birth_year option:eq(2)').prop('selected', true); $('#birth_month option:eq(2)').prop('selected', true); $('#birth_day option:eq(2)').prop('selected', true); $('#cardholder_email_address').val(email_address); //$('#cboCountry').val('USA'); //$('#cboCountry').change(); $('#billing_postalcode').val('0000'); $('#billing_city').val('city'); $('#billing_street_1').val('address1'); $('#billing_street_2').val('address2'); //$('#telephone_country_iso3').html(''); $('#agreement_ACK1').prop('checked', true); $('#agreement_ACK2').prop('checked', true); //$('#telephone_number').val('+'); $('.form-block').css('display', 'none'); } function showHideLoader(show){ if(show){ showLoader("Working..."); } else hideLoader(); } function setAdditionalParameters(params){ alert(params); } //var additionalParameters = {}; function getMemberEmailAddress(){ clearErrors(); showHideLoader(true); $('#signin-input').addClass('hide_tell_friend_row'); //window.location.href = SITE_SCHEMA+'://account_access?emailaddress=&callback=showMemberEmailAddress'; showMemberEmailAddress() return false; } var login_type = 'email_address'; var login_verification = 'email_address'; var theme_data = ''; function showMemberEmailAddress(params){ var temporary_emailaddress_placeholder = "Set Your Personal Email Address"; //if(params == undefined) return false; breaks loading console.log('get_member_emailaddress params', params); //if(!empty(params)) additionalParameters = $.parseJSON(params); var newParams = {}; if(!empty(additionalParameters.PAYYAP_version)) newParams.PAYYAP_version = additionalParameters.PAYYAP_version; if(!empty(additionalParameters.PAYYAP_device_type)) newParams.PAYYAP_device_type = additionalParameters.PAYYAP_device_type; $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/get_member_emailaddress.gate' ,data: $.extend( { member_hash: member_hash, account_hash: selected_account_hash, whitelabel_business_account_hash: whitelabel_business_account_hash }, newParams ) //,dataType: 'json' ,success:function(data){ console.log('get_member_emailaddress data', data); try { data = $.parseJSON(data); theme_data = data; } catch(err) { console.log('err', err); data = {member_emailaddress: data, force_update: 'NO'}; } if(!empty(data)){ login_type = !empty(data.login_type)? data.login_type : 'email_address'; login_verification = !empty(data.login_verification)? data.login_verification : 'email_address'; if( login_type == 'email_address' ) { $('#frmSignIn #inputCountryCode').closest('fieldset').addClass('hide-filed'); $('#frmSignIn #inputEmail').attr('placeholder', temporary_emailaddress_placeholder); $('#frmSignIn #inputEmail').attr('type', 'email'); } else{ $('#frmSignIn #inputCountryCode').closest('fieldset').removeClass('hide-filed'); $('#frmSignIn #inputEmail').attr('placeholder', "Mobile Number for SMS Verification"); $('#frmSignIn #inputEmail').attr('type', 'tel'); } if(!empty(data.display_agent_login) && data.display_agent_login.toLowerCase() == 'false'){ $('#agentLogin').addClass('hide-filed'); } else{ $('#agentLogin').removeClass('hide-filed'); } //terms if(!empty(form_flow) && form_flow == 'single_page'){ if(!empty(data['onboarding_preferences'])){ var terms_link = ''; if(!empty(data['onboarding_preferences']['onboarding_terms_of_service_url'])){ terms_link = 'Terms of Service'; } else if(!empty(data['onboarding_preferences']['onboarding_terms_of_service_text'])){ terms_link = 'Terms of Service
'; } $('#tsys_service_agreement').html(terms_link); } //changePage('#singlepage'); } // applyTheme(); // if(data.force_update.toUpperCase() == 'YES'){ // $('#signin-input').addClass('hide_tell_friend_row'); // displayErrors('To login, please update PAYYAP now.

'); // show_device_alert('ALERT', 'openDownloadPage', 'openDownloadPage'); // } // else{ if(!empty(data.login_screen_footer_url_or_text)) { $('#login_screen_footer_url_or_text').html(data.login_screen_footer_url_or_text); } $('#signin-input').removeClass('hide_tell_friend_row'); //$('#inputEmail').val(data.member_emailaddress); $('#inputEmail').focus(); //} } } ,error:function(){ //reset $('#signin-input').removeClass('hide_tell_friend_row'); //$('#inputEmail').val(''); $('#inputEmail').focus(); } ,complete:function(){ showHideLoader(false); } }); } function applyTheme(){ //page background start var data = theme_data; if(!empty(data.theme)){ var background_color = !empty(data.theme.background_color) ? data.theme.background_color : '#EEEEEE'; var background_image = !empty(data.theme.background_image) ? data.theme.background_image : API_DOMAIN+'/link_images/intelitruth_app_wallpaper/theme_6.jpg'; $('div[data-role="page"]').css('background-image', 'url('+background_image+')'); $('div[data-role="page"]').css('background-color', background_color); //$('div[data-role="page"]').css('background-color', "#F9F9F9"); // ui-page CSS in app.css file $('div[data-role="page"]').css('background', 'none !important'); if(!empty(data.theme.background_border)){ var background_border_color = !empty(data.theme.background_border.color) ? data.theme.background_border.color : '#AAAAFF'; var background_border_style = !empty(data.theme.background_border.style) ? data.theme.background_border.style : 'dotted'; var background_border_width = !empty(data.theme.background_border.width) ? data.theme.background_border.width : '3px'; $('div[data-role="page"], .ui-header-fixed, .ui-footer-fixed').css('border-color', '' + background_border_color + ''); $('div[data-role="page"], .ui-header-fixed, .ui-footer-fixed').css('border-style', '' + background_border_style + ''); $('div[data-role="page"], .ui-header-fixed, .ui-footer-fixed').css('border-width', '' + background_border_width + ''); $('div[data-role="page"]').css({'border-bottom': 'none !important', 'border-top' : 'none !important'}); try{ var border_width = parseInt(background_border_width); $('div[data-role="page"], .ui-header-fixed, .ui-footer-fixed').css('width', 'calc(100% - ' + (border_width*2) + 'px)'); } catch(err){ } } if(!empty(data.theme.content_border)){ var content_border_color = !empty(data.theme.content_border.color) ? data.theme.content_border.color : '#AAAAFF'; var content_border_style = !empty(data.theme.content_border.style) ? data.theme.content_border.style : 'dotted'; var content_border_width = !empty(data.theme.content_border.width) ? data.theme.content_border.width : '3px'; var content_border_padding_top = !empty(data.theme.content_border.padding_top) ? data.theme.content_border.padding_top : '0px'; var content_border_padding_bottom = !empty(data.theme.content_border.padding_bottom) ? data.theme.content_border.padding_bottom : '0px'; var content_border_padding_left = !empty(data.theme.content_border.padding_left) ? data.theme.content_border.padding_left : '20px'; var content_border_padding_right = !empty(data.theme.content_border.padding_right) ? data.theme.content_border.padding_right : '20px'; $('.ui-content').css({'border-color': content_border_color, 'border-style': content_border_style, 'border-width': content_border_width, 'padding-top': content_border_padding_top, 'padding-bottom': content_border_padding_bottom, 'padding-left': content_border_padding_left, 'padding-right': content_border_padding_right}); } } //page background end } function openDownloadPage(){ window.location.href = '//play.google.com/store/apps/details?id=network.payyap.payments.app'; return false; } function getAccountAccess(){ clearErrors(); var email = $('#inputEmail').val(); var verification_PIN = $('#verification_PIN').val(); email = $.trim(email); verification_PIN = $.trim(verification_PIN); if(empty(email)) { //displayErrors("Email Address can't be empty!"); displayErrors("Mobile Number can't be empty!"); $('#inputEmail').focus(); return false; } showLoader("Working..."); if( login_type == 'mobile_number' ){ email = $('#inputCountryCode').find(':selected').attr('data-countryCode') + '/' + $('#inputEmail').val(); } if(!empty(email)){ email = email.toLowerCase(); email_address = email; } //window.location.href = SITE_SCHEMA+'://account_access?emailaddress=' + email + '&callback=getAuthText'; setSessionUserData('emailaddress', email, function(data){getAuthText(data);}); return false; } function confirm_verification_PIN_check(verification_PIN) { console.log("verification_PIN: "+verification_PIN); var AJAX_URL = siteProtocol + '//'+API_DOMAIN+'/link_gateway/IEW_verify_PIN.gate'; console.log("AJAX_URL: "+AJAX_URL); var member_email_address = $("#inputEmail").val(); console.log("member_email_address: "+member_email_address); var AJAX_POST_DATA = { verification_PIN: verification_PIN, member_email_address: member_email_address }; console.log("AJAX_POST_DATA: "+AJAX_POST_DATA); //console.log('setSessionUserData_api_data: '+setSessionUserData_api_data); window.confirm_verification_PIN = false; $.ajax({ type: "POST" ,url:AJAX_URL ,data: AJAX_POST_DATA ,success:function(data){ console.log("confirm_verification_PIN_data (1): "+data); var response = $.trim(data); console.log("confirm_verification_PIN_response (000): "+response); if(response.indexOf("TRUE") > -1) { setSessionUserData('emailaddress', email, function(data){getAuthText(data);}) return false; } console.log("confirm_verification_PIN_data (3): "+response); window.confirm_verification_PIN = false; return false; } }); } window.confirm_verification_PIN = ""; function getAccountAccess_viaPIN() { //getAccountAccess() clearErrors(); //alert(1); var email = $('#inputEmail').val(); email = $.trim(email); var verification_PIN = $('#verification_PIN').val(); verification_PIN = $.trim(verification_PIN); if(empty(email)) { //displayErrors("Email Address can't be empty!"); alert("Email Address May Not Be Empty"); $('#inputEmail').focus(); return false; } if(empty(verification_PIN)) { //displayErrors("Email Address can't be empty!"); alert("Verification PIN May Not Be Empty"); $('#verification_PIN').focus(); return false; } showLoader("Working..."); if( login_type == 'mobile_number' ){ email = $('#inputCountryCode').find(':selected').attr('data-countryCode') + '/' + $('#inputEmail').val(); } if(!empty(email)){ email = email.toLowerCase(); email_address = email; } //window.location.href = SITE_SCHEMA+'://account_access?emailaddress=' + email + '&callback=getAuthText'; //alert(2); console.log("verification_PIN (6-A): "+verification_PIN); //showHideLoader(false); console.log("verification_PIN: "+verification_PIN); var AJAX_URL = siteProtocol + '//'+API_DOMAIN+'/link_gateway/IEW_verify_PIN.gate'; console.log("AJAX_URL: "+AJAX_URL); var member_email_address = $("#inputEmail").val(); console.log("member_email_address: "+member_email_address); var AJAX_POST_DATA = { verification_PIN: verification_PIN, member_email_address: member_email_address }; console.log("AJAX_POST_DATA: "+AJAX_POST_DATA); //console.log('setSessionUserData_api_data: '+setSessionUserData_api_data); window.confirm_verification_PIN = false; $.ajax({ type: "POST" ,url:AJAX_URL ,data: AJAX_POST_DATA ,success:function(response){ console.log("BACK FROM IEW_verify_PIN"); response = $.parseJSON($.trim(response)); console.log("response.status (001): "+response.status); console.log("response.response (001): "+response.response); console.log("response.details (001): "+response.details); console.log("response.details (001): "+response.details.account_hash); console.log("response.details (001): "+response.details.member_hash); //console.log("response.details (001): "+response.details); //data = response.response; data = $.parseJSON($.trim(response.response)); console.log("data (002): "+data); console.log("data.login_message (002): "+data.login_message); console.log("data.member_hash (002): "+data.member_hash); console.log("data.account_hash (002): "+data.account_hash); //var response = data; if(response.status.indexOf("TRUE") > -1) { console.log("response==TRUE"); // showHideLoader("..."); showLoader("Logging-in..."); /// console.log("response (email): "+email); /// console.log("response (response.account_hash): "+response.details.account_hash); /// /// console.log("setSessionUserData: CHECK"); /// showLoader('setSessionUserData...'); /// setSessionUserData('emailaddress', email, function(data){getAuthText(data);}); /// /// console.log("goLogin: CHECK"); /// showLoader('goLogin...'); /// goLogin(response.details.account_hash); /// /// //console.log("response: CHECK"); /// //showLoader('showHome...'); /// //showHome(response.details.account_hash); var account_hash = window.account_hash = response.details.account_hash; console.log("002-LOGIN-account_hash",account_hash); var member_hash = window.member_hash = response.details.member_hash; console.log("002-LOGIN-member_hash",member_hash); setSessionUserData('member_hash', member_hash); setTimeout(function(){ hideLoader(); setTimeout(function(){ console.log("0-login_verification: "+login_verification); if( ( login_verification == 'none') ){ //setTimeout(function(){ console.log("2-account_hash: "+account_hash, "2-member_hash:"+member_hash); goLogin(account_hash); //}, 500); } else{ console.log("0-login_type: "+login_type); if( ( login_type == 'email_address' ) && ( login_verification == 'email_address') ){ // } else if( ( login_type == 'mobile_number' ) && ( login_verification == 'mobile_sms') ){ // } if(data.login_message != "SUCCESS") { console.log("0-data.login_message: "+data.login_message); show_device_alert('SUCCESS', data.login_message); } else if(data.login_message.indexOf("ALERT")>-1){ console.log("0-data.login_message: "+data.login_message); show_device_alert('ERROR', data.login_message); } else if(data.login_message.indexOf("ERROR")>-1){ console.log("0-data.login_message: "+data.login_message); show_device_alert('ERROR', data.login_message); } else{ //alert(10); $("#inputEmail").prop('disabled', false); $("#inputEmail").val(""); $("#PIN_VERIFICATION_FIELD").html(''); $("#display_submit_bitton").html(''); //$("#div_verification_PIN").html(""); //setTimeout(function(){ /// MADE IT TO HERE ON LOGIN: console.log("3-account_hash: "+account_hash, "3-member_hash:"+member_hash); goLogin(account_hash); //}, 500); } } }, 100); }, 500); return true; } console.log("response==FALSE"); // console.log("confirm_verification_PIN_response: FALSE"); alert("\nALERT!\n\nThe Verification PIN that you provided does not match our records.\n\nPlease confirm your Verification PIN.\n"); showHideLoader(false); $('#verification_PIN').focus(); return false; } }); } function setSessionUserData(key, value, callback){ var setSessionUserData_api_call = siteProtocol + '//'+API_DOMAIN+'/link_gateway/set_member_emailaddress.gate'; console.log('005-setSessionUserData_api_call: '+setSessionUserData_api_call); console.log('005-member_hash',member_hash); console.log('005-account_hash',account_hash); console.log('005-selected_account_hash',selected_account_hash); console.log('005-key',key); console.log('005-value',value); var setSessionUserData_api_data = { member_hash: member_hash, account_hash: selected_account_hash, key: key, value: value }; console.log('005-setSessionUserData_api_data: '+setSessionUserData_api_data); if (typeof(data) !== 'undefined') { console.log('005-data',data); } else { console.log('005-data: NULL'); } $.ajax({ type: "POST" ,url:setSessionUserData_api_call ,data: setSessionUserData_api_data ,success:function(data){ console.log('006-data',data); if(!empty(callback)) callback(data); } ,error:function(data){ if(!empty(callback)) callback(data); } ,complete:function(){ } }); } ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// /// START: WHITELABEL ACCOUNT DETAILS (RE: DYNAMIC LOGOS TO USE) //alert("window.location.hostname",window.location.hostname); //alert("window.location.href",window.location.href); /// END: WHITELABEL ACCOUNT DETAILS (RE: DYNAMIC LOGOS TO USE) ///////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// //var whitelabel_business_account_hash = "2a31b58f2a89687254ba451be3114001"; var demoAccountHash = '97d1ea8d7fb372558954fc6554e15215'; //'728872d4704be61221050fffc74c704f'; //'fc053601513728fe23a5e1008950bf4a'; function getAuthText(params){ console.log('getAuthText()', params); if(typeof params != 'object' ){ //if(!empty(params)) additionalParameters = $.parseJSON(params); //console.log('params', additionalParameters); } //open_social_blast_options_form(); return; clearErrors(); //window.location.href = SITE_SCHEMA+'://getauthtext'; var email = $('#inputEmail').val(); email = $.trim(email); if(empty(email)) { $('#inputEmail').focus(); return false;} additionalParameters.emailaddress = email; if(email == 'demo@corp.nsdb.com' || email == 'demo@payyap.network' || email == 'shahid@corp.nsdb.com' || email == 'test@payyap.network'){ if(email == 'demo@corp.nsdb.com') demoAccountHash = '97d1ea8d7fb372558954fc6554e15215'; else if(email == 'demo@payyap.network') demoAccountHash = '2a31b58f2a89687254ba451be3114b97'; else if(email == 'shahid@corp.nsdb.com') demoAccountHash = '728872d4704be61221050fffc74c704f'; else if(email == 'test@payyap.network') demoAccountHash = 'ba7932b08d4ab0748fab6988ea3da92f'; account_hash = demoAccountHash; //showHome(account_hash); //showHideLoader(false); goLogin(account_hash); return false; } console.log('login_type', login_type); if( login_type == 'mobile_number' ){ email = $('#inputCountryCode').find(':selected').attr('data-countryCode') + '/' + $('#inputEmail').val(); } additionalParameters.emailaddress = email; console.log('additionalParameters.emailaddress', additionalParameters.emailaddress); var AJAX_URL = siteProtocol + '//'+API_DOMAIN+'/link_gateway/nsdbAPP_account_access.gate'; console.log('090-AJAX_URL', AJAX_URL); var accountAccessPostData = $.extend( { whitelabel_business_account_hash: whitelabel_business_account_hash, SITE_SCHEMA: SITE_SCHEMA, SITE_TITLE: SITE_TITLE, PAYYAP_device_IP: CUSTOMER_IP }, additionalParameters ); if(!empty(agent_account_hash)){ accountAccessPostData = $.extend( { agent_account_hash: agent_account_hash }, accountAccessPostData ); } console.log('090-accountAccessPostData', accountAccessPostData); $.ajax({ type: "GET" ,url: AJAX_URL ,data: accountAccessPostData //,dataType: 'json' ,success:function(data){ //alert(1); console.log(data); //updateContent(data); console.log("FLAG_1 "+ data); if(data == 'OK'){ /// 2020.02.29 DEFAULT: displayErrors("A validation email has been sent! Please check your INBOX (or SPAM Folder) and click on the link."); setTimeout(function(){ //window.location.href = SITE_SCHEMA+'://setMemberHash?member_hash='; console.log('setSessionUserData(1)'); setSessionUserData('member_hash', ''); }, 1000); hideLoader(); } // else if(data.toUpperCase().indexOf('SUCCESS')!=-1){ // // show_device_alert('SUCCESS', data); // } else{ try { //console.log("FLAG_2"); if(!empty(data)) data = $.parseJSON($.trim(data)); console.log("001A-account_hash",account_hash); console.log("001A-member_hash",member_hash); if(typeof data == 'object' ){ account_hash = data.account_hash; member_hash = data.member_hash; console.log("001B-account_hash",account_hash); console.log("001B-member_hash",member_hash); console.log("LOGIN-account_hash: "+account_hash, "LOGIN-member_hash:"+member_hash); console.log('setSessionUserData(2)'); setSessionUserData('member_hash', member_hash); setTimeout(function(){ hideLoader(); setTimeout(function(){ console.log("0-login_verification: "+login_verification); //console.log("0-FLAG_3: "+data); if( ( login_verification == 'none') ){ //setTimeout(function(){ console.log("FLAG_100: verified - now login..."); console.log("2-account_hash: "+account_hash, "2-member_hash:"+member_hash); goLogin(account_hash); //}, 500); } else{ console.log("0-login_type: "+login_type); if( ( login_type == 'email_address' ) && ( login_verification == 'email_address') ){ // } else if( ( login_type == 'mobile_number' ) && ( login_verification == 'mobile_sms') ){ // } if(data.login_message != "SUCCESS") { console.log("0.01-data.login_message: "+data.login_message); $("#display_verification_PIN").fadeIn(); //$("#display_submit_bitton").html(''); //alert(1); $("#inputEmail").prop('disabled', true); $("#PIN_VERIFICATION_FIELD").html('
Enter your PIN
(sent to you via email)
'); $("#display_submit_bitton").html('
Edit Email Address / Resend PIN
'); $("inputEmail").prop('disabled', true); // disable email afddress field; $('#verification_PIN').focus(); show_device_alert('SUCCESS', data.login_message); } else if(data.login_message.indexOf("ALERT")>-1){ console.log("0.02-data.login_message: "+data.login_message); show_device_alert('ERROR', data.login_message); } else if(data.login_message.indexOf("ERROR")>-1){ console.log("0.03-data.login_message: "+data.login_message); show_device_alert('ERROR', data.login_message); } else{ //setTimeout(function(){ //alert(2); //$("inputEmail").prop('disabled', false); //$("#PIN_VERIFICATION_FIELD").html(''); //$("#display_submit_bitton").html(''); console.log("0.04-account_hash: "+account_hash, "3-member_hash:"+member_hash); goLogin(account_hash); //}, 500); } } }, 100); }, 500); /* if(!empty(data.login_message)){ show_device_alert('SUCCESS', data.login_message); hideLoader(); setTimeout(function(){ //window.location.href = SITE_SCHEMA+'://setMemberHash?member_hash='+member_hash; setSessionUserData('member_hash', member_hash); }, 1000); if(!empty(agent_account_hash)){ setTimeout(function(){ goLogin(account_hash); }, 500); } } else{ goLogin(account_hash); //showHome(account_hash); } */ } else{ displayErrors('An error occurred, please try again.'); hideLoader(); } } catch(err) { displayErrors('An error occurred, please try again.'); hideLoader(); } } } ,error:function(jqXHR, exception){ displayErrors('An error occurred, please try again.'); hideLoader(); } ,fail:function (jqXHR, exception) { console.log('fail'); displayErrors('An error occurred, please try again.'); hideLoader(); } ,complete:function(){ //showHideLoader(false); //alert(3); } }); //alert(4); return false; } function logout(exit_url) { if(empty(exit_url)) var exit_url = ""; resetPaymentForm(); //member_hash = ''; accountLists = null; goLogout(); //showLogin(); return false; } function goHome(){ window.location.href = SITE_SCHEMA+'://home'; } function goLogin(hash) { console.log("000-goLogin(): "+hash); //window.location.href = SITE_SCHEMA+'://login?' + hash; setSessionUserData('account_hash', hash, function(data){showHome(hash);}); } function goLogout(exit_url){ if(empty(exit_url)) var exit_url = ""; //window.location.href = SITE_SCHEMA+'://logout'; setSessionUserData('account_hash', '', function(data){showLogin('yes');}); } function showPhotoActionMenu(){ window.location.href = SITE_SCHEMA+'://showPhotoActionMenu'; } function backToHome(){ $('#frmSignIn').css('display', 'none'); $('#frmPayment').css('display', 'block'); changePage('#login'); return false; } function showHome(hash){ //alert(hash); console.log("010-showHome()",hash); member_hash = ''; selected_account_hash = null; accountLists = null; searchHistory = []; account_hash = hash; $('#logo').css('width', '100%'); $('#logo').css('padding-top', '20px'); //$('#logo').css('padding-bottom', '40px'); $('#logo').attr('src', 'PAYYAP_2048x452T.png'); //$('.sologan').css('position', 'relative'); //$('.sologan').css('top', '0px'); $('#frmSignIn').css('display', 'none'); $('#frmPayment').css('display', 'none'); console.log("1-showHome(): "+account_hash); showLoader("Loading Account..."); // stuck here //showStepPage('#account_form'); console.log("2-showHome(): "+account_hash); showAccountLists(); //galleryStats(); //showStepPage('#payment_result'); //paymentStatusAnimation(); } function showLogin(logout){ $('#logo').css('width', '50%'); //$('#logo').css('padding-top', '0px'); //$('#logo').css('padding-bottom', '0px'); $('#logo').attr('src', 'PAYYAP_1024x852.png'); //$('.sologan').css('position', 'relative'); //$('.sologan').css('top', '-40px'); //$('#inputEmail').val(email_address); $('#frmSignIn').css('display', 'block'); $('#frmPayment').css('display', 'none'); getMemberEmailAddress(); if($.mobile.activePage.attr("id") != 'login'){ if(!empty(logout)) changeBackPage('#login'); else changePage('#login'); } } var selectFileExtension = ''; var selectedPDFData = ''; function readFile(input){ var ext = input.files[0]['name'].substring(input.files[0]['name'].lastIndexOf('.') + 1).toLowerCase(); selectFileExtension = ext; if (input.files && input.files[0] && (ext == "gif" || ext == "png" || ext == "jpeg" || ext == "jpg" || ext == "pdf")) { var reader = new FileReader(); reader.onload = function (e) { //$('#img').attr('src', e.target.result); selectedPDFData = e.target.result; showSelectedImage(e.target.result, gImageNo); } reader.readAsDataURL(input.files[0]); }else{ alert('File is not supported'); } } var gImageNo = 0; var photoSelectAction = 'takePhoto'; function takePhoto(imageNo){ selectFileExtension = ''; selectedPDFData = ''; gImageNo = imageNo; photoSelectAction = 'takePhoto'; // window.location.href = SITE_SCHEMA+'://takePhoto?imageNo=' + imageNo; //setTimeout(function(){changePage('#captureImage');}, 1000); //openUploadProgressPopup(); changePage('#captureImage'); return false; } function selectPhoto(imageNo){ console.log('selectPhoto',1); selectFileExtension = ''; selectedPDFData = ''; gImageNo = imageNo; photoSelectAction = 'selectPhoto'; //window.location.href = SITE_SCHEMA+'://selectPhoto?imageNo=' + imageNo; $('#selectPhotoInput').remove(); console.log('selectPhoto',2); $('body').append(''); //$('body').append('readFile(this);'); //readFile(this); console.log('selectPhoto',3); $('#selectPhotoInput').click(); console.log('selectPhoto',4); $('#selectPhotoInput').on('change', function(e) { console.log('selectPhoto',5); console.log('selectPhoto',e); readFile(this); console.log('selectPhoto',6); }); console.log('selectPhoto',7); return false; } function formatImageNo(imageNo){ var tempimageNo = imageNo; if(tempimageNo>3) tempimageNo -= 1; return tempimageNo; } function showSelectedImage(data, imageNo){ console.log('showSelectedImage(data)', data); console.log('showSelectedImage(imageNo)', imageNo); console.log('showSelectedImage(selectFileExtension)', selectFileExtension); console.log('showSelectedImage(form_flow)', form_flow); var html = '
'; //html += '
DOCUMENT #'+formatImageNo(imageNo)+'
'; html += '
'; html += ''; if(selectFileExtension == 'pdf'){ html += '
'; //html += ''; html += ''; //html += ''; html += ''; html += '
'; } else{ if(form_flow == 'single_page'){ html += '
'; } else{ html += '
'; html += ''; html += '
'; } } html += '
'; html += '
'; //$('#selectedImage img').attr('src', data + "?" + generateRandomNumber() ); //$('#selectedImage img').css('display', 'inline-block'); //$('#selectedImage').prepend(html); $('.proof' + imageNo + ' .selectedImage .selectedImageInfo').hide(); //selfie //if(imageNo == 11) { // //$('.proof' + imageNo + ' .selectedImage').html(html); // $('.proof' + imageNo + ' .selectedImage .photo-container').remove(); // $('.proof' + imageNo + ' .selectedImage').append(html); //} //else $('.proof' + imageNo + ' .selectedImage').append(html); if(selectFileExtension == 'pdf'){ //document.getElementById('capturePhoto' + imageNo ).data = data; photoLoaded(imageNo); } else{ //document.getElementById('capturePhoto' + imageNo ).src = data; } var n = $( ".photo-container" ).length; //$('#selectedImage').css('width', (n * 320) + 'px' ); //$('.photo-container').css('max-width', viewport.width); //$('.photo-container .photo img').css('max-height', '100px'); /* var r = confirm("Want to keep the image?"); if (r == true) { } else { window.location.href = SITE_SCHEMA+'://removePhoto'; } */ //window.location.href = SITE_SCHEMA+'://openConfirmModal'; //open_social_blast_options_form(); } function photoLoaded(imageNo) { if( photoSelectAction == 'selectPhoto'){ //window.location.href = SITE_SCHEMA+'://openConfirmModal'; //alert("startUploading "+1); startUploading(imageNo); } else{ //openSlideBottomMenu(); } } // AGENT LOGIN/REGISTRATION START// function closeAgentLoginForm(){ $( "#popupLogin" ).popup( "close" ); //$( "#popupLogin" ).popup( "close" ); return false; } function closeAgentRegistrationForm(){ $( "#popupRegistration" ).popup( "close" ); //$( "#popupRegistration" ).popup( "close" ); return false; } function openAgentLoginForm(){ $( "#popupRegistration" ).popup( "close" ); //$( "#popupRegistration" ).popup( "close" ); setTimeout(function() { $('#popupLogin').popup('open', {"transition": "pop"}); }, 500); } function openAgentRegintrationForm(){ $( "#popupLogin" ).popup( "close" ); //$( "#popupLogin" ).popup( "close" ); setTimeout(function() { $('#popupRegistration').popup('open', {"transition": "pop"}); }, 500); } $(document).bind('pageinit', function() { $("#popupLogin").on("popupafteropen", function () { $('#agent_login_emailaddress').focus(); }); $("#popupRegistration").on("popupafteropen", function () { $('#agent_register_name_first').focus(); }); }); function doAgentRegister(){ showLoader("Working..."); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/agent_register_login.gate'; //WHITELABEL_account_hash var agent_register_name_first = $('#agent_register_name_first').val(); var agent_register_name_last = $('#agent_register_name_last').val(); var agent_register_emailaddress = $('#agent_register_emailaddress').val(); var agent_register_password_1 = $('#agent_register_password_1').val(); var agent_register_password_2 = $('#agent_register_password_2').val(); $.ajax({ type: "POST" ,url:url ,data: { WHITELABEL_account_hash: whitelabel_business_account_hash, agent_register_name_first:agent_register_name_first, agent_register_name_last:agent_register_name_last, agent_register_emailaddress:agent_register_emailaddress, agent_register_password_1:agent_register_password_1, agent_register_password_2: agent_register_password_2 } ,dataType: 'json' ,success:function(data){ console.log('doAgentRegister>', data); setAgentAccountHash(data); $('#agent_register_name_first').focus(); } ,error:function(){ } ,complete:function(){ hideLoader(); } }); return false; } function doAgentLogin(){ showLoader("Working..."); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/agent_register_login.gate'; //WHITELABEL_account_hash var agent_login_emailaddress = $('#agent_login_emailaddress').val(); var agent_login_password = $('#agent_login_password').val(); $.ajax({ type: "POST" ,url:url ,data: { WHITELABEL_account_hash: whitelabel_business_account_hash, agent_login_emailaddress:agent_login_emailaddress, agent_login_password:agent_login_password } ,dataType: 'json' ,success:function(data){ console.log('doAgentLogin>', data); setAgentAccountHash(data); $('#agent_login_emailaddress').focus(); } ,error:function(){ } ,complete:function(){ hideLoader(); } }); return false; } function setAgentAccountHash(data){ if(empty(data.agent_account_hash)){ showAgenAPIErrorMessage('ERROR', 'Failed, Please try again!', data); } else{ showAgenAPIErrorMessage('SUCCESS', 'Your request have successfully been completed!', data) agent_account_hash = data.agent_account_hash; $('#agentLogin').hide(); $('#agentLogout').show(); setTimeout(function(){ closeAgentLoginForm(); closeAgentRegistrationForm(); setAgentSession(data); },100); } } function showAgenAPIErrorMessage(title, msg, data){ var system_message_title = title; var system_message = msg; if(!empty(data.system_message_title)) system_message_title = data.system_message_title; if(!empty(data.system_message)) system_message = data.system_message; show_device_alert(system_message_title, system_message); } function setAgentSession(data){ var agent_account_hash = ''; var agent_name_first = ''; var agent_name_last = ''; if(!empty(data)) { if(!empty(data.agent_account_hash)) agent_account_hash = data.agent_account_hash; if(!empty(data.agent_name_first)) agent_name_first = data.agent_name_first; if(!empty(data.agent_name_last)) agent_name_last = data.agent_name_last; } $('#agent_name_first').html(agent_name_first); $('#agent_name_last').html(agent_name_last); setTimeout(function(){ //window.location.href = SITE_SCHEMA + '://setAgentSession?agent_account_hash=' + agent_account_hash + '&agent_name_first=' + agent_name_first + '&agent_name_last=' + agent_name_last; }, 500); } function agentLogout(){ agent_account_hash = ''; agent_name_first = ''; agent_name_last = ''; $('#agentLogin').show(); $('#agentLogout').hide(); setAgentSession(); return false; } // AGENT LOGIN/REGISTRATION END// function openSlideBottomMenu(){ /* $( "#popupBottomMenu" ).popup(); $( "#popupBottomMenu" ).popup("option", "transition", "slidedown"); $( "#popupBottomMenu" ).popup( "open" ); */ $('#preview_snap').attr('src', capturedImageData); changePage('#popupBottomMenu'); } function photoSelectionPostAction(action){ $( "#popupBottomMenu" ).dialog( "close" ); //setTimeout(function(){ //window.location.href = SITE_SCHEMA+'://photoSelectionPostAction/' + action; //}, 1000); if(action == 'store_photo') { showSelectedImage(capturedImageData, gImageNo); setTimeout(function(){ //alert("startUploading "+2); startUploading(gImageNo); }, 500); } else if(action == 'delete') { //deleteSelectedImage(gImageNo); capturedImageData = ''; } return false; } var uploadProgressValue = 0; function setProgress(value, imageNo){ value = parseInt(value); if(value > uploadProgressValue){ uploadProgressValue = value; setUploadProgress(value); } } function deleteSelectedImage(imageNo){ $('.photo' + imageNo ).remove(); } function scrollToElement(id) { try{ var myDivPos = $(id).offset().top - 50; $.mobile.silentScroll( myDivPos ); } catch(err){ //console.log('scrollToElement > ERRPR', err.line + " " + err.message ); console.log('scrollToElement > ERRPR', err.stack); } } function startUploading(imageNo){ //alert("imageNo: "+imageNo); //reset upload progress uploadProgressValue = 0; //$('.photo' + imageNo).find('.upload-no').html('Uploading... '); //$('.photo' + imageNo +' .progress').css('display' , 'block'); setTimeout(function(){ openUploadProgressPopup(); setTimeout(function(){ uploadPhoto(); }, 1000); }, 1000); } var pbar = null; function openUploadProgressPopup(){ console.log('openUploadProgressPopup', 'called'); //alert('openUploadProgressPopup'); $( "#progressDialog" ).popup(); $( "#progressDialog" ).popup( "open" ); if(empty(pbar)){ pbar = jQMProgressBar('progressbar') .setOuterTheme('a') .setInnerTheme('b') .isMini(true) .setMax(100) .setStartFrom(0) .showCounter(true) .build(); } setUploadProgress(0); } function setUploadProgress(value){ if(!empty(pbar)) pbar.setValue(value); //$('.progress .progress-bar').css('width', value + '%'); //$('.progress .progress-bar-value').html(value + '%'); } function closeUploadProgressPopup(){ setTimeout(function(){ $( "#progressDialog" ).popup( "close" ); }, 1000); } function base64ToBlob(base64, mime) { mime = mime || ''; var sliceSize = 1024; var byteChars = window.atob(base64); var byteArrays = []; for (var offset = 0, len = byteChars.length; offset < len; offset += sliceSize) { var slice = byteChars.slice(offset, offset + sliceSize); var byteNumbers = new Array(slice.length); for (var i = 0; i < slice.length; i++) { byteNumbers[i] = slice.charCodeAt(i); } var byteArray = new Uint8Array(byteNumbers); byteArrays.push(byteArray); } return new Blob(byteArrays, {type: mime}); } function uploadPhoto(){ var url = SITE_SCHEMA+'://uploadPhoto'; if(!empty(document.frmPayment) && !empty(document.frmPayment['enable_high_security_chargeback_protection'])){ var enable_high_security_chargeback_protection = document.frmPayment['enable_high_security_chargeback_protection'].checked; if(enable_high_security_chargeback_protection){ url += '?transaction_session_hash=' + transaction_session_hash; } } //window.location.href = url; var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/QUALIFY_Wizard.gate'; // alert("QUALIFY_Wizard "+4); //alert("2+url: "+url); var image = $('.photo' + gImageNo+' img:last').attr('src') ; //$('#image-id').attr('src'); var type = 'image/jpeg'; if(selectFileExtension == 'pdf') { type = 'application/pdf'; //image = $('.capturePhoto' + gImageNo+' embed:last').attr('src') ; image = selectedPDFData; } if(gImageNo == 100){ image = $('#sign').attr('src') ; } var base64ImageContent = image.replace(/^data:(image|application)\/(png|jpg|pdf);base64,/, ""); //var blob = base64ToBlob(base64ImageContent, 'image/png'); console.log($('.photo' + gImageNo+' img:last')); //console.log(image); var binary = atob(image.split(',')[1]); var array = []; for (var i = 0; i < binary.length; i++) { array.push(binary.charCodeAt(i)); } var file = new Blob([new Uint8Array(array)], {type: type}); var formData = new FormData(); formData.append('file', file); formData.append("hash", selected_account_hash); formData.append("member_hash", member_hash); formData.append("device", "desktop"); formData.append("imageNo", gImageNo); formData.append("action", "upload"); formData.append("extension", selectFileExtension); //uploader_name var uploadFor = ""; if (gImageNo == 1) uploadFor = "account_identity_manager_photo_id_filename"; else if (gImageNo == 2) uploadFor = "proof_of_business_1_filename"; else if (gImageNo == 3) uploadFor = "proof_of_business_2_filename"; else if (gImageNo == 4) uploadFor = "proof_of_business_processing_filename"; else if (gImageNo == 111) uploadFor = "account_identity_manager_proof_of_residence_filename"; else if (gImageNo == 311) uploadFor = "proof_of_business_tax_returns_filename"; else if (gImageNo == 11) uploadFor = "selfie"; else if (gImageNo == 61) uploadFor = "proof_of_business_3_filename"; else if (gImageNo == 62) uploadFor = "proof_of_business_4_filename"; else if (gImageNo == 63) uploadFor = "proof_of_business_5_filename"; else if (gImageNo == 64) uploadFor = "proof_of_business_6_filename"; else if (gImageNo == 65) uploadFor = "proof_of_business_7_filename"; else if (gImageNo == 100) uploadFor = "signature"; else{ //additional document uploadFor = 'filename_is_not_set'; var additional_document_filename = $('.proof' + gImageNo).data('additional_document_filename'); console.log('additional_document_filename', additional_document_filename); if(!empty(additional_document_filename)) uploadFor = additional_document_filename; } formData.append("uploader_name", uploadFor); var business_description = $('#business_description').val(); formData.append("business_description", business_description); $.ajax({ url: url, type: "POST", cache: false, contentType: false, processData: false, data: formData, xhr: function(){ //upload Progress var xhr = $.ajaxSettings.xhr(); if (xhr.upload) { xhr.upload.addEventListener('progress', function(event) { var percent = 0; var position = event.loaded || event.position; var total = event.total; if (event.lengthComputable) { percent = Math.ceil(position / total * 100); } console.log('percent = ', percent); setProgress(percent, gImageNo); //update progressbar //$(progress_bar_id +" .progress-bar").css("width", + percent +"%"); //$(progress_bar_id + " .status").text(percent +"%"); }, true); } return xhr; }, mimeType:"multipart/form-data" }) .done(function(data){ //alert('done!'); uploadFinished(data) }); } function uploadFinished(data){ closeUploadProgressPopup(); try { data = $.parseJSON(data); //console.log(data); if(!empty(data.msg)){ $('.photo' + data.imageNo ).last().find('.progress').css('display' , 'none'); $('.photo' + data.imageNo ).last().find('.upload-no').html('' + data.msg + ''); $('.photo' + data.imageNo ).last().attr('upload-status', 'failed'); show_device_alert('ERROR', data.msg); clearSelectedPhoto(data.imageNo); var imageUploaderName = 'personal_document_type'; if(data.imageNo==1) imageUploaderName = 'personal_document_type'; else if(data.imageNo==2) imageUploaderName = 'business_document_type'; else if(data.imageNo==3) imageUploaderName = 'pricing_document_type'; else if(data.imageNo==4) imageUploaderName = 'processing_document_type'; else if(data.imageNo==111) imageUploaderName = 'residence_document_type'; else if(data.imageNo==311) imageUploaderName = 'tax_returns_document_type'; else if(data.imageNo>=91 && data.imageNo<=96){ $('#btnChargebackPretection' + data.imageNo).attr('disabled', 'disabled'); } //showErrorImg($('.photo' + data.imageNo ).parent().parent().prev().find('#' + imageUploaderName)); //$('.photo' + data.imageNo ).parent().parent().prev().find('.help-block').html('Please upload document'); $('.photo' + data.imageNo ).last().parent().parent().prev().find('.help-block').html(''); } else { $('.photo' + data.imageNo ).last().find('.progress').css('display' , 'none'); $('.photo' + data.imageNo ).last().find('.upload-no').html('Uploaded.'); $('.photo' + data.imageNo ).last().attr('upload-status', 'uploaded'); var imageUploaderName = 'personal_document_type'; if(data.imageNo==1) imageUploaderName = 'personal_document_type'; else if(data.imageNo==2) imageUploaderName = 'business_document_type'; else if(data.imageNo==3) imageUploaderName = 'pricing_document_type'; else if(data.imageNo==4) imageUploaderName = 'processing_document_type'; else if(data.imageNo==111) imageUploaderName = 'residence_document_type'; else if(data.imageNo==311) imageUploaderName = 'tax_returns_document_type'; else if(data.imageNo>=91 && data.imageNo<=96){ $('#btnChargebackPretection' + data.imageNo).removeAttr('disabled'); } showValidImg($('.photo' + data.imageNo ).last().parent().parent().prev().find('#' + imageUploaderName)); $('.photo' + data.imageNo ).last().parent().parent().prev().find('.help-block').html(''); //if(data.imageNo==1) $('#btnActivateUSDirectAccount').removeAttr('disabled'); //else if(data.imageNo==2) $('#btnActivateUSDirectFinalAccount').removeAttr('disabled'); /// START: removed by shea // FEB 14, 2021 var hash_data_hash = false; has_data_hash = document.querySelectorAll(`[data-remove-imageid='${data.imageNo}']`); //alert("has_data_hash: "+has_data_hash); //var remove_photo_exists = $('.photo' + data.imageNo + ' .photo').data('data-remove-imageid')); // alert("remove_photo_exists: "+remove_photo_exists); // alert("data.imageNo"+data.imageNo); var remove_photo_exists = $('.photo' + data.imageNo + ' .photo').hasClass("remove-photo"); //alert("remove_photo_exists: "+remove_photo_exists); //alert($("p").hasClass("intro")); //find(`[data-slide='${remove-photo}']`) //alert("data.hash: "+data.hash); if( (!empty(data.hash)) /* && (hash_data_hash != true) */ /* && ( window.REMOVE_BUTTON == false) */ ){ //window.REMOVE_BUTTON = true; //1 var remove_button_text = 'Remove'; $('.photo' + data.imageNo + ' .photo').last().append('

  '+remove_button_text+'

'); //$('.photo' + data.imageNo + ' .photo img').last().attr('data-hash', data.hash); //$('.photo' + data.imageNo + ' .photo img').last().attr('data-document-type', data.document_type); } /// END: remmoved by shea // FEB 14, 2021 } } catch(err) { //console.log('uploadFinished > ERRPR', err.line + " " + err.message ); //console.log('uploadFinished > ERRPR', err.stack); $('.photo' + gImageNo ).last().find('.progress').css('display' , 'none'); $('.photo' + gImageNo ).last().find('.upload-no').html('Failed'); $('.photo' + gImageNo ).last().attr('upload-status', 'failed'); show_device_alert('ERROR', "Upload Failed! Please try again."); clearSelectedPhoto(gImageNo); } scrollToElement('.photo' + gImageNo+' img:last'); updateUploadButtonText(gImageNo); } function updateUploadButtonText(imageNo) { if(imageNo == 100){ if(!empty($('#sign').attr('src'))){ $('#btnSignUpload').html("Edit Your Signature"); $('#btnSignUpload').removeClass('btn-sign-purple'); $('#btnSignUpload').addClass('btn-sign-grey'); $('#sign').parent().removeClass('required'); $('#sign').parent().removeClass('optional'); $('#sign').parent().removeClass('do_not_display'); $('#sign').parent().addClass('completed'); var onscreen_signature_button_url = getOnboardingPreference('onscreen_signature_button_url'); console.log('onscreen_signature_button_url', onscreen_signature_button_url); if(!empty(onscreen_signature_button_url)){ $('#btnSignUpload').html(''); } } } if($('.photo' + imageNo ).length>=1){ $('.proof' + imageNo + ' .btn-document-upload').html('  Upload Another File'); $('.proof' + imageNo + ' .btn-document-capture').html('  Take Another Photo'); } else{ $('.proof' + imageNo + ' .btn-document-upload').html('  Upload A File'); $('.proof' + imageNo + ' .btn-document-capture').html('  Take A Photo'); } } function clearSelectedPhoto(imageNo, noAlert){ //imageNo = gImageNo; if(!noAlert){ //show_device_alert('ERROR', 'Upload Failed! Please try again.'); var rpp = $('.proof' + imageNo + ' .selectedImage .photo-container img:last'); if(selectFileExtension == 'pdf'){ rpp = $('.proof' + imageNo + ' .selectedImage .photo-container embed:last'); } console.log('rpp', rpp); //scrollToElement($(rpp).closest('.form-group')); if($('#' + $(rpp).parent().parent().parent().attr('id') + ' .photo-container' ).length < 2 ){ $(rpp).closest('.form-group').find('.selectedImageInfo').css('display', 'block') } $(rpp).parent().parent().remove(); } else{ //$('.proof' + imageNo + ' .selectedImage').html('
With your device camera, you may now please take a photo of your Proof of Additional Business Identity — Simply click on the button (below): "Take a Photo"! — or if you have a file/scan/or photo (of your Additional Business ID) already "in" your device gallery/storage, then: "Upload a File"!
'); $('.proof' + imageNo + ' .selectedImage .photo-container').remove(); //photo-container photo1 $('.proof' + imageNo + ' .selectedImage .selectedImageInfo').show(); } } function backToVerificationForm(){ showStepPage('#identity_verification_form'); return false; } function goToTopOfPage(){ $('html, body').animate({ scrollTop: $(".form-signin-heading").offset().top }, 1000); } function showStepPage(id){ console.log("510-showStepPage(id)",id); $('.logout').parent().css('display', 'none'); $('.step-page').css('display', 'none'); $(id).css('display', 'block'); searchHistory.push(id); if(id == '#payment_receipt' || id == '#identity_verification_form_result' || id =='#email_invoice_form_receipt'){ searchHistory = []; //clear searHistory } fillDemoForm(); if(demoAccountHash==account_hash && id=='#payment_form'){ // } else if(id == '#account_form'){ $('.logout').parent().css('display', 'block'); showAccountLists(); } else if( id=='#selected_account_form' || id=='#email_invoice_form' || id=='#email_invoice_form_receipt' || id=='#identity_verification_region' || id=='#verification_form_advanced' ){ console.log("511-showStepPage(id)",id); $('.logout').parent().css('display', 'none'); } else if(id=='#identity_verification_form'){ $('.logout').parent().css('display', 'none'); $('html, body').animate({ scrollTop: $(".form-signin-heading").offset().top }, 1000); } else if(id=='#identity_verification_photo_form'){ $('.logout').parent().css('display', 'none'); $('html, body').animate({ scrollTop: $(".form-signin-heading").offset().top }, 1000); } else if(id=='#identity_verification_form_result'){ $('.logout').parent().css('display', 'none'); } else{ //$('.logout').parent().css('display', 'block'); } //fill form data if(id=='#identity_verification_region'){ console.log("512-showStepPage(id)",id); var tmp_verification_region = $('#verification_region').val(verification_region); console.log("513-tmp_verification_region",tmp_verification_region); if(empty($('#verification_region').val())){ verification_region = $("#verification_region").find("option").eq(0).val(); $("#verification_region").val(verification_region); } // if(email_address == 'demo@corp.nsdb.com' || email_address == 'demo@payyap.network' || email_address == 'shahid@corp.nsdb.com'){ // // // } // else{ // //REMOVE UNITED_STATES_DIRECT OPTION FOR NOT DEMO ACCOUNTS // if($("#verification_region").find("option").eq(0).val() == 'united_states_direct'){ // $("#verification_region").find("option").eq(0).remove(); // $("#verification_region").val($("#verification_region").find("option").eq(0).val()); // verification_region = $("#verification_region").find("option").eq(0).val(); // } // } } goToTopOfPage(); return false; } function selectAccount(account_hash, account_name){ $('.form-group').removeClass('has-error has-success has-feedback'); $('.form-group .glyphicon').remove(); selected_account_hash = account_hash; resetPaymentForm(); var selected_account_details = getSelectAccountDetails(); //console.log(selected_account_details); if(selected_account_details!=null){ $('.lblAccountName').html(selected_account_details.account_name); $('.account_name').html(selected_account_details.account_name); $('.account_balance').html(selected_account_details.account_balance); if(empty(selected_account_details.service_message)){ $('.service-message-row').css('display', 'none'); } else{ $('.service_message').html(selected_account_details.service_message); $('.service-message-row').css('display', 'block'); } //showTransactionHistory(); //showStepPage('#selected_account_form'); show_device_alert('SUCCESS', "\n\nAlert!\n\nYour account is already Approved!\n\n(Please contact Customer Support if you would like to edit / update your profile.)"); } else{ show_device_alert('ERROR', "An error occured, please try again!"); } } function showSubmittedAlert(isApproved){ console.log("showSubmittedAlert(isApproved)",isApproved); var message = "(1) You have already submitted your profile. A final activation notice will be sent to your registered email address once your payment processing account has been approved. Now sit back, relax... and allow up to 72 hours for your account to be acivated!"; var selected_account_details = accountMenus; //console.log(selected_account_details); if( !empty(selected_account_details) ){ if(isApproved){ message = ''; if(!empty(selected_account_details.your_profile_is_approved_alert_text) ){ message = selected_account_details.your_profile_is_approved_alert_text; } } else{ if(!empty(selected_account_details.your_have_already_submitted_your_profile_alert_text) ){ message = selected_account_details.your_have_already_submitted_your_profile_alert_text; } } } if(!empty(message)){ //show_device_alert('ERROR', message); show_device_confirm('ERROR', message, true); } return false; } function showApprovedAlert(account_hash) { console.log("showApprovedAlert(isApproved)",account_hash); var isApproved = true; var message = "(2) You have already submitted your profile. A final activation notice will be sent to your registered email address once your payment processing account has been approved. Now sit back, relax... and allow up to 72 hours for your account to be acivated!"; var selected_account_details = accountMenus; //console.log(selected_account_details); if( !empty(selected_account_details) ){ if(isApproved){ message = ''; if(!empty(selected_account_details.your_profile_is_approved_alert_text) ){ message = selected_account_details.your_profile_is_approved_alert_text; } } else{ if(!empty(selected_account_details.your_have_already_submitted_your_profile_alert_text) ){ message = selected_account_details.your_have_already_submitted_your_profile_alert_text; } } } if(!empty(message)){ //show_device_alert('ERROR', message); //show_device_confirm('ERROR', message, true); console.log("showApprovedAlert(message)",message); var confirm_value = confirm(message); if(confirm_value == true) { console.log("showApprovedAlert(account_hash)",account_hash); verifyAccount(account_hash); return true; } else { return false; } } return false; } var transaction_session_hash = ''; function openPaymentForm(){ transaction_session_hash = rand(); showStepPage('#payment_form'); $('#payment_form #amount').focus(); return false; } function showEmailInvoiceForm(){ show_device_alert('ALERT', "Coming Soon..."); //showStepPage('#email_invoice_form'); return false; } function getSelectAccountDetails(){ var selected_account_details = null; console.log("700-getSelectAccountDetails",selected_account_details); console.log("701-accountLists",accountLists); if(accountLists!=null){ $.each(accountLists, function(index, item){ console.log("702-item.account_hash", index, item.account_hash); if(item.account_hash == selected_account_hash){ //console.log(selected_account_hash, item); selected_account_details = item; } }); } console.log("703-selected_account_details", selected_account_details); return selected_account_details; } function getSelectAccountDetails_v2(accountLists){ console.log("222-accountLists: "+accountLists); var selected_account_details = null; //if(!accountLists) accountLists = window.accountLists; if(accountLists != null){ $.each(accountLists, function(index, item){ if(item.account_hash == selected_account_hash){ //console.log(selected_account_hash, item); selected_account_details = item; } }); } return selected_account_details; } var verifyFormCountryLoaded = false; function verifyAccount(account_hash){ console.log('041-verifyAccount()',account_hash); $('.form-group').removeClass('has-error has-success has-feedback'); $('.form-group .glyphicon').remove(); //window.location.href = SITE_SCHEMA+'://confirmAccountVerification'; showVerificationForm(account_hash); return false; } function showVerificationForm(account_hash){ console.log("042-showVerificationForm()",account_hash); selected_account_hash = account_hash; //show_device_alert('ERROR', 'ALERT: This account needs to be validated before is it able to receives money. Please use your email address, to log into your BANGK! Account @ //login.payyap.network, and follow the logical instructions to Verify this account. Account validation takes about 5 minutes from your desktop, laptop or tablet.'); if(!verifyFormCountryLoaded){ //fillCountryList('official_country_of_citizenship'); //fillCountryList('residential_country');fillStateList('residential_country', 'residential_state'); //fillCountryList('business_country');fillStateList('business_country', 'business_state'); //fillCountryList('banking_country');fillStateList('banking_country', 'banking_state'); verifyFormCountryLoaded = true; } var selected_account_details = getSelectAccountDetails(); console.log("042-showVerificationForm(selected_account_details)",selected_account_details); if(!empty(selected_account_details.activate_business_document_3) && selected_account_details.activate_business_document_3 == "YES"){ // $('#additional_business_document_type').html(''); // $.each(selected_account_details.activate_business_document_3_pulldown_option, function(i, val){ // $('#additional_business_document_type').append(''); // }); //fillSelectOptions('#additional_business_document_type', selected_account_details.activate_business_document_3_pulldown_option); //showStepPage('#TSYS_US_Direct_form_proof_of_additional_identity'); console.log("503-buildDocument3Uploader(1)"); buildDocument3Uploader(1); } else if(startPage == 3){ console.log("504-startPage",startPage); showStepPage('#TSYS_US_Direct_form_final'); $('#tsys_us_direct_business_name').focus(); } else{ //var selected_account_details = getSelectAccountDetails(); console.log("505-showVerificationForm"); fillSelectOptions('#business_category', selected_account_details.KYC_business_category_pulldown_options); fillSelectOptions('#business_description', selected_account_details.KYC_business_description_pulldown_options); fillSelectOptions('#personal_document_type', selected_account_details.KYC_option_text_proof_of_person); fillSelectOptions('#business_document_type', selected_account_details.KYC_option_text_proof_of_business); fillSelectOptions('#pricing_document_type', selected_account_details.KYC_option_text_proof_of_pricing); fillSelectOptions('#processing_document_type', selected_account_details.KYC_option_text_proof_of_processing); fillSelectOptions('#residence_document_type', selected_account_details.KYC_option_text_proof_of_personal_residence); fillSelectOptions('#tax_returns_document_type', selected_account_details.KYC_option_text_proof_of_business_tax_returns); //fillSelectOptions('#business_registered_region', selected_account_details.business_registered_region_options); //fillSelectOptions('#business_registered_country_iso3', selected_account_details.business_registered_country_iso3_options); updateTitleAndDescriptiveParagraph('#business_category', selected_account_details.KYC_business_category_pulldown_title, ''); updateTitleAndDescriptiveParagraph('#business_description', selected_account_details.KYC_business_description_pulldown_title, ''); updateTitleAndDescriptiveParagraph('#personal_document_type', selected_account_details.KYC_option_text_proof_of_person_title, selected_account_details.KYC_option_text_proof_of_person_descriptive_paragraph); updateTitleAndDescriptiveParagraph('#business_document_type', selected_account_details.KYC_option_text_proof_of_business_title, selected_account_details.KYC_option_text_proof_of_business_descriptive_paragraph); updateTitleAndDescriptiveParagraph('#pricing_document_type', selected_account_details.KYC_option_text_proof_of_pricing_title, selected_account_details.KYC_option_text_proof_of_pricing_descriptive_paragraph); updateTitleAndDescriptiveParagraph('#processing_document_type', selected_account_details.KYC_option_text_proof_of_processing_title, selected_account_details.KYC_option_text_proof_of_processing_descriptive_paragraph); updateTitleAndDescriptiveParagraph('#residence_document_type', selected_account_details.KYC_option_text_proof_of_personal_residence_title, selected_account_details.KYC_option_text_proof_of_personal_residence_descriptive_paragraph); updateTitleAndDescriptiveParagraph('#tax_returns_document_type', selected_account_details.KYC_option_text_proof_of_business_tax_returns_title, selected_account_details.KYC_option_text_proof_of_business_tax_returns_descriptive_paragraph); updateTitleAndDescriptiveParagraph('#slefie_document_type', selected_account_details.KYC_option_text_selfie_title, selected_account_details.KYC_option_text_selfie_descriptive_paragraph); showStepPage('#identity_verification_region'); //set form if(!empty(selected_account_details.KYC_option_request_business_url_required) && selected_account_details.KYC_option_request_business_url_required == 'TRUE'){ console.log("506-showVerificationForm"); $('#tsys_us_direct_business_website').addClass('required'); $('#tsys_us_direct_business_website').prev().find('.field-optional').addClass('hide-filed'); } else{ console.log("507-showVerificationForm"); $('#tsys_us_direct_business_website').removeClass('required'); $('#tsys_us_direct_business_website').prev().find('.field-optional').removeClass('hide-filed'); } //changePageWithHeaderFooter('#configureAccount'); //checkAndShowNextForm(1); } console.log("508-showVerificationForm"); KYC_getSESSION(); } function closeSignatureForm(){ setTimeout(function(){ $( "#signatureDialog" ).popup( "close" ); }, 1000); } function openSignatureForm(el){ gImageNo = 100; $( "#signatureDialog" ).popup(); $( "#signatureDialog" ).popup( "open" ); return false; } function showSignatureImage(data){ closeSignatureForm(); console.log('showSignatureImage > ', data); //var imageURL = siteProtocol + '//' + API_DOMAIN + '/authorizations/ids/' + account_hash + '_signature.png'; $('#sign').removeClass('do_not_display'); $('#sign').attr('src', data); if(form_flow == 'single_page'){ // } else{ setTimeout(function(){ uploadPhoto(); setTimeout(function(){ openUploadProgressPopup(); }, 500); }, 500); } return false; } function confirmTakePhoto1(n){ confirmTakePhoto(n + $('.additional_business_document_number').val()); return false; } function confirmSelectPhoto1(n){ confirmSelectPhoto(n + $('.additional_business_document_number').val()); return false; } function buildDocument3Uploader(n){ var selected_account_details = getSelectAccountDetails(); //selected_account_details.activate_business_document_3; //RESET UPLOADER $('#additional_business_document_type').parent().removeClass('has-success has-feedback has-error').find('.glyphicon').remove(); $('.proof6' + n + ' .selectedImage').html('
With your device camera, you may now please take a photo of your Proof of Additional Business Identity — Simply click on the button (below): Take A Photo! Or if you have a file, scan, or photo (of your Additional Business ID) already in your device gallery / storage, then: Upload A File!
'); $('.proof6' + n).addClass('hide-row'); $('#btnSkipProofOfAdditonalBusinessIdentity, #btnCompleteProofOfAdditonalBusinessIdentity').parent().removeClass('hide-row'); //RESET UPLOADER var titlePrefix = 'OPTIONAL: '; $('#additional_business_document_type').removeClass('required'); $('#btnSkipProofOfAdditonalBusinessIdentity').removeClass('hide-filed'); $('.additional_business_document_number').val(n); //, #btnCompleteProofOfAdditonalBusinessIdentity' if( (n==1 && selected_account_details.additional_business_document_3_required) || (n==2 && selected_account_details.additional_business_document_4_required) || (n==3 && selected_account_details.additional_business_document_5_required) || (n==4 && selected_account_details.additional_business_document_6_required) || (n==5 && selected_account_details.additional_business_document_7_required) ){ $('#btnSkipProofOfAdditonalBusinessIdentity').parent().addClass('hide-row'); titlePrefix = 'REQUIRED: '; $('#additional_business_document_type').addClass('required'); $('#btnSkipProofOfAdditonalBusinessIdentity').addClass('hide-filed'); } if(n == 1){ var options = selected_account_details.activate_business_document_3_pulldown_option; } else if(n == 2){ var options = selected_account_details.activate_business_document_4_pulldown_option; } else if(n == 3){ var options = selected_account_details.activate_business_document_5_pulldown_option; } else if(n == 4){ var options = selected_account_details.activate_business_document_6_pulldown_option; } else if(n == 5){ var options = selected_account_details.activate_business_document_7_pulldown_option; } fillSelectOptions('#additional_business_document_type', options); $('#additional_business_document_type').attr('name', 'business_document_' + (2+n) + '_type' ); $('.proof6 .photo6').attr('upload-status', 'ready'); $('#configureAccountAdditionalIdentity .page-title').html(titlePrefix + 'Additional Proof of Business #' + n); if(!empty(kyc_session)){ //console.log('kyc_session', 'business_document_' + (2+n) + '_type', kyc_session['business_document_' + (2+n) + '_type']); if ( $("#additional_business_document_type option[value='" + escape(kyc_session['business_document_' + (2+n) + '_type']) + "']").length > 0 ){ $('#additional_business_document_type').val(escape(kyc_session['business_document_' + (2+n) + '_type'])); jqeuryMobileSetSelectOption('additional_business_document_type', escape(kyc_session['business_document_' + (2+n) + '_type'])); $('.proof6').removeClass('hide-row'); } else if ( $("#additional_business_document_type option[value='" + (kyc_session['business_document_' + (2+n) + '_type']) + "']").length > 0 ){ $('#additional_business_document_type').val((kyc_session['business_document_' + (2+n) + '_type'])); $('.proof6').removeClass('hide-row'); } else{ $('#additional_business_document_type').val(''); $('.proof6').addClass('hide-row'); jqeuryMobileSetSelectOption('additional_business_document_type', ''); } if(!empty(kyc_session['business_document_' + (2+n) + '_url'])){ var html = '
'; html += '
'; html += '
'; html += '
'; html += '
'; //$('#selectedImage' + imageNo).html(html); $('.proof6' + n + ' .selectedImage').html(html); setTimeout(function(){ //$('#selectedImage' + imageNo + ' .photo img').attr('src', value); $('.proof6' + n + ' .selectedImage .photo img').attr('src', kyc_session['business_document_' + (2+n) + '_url'] + '?' + generateRandomNumber()); }, 100); } } showStepPage('#TSYS_US_Direct_form_proof_of_additional_identity'); changePageWithHeaderFooter('#configureAccountAdditionalIdentity'); } function fillSelectOptions(id, options){ if(!empty(options)){ $(id).html(''); $.each(options, function(i, val){ if(!empty(val)){ $(id).append(''); } }); } } function updateTitleAndDescriptiveParagraph(id, title, description){ if(!empty(title)) $(id).prev('label').html(title); if(!empty(description)) $(id).parent().next().find('.selectedImageInfo').html(description); } function getAccountEmailAddress(){ console.log("getAccountEmailAddress(): TRUE"); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/NSDB_account_menu.gate?gate_key=NSDBECP&member_hash=' + member_hash + '&account_hash=' + selected_account_hash + '&action=get_emailaddress'; $.ajax({ type: "GET" ,url:url ,data: { } ,dataType: 'json' ,success:function(data){ //console.log(data); if(!empty(data) && !empty(data.emailaddress)){ login_email = data.emailaddress; } } ,error:function(){ } ,complete:function(){ } }); return false; } var tell_a_friend_info_button = ''; var YOUTUBE_Services_Video_ID = ''; var accountLists = null; window.accountLists = null; var accountMenus = null; var unverified_account = 0; function showAccountLists(){ var newPageId = 'accountLists'; var mobile_activePage = $.mobile.activePage; console.log("mobile_activePage: "+mobile_activePage); var mobile_activePage_id = ''; if($.mobile.activePage != undefined) mobile_activePage_id = $.mobile.activePage.attr("id"); console.log("mobile_activePage_id: "+mobile_activePage_id); console.log("newPageId: "+newPageId); if(!empty(mobile_activePage) && (mobile_activePage_id == newPageId || mobile_activePage_id == "configureAccountAdditionalIdentity" || mobile_activePage_id == 'configureAccountAcitve')){ showLoader("Loading Account...."); } YOUTUBE_Services_Video_ID = ''; $('#rowTellFriends').addClass('hide_tell_friend_row'); //getAccountEmailAddress(); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/NSDB_account_menu.gate?gate_key=NSDBECP&member_hash=' + member_hash + '&account_hash=' + account_hash + '&whitelabel_business_account_hash=' + whitelabel_business_account_hash + '&PAYYAP_version=' + additionalParameters.PAYYAP_version + '&PAYYAP_device_type=' + additionalParameters.PAYYAP_device_type; console.log("showAccountLists() URL: "+url); $('#account_buttons').html(''); $('#demoVideo #demoVideoImage').attr('src', ''); $('#youtubeImage').attr('src', 'loading.gif'); $('.service-vedo-row').addClass('hide-row'); $.ajax({ type: "GET" ,url:url ,data: { } ,dataType: 'json' ,success:function(data){ console.log("025-data",data); console.log("025-data.account_menus",data.account_menus); $('.service-vedo-row').removeClass('hide-row'); if(!empty(data)){ if(!empty(data.force_update) && data.force_update.toUpperCase() == 'YES'){ //logout(); //return false; } YOUTUBE_Services_Video_ID = data.YOUTUBE_Services_Video_ID; //$('#demoVideo').removeClass('hide_tell_friend_row'); //$('#demoVideo #demoVideoImage').attr('src', '//img.youtube.com/vi/' + YOUTUBE_Services_Video_ID + '/0.jpg?rnd=' + generateRandomNumber()); var url = '//img.youtube.com/vi/' + YOUTUBE_Services_Video_ID + '/0.jpg'; setTimeout(function(){ //$('#youtubeImage').attr('src', 'youtube-512.png'); $('#demoVideo #demoVideoImage').attr('src', url); }, 100); if(!empty(data.display_TELL_A_FRIEND) && data.display_TELL_A_FRIEND != 'OFF'){ tell_a_friend_info_button = data.tell_a_friend_info_button; $('.btn-tell-a-friend').html(data.tell_a_friend_button_text); $('#rowTellFriends').removeClass('hide_tell_friend_row'); } else { $('#rowTellFriends').addClass('hide_tell_friend_row'); } $('#enable_high_security_chargeback_protection').removeAttr('checked'); if(data.enable_high_security_chargeback_protection == 'YES'){ $('#enable_high_security_chargeback_protection').parent().parent().removeClass('hide-row'); } else { $('#enable_high_security_chargeback_protection').parent().parent().addClass('hide-row'); } unverified_account = 0; accountLists = data.account_menus; console.log("027-accountLists",accountLists); accountMenus = data; console.log("027-accountMenus",accountMenus); var account_html = ''; var pending_account = 0; var setMemberHash = false; console.log("accountLists[0].creator_member_hash: "+accountLists[0].creator_member_hash); $.each(accountLists, function(index, item){ var member_hash = ""; member_hash = item.member_hash; if(item.creator_member_hash) var member_hash = item.creator_member_hash; window.member_hash = member_hash; console.log("### member_hash: "+member_hash); console.log("### window.member_hash: "+window.member_hash); setMemberHash = true; //alert(startPage, account_hash); if(startPage == 3){ //back from web verifyAccount(item.account_hash); startPage = 0; return false; } //item.account_status = '(verification required)'; //item.account_status = 'VERIFIED'; console.log("showAccountLists() item.account_status: "+item.account_status); /////////////////////////////////////// ///////////// VERIFIED; CANNOT EDIT if(item.account_status.toUpperCase() == 'VERIFIED'){ account_html += '
  • '; account_html += ''; account_html += ''; /// account_html += item.account_name; /// account_html += ''; /// account_html += '

    Balance: ' + item.account_balance + ' USD

    '; //account_html += '

    '; //account_html += item.account_name; //account_html += '

    '; if(typeof item.creator_member_full_name !== 'undefined') { if(item.creator_member_full_name !== null) { if(!empty(item.creator_member_full_name)) { account_html += '

    '; account_html += ''; account_html += 'NAME:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_full_name); account_html += '

    '; } } } if(typeof item.creator_member_emailaddress !== 'undefined') { if(item.creator_member_emailaddress !== null) { if(!empty(item.creator_member_emailaddress)) { account_html += '

    '; account_html += ''; account_html += 'EMAIL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_emailaddress); account_html += '

    '; } } } if(typeof item.creator_member_phone_number !== 'undefined') { if(item.creator_member_phone_number !== null) { if(!empty(item.creator_member_phone_number)) { account_html += '

    '; account_html += ''; account_html += 'TEL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_phone_calling_code+'/'+item.creator_member_phone_number); account_html += '

    '; } } } if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(!empty(item.account_business_name)) { account_html += '

    '; account_html += ''; account_html += 'BUSINESS:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.account_business_name); if(typeof item.account_business_type !== 'undefined') { if(item.account_business_type !== null) { if(!empty(item.account_business_type)) { account_html += ' '; account_html += item.account_business_type; } } } account_html += '

    '; } } } /// if(!empty(item.account_business_emailaddress)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B EMAIL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_emailaddress; /// account_html += '

    '; /// } /// if(!empty(item.account_business_phone_number)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B TEL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_phone_calling_code+'/'+item.account_business_phone_number; /// account_html += '

    '; /// } //account_html += ' '; //account_html += '

    '; account_html += '

    '; account_html += '• • • VERIFIED'; account_html += '

    '; //account_html += '

    '; if(typeof item.creator_member_UUID_for_member_from_client !== 'undefined') { if(item.creator_member_UUID_for_member_from_client !== null) { if(empty(item.creator_member_UUID_for_member_from_client)) { if(typeof item.creator_member_hash !== 'undefined') { if(item.creator_member_hash !== null) { if(!empty(item.creator_member_hash)) { account_html += '

    '; account_html += ''; account_html += 'M•ID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_hash; account_html += ''; account_html += '

    '; } } } if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(!empty(item.account_business_name)) { // only display AID if business name is set account_html += '

    '; account_html += ''; account_html += 'A•ID:'; account_html += ' '; account_html += ' '; account_html += item.account_hash; account_html += ''; account_html += '

    '; } } } } } } if(typeof item.creator_member_UUID_for_member_from_client !== 'undefined') { if(item.creator_member_UUID_for_member_from_client !== null) { if(!empty(item.creator_member_UUID_for_member_from_client)) { account_html += '

    '; account_html += ''; account_html += 'UUID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_UUID_for_member_from_client; account_html += ''; account_html += '

    '; } } } account_html += ''; account_html += '
    '; account_html += '
  • '; } /////////////////////////////////////// ///////////// INCOMPLETE "(verification required)"; CAN COMPLETE else if( (item.account_status == '(verification required)') || (item.account_status == 'PENDING') || (item.account_status == 'SUBMITTED') ) { ///else if( (item.account_status == '(verification required)') || (item.account_status == 'SUBMITTED') ) { //alert("item.account_status: "+item.account_status); console.log("(verification required)-001"); account_html += ''; account_html += '
  • '; account_html += ''; account_html += ''; //account_html += '

    '; //account_html += item.account_name; //account_html += '

    '; var row_status = false; console.log("row_status: "+ row_status); if(typeof item.creator_member_full_name !== 'undefined') { if(item.creator_member_full_name !== null) { if(!empty(item.creator_member_full_name)) { account_html += '

    '; account_html += ''; account_html += 'NAME:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_full_name); account_html += '

    '; row_status = true; } } } if(row_status == false) { account_html += '

    '; account_html += ''; account_html += 'NAME:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += '---'; account_html += '

    '; } console.log("row_status: "+ row_status); row_status = false; if(typeof item.creator_member_emailaddress !== 'undefined') { if(item.creator_member_emailaddress !== null) { if(!empty(item.creator_member_emailaddress)) { account_html += '

    '; account_html += ''; account_html += 'EMAIL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_emailaddress); account_html += '

    '; row_status = true; } } } if(row_status == false) { account_html += '

    '; account_html += ''; account_html += 'EMAIL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += '---@---'; account_html += '

    '; } console.log("row_status: "+ row_status); row_status = false; if(typeof item.creator_member_phone_number !== 'undefined') { if(item.creator_member_phone_number !== null) { if(!empty(item.creator_member_phone_number)) { account_html += '

    '; account_html += ''; account_html += 'TEL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_phone_calling_code+'/'+item.creator_member_phone_number); account_html += '

    '; row_status = true; } } } if(row_status == false) { account_html += '

    '; account_html += ''; account_html += 'TEL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += '---'; account_html += '

    '; } console.log("row_status: "+ row_status); if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(!empty(item.account_business_name)) { account_html += '

    '; account_html += ''; account_html += 'BUSINESS:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.account_business_name); if(typeof item.account_business_type !== 'undefined') { if(item.account_business_type !== null) { if(!empty(item.account_business_type)) { account_html += ' '; account_html += unescape(item.account_business_type); } } } account_html += '

    '; } } } /// if(!empty(item.account_business_emailaddress)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B EMAIL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_emailaddress; /// account_html += '

    '; /// } /// if(!empty(item.account_business_phone_number)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B TEL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_phone_calling_code+'/'+item.account_business_phone_number; /// account_html += '

    '; /// } //account_html += ' '; //account_html += '

    '; account_html += '

    '; account_html += "• • • Incomplete profile. Please continue..."; account_html += '

    '; //account_html += '

    '; if(typeof item.creator_member_UUID_for_member_from_client !== 'undefined') { if(item.creator_member_UUID_for_member_from_client !== null) { if(empty(item.creator_member_UUID_for_member_from_client)) { if(typeof item.creator_member_hash !== 'undefined') { if(item.creator_member_hash !== null) { if(!empty(item.creator_member_hash)) { account_html += '

    '; account_html += ''; account_html += 'M•ID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_hash; account_html += ''; account_html += '

    '; } } } if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(!empty(item.account_business_name)) { // only display AID if business name is set account_html += '

    '; account_html += ''; account_html += 'A•ID:'; account_html += ' '; account_html += ' '; account_html += item.account_hash; account_html += ''; account_html += '

    '; } } } } } } if(typeof item.creator_member_UUID_for_member_from_client !== 'undefined') { if(item.creator_member_UUID_for_member_from_client !== null) { if(!empty(item.creator_member_UUID_for_member_from_client)) { account_html += '

    '; account_html += ''; account_html += 'UUID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_UUID_for_member_from_client; account_html += ''; account_html += '

    '; } } } account_html += '
    '; account_html += '
    '; account_html += '
  • '; console.log("account_html: "+ account_html); unverified_account++; console.log("unverified_account: "+ unverified_account); //showStepPage(1); } /////////////////////////////////////// ///////////// PENDING; CANNOT EDIT else if(item.account_status.toLowerCase().indexOf('pending') != -1 || item.account_status == 'SUBMITTED'){ pending_account++; account_html += '
  • '; account_html += ''; account_html += ''; /// account_html += '

    '; /// account_html += item.account_name; /// account_html += '

    '; /// account_html += ' '; /// account_html += '

    PENDING

    '; //account_html += '

    '; //account_html += item.account_name; //account_html += '

    '; if(typeof item.creator_member_full_name !== 'undefined') { if(item.creator_member_full_name !== null) { if(!empty(item.creator_member_full_name)) { account_html += '

    '; account_html += ''; account_html += 'NAME:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_full_name); account_html += '

    '; } } } if(typeof item.creator_member_emailaddress !== 'undefined') { if(item.creator_member_emailaddress !== null) { if(!empty(item.creator_member_emailaddress)) { account_html += '

    '; account_html += ''; account_html += 'EMAIL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_emailaddress); account_html += '

    '; } } } if(typeof item.creator_member_phone_number !== 'undefined') { if(item.creator_member_phone_number !== null) { if(!empty(item.creator_member_phone_number)) { account_html += '

    '; account_html += ''; account_html += 'TEL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_phone_calling_code+'/'+item.creator_member_phone_number); account_html += '

    '; } } } if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(!empty(item.account_business_name)) { account_html += '

    '; account_html += ''; account_html += 'BUSINESS:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.account_business_name); if(!empty(item.account_business_type)) { account_html += ' '; account_html += unescape(item.account_business_type); } account_html += '

    '; } } } /// if(!empty(item.account_business_emailaddress)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B EMAIL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_emailaddress; /// account_html += '

    '; /// } /// if(!empty(item.account_business_phone_number)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B TEL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_phone_calling_code+'/'+item.account_business_phone_number; /// account_html += '

    '; /// } //account_html += ' '; account_html += '

    '; account_html += ''; account_html += '• • • PENDING'; account_html += ''; account_html += '

    '; if(typeof item.creator_member_UUID_for_member_from_client !== 'undefined') { if(item.creator_member_UUID_for_member_from_client !== null) { if(empty(item.creator_member_UUID_for_member_from_client)) { if(typeof item.creator_member_hash !== 'undefined') { if(item.creator_member_hash !== null) { if(!empty(item.creator_member_hash)) { account_html += '

    '; account_html += ''; account_html += 'M•ID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_hash; account_html += ''; account_html += '

    '; } } } if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(!empty(item.account_business_name)) { // only display AID if business name is set account_html += '

    '; account_html += ''; account_html += 'A•ID:'; account_html += ' '; account_html += ' '; account_html += item.account_hash; account_html += ''; account_html += '

    '; } } } } } } if(typeof item.creator_member_UUID_for_member_from_client !== 'undefined') { if(item.creator_member_UUID_for_member_from_client !== null) { if(!empty(item.creator_member_UUID_for_member_from_client)) { account_html += '

    '; account_html += ''; account_html += 'UUID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_UUID_for_member_from_client; account_html += ''; account_html += '

    '; } } } account_html += '
    '; account_html += '
    '; account_html += '
  • '; } /////////////////////////////////////// ///////////// OPEN STATUS; CAN EDIT ///////////// "APPROVED"; CAN EDIT ///////////// "RETURNED"; CAN EDIT else { console.log("approved-showAccountLists() account_html: "+account_html); console.log("approved-showAccountLists() item.account_hash: "+item.account_hash); console.log("approved-showAccountLists() step: 1"); //account_html += '
  • ' + item.account_name + '

    ' + item.account_status + '

  • '; ///account_html += '
  • ' + item.account_name + '

    ' + item.account_status + '

  • '; /// item.CUSTOMER_FULL_NAME /// item.account_name = business account name account_html += ''; account_html += '
  • '; account_html += ''; account_html += ''; console.log("approved-showAccountLists() step: 2"); ///account_html += '

    '; ///account_html += item.account_name; ///account_html += ' '; ///account_html += '

    '; ///account_html += '

    ' + item.account_status + '

    '; //account_html += '

    '; //account_html += item.account_name; //account_html += '

    '; if(typeof item.creator_member_full_name !== 'undefined') { if(item.creator_member_full_name !== null) { if(!empty(item.creator_member_full_name)) { account_html += '

    '; account_html += ''; account_html += 'NAME:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_full_name); account_html += '

    '; } } } if(typeof item.creator_member_emailaddress !== 'undefined') { if(item.creator_member_emailaddress !== null) { if(!empty(item.creator_member_emailaddress)) { account_html += '

    '; account_html += ''; account_html += 'EMAIL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_emailaddress); account_html += '

    '; } } } console.log("approved-showAccountLists() step: 3"); console.log("approved-showAccountLists() item.creator_member_phone_number: "+item.creator_member_phone_number); if(typeof item.creator_member_phone_number !== 'undefined') { if(item.creator_member_phone_number !== null) { if(item.creator_member_phone_number.length > 5) { account_html += '

    '; account_html += ''; account_html += 'TEL:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.creator_member_phone_calling_code+'/'+item.creator_member_phone_number); account_html += '

    '; } } } console.log("approved-showAccountLists() step: 4"); if(typeof item.account_business_name !== 'undefined') { if(item.account_business_name !== null) { if(item.account_business_name.length > 3) { //if(!empty(item.account_business_name)) { account_html += '

    '; account_html += ''; account_html += 'BUSINESS:'; account_html += ''; account_html += ' '; account_html += ' '; account_html += unescape(item.account_business_name); if(!empty(item.account_business_type)) { account_html += ' '; account_html += unescape(item.account_business_type); } account_html += '

    '; } } } /// if(!empty(item.account_business_emailaddress)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B EMAIL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_emailaddress; /// account_html += '

    '; /// } /// if(!empty(item.account_business_phone_number)) { /// account_html += '

    '; /// account_html += ''; /// account_html += 'B TEL:'; /// account_html += ''; /// account_html += ' '; /// account_html += ' '; /// /// account_html += item.account_business_phone_calling_code+'/'+item.account_business_phone_number; /// account_html += '

    '; /// } //account_html += ' '; //account_html += '

    '; //////////////////////////////////////// //////////////// ACCOUNT STATUS: //account_html += '

    '; ///account_html += item.account_status; account_html += "ACTION: Click to Edit/Update..."; //account_html += '

    '; account_html += '
    '; console.log("approved-showAccountLists() step: 5"); /* if(empty(item.creator_member_UUID_for_member_from_client)) { if(!empty(item.creator_member_hash)) { account_html += '

    '; account_html += ''; account_html += 'M•ID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_hash; account_html += ''; account_html += '

    '; } if(!empty(item.account_business_name)) { // only display AID if business name is set account_html += '

    '; account_html += ''; account_html += 'A•ID:'; account_html += ' '; account_html += ' '; account_html += item.account_hash; account_html += ''; account_html += '

    '; } } if(!empty(item.creator_member_UUID_for_member_from_client)) { account_html += '

    '; account_html += ''; account_html += 'UUID:'; account_html += ' '; account_html += ' '; account_html += item.creator_member_UUID_for_member_from_client; account_html += ''; account_html += '

    '; } */ account_html += '
    '; account_html += '
    '; account_html += '
  • '; } //account_html += '
    '; console.log("approved-showAccountLists() step: 6"); ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// /// START: ADDITIONAL PERSONAL DOCUMENTS //$('#additional_document_personal, #additional_document_business').html(''); $('#additional_document_personal').html(''); var group_key = 0; console.log('666666-item', item); console.log('666666-item.additional_document', item.additional_document); if(!empty(item.additional_document) ){ $.each(item.additional_document, function(key, additional_document_group){ //alert("key: "+key); group_key++; console.log('personal: additional_document_group: key', key); console.log('personal: additional_document_group', additional_document_group); $.each(additional_document_group, function(item_key, additional_document_group_item) { var additional_document_template = $('#document_upload_template').html(); //var additional_icon = '//images.intelitruth.com/more_documents_icon.png'; var additional_icon = siteProtocol + '//'+API_DOMAIN+'/link_images/more_documents_icon.png'; var additional_title = 'Title Not Set'; if(!empty(additional_document_group_item.title)) { additional_title = additional_document_group_item.title; } var update_the_pulldown_1 = false; var update_the_pulldown_2 = false; var additional_options = ''; $.each(additional_document_group_item.options, function(index, additional_document_group_item_option) { additional_options += ''; //window.default_option_value = additional_document_group_item_option; if(additional_document_group_item_option == "Passport%20%28Front%20%2B%20Back%29") update_the_pulldown_1 = true; }); var additional_document_number = '88' + group_key + item_key; var additional_document_type = 'additional_document_' + key + additional_document_number; if(additional_document_type == "additional_document_personal8810") update_the_pulldown_2 = true; var additional_document_filename = 'additional_document_' + key + '_' + (item_key + 1); var additional_document_description_text = 'With your device camera, you may now please take a photo of your document — Simply click on the button (below): "Take a Photo"! — or if you have a file/scan/or photo (of your Personal ID) already "in" your device gallery/storage, then: "Upload a File"!'; if(!empty(additional_document_group_item.description_text)){ additional_document_description_text = additional_document_group_item.description_text; } //console.log('7777777-additional_document_template', additional_document_template); console.log('8888-8888-additional_document_filename', additional_document_filename); if(!empty(additional_document_template)){ console.log('9999-9999-additional_document_filename', additional_document_filename); additional_document_template = additional_document_template.replace(/{{additional_document_type_icon}}/g, additional_icon); additional_document_template = additional_document_template.replace(/{{additional_document_title}}/g, additional_title); additional_document_template = additional_document_template.replace(/{{additional_document_options}}/g, additional_options); additional_document_template = additional_document_template.replace(/{{additional_document_type}}/g, additional_document_type); additional_document_template = additional_document_template.replace(/{{additional_document_number}}/g, additional_document_number); additional_document_template = additional_document_template.replace(/{{additional_document_filename}}/g, additional_document_filename); additional_document_template = additional_document_template.replace(/{{additional_document_description_text}}/g, additional_document_description_text); //$("#"+additional_document_type).val("1234").change(); //alert("additional_document_type: "+additional_document_type); //$("#"+additional_document_type).val(window.default_option_value).change(); /// removed by shea 20220314 //if(additional_document_type == "additional_document_personal8810" ) { //$('#additional_document_personal8810').val("Passport%20%28Front%20%2B%20Back%29").change(); //} } //$('#additional_document_personal8810').val("Passport%20%28Front%20%2B%20Back%29"); // working //$('#additional_document_personal8810 option[value=Passport%20%28Front%20%2B%20Back%29]').attr('selected','selected'); $('#additional_document_' + key).append(additional_document_template); if(update_the_pulldown_1 == true && update_the_pulldown_2 == true) { //$('#additional_document_personal8810').val("Passport%20%28Front%20%2B%20Back%29").change(); } else { update_the_pulldown_1 = false; update_the_pulldown_2 = false; } }); }); } //$("#"+additional_document_type).val(additional_document_group_item_option).change(); //$('#'+additional_document_type).val(additional_document_group_item_option).change(); //$("#"+additional_document_type).prop("selectedIndex", 2); /// END: ADDITIONAL PERSONAL DOCUMENTS ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// }); //$('#'+additional_document_type).val(1); console.log("080-account_html",account_html); if(empty(account_html)){ account_html += '
  • '; account_html += '

    '; account_html += "No accounts found."; account_html += '

    '; account_html += '
  • '; } account_html = '
    • Accounts Menu
    • ' + account_html; account_html += '
    '; console.log("081-account_html",account_html); /////////////////////////////////////// ///////////// ACCOUNTS MENU (PENDING) if(pending_account>0){ account_html += '
    '; account_html += ''; account_html += '
    '; account_html += '
    '; account_html += 'Exit Profile'; } //$('#account_buttons').html(account_html); // Prepare your page structure if( $.mobile.activePage.attr("id") == newPageId || $.mobile.activePage.attr("id") == 'login' || $.mobile.activePage.attr("id") == 'configureAccountAcitve' ){ $('#' + newPageId).remove(); console.log("082-account_html",account_html); } var newPageHtml = "
    "; console.log("083-newPageHtml",newPageHtml); //header //newPageHtml += "
    Navigation

    "+SITE_TITLE+"

    Navigation "; newPageHtml += "
    "; if(!empty(LOGO_RECTANGLE)) { newPageHtml += "
    "; newPageHtml += ""; newPageHtml += "
    "; } newPageHtml += account_html; newPageHtml += "
    "; newPageHtml += ""; newPageHtml += ''; newPageHtml += '
    '; console.log("newPageHtml: "+ newPageHtml); var newPage = $(newPageHtml); console.log("085-newPage",newPage); if(unverified_account > 0 && accountLists.length == 1){ console.log("unverified_account",unverified_account); newPage.appendTo($.mobile.pageContainer); //changePageWithHeaderFooter('#configureAccount'); //checkAndShowNextForm(1); setTimeout(function(){ console.log("040-accountLists[0].account_hash",accountLists[0].account_hash); verifyAccount(accountLists[0].account_hash); //showVerificationForm(accountLists[0].account_hash); }, 100); } else{ console.log("newPageId",newPageId); console.log("newPage",newPage); injectNewPage('#'+newPageId,newPage); } if(setMemberHash){ console.log("070-setMemberHash",setMemberHash); console.log("070-member_hash",member_hash); //window.location.href = SITE_SCHEMA+'://setMemberHash?member_hash='+member_hash; setSessionUserData('member_hash', member_hash); } } } ,error:function(){ var account_html = ''; account_html += '

    Failed to load Account List.

    '; account_html += '

    '; $('#account_buttons').html(account_html); } ,complete:function(){ if(unverified_account > 0 && accountLists.length == 1){ // console.log("086-complete:function()"); } else{ console.log("071-hideLoader"); hideLoader(); } } }); return false; } function showTransactionHistory(doRefresh){ //selected_account_hash = '0f3c24cc0756e881b0feb984772f421f'; var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/vWAVE_transaction_history.gate?member_hash=' + member_hash + '&account_hash=' + selected_account_hash + '&history=25'; //console.log(url); $('#transactionHistoryCancel').css('display', 'none'); $('#transactionHistoryBlock').css('display', 'block'); if(empty(doRefresh) || doRefresh){ $('#transactionHistoryBlock').html(''); } $.ajax({ type: "GET" ,url:url ,data: { } ,dataType: 'json' ,success:function(data){ if(data!=null){ var history_html = '
    Transaction History:
    '; history_html += ''; history_html += ''; history_html += ''; history_html += ''; history_html += ''; history_html += ''; $.each(data, function(index, item){ history_html += ''; history_html += ''; history_html += ''; history_html += ''; }); if(data.length<1){ history_html += ''; history_html += '' history_html += '' } history_html += '
    '; history_html += 'Name'; history_html += ''; history_html += 'AMOUNT'; history_html += ''; history_html += 'STATUS'; history_html += '
    '; history_html += ''; history_html += '
    '; history_html += item.CUSTOMER_FULL_NAME history_html += '
    '; history_html += '
    '; history_html += '
    '; history_html += item.AUTHORIZATION_AMOUNT; history_html += ''; history_html += item.AUTHORIZATION_STATUS; history_html += '
    '; history_html += '(no transaction history)'; history_html += '
    ' if(data.length>0){ $('#transactionHistoryCancel').css('display', 'block'); } $('#transactionHistoryBlock').css('display', 'block'); $('#transactionHistoryBlock').html(history_html); $('#transactionHistoryBlock table tr').unbind('click'); $('#transactionHistoryBlock table tr').click(function(event){ var history_hash = $(this).attr('data-history-hash'); if(empty(history_hash)) return false; openTransactionDetailsPopup(history_hash); }); } } ,error:function(){ var history_html = ''; $('#transactionHistoryBlock').html(history_html); } ,complete:function(){ $('#transactionHistoryCancel').css('display', 'block'); } }); return false; } function openTransactionDetailsPopup(hash){ if(empty(hash)) return false; var windowWidth = window.outerWidth; //$(window).width(); var windowHeight = window.outerHeight; //$(window).height(); if($('body').height() < windowHeight){ $('body').css('height', windowHeight); } $('#transactionDetails').css('max-height', (windowHeight - 180)); $('#transactionDetails').css('overflow', 'auto'); $('#transactionDetailsModal').modal({ backdrop: 'static', keyboard: false }); $('#transaction_hash').val(hash); ////gateway.payyap.network/PAYYAP_transaction_details.gate?transaction_hash=10487abc06bac1c2853f6547bd55ff34 $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/PAYYAP_transaction_details.gate' ,data: {transaction_hash: hash} //,dataType: 'json' ,success:function(data){ if(data == 'INVALID'){ show_device_alert('ERROR', "Details are not available for this transaction."); closeTransactionDetailsPopup(); } else $('#transactionDetails').html(data); } ,error:function(){ show_device_alert('ERROR', "An error occurred, please try again."); closeTransactionDetailsPopup(); } ,complete:function(){ } }); return false; } function retryThisTransaction(){ var hash = $('#transaction_hash').val(); if(empty(hash)) return false; showProgressDialog("Working..."); setTimeout(function(){ ////gateway.payyap.network/PAYYAP_retry.gate?api_session_hash=10487abc06bac1c2853f6547bd55ff34 $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/PAYYAP_retry.gate' ,data: {api_session_hash: hash} ,dataType: 'json' ,success:function(data){ hideProgressDialog(); setTimeout(function(){ try { //data = $.parseJSON(data); if(!empty(data)){ var AUTHORIZATION_AMOUNT = 0.0; if(!empty(data.AUTHORIZATION_AMOUNT)) AUTHORIZATION_AMOUNT = parseFloat(data.AUTHORIZATION_AMOUNT); var CUSTOMER_FULL_NAME = ''; if(!empty(data.CUSTOMER_FULL_NAME)) CUSTOMER_FULL_NAME = data.CUSTOMER_FULL_NAME; var CUSTOMER_TELEPHONE_COUNTRY_CODE = ''; if(!empty(data.CUSTOMER_TELEPHONE_COUNTRY_CODE)) CUSTOMER_TELEPHONE_COUNTRY_CODE = data.CUSTOMER_TELEPHONE_COUNTRY_CODE; var CUSTOMER_TELEPHONE_NUMBER = ''; if(!empty(data.CUSTOMER_TELEPHONE_NUMBER)) CUSTOMER_TELEPHONE_NUMBER = data.CUSTOMER_TELEPHONE_NUMBER; $('#amount').val(AUTHORIZATION_AMOUNT); $('#name_on_card').val(CUSTOMER_FULL_NAME); $('#telephone_country_iso3').val(CUSTOMER_TELEPHONE_COUNTRY_CODE); $('#telephone_number').val(CUSTOMER_TELEPHONE_NUMBER); showStepPage('#payment_form'); $('#payment_form #amount').focus(); closeTransactionDetailsPopup(); } else show_device_alert('ERROR', data); } catch(err) { //console.log(err.message); show_device_alert('ERROR', "An error occurred, please try again."); } }, 500); } ,error:function(){ show_device_alert('ERROR', "An error occurred, please try again."); } ,complete:function(){ hideProgressDialog(); } }); }, 500); return false; } function refundThisTransaction(){ window.location.href = SITE_SCHEMA+'://confirmRefundThisTransaction'; return false; } function confirmRefundThisTransaction(){ var hash = $('#transaction_hash').val(); if(empty(hash)) return false; showProgressDialog("Working..."); setTimeout(function(){ ////gateway.payyap.network/PAYYAP_refund.gate?api_session_hash=10487abc06bac1c2853f6547bd55ff34 $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/PAYYAP_refund.gate' ,data: {api_session_hash: hash} //,dataType: 'json' ,success:function(data){ hideProgressDialog(); setTimeout(function(){ if(data == 'SUCCESS') show_device_alert('SUCCESS', data); else show_device_alert('ERROR', data); setTimeout(function(){ closeTransactionDetailsPopup(); showTransactionHistory(); }, 500); }, 500); } ,error:function(){ show_device_alert('ERROR', "An error occurred, please try again."); } ,complete:function(){ hideProgressDialog(); } }); }, 500); return false; } function closeTransactionDetailsPopup(){ $('#transactionDetailsModal').modal('hide'); } function generateRandomNumber(){ return Math.floor((Math.random() * 100) + 1); } function show_device_alert(type, msg, callback){ //window.location.href = SITE_SCHEMA+'://showAlert/' + type + ':' + msg; if(empty(callback)) callback = ''; //window.location.href = SITE_SCHEMA+'://showAlert?type=' + type + '&msg=' + encodeURIComponent(msg) + '&callback=' + callback; if(!empty(msg)) alert(msg); if(!empty(callback)) eval("callback();"); } function show_device_confirm(type, msg, display_confirmation_message , callback){ console.log('show_device_confirm',type); console.log('show_device_confirm',msg); console.log('show_device_confirm',1); if(empty(callback)) callback = ''; console.log('show_device_confirm',2); //window.location.href = SITE_SCHEMA+'://showConfirm?type=' + type + '&msg=' + encodeURIComponent(msg) + '&callback=' + callback; if(!empty(msg)){ console.log('show_device_confirm',3); /// START: ODDITY /// /// this used to show a confirmation message; /// somehow if the user waited too long to confirm, it would fail to open the file finder in CHROME (only!); /// temp solution: do not display message when file upload is selected; /// ideally would be nice have some message that displays typs of document supported: /// used "display_confirmation_message" variable to set true or flase to display; /// /// if(display_confirmation_message == true) { var retVal = confirm(msg); } else { var retVal = true; // DEFAULTED TO "true" and it works... no need to wait for user input. } //var retVal = true; // DEFAULTED TO "true" and it works... no need to wait for user input. /// /// END ODDITY console.log('show_device_confirm',4); if( retVal == true ){ console.log('show_device_confirm',5); //if(!empty(callback)){ //eval("callback();"); if (type == "ConfirmAccountVerification") { console.log('show_device_confirm',6); eval("showVerificationForm(account_hash);"); } else if (type == "confirmSelectOption") { console.log('show_device_confirm',7); eval("confirmSelectOption('yes');"); } else if(type == "confirmRemovePhoto"){ console.log('show_device_confirm',8); removePhoto(); } console.log('show_device_confirm',9); //} return true; } else{ console.log('show_device_confirm',10); if (type == "confirmSelectOption") { console.log('show_device_confirm',11); eval("confirmSelectOption('no');"); } console.log('show_device_confirm',12); return false; } console.log('show_device_confirm',13); } console.log('show_device_confirm',14); return false; } var searchHistory = []; function goBack(){ var lastItem = searchHistory.pop(); lastItem = searchHistory.pop(); //alert(lastItem); if(!empty(lastItem)){ showStepPage(lastItem); } else{ //alert("dd"); window.location.href = SITE_SCHEMA+'://finish'; } } var contactCategory = ''; function openContact(category){ contactCategory = category; //window.location.href = SITE_SCHEMA+'://openContact'; if(contactCategory == 'tell_friends_form'){ openContactsCallLogsForm(); //$('.contactsUploadingStatus').html(''); } window.location.href = SITE_SCHEMA+'://openContact/' + contactCategory; return false; } function fillFormDataFromContact(email, name, phone){ if(!empty(phone)){ phone = phone.replace(/ /g, ""); phone = phone.replace(/-/g, ""); phone = phone.replace(/\+/g, ""); } console.log('email, name, phone', email, name, phone); switch(contactCategory){ case 'payment_form': $('#cardholder_email_address').val(email); $('#name_on_card').val(name); $('#telephone_number').val(phone); $('#cardholder_email_address').blur(); $('#name_on_card').blur(); $('#telephone_number').blur(); break; case 'email_invoice': $('#recipient_email_address').val(email); $('#recipient_first_name').val(name); $('#recipient_email_address').blur(); $('#recipient_first_name').blur(); break; case 'official_identity': $('#official_first_name').val(name); $('#official_first_name').blur(); break; case 'tell_friends_form': break; case 'XXXX': break; default: break; } return false; } function contactUploadFinished(){ $('.contactsUploadingStatus').html(''); } function tell_friends_cancel(){ window.location.href = SITE_SCHEMA+'://closeCalllogCursor'; return false; } function tell_friends_ok(){ window.location.href = SITE_SCHEMA+'://confirmInviteToPAYYAPNow?msg=' + escape(tell_a_friend_info_button); return false; } function confirmInviteToPAYYAP(){ var len = $("#contacts_call_logs_form input[name='checked_contacts_index[]']:checked").length; if(len<1){ show_device_alert('ERROR', "Please select at least one (1) associate to invite."); return false; } $('#member_hash').val(member_hash); $('#hash').val(account_hash); $('#myModal .modal-footer').addClass('hideContactUploadModalButtons'); $('#myModal .modal-footer').parent().append('
    '); $.ajax({ type: "POST" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/payyap_member_referral.gate' //,data: { member_hash: member_hash, hash: account_hash, contacts: $('#contacts_call_logs_form').serialize() } ,data: $('#contacts_call_logs_form').serialize() //,dataType: 'json' ,success:function(data){ show_device_alert('SUCCESS', "InviteToPAYYAPNowSuccessMessage"); setTimeout(function(){ showAccountLists(); $('#checkUncheckAllContacts').prop('checked', true); toggle(document.getElementById('checkUncheckAllContacts')); closeContactsCallLogsForm(); }, 500); } ,error:function(){ show_device_alert('ERROR', "An error occurred, please try again."); } ,complete:function(){ $('#myModal .modal-footer').removeClass('hideContactUploadModalButtons'); $('#myModal .modal-footer').next().remove(); } }); return false; } function fillContactsCallLogsForm(callDetails){ var windowWidth = window.outerWidth; //$(window).width(); var windowHeight = window.outerHeight; //$(window).height(); if($('body').height() < windowHeight){ $('body').css('height', windowHeight); } //$('#contacts_n_call_logs').css('height',viewport.height); $('#contacts_n_call_logs').css('max-height', (windowHeight - 300)); $('#contacts_n_call_logs').css('overflow', 'auto'); callDetails = $.parseJSON(callDetails); console.log('callDetails', callDetails); var totalCallLogs = 0; var totalContacts = 0; var total = 0; if(!empty(callDetails.callLogs.length)) totalCallLogs = callDetails.callLogs.length; if(!empty(callDetails.contacts.length)) totalContacts = callDetails.contacts.length; total = totalCallLogs+totalContacts; console.log("total", total); if(total>0){ var html = ""; html += '
    Check/Uncheck All

    '; html += '
    Call Logs:
    '; if(totalCallLogs<1) html += 'We cannot find any contacts in your call log.'; $.each(callDetails.callLogs, function(key, value) { //console.log(key, value); //for(k=0;k<20;k++){ html += '
    '; html += '
    '; html += ''; html += ''; html += ' '; html += '' + value.cachedName + '
    '; html += '' + value.phone + ''; html += '
    '; //} }); html += '
    '; // html += '
    Contacts:
    '; // if(totalContacts<1) html += 'No contacts were found!'; // $.each(callDetails.contacts, function(key, value) { // //console.log(key, value); // var name = $.trim($.trim(value.firstname + ' ' + value.middlename) + value.lastname); // html += '
    '; // html += ' '; // html += '' + value.name + '
    '; // html += '' + value.phone + ''; // html += '
    '; // }); // html += '
    '; $('#contacts_n_call_logs').html(html); $('.contact-log').click(function(event){ //alert('function runs twice'); if(event.target.type !== 'checkbox'){ $(':checkbox', this).trigger('click'); // Change property instead //$(':checkbox', this).prop('checked', true); } }); } else{ $('#contacts_n_call_logs').html('We cannot find any contacts in your call log.'); } } function openContactsCallLogsForm(){ $('#myModal').modal({ backdrop: 'static', keyboard: false }) } function closeContactsCallLogsForm(){ $('#myModal').modal('hide'); } $('#myModal').on('show.bs.modal', function (e) { var modal = $(this); modal.find('.modal-title').text('New message to ') //modal.find('.modal-body input').val(recipient) $('.btn-close').click(function(){ alert('Closed'); $('#myModal').modal('hide'); }); }); function toggle(source) { checkboxes = document.getElementsByName('checked_contacts_index[]'); for(var i=0, n=checkboxes.length;i0){ show_device_alert('ERROR', "Please complete the form."); //$('#verification_region').focus(); //return false; return true; } else{ //showStepPage('#identity_verification_form'); verification_region = $('#verification_region').val(); $('.sell_product_type').html($('#business_category').val()); /* if(verification_region == 'united_states'){ //changePageWithHeaderFooter('#configureAccount2'); */ checkAndShowNextForm(2); /* } else{ showStepPage('#TSYS_form'); $('#tsys_email_address').val(email_address); $('#tsys_email_address').focus(); if(verification_region == 'united_states'){ $('.us-field').css('display', 'block'); $('.non-us-field').css('display', 'none'); $('#tsys_social_security_number').val(''); } else{ $('.us-field').css('display', 'none'); $('.non-us-field').css('display', 'block'); $('#tsys_personal_id_number').val(''); //showStepPage('#identity_verification_form'); } } */ setTimeout(function(){ //window.location.href = SITE_SCHEMA+'://verification_region/' + verification_region; setSessionUserData('verification_region', verification_region); }, 1000); } //return false; } function checkAgeRestriction(field) { var user_dob_time = new Date(field.value).getTime(); var mimimum_date_time = new Date(window.onboarding_personal_minimum_date_of_birth).getTime(); if(Number.isNaN(user_dob_time)) { //alert("user_dob_time: "+ user_dob_time); no_of_error++; showErrorImg(field); return; } else if( (new Date(field.value).getTime() > new Date(window.onboarding_personal_minimum_date_of_birth).getTime()) ) { alert("\n\nALERT!\n\n Our minimum age requirement is: "+window.onboarding_personal_minimum_age+"\n\n"); showErrorImg(field); no_of_error++; return; } else { showValidImg(field); return; } } function TSYS_US_Direct_Form_Validate(){ var no_of_error = 0; if(isOnboardingRequired('tsys_us_direct_first_name')) { validateText(document.configureAccount2Form['tsys_us_direct_first_name'], 'onBlur'); if($('#tsys_us_direct_first_name').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_middle_name')) { validateText(document.configureAccount2Form['tsys_us_direct_middle_name'], 'onBlur'); if($('#tsys_us_direct_middle_name').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_last_name')) { validateText(document.configureAccount2Form['tsys_us_direct_last_name'], 'onBlur'); if($('#tsys_us_direct_last_name').parent().hasClass('has-error')) no_of_error++; } // validate if(isOnboardingRequired('tsys_us_direct_personal_email_address')) { validateText(document.configureAccount2Form['tsys_us_direct_personal_email_address'], 'onBlur'); if($('#tsys_us_direct_personal_email_address').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_personal_telephone_country_code')) { validateText(document.configureAccount2Form['tsys_us_direct_personal_telephone_country_code'], 'onBlur'); if($('#tsys_us_direct_personal_telephone_country_code').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_personal_telephone_number')) { validateText(document.configureAccount2Form['tsys_us_direct_personal_telephone_number'], 'onBlur'); if($('#tsys_us_direct_personal_telephone_number').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_street_address')) { validateText(document.configureAccount2Form['tsys_us_direct_street_address'], 'onBlur'); if($('#tsys_us_direct_street_address').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_street_address_2')) { validateText(document.configureAccount2Form['tsys_us_direct_street_address_2'], 'onBlur'); if($('#tsys_us_direct_street_address_2').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_city')) { validateText(document.configureAccount2Form['tsys_us_direct_city'], 'onBlur'); if($('#tsys_us_direct_city').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_state')) { validateText(document.configureAccount2Form['tsys_us_direct_state'], 'onBlur'); if($('#tsys_us_direct_state').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_postal_code')) { validateText(document.configureAccount2Form['tsys_us_direct_postal_code'], 'onBlur'); if($('#tsys_us_direct_postal_code').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_country_iso3')) { validateText(document.configureAccount2Form['tsys_us_direct_country_iso3'], 'onBlur'); if($('#tsys_us_direct_country_iso3').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_social_security_number')) { validateText(document.configureAccount2Form['tsys_us_direct_social_security_number'], 'onBlur'); if($('#tsys_us_direct_social_security_number').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_birth_date')) { checkAgeRestriction(document.configureAccount2Form['tsys_us_direct_birth_date']); validateText(document.configureAccount2Form['tsys_us_direct_birth_date'], 'onBlur'); if($('#tsys_us_direct_birth_date').parent().hasClass('has-error')) no_of_error++; } //validateTSYSUSDirectDOB(document.configureAccount2Form['tsys_us_direct_birth_date']); //ERROR CHECKING if(isOnboardingRequired('tsys_us_direct_gender')) { validateText(document.configureAccount2Form['tsys_us_direct_gender'], 'onBlur'); if($('#tsys_us_direct_gender').parent().hasClass('has-error')) no_of_error++; } if(no_of_error>0){ show_device_alert('ERROR', "Please complete the form."); //$("#configureAccount2Form").validate(); return true; } else{ if( (!isOnboardingDoNotDisplay('tsys_us_direct_social_security_number')) ) { validateSocialSecurityNumber('#tsys_us_direct_social_security_number', '#tsys_us_direct_country_iso3', function(){ displayPersonalIdentity($('#tsys_us_direct_business_name'), '#tsys_us_direct_business_name'); //changePageWithHeaderFooter('#configureAccount3'); checkAndShowNextForm(3); }); } else{ displayPersonalIdentity($('#tsys_us_direct_business_name'), '#tsys_us_direct_business_name'); //changePageWithHeaderFooter('#configureAccount3'); checkAndShowNextForm(3); } } //return false; } var isLoadedDocuments = false; function validateBusinessIdentity(el){ var no_of_error = 0; if(isOnboardingRequired('tsys_us_direct_business_name')) { validateText(document.configureAccount3Form['tsys_us_direct_business_name'], 'onBlur'); if($('#tsys_us_direct_business_name').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_type')) { validateText(document.configureAccount3Form['tsys_us_direct_business_type'], 'onBlur'); if($('#tsys_us_direct_business_type').parent().hasClass('has-error')) no_of_error++; if($('#tsys_us_direct_business_type').val() == 'unregistered' ){ //&& document.frmPayment['authorization_to_email_EIN_FAQ'].checked){ // //show_device_alert('ERROR', 'You must have a Certified DBA or Registered EIN to continue. If you have neither, we suggest that you please follow our SUPER EASY guide to registering an EIN in 5 MINUTES or LESS!'); //return true; } else if($('#tsys_us_direct_business_type').val() == 'Certified DBA'){ // } else{ if(isOnboardingRequired('tsys_us_direct_business_tax_id')) { validateText(document.configureAccount3Form['tsys_us_direct_business_tax_id'], 'onBlur'); if($('#tsys_us_direct_business_tax_id').parent().hasClass('has-error')) no_of_error++; } } } if(isOnboardingRequired('tsys_us_direct_business_registered_country_iso3')) { validateText(document.configureAccount3Form['tsys_us_direct_business_registered_country_iso3'], 'onBlur'); if($('#tsys_us_direct_business_registered_country_iso3').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_registered_region')) { validateText(document.configureAccount3Form['tsys_us_direct_business_registered_region'], 'onBlur'); if($('#tsys_us_direct_business_registered_region').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_email_address')) { validateText(document.configureAccount3Form['tsys_us_direct_business_email_address'], 'onBlur'); if($('#tsys_us_direct_business_email_address').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_telephone_country_code')) { validateText(document.configureAccount3Form['tsys_us_direct_business_telephone_country_code'], 'onBlur'); if($('#tsys_us_direct_business_telephone_country_code').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_telephone')) { validateText(document.configureAccount3Form['tsys_us_direct_business_telephone'], 'onBlur'); if($('#tsys_us_direct_business_telephone').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_mailing_street_1')) { validateText(document.configureAccount3Form['tsys_us_direct_business_mailing_street_1'], 'onBlur'); if($('#tsys_us_direct_business_mailing_street_1').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_mailing_street_2')) { validateText(document.configureAccount3Form['tsys_us_direct_business_mailing_street_2'], 'onBlur'); if($('#tsys_us_direct_business_mailing_street_2').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_mailing_city')) { validateText(document.configureAccount3Form['tsys_us_direct_business_mailing_city'], 'onBlur'); if($('#tsys_us_direct_business_mailing_city').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_mailing_state')) { validateText(document.configureAccount3Form['tsys_us_direct_business_mailing_state'], 'onBlur'); if($('#tsys_us_direct_business_mailing_state').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_mailing_postal_code')) { validateText(document.configureAccount3Form['tsys_us_direct_business_mailing_postal_code'], 'onBlur'); if($('#tsys_us_direct_business_mailing_postal_code').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_mailing_country_iso3')) { validateText(document.configureAccount3Form['tsys_us_direct_business_mailing_country_iso3'], 'onBlur'); if($('#tsys_us_direct_business_mailing_country_iso3').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('tsys_us_direct_business_website')) { validateText(document.configureAccount3Form['tsys_us_direct_business_website'], 'onBlur'); if($('#tsys_us_direct_business_website').parent().hasClass('has-error')) no_of_error++; } /* var selected_account_details = getSelectAccountDetails(); if(!empty(selected_account_details.KYC_option_request_business_url_required) && selected_account_details.KYC_option_request_business_url_required == 'TRUE'){ } if($('#tsys_us_direct_business_website').hasClass('required')){ //$('#is_advertise_website').prop("checked", true); $('#legal_tickbox_alert_terms_of_service, #legal_tickbox_alert_refund_policy, #legal_tickbox_alert_privacy_policy').addClass('required'); validateCheckbox(document.configureAccount3Form['legal_tickbox_alert_terms_of_service']); if($('#legal_tickbox_alert_terms_of_service').parent().hasClass('has-error')) no_of_error++; validateCheckbox(document.configureAccount3Form['legal_tickbox_alert_refund_policy']); if($('#legal_tickbox_alert_refund_policy').parent().hasClass('has-error')) no_of_error++; validateCheckbox(document.configureAccount3Form['legal_tickbox_alert_privacy_policy']); if($('#legal_tickbox_alert_privacy_policy').parent().hasClass('has-error')) no_of_error++; } else{ $('#legal_tickbox_alert_terms_of_service, #legal_tickbox_alert_refund_policy, #legal_tickbox_alert_privacy_policy').removeClass('required'); } */ //ERROR CHECKING if(no_of_error>0){ show_device_alert('ERROR', "Please complete the form."); return true; } else{ //changePageWithHeaderFooter('#configureAccount4'); //alert(4); checkAndShowNextForm(4); resetAllImages(); getTermsAndConditionsAggreementText(); } return false; } //reset all images function resetAllImages(){ if(!isLoadedDocuments && !empty(kyc_session)){ //isLoadedDocuments = true; resetSelectedImages('selfie_document', kyc_session['selfie_document']); resetSelectedImages('personal_document', kyc_session['personal_document']); resetSelectedImages('business_document', kyc_session['business_document']); resetSelectedImages('pricing_document', kyc_session['pricing_document']); resetSelectedImages('processing_document', kyc_session['processing_document']); resetSelectedImages('residence_document', kyc_session['residence_document']); resetSelectedImages('tax_returns_document', kyc_session['tax_returns_document']); resetSelectedImages('business_document_3_url', kyc_session['business_document_3_url']); resetSelectedImages('business_document_4_url', kyc_session['business_document_4_url']); resetSelectedImages('business_document_5_url', kyc_session['business_document_5_url']); resetSelectedImages('business_document_6_url', kyc_session['business_document_6_url']); resetSelectedImages('business_document_7_url', kyc_session['business_document_7_url']); //additional_documents start var group_key = 0; if(!empty(kyc_session['additional_documents']) ){ $.each(kyc_session['additional_documents'], function(key, additional_document_group){ group_key++; //console.log('key', key); //console.log('additional_document_group', additional_document_group); $.each(additional_document_group, function(item_key, additional_document_group_item){ var additional_document_number = '88' + group_key + item_key; var additional_document_type = 'additional_document_' + key + additional_document_number; if(!empty(additional_document_group_item)){ //console.log('additional_document_group_item', additional_document_group_item); resetSelectedImages(additional_document_type, additional_document_group_item, additional_document_number); } }); }); } //additional_documents ends } } //reset images function resetSelectedImages(key, value, additional_document_number){ var imageNo = 0; if(key == 'selfie_document'){ imageNo = 11; } else if(key == 'personal_document'){ imageNo = 1; } else if(key == 'business_document'){ imageNo = 2; } else if(key == 'pricing_document'){ imageNo = 3; } else if(key == 'processing_document'){ imageNo = 4; } else if(key == 'residence_document'){ imageNo = 111; } else if(key == 'tax_returns_document'){ imageNo = 311; } else if(key == 'business_document_3_url'){ imageNo = 61; } else if(key == 'business_document_4_url'){ imageNo = 62; } else if(key == 'business_document_5_url'){ imageNo = 63; } else if(key == 'business_document_6_url'){ imageNo = 64; } else if(key == 'business_document_7_url'){ imageNo = 65; } else if(!empty(additional_document_number)){ imageNo = additional_document_number; } clearSelectedPhoto(imageNo, true); $('.proof' + imageNo).closest('div.ui-body').removeClass('completed'); //console.log('>>', $('.proof' + imageNo)); if( (!empty(value)) && ( key == 'business_document_3_url' || key == 'business_document_4_url' || key == 'business_document_5_url' || key == 'business_document_6_url' || key == 'business_document_7_url' || key == 'selfie_document' || key == 'personal_document' || key == 'business_document' || key == 'pricing_document' || key == 'processing_document' || key == 'residence_document' || key == 'tax_returns_document' || key.indexOf('additional_document_') >=0 ) ){ if(imageNo > 0) { //$('.proof' + imageNo + ' .selectedImage .selectedImageInfo').show(); //$('.proof' + imageNo + ' .selectedImage .photo-container').remove(); } console.log('resetSelectedImages(): imageNo', imageNo); console.log('resetSelectedImages(): value', value); // array of all the images var html = ''; $.each(value, function(index, item) { console.log('resetSelectedImages(): index', index); console.log('resetSelectedImages(): item', item); console.log('resetSelectedImages(): item.url', item.url); console.log('resetSelectedImages(): item.hash', item.hash); //check if document is alredy deleted if( (empty(item)) || (empty(item.hash)) || (empty(item.url)) ) { return true; } console.log('resetSelectedImages(): stage',1); if($.inArray(item.hash, deletedDocuments) == -1) { console.log('resetSelectedImages(): stage',2); var imageExt = item.url.split(".").pop(); if(imageExt == 'png' || imageExt == 'jpg' || imageExt == 'jpeg' || imageExt == 'pdf') { console.log('resetSelectedImages(): stage',3); console.log(key , ' url > ', item.url); var option_val = $('.proof' + imageNo).parent().find('select').val(); if(!empty(option_val)) { $('.proof' + imageNo).closest('div.ui-body').addClass('completed'); } html += '
    '; html += '
    '; var pdfchecking = -1; if(!empty(item.url)) pdfchecking = item.url.indexOf(".pdf"); console.log('resetSelectedImages(): pdfchecking', pdfchecking); if(window.REMOVE_BUTTON != true) { if(pdfchecking>-1) { //2 var remove_button_text = 'Remove'; html += '

      '+remove_button_text+'

    '; } else{ //3 var remove_button_text = 'Remove'; html += '

      '+remove_button_text+'

    '; } } html += '
    '; html += '
    '; console.log('resetSelectedImages(): html', html); //$('#selectedImage' + imageNo).html(html); //$('.proof' + imageNo + ' .selectedImage').html(html); //$('#selectedImage' + imageNo).html(html); //$('.proof' + imageNo + ' .selectedImage .selectedImageInfo').hide(); //$('.proof' + imageNo + ' .selectedImage').append(html); //console.log('html', $('.proof' + imageNo + ' .selectedImage').length); //console.log('html', html); //console.log('images div >', $('.proof' + imageNo + ' .selectedImage')); //setTimeout(function(){ //$('#selectedImage' + imageNo + ' .photo img').attr('src', value); //$('.proof' + imageNo + ' .selectedImage .photo img').attr('src', value + '?' + generateRandomNumber()); //}, 500); } } }); if(!empty(html)) { $('.proof' + imageNo + ' .selectedImage .selectedImageInfo').hide(); $('.proof' + imageNo + ' .selectedImage').append(html); } console.log('resetSelectedImages(): updateUploadButtonText()',1); updateUploadButtonText(imageNo); } } var deletedDocuments = []; var removePhotoHash = ''; function removePhotoConfirm(hash){ removePhotoHash = hash; show_device_confirm('confirmRemovePhoto', "Are you sure want to remove the document?" , true); return false; } function removePhoto(){ var hash = removePhotoHash; //if(confirm("Are you sure want to remove the document?")){ showProgressDialog('Deleting...'); var document_type = $( "div[data-hash='"+hash+"']" ).attr('data-document-type'); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/QUALIFY_Wizard.gate'; // alert("QUALIFY_Wizard "+5); setTimeout(function(){ $.ajax({ type: "POST" ,url:url ,data: { action: 'remove_document', document_type:document_type, hash: hash } ,dataType: 'json' ,success:function(data){ console.log('removePhoto', data); setTimeout(function(){ hideProgressDialog(); if(!empty(data.result) && data.result == 'success') { deletedDocuments.push(hash); var rpp = $( "div[data-hash='"+hash+"']" ); scrollToElement($(rpp).closest('.form-group')); if($('#' + $(rpp).parent().parent().parent().attr('id') + ' .photo-container' ).length < 2 ) { $(rpp).closest('.form-group').find('.selectedImageInfo').css('display', 'block') } showDocumentValidImg($('#' + $(rpp).parent().parent().parent().attr('id') ), false); $(rpp).parent().parent().remove(); } else if(!empty(data.msg)) { setTimeout(function() { show_device_alert('ERROR', data.msg); }, 500); } }, 500); } ,error:function() { setTimeout(function() { hideProgressDialog(); show_device_alert('ERROR', "An error occurred, please try again."); }, 500); } ,complete:function(){ //$(el).next().remove(); } }); }, 500); //} return false; } var documents_required = { "11": "slefie_document_type", "1": "personal_document_type", "2": "business_document_type", "3": "pricing_document_type", "4": "processing_document_type", "111": "residence_document_type", "311": "tax_returns_document_type" }; function validateProofOfIdentity(el){ var no_of_error = 0; $.each(documents_required, function( key, value ) { if(isOnboardingRequired(value)) { var error_msg = ''; validateText(document.configureAccount4Form[value], 'onBlur'); if($('#' + value).parent().hasClass('has-error')){ no_of_error++; //console.log('1. ', $('#' + value)); } else{ if($('.proof' + key + ' .photo' + key ).attr('upload-status') == 'uploaded'){ showValidImg($('#' + key)); $('#' + value).parent().parent().next('.help-block').html(''); } else{ showErrorImg($('#' + value)); $('#' + value).parent().parent().next('.help-block').html(error_msg); //$('#' + key).parent().find('.help-block').html(''); //console.log('2. ', $('#' + value).parent().parent().next('.help-block')); } if($('#' + value).parent().hasClass('has-error')) no_of_error++; //console.log('3. ', $('#' + value)); } } else{ if($('.proof' + key + ' .photo' + key + ' img, .proof' + key + ' .photo' + key + ' embed' ).length<1){ $('tr.' + value + '_preview').addClass('do_not_display'); } } }); if(no_of_error>0){ show_device_alert('ERROR', "Please complete the form."); return true; } else{ changePageWithHeaderFooter('#configureAccountAcitve'); } return false; } /* var formSequences = { 1: "#configureaccount", 2: "#configureaccount2", 3: "#configureaccount3", 4: "#postfixform", 5: "#configureaccount4", 6: "#configureAccountAcitve" }; */ var formSequences = { 1: {"ID":"#configureAccount" , "fields":{0:"estimated_average_transaction_value" , 1:"year_doing_business" , 2:"tsys_us_direct_sell_what" , 3:"business_description" , 4:"business_category" , 5:"verification_region"}}, 2: {"ID":"#configureAccount2" , "fields":{0:"tsys_us_direct_first_name" , 1:"tsys_us_direct_middle_name" , 2:"tsys_us_direct_last_name" , 3:"tsys_us_direct_personal_email_address" , 4:"tsys_us_direct_personal_telephone_country_code" , 5:"tsys_us_direct_personal_telephone_number" , 6:"tsys_us_direct_street_address" , 7:"tsys_us_direct_street_address_2" , 8:"tsys_us_direct_city" , 9:"tsys_us_direct_state" , 10:"tsys_us_direct_postal_code" , 11:"tsys_us_direct_country_iso3" , 12:"tsys_us_direct_birth_date" , 13:"tsys_us_direct_gender" , 14:"tsys_us_direct_social_security_number"}}, 3: {"ID":"#configureAccount3" , "fields":{0:"tsys_us_direct_business_name" , 1:"tsys_us_direct_business_type" , 2:"tsys_us_direct_business_registered_country_iso3" , 3:"tsys_us_direct_business_registered_region" , 4:"tsys_us_direct_business_tax_id" , 5:"tsys_us_direct_business_telephone_country_code" , 6:"tsys_us_direct_business_telephone" , 7:"tsys_us_direct_business_email_address" , 8:"tsys_us_direct_business_mailing_street_1" , 9:"tsys_us_direct_business_mailing_street_2" , 10:"tsys_us_direct_business_mailing_city" , 11:"tsys_us_direct_business_mailing_state" , 12:"tsys_us_direct_business_mailing_postal_code" , 13:"tsys_us_direct_business_mailing_country_iso3" , 14:"tsys_us_direct_business_website" , 15:"is_advertise_website" , 16:"legal_tickbox_alert_terms_of_service" , 17:"legal_tickbox_alert_refund_policy" , 18:"legal_tickbox_alert_privacy_policy"}}, 4: {"ID":"#postfixform" , "fields":{}}, 5: {"ID":"#configureAccount4" , "fields":documents_required}, 6: {"ID":"#configureAccountAcitve"} }; function checkAndShowNextForm(nextPageId){ //console.log('formSequences', nextPageId, formSequences[nextPageId]); var no_of_visible_items = 0; /// if(nextPageId == 4) { $('tr.postfixformitem').remove(); // remove all postfix preview item if(!isOnboardingDoNotDisplay('intelitruth_postfix')){ getPostFixFormData(); } else{ // alert(5.0); checkAndShowNextForm(5); } /// } else if( (!empty(formSequences[nextPageId])) && (!empty(formSequences[nextPageId]['fields'])) ){ //alert(1); $.each(formSequences[nextPageId]['fields'], function( key, value ) { if(!isOnboardingDoNotDisplay(value)) { //console.log(key, value); no_of_visible_items++; } }); /// if(!empty(formSequences[nextPageId]['ID'])) { //alert(2); //console.log('no_of_visible_items', no_of_visible_items, formSequences[nextPageId]['ID']); if(no_of_visible_items>0){ //console.log('nextPageId', formSequences[nextPageId]['ID']); changePageWithHeaderFooter(formSequences[nextPageId]['ID']); } else{ checkAndShowNextForm(nextPageId + 1); } } /// } else if(!empty(formSequences[nextPageId])) { //alert(3); changePageWithHeaderFooter(formSequences[nextPageId]['ID']); } //alert("window.account_hash,"+window.account_hash); //alert("window.premiuum_account_hash,"+window.premiuum_account_hash); //alert("window.WHITELABEL_account_hash,"+window.WHITELABEL_account_hash); if( (nextPageId == 5) && ( (window.account_hash == window.premiuum_account_hash) || (window.WHITELABEL_account_hash == window.premiuum_account_hash) ) ) { //alert(111111); } // return false; return true; } function confirmAdditionalProofOfIdentity(el){ var additional_business_document_number = $('.additional_business_document_number').val(); var no_of_error = 0; //console.log('business_document_', 'business_document_' + (2+additional_business_document_number) + '_type'); validateText(document.configureAccountAdditionalIdentityForm['business_document_' + (2+ parseInt(additional_business_document_number) ) + '_type'], 'onBlur'); if($('#additional_business_document_type').parent().hasClass('has-error')){ no_of_error++; } else{ if($('.proof6' + additional_business_document_number + ' .photo6' + additional_business_document_number).attr('upload-status') == 'uploaded'){ showValidImg($('#additional_business_document_type')); $('#additional_business_document_type').parent().find('.help-block').html(''); } else{ showErrorImg($('#additional_business_document_type')); //$('#personal_document_type').parent().find('.help-block').html('Please upload document'); $('#additional_business_document_type').parent().find('.help-block').html(''); } if($('#additional_business_document_type').parent().hasClass('has-error')) no_of_error++; } if(no_of_error>0){ show_device_alert('ERROR', "Please complete the form."); return true; } else{ if(additional_business_document_number < 5){ buildDocument3Uploader(++additional_business_document_number); return false; } completeAdditionalProofOfBusinessIdentity(); } return false; } function completeAdditionalProofOfBusinessIdentity(){ ////gateway.payyap.network/KYC_Wizard_followup.gate?member_hash=_XXXXX_&business_account_hash=_XXXXX_&business_document_3_action=confirmed //var apiData = { member_hash: member_hash, business_account_hash: account_hash, business_document_3_action: "confirmed"}; var apiData = { member_hash: member_hash, business_account_hash: selected_account_hash, additional_document_status: "complete"}; showProgressDialog('Processing'); setTimeout(function(){ $.ajax({ type: "POST" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_Wizard_followup.gate' ,data: apiData //,dataType: 'json' ,success:function(data){ setTimeout(function(){ hideProgressDialog(); show_device_alert('SUCCESS', data); setTimeout(function(){ //showStepPage('#account_form'); showAccountLists(); }, 500); }, 500); } ,error:function(){ setTimeout(function(){ hideProgressDialog(); show_device_alert('ERROR', "An error occurred, please try again."); }, 500); } ,complete:function(){ //$(el).next().remove(); } }); }, 500); return false; } function activeMerchantID(el){ if(isOnboardingRequired('signature_url') && empty($('#sign').attr('src')) ){ show_device_alert('ERROR', "Please upload your signature."); return false; } var no_of_error = 0; /* var tsys_us_direct_personal_email_address = $('#tsys_us_direct_personal_email_address').val(); var tsys_us_direct_first_name = $('#tsys_us_direct_first_name').val(); var tsys_last_name = $('#tsys_last_name').val(); var tsys_last_name = $('#tsys_last_name').val(); var tsys_street_address = $('#tsys_street_address').val(); var tsys_zip_code = $('#tsys_zip_code').val(); //var tsys_city_stats = $('#tsys_city_stats').val(); var tsys_phone_number = $('#tsys_phone_number').val(); var tsys_social_security_number = $('#tsys_social_security_number').val(); var tsys_personal_id_number = $('#tsys_personal_id_number').val(); var tsys_birth_year = $('#tsys_birth_year').val(); var tsys_birth_month = $('#tsys_birth_month').val(); var tsys_birth_day = $('#tsys_birth_day').val(); //var TSYS_merchant_account_id = $('#TSYS_merchant_account_id').val(); //,url:'//gateway.'+API_DOMAIN+'/TSYS_Merchant_Account_ID_registration.gate' //var isBusinessMoreThanOneYearOld = $('input[name=isBusinessMoreThanOneYear]:checked').val(); var isBusinessAcceptCreditCard = $('input[name=isBusinessAcceptCreditCard]:checked').val(); var year_doing_business = $('#year_doing_business').val(); //US DIRECT form data var tsys_us_direct_first_name = $('#tsys_us_direct_first_name').val(); var tsys_us_direct_middle_name = $('#tsys_us_direct_middle_name').val(); var tsys_us_direct_last_name = $('#tsys_us_direct_last_name').val(); var tsys_us_direct_personal_email_address = $('#tsys_us_direct_personal_email_address').val(); var tsys_us_direct_business_name = $('#tsys_us_direct_business_name').val(); var tsys_us_direct_business_type = $('#tsys_us_direct_business_type').val(); var tsys_us_direct_business_registered_country_iso3 = $('#tsys_us_direct_business_registered_country_iso3').val(); var tsys_us_direct_business_registered_region = $('#tsys_us_direct_business_registered_region').val(); var tsys_us_direct_business_tax_id = $('#tsys_us_direct_business_tax_id').val(); var tsys_us_direct_business_telephone_country_code = $('#tsys_us_direct_business_telephone_country_code').val(); var tsys_us_direct_business_telephone = $('#tsys_us_direct_business_telephone').val(); var tsys_us_direct_business_email_address = $('#tsys_us_direct_business_email_address').val(); var tsys_us_direct_business_mailing_street_1 = $('#tsys_us_direct_business_mailing_street_1').val(); var tsys_us_direct_business_mailing_street_2 = $('#tsys_us_direct_business_mailing_street_2').val(); var tsys_us_direct_business_mailing_city = $('#tsys_us_direct_business_mailing_city').val(); var tsys_us_direct_business_mailing_state = $('#tsys_us_direct_business_mailing_state').val(); var tsys_us_direct_business_mailing_postal_code = $('#tsys_us_direct_business_mailing_postal_code').val(); var tsys_us_direct_business_mailing_country_iso3 = $('#tsys_us_direct_business_mailing_country_iso3').val(); var tsys_us_direct_personal_telephone_country_code = $('#onboarding_tsys_us_direct_personal_telephone_country_code').val(); var tsys_us_direct_personal_telephone_number = $('#tsys_us_direct_personal_telephone_number').val(); var tsys_us_direct_sell_what = $('#tsys_us_direct_sell_what').val(); var tsys_us_direct_business_website = $('#tsys_us_direct_business_website').val(); var is_advertise_website = document.configureAccount3Form['is_advertise_website'].checked; var tsys_us_direct_street_address = $('#tsys_us_direct_street_address').val(); var tsys_us_direct_street_address_2 = $('#tsys_us_direct_street_address_2').val(); var tsys_us_direct_city = $('#tsys_us_direct_city').val(); var tsys_us_direct_state = $('#tsys_us_direct_state').val(); var tsys_us_direct_postal_code = $('#tsys_us_direct_postal_code').val(); var tsys_us_direct_country_iso3 = $('#tsys_us_direct_country_iso3').val(); var tsys_us_direct_social_security_number = $('#tsys_us_direct_social_security_number').val(); var tsys_us_direct_birth_date = $('#tsys_us_direct_birth_date').val(); var personal_document_type = $('#personal_document_type').val(); var business_document_type = $('#business_document_type').val(); var pricing_document_type = $('#pricing_document_type').val(); var processing_document_type = $('#processing_document_type').val(); var residence_document_type = $('#residence_document_type').val(); var tax_returns_document_type = $('#tax_returns_document_type').val(); // var business_category = $('#business_category').val(); var business_description = $('#business_description').val(); var authorization_to_email_EIN_FAQ = document.configureAccount3Form['authorization_to_email_EIN_FAQ'].checked; */ //var apiData = { member_hash: member_hash, business_account_hash: selected_account_hash, region: verification_region, business_category:business_category, year_doing_business: year_doing_business, business_accept_credit_card: isBusinessAcceptCreditCard, tsys_email_address: tsys_email_address, tsys_first_name: tsys_first_name, tsys_last_name: tsys_last_name, tsys_street_address: tsys_street_address, tsys_zip_code: tsys_zip_code, tsys_phone_number: tsys_phone_number, tsys_social_security_number: tsys_social_security_number, tsys_personal_id_number: tsys_personal_id_number, tsys_birth_year: tsys_birth_year, tsys_birth_month: tsys_birth_month, tsys_birth_day: tsys_birth_day}; //if(verification_region == 'united_states'){ /* var apiData = { member_hash: member_hash , business_account_hash: selected_account_hash , region: verification_region , business_category:business_category , business_description: business_description , year_doing_business: year_doing_business , business_accept_credit_card: isBusinessAcceptCreditCard , tsys_us_direct_first_name: tsys_us_direct_first_name , tsys_us_direct_middle_name: tsys_us_direct_middle_name , tsys_us_direct_last_name: tsys_us_direct_last_name , tsys_us_direct_personal_email_address: tsys_us_direct_personal_email_address , tsys_us_direct_personal_telephone_country_code: tsys_us_direct_personal_telephone_country_code , tsys_us_direct_personal_telephone_number: tsys_us_direct_personal_telephone_number , tsys_us_direct_business_name: tsys_us_direct_business_name , tsys_us_direct_business_type: tsys_us_direct_business_type , tsys_us_direct_business_registered_country_iso3: tsys_us_direct_business_registered_country_iso3 , tsys_us_direct_business_registered_region: tsys_us_direct_business_registered_region , tsys_us_direct_business_tax_id: tsys_us_direct_business_tax_id , tsys_us_direct_business_telephone_country_code: tsys_us_direct_business_telephone_country_code , tsys_us_direct_business_telephone: tsys_us_direct_business_telephone , tsys_us_direct_business_email_address: tsys_us_direct_business_email_address , tsys_us_direct_business_mailing_street_1: tsys_us_direct_business_mailing_street_1 , tsys_us_direct_business_mailing_street_2: tsys_us_direct_business_mailing_street_2 , tsys_us_direct_business_mailing_city: tsys_us_direct_business_mailing_city , tsys_us_direct_business_mailing_state: tsys_us_direct_business_mailing_state , tsys_us_direct_business_mailing_postal_code: tsys_us_direct_business_mailing_postal_code , tsys_us_direct_business_mailing_country_iso3: tsys_us_direct_business_mailing_country_iso3 , tsys_us_direct_street_address: tsys_us_direct_street_address , tsys_us_direct_street_address_2: tsys_us_direct_street_address_2 , tsys_us_direct_city: tsys_us_direct_city , tsys_us_direct_state: tsys_us_direct_state , tsys_us_direct_postal_code: tsys_us_direct_postal_code , tsys_us_direct_country_iso3: tsys_us_direct_country_iso3 , tsys_us_direct_gender: tsys_us_direct_gender , tsys_us_direct_social_security_number: tsys_us_direct_social_security_number , tsys_us_direct_sell_what: tsys_us_direct_sell_what , tsys_us_direct_business_website:tsys_us_direct_business_website , is_advertise_website: is_advertise_website , tsys_us_direct_birth_date: tsys_us_direct_birth_date , personal_document_type: personal_document_type , business_document_type: business_document_type , pricing_document_type: pricing_document_type , processing_document_type: processing_document_type , residence_document_type: residence_document_type , tax_returns_document_type: tax_returns_document_type , authorization_to_email_EIN_FAQ: authorization_to_email_EIN_FAQ }; */ var apiData = {member_hash: member_hash, business_account_hash: selected_account_hash}; //} //$(el).parent().append('
    '); showProgressDialog("Processing..."); setTimeout(function(){ var AJAX_URL = siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_Wizard.gate'; //alert("AJAX_URL: "+AJAX_URL); $.ajax({ type: "POST" ,url:AJAX_URL ,data: apiData ,success:function(raw_data){ //alert("raw_data: "+raw_data); var data = JSON.parse(raw_data); console.log('data', data); setTimeout(function(){ hideProgressDialog(); show_device_alert('SUCCESS', data.system_message); if( (!empty(data.PROFILE_ON_SUBMIT_REDIRECT_URL)) && (data.PROFILE_ON_SUBMIT_REDIRECT_URL != "") ){ // URL FROM CALLBACK window.top.location.href = data.PROFILE_ON_SUBMIT_REDIRECT_URL; return true; } else if( (!empty(data.onboarding_post_submission_url)) && (data.onboarding_post_submission_url != "") ) { //window.location.assign(data.onboarding_post_submission_url); window.top.location.href = data.onboarding_post_submission_url; return true; } setTimeout(function() { showAccountLists(); }, 500); }, 500); } ,error:function(){ setTimeout(function(){ hideProgressDialog(); show_device_alert('ERROR', "(1) An error occurred, please try again."); }, 500); } ,complete:function(){ //$(el).next().remove(); } }); }, 500); return false; } function submitSinglePageForm(el){ var no_of_error = 0; if(isOnboardingRequired('singlepage_first_name')) { validateText(document.singlepageForm['singlepage_first_name'], 'onBlur'); if($('#singlepage_first_name').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('singlepage_last_name')) { validateText(document.singlepageForm['singlepage_last_name'], 'onBlur'); if($('#singlepage_last_name').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('singlepage_email_address')) { validateText(document.singlepageForm['singlepage_email_address'], 'onBlur'); if($('#singlepage_email_address').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('singlepage_country_code')) { validateText(document.singlepageForm['singlepage_country_code'], 'onBlur'); if($('#singlepage_country_code').parent().hasClass('has-error')) no_of_error++; } if(isOnboardingRequired('singlepage_mobile_number')) { validateText(document.singlepageForm['singlepage_mobile_number'], 'onBlur'); if($('#singlepage_mobile_number').parent().hasClass('has-error')) no_of_error++; } //selfie check start var key = '11'; var value = 'slefie_document_type'; if(isOnboardingRequired(value)) { var error_msg = ''; validateText(document.singlepageForm[value], 'onBlur'); if($('#' + value).parent().hasClass('has-error')){ no_of_error++; //console.log('1. ', $('#' + value)); } else{ if($('.proof' + key + ' .photo' + key ).attr('upload-status') == 'uploaded'){ showValidImg($('#' + key)); $('#' + value).parent().parent().next('.help-block').html(''); } else{ showErrorImg($('#' + value)); $('#' + value).parent().parent().next('.help-block').html(error_msg); //$('#' + key).parent().find('.help-block').html(''); //console.log('2. ', $('#' + value).parent().parent().next('.help-block')); } if($('#' + value).parent().hasClass('has-error')) no_of_error++; //console.log('3. ', $('#' + value)); } } //selfie check end if(isOnboardingRequired('signature_url') ){ if(empty($('#sign').attr('src')) ){ show_device_alert('ERROR', "Please upload your signature."); return false; } } var singlepage_first_name = $('#singlepage_first_name').val(); var singlepage_last_name = $('#singlepage_last_name').val(); var singlepage_email_address = $('#singlepage_email_address').val(); var singlepage_country_code = $('#singlepage_country_code').val(); var singlepage_mobile_number = $('#singlepage_mobile_number').val(); var singlepage_selfie_url = ''; var singlepage_signature_url = ''; //MOVE TO QUEUE START var form_type_display_queue_class='do_not_display'; var form_type_display_queue = getOnboardingPreference('form_type_display_queue'); if(!empty(form_type_display_queue) && form_type_display_queue == 'on'){ form_type_display_queue_class = 'optional'; } //$('#singlepage_queue').addClass(form_type_display_queue_class); if($('#singlepage_queue').length < 1 ){ var upload_queue_wrapper = `
    `; $('#singlepageForm').parent().append(upload_queue_wrapper); } //prepare queue var queue_hash = rand(); var singlepage_name = singlepage_first_name + ' ' + singlepage_last_name; var selfieImage = $('#capturePhoto11').attr('src'); var singImage = $('#sign').attr('src'); var html = '

    ' + singlepage_name + '

    '; if(!empty(selfieImage)){ html += '
    '; } if(!empty(singImage)){ html += '
    '; } html += '
    '; html += '
    '; html += '0%'; html += '
    '; html += '
    '; $('#singlepage_queue').prepend(''); //Select item image and pass to the function var item = $("#singlepageForm"); if(form_type_display_queue == 'on'){ flyToElement($(item), $('#singlepage_queue')); } else{ $('#singlepage_first_name').focus(); } uploadQueueItem(queue_hash); $("#singlepageForm")[0].reset(); $('#sign').attr('src', ''); $('#sign').attr('src', ''); $('#selectedImage11').html('
    With your mobile device camera, you may now please take a live Selfie
    '); $("#singlepageForm fieldset").removeClass('completed'); $('#singlepage_message').html(''); //MOVE TO QUEUE END return false; /* var apiData = { action: 'singlepage_form', whitelabel_business_account_hash: whitelabel_business_account_hash, singlepage_first_name:singlepage_first_name, singlepage_last_name:singlepage_last_name, singlepage_email_address: singlepage_country_code: singlepage_country_code, singlepage_mobile_number: singlepage_mobile_number , singlepage_selfie_url: singlepage_selfie_url, singlepage_signature_url: singlepage_signature_url }; showProgressDialog('Processing...'); setTimeout(function(){ $.ajax({ type: "POST" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_Wizard.gate' ,data: apiData //,dataType: 'json' ,success:function(data){ setTimeout(function(){ hideProgressDialog(); show_device_alert('SUCCESS', data); //member_hash: member_hash, setTimeout(function(){ //if(!empty(data.member_hash)){ $("#singlepageForm")[0].reset(); //changeBackPage('#singlepage'); if($('#singlepage_queue').length < 1 ){ var upload_queue_wrapper = `
    `; $('#singlepageForm').parent().append(upload_queue_wrapper); } //var queue_item = `
    //
    `; //$('#singlepage_queue').prepend(queue_item); //prepare queue var queue_hash = rand(); var singlepage_name = singlepage_first_name + ' ' + singlepage_last_name; var selfieImage = $('#capturePhoto11').attr('src'); var singImage = $('#sign').attr('src'); var html = '

    ' + singlepage_name + '

    '; if(!empty(selfieImage)){ html += '
    '; } if(!empty(singImage)){ html += '
    '; } $('#singlepage_queue').prepend(''); //Scroll to top if cart icon is hidden on top //$('html, body').animate({ // 'scrollTop' : $(".singlepage_queue").position().top //}); //Select item image and pass to the function var item = $("#singlepageForm"); flyToElement($(item), $('#singlepage_queue')); //uploadQueueItem(queue_hash); //} //else{ //} }, 500); }, 500); } ,error:function(){ setTimeout(function(){ hideProgressDialog(); show_device_alert('ERROR', 'An error occurred, please try again.'); }, 500); } ,complete:function(){ //$(el).next().remove(); } }); }, 500); return false; */ } /*! * Function: flyToElement * Author: CodexWorld * Author URI: http://www.codexworld.com * Author Email: contact@codexworld.com * Description: This function is used for adding flying effect to the element. */ function flyToElement(flyer, flyingTo) { var $func = $(this); var divider = 3; var flyerClone = $(flyer).clone(); $(flyerClone).css({position: 'absolute', top: $(flyer).offset().top + "px", left: $(flyer).offset().left + "px", opacity: 1, 'z-index': 1000}); $('body').append($(flyerClone)); var gotoX = $(flyingTo).offset().left + ($(flyingTo).width() / 2) - ($(flyer).width()/divider)/2; var gotoY = $(flyingTo).offset().top + ($(flyingTo).height() / 2) - ($(flyer).height()/divider)/2; $(flyerClone).animate({ opacity: 0.4, left: gotoX, top: gotoY, width: $(flyer).width()/divider, height: $(flyer).height()/divider }, 700, function () { $(flyingTo).fadeOut('fast', function () { $(flyingTo).fadeIn('fast', function () { $(flyerClone).fadeOut('fast', function () { $(flyerClone).remove(); $('.queue-item').eq(0).fadeIn('fast'); $('#singlepage_first_name').focus(); }); }); }); }); } function addImageInFormData(imageName, imageData, formData){ var type = 'image/jpeg'; if(!empty(imageData)){ var base64ImageContent = imageData.replace(/^data:(image|application)\/(png|jpg|pdf);base64,/, ""); var binary = atob(imageData.split(',')[1]); var array = []; for (var i = 0; i < binary.length; i++) { array.push(binary.charCodeAt(i)); } var file = new Blob([new Uint8Array(array)], {type: type}); formData.append(imageName, file); } return formData; } function uploadQueueItem(queue_hash){ var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_Wizard.gate'; var singlepage_first_name = $('#singlepage_first_name').val(); var singlepage_last_name = $('#singlepage_last_name').val(); var singlepage_email_address = $('#singlepage_email_address').val(); var singlepage_country_code = $('#singlepage_country_code').val(); var singlepage_mobile_number = $('#singlepage_mobile_number').val(); var singlepage_selfie_url = ''; var singlepage_signature_url = ''; var selfieImage = $('#capturePhoto11').attr('src'); var singImage = $('#sign').attr('src'); var formData = new FormData(); formData.append("whitelabel_business_account_hash", whitelabel_business_account_hash); formData.append("singlepage_first_name", singlepage_first_name); formData.append("singlepage_last_name", singlepage_last_name); formData.append("singlepage_email_address", singlepage_email_address); formData.append("singlepage_country_code", singlepage_country_code); formData.append("singlepage_mobile_number", singlepage_mobile_number); formData = addImageInFormData('selfieImage', selfieImage, formData); formData = addImageInFormData('singImage', singImage, formData); formData.append("device", "desktop"); formData.append("action", "singlepage_form"); formData.append("extension", 'png'); $.ajax({ url: url, type: "POST", cache: false, contentType: false, processData: false, data: formData, dataType: 'json', xhr: function(){ //upload Progress var xhr = $.ajaxSettings.xhr(); if (xhr.upload) { xhr.upload.addEventListener('progress', function(event) { var percent = 0; var position = event.loaded || event.position; var total = event.total; if (event.lengthComputable) { percent = Math.ceil(position / total * 100); } console.log('percent = ', percent); //update progressbar $('.queue-item[data-queue-hash="' + queue_hash + '"]').find(".progress-bar").html(percent +"%").css("width", + percent +"%"); }, true); } return xhr; }, mimeType:"multipart/form-data" }) .done(function(data){ //alert('done!'); console.log('queue_hash', queue_hash, data); $('.queue-item[data-queue-hash="' + queue_hash + '"]').find(".progress-bar").html(data.msg); console.log($('.queue-item[data-queue-hash="' + queue_hash + '"]')); //$('.queue-item[data-queue-hash="' + queue_hash + '"]').find(".progress").remove(); //uploadFinished(data) }); } function sendGettingMerchantIDInstruction(el){ $(el).parent().append('
    '); $.ajax({ type: "POST" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/PAYYAP_send_merchant_account_instructions.gate' ,data: { member_hash: member_hash, business_account_hash: selected_account_hash, TSYS_merchant_account_id: '' } //,dataType: 'json' ,success:function(data){ show_device_alert('SUCCESS', data); goToTopOfPage(); $('#TSYS_merchant_account_id').focus(); } ,error:function(){ show_device_alert('ERROR', "An error occurred, please try again."); } ,complete:function(){ $(el).next().remove(); } }); return false; } function playDemoVideo(){ if(empty(YOUTUBE_Services_Video_ID)) return false; else if($('#youtubeImage').attr('src') == 'loading.gif') return false; window.location.href = SITE_SCHEMA+'://openLink/youtube?vid=' + YOUTUBE_Services_Video_ID; return false; } function youtubeDemoVideoLoaded(){ $('#youtubeImage').attr('src', 'youtube-512.png'); } function checkBusinessWebsiteIsNotEmpty(el){ if(document.configureAccount3Form['is_advertise_website'].checked){ if(empty($('#tsys_us_direct_business_website').val())){ show_device_alert('ERROR', "To qualify for free advertising, and a listing on the PAYYAP.network Business Directory, you must please set your business webpage / URL."); document.configureAccount3Form['is_advertise_website'].checked = false; //return false; } } } function confirmTermsPolicies(el){ if($(el).is(':checked')){ var key = $(el).attr('id'); var selected_account_details = getSelectAccountDetails(); show_device_alert('ALERT!', selected_account_details[key]); } } function validateSocialSecurityNumber(id, validate_tax_id_country_iso3, callback){ //'#tsys_us_direct_social_security_number' //$(id).val() var ssn = $(id).val(); var tax_id_country_iso3 = $(validate_tax_id_country_iso3).val(); if(empty(ssn)){ if(!empty(callback)) callback(); return false; } else if($(id).attr('data-validation-status') == 'valid'){ if(!empty(callback)) callback(); return false; } else if($(id).attr('data-validation-status') == 'invalid'){ if(!empty(callback)) callback(); return false; } showProgressDialog('Checking ' + $(id).attr('placeholder')) + '...'; setTimeout(function(){ var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/social_security_checker.gate'; $.ajax({ type: "GET" ,url: url ,data: {tsys_us_direct_social_security_number: ssn, tax_country_iso3: tax_id_country_iso3} ,dataType: 'json' ,success:function(data){ hideProgressDialog(); setTimeout(function(){ //console.log(data); if(data.status == 'VALID'){ //$(id).val(data.ssn); //$('#btnActivateUSDirectAccount').removeAttr('disabled'); $(id).attr('data-validation-status', 'valid'); if(!empty(callback)) callback(); } else{ showErrorImg($(id)); $(id).attr('data-validation-status', 'invalid'); //$('#btnActivateUSDirectAccount').attr('disabled', 'disabled'); show_device_alert('ERROR', 'INVALID ' + $(id).attr('placeholder') ); $(id).focus(); } }, 500); } ,error:function(){ hideProgressDialog(); setTimeout(function(){ show_device_alert('ERROR', globalErrorMessage + API_DOMAIN); }, 500); } ,complete:function(){ //hideProgressDialog(); } }); }, 1000); } function actionBarItem(action){ window.location.href = SITE_SCHEMA+'://actionBarItem?action=' + action; return false; } function openActionBarMenu(){ $('.dropdown').addClass('open'); // Opens the dropdown } function getTermsAndConditionsAggreementText(){ var key = 'step_4_of_4_proof_of_identity_introduction_text'; var selected_account_details = getSelectAccountDetails(); if(!empty(selected_account_details) && !empty(selected_account_details[key])){ $('#step_4_of_4_proof_of_identity_introduction_text').html(selected_account_details[key]); } key = 'final_confirmation_notes_prior_to_signature_and_submission'; if(!empty(selected_account_details) && !empty(selected_account_details[key])){ $('#final_confirmation_notes_prior_to_signature_and_submission').html(selected_account_details[key]); } //if(empty($('#tsys_service_agreement').html())){ /* $('#tsys_service_agreement').html('
    '); $.ajax({ type: "GET" ,url:siteProtocol + '//'+API_DOMAIN+'/link_gateway/PROPAY_terms_of_service.gate?link_from_payyap=yes' ,data: {} //,dataType: 'json' ,success:function(data){ $('#tsys_service_agreement').html(data); } ,error:function(){ } ,complete:function(){ } }); */ if(kyc_session['onboarding_preferences'] == null) kyc_session['onboarding_preferences'] = ""; if( (!empty(kyc_session['onboarding_preferences'])) ) { var terms_link = ''; if(!empty(kyc_session['onboarding_preferences']['onboarding_terms_of_service_url'])){ terms_link = 'Terms of Service'; if(form_flow == 'single_page'){ terms_link = 'Click here to see Terms of Service'; } } else if(!empty(kyc_session['onboarding_preferences']['onboarding_terms_of_service_text'])){ terms_link = ''; if(form_flow == 'single_page'){ terms_link = '
    ' + kyc_session['onboarding_preferences']['onboarding_terms_of_service_text'] + '
    '; } } if(form_flow == 'single_page'){ $('#singlepage_service_agreement').html(terms_link); } else{ $('#tsys_service_agreement').html(terms_link); } } //} return false; } function showProofOfBusinessUploader(el, uploader){ if(empty($(el).val())){ $('.' + uploader).addClass('hide-row'); } else{ $('.' + uploader).removeClass('hide-row'); //window.location.href = SITE_SCHEMA+'://setProofOfBusiness?uploader_name=' + uploader + 'option=' + escape($(el).find('option:selected').text()); //alert($(el).find('option:selected').text()); } return false; } var proofOfBusinessUploaderAction = ''; var proofOfBusinessUploaderNo = ''; function confirmTakePhoto(n){ //alert("confirmTakePhoto: "+n); proofOfBusinessUploaderAction = 'takePhoto'; confirmTakeOrSelectPhoto(n,true); return false; } function confirmSelectPhoto(n){ //alert("confirmSelectPhoto: "+n); proofOfBusinessUploaderAction = 'selectPhoto'; confirmTakeOrSelectPhoto(n,false); return false; } function confirmTakeOrSelectPhoto(n,display_confirmation_message) { //alert("confirmTakeOrSelectPhoto: "+n); proofOfBusinessUploaderNo = n; console.log('confirmTakeOrSelectPhoto', n); console.log('confirmTakeOrSelectPhoto',1); var selected_account_details = getSelectAccountDetails(); console.log('confirmTakeOrSelectPhoto',2); var selectedIndex = $('.proof' + n).prev().find(":selected").index() - 1; console.log('confirmTakeOrSelectPhoto',3); var confirmationText = ''; if(!empty(selected_account_details)) { if(n == '11'){ if(!empty(selected_account_details.KYC_confirmation_text_selfie)) confirmationText = selected_account_details.KYC_confirmation_text_selfie[selectedIndex]; } else if(n == '1'){ if(!empty(selected_account_details.KYC_confirmation_text_proof_of_person)) confirmationText = selected_account_details.KYC_confirmation_text_proof_of_person[selectedIndex]; } else if(n == '2'){ if(!empty(selected_account_details.KYC_confirmation_text_proof_of_business)) confirmationText = selected_account_details.KYC_confirmation_text_proof_of_business[selectedIndex]; } else if(n == '3'){ if(!empty(selected_account_details.KYC_confirmation_text_proof_of_pricing)) confirmationText = selected_account_details.KYC_confirmation_text_proof_of_pricing[selectedIndex]; } else if(n == '4'){ if(!empty(selected_account_details.KYC_confirmation_text_proof_of_processing)) confirmationText = selected_account_details.KYC_confirmation_text_proof_of_processing[selectedIndex]; } else if(n == '111'){ if(!empty(selected_account_details.KYC_confirmation_text_proof_of_personal_residence)) confirmationText = selected_account_details.KYC_confirmation_text_proof_of_personal_residence[selectedIndex]; } else if(n == '311'){ if(!empty(selected_account_details.KYC_confirmation_text_proof_of_business_tax_returns)) confirmationText = selected_account_details.KYC_confirmation_text_proof_of_business_tax_returns[selectedIndex]; } else if(n == '61'){ if(!empty(selected_account_details.activate_business_document_3_pulldown_option_confirmation_text)) confirmationText = selected_account_details.activate_business_document_3_pulldown_option_confirmation_text[selectedIndex]; } else if(n == '62'){ if(!empty(selected_account_details.activate_business_document_4_pulldown_option_confirmation_text)) confirmationText = selected_account_details.activate_business_document_4_pulldown_option_confirmation_text[selectedIndex]; } else if(n == '63'){ if(!empty(selected_account_details.activate_business_document_5_pulldown_option_confirmation_text)) confirmationText = selected_account_details.activate_business_document_5_pulldown_option_confirmation_text[selectedIndex]; } else if(n == '64'){ if(!empty(selected_account_details.activate_business_document_6_pulldown_option_confirmation_text)) confirmationText = selected_account_details.activate_business_document_6_pulldown_option_confirmation_text[selectedIndex]; } else if(n == '65'){ if(!empty(selected_account_details.activate_business_document_7_pulldown_option_confirmation_text)) confirmationText = selected_account_details.activate_business_document_7_pulldown_option_confirmation_text[selectedIndex]; } } console.log('confirmTakeOrSelectPhoto',4); confirmationText = 'TIPS:\n• Keep it in the frame.\n• Keep it clear.\n(no one likes a blurry photo)\n• Be sure it’s good!'; if(!empty(confirmationText)){ console.log('confirmTakeOrSelectPhoto',5); //var c = confirm(confirmationText, "Confirm"); //if(!c) return false; //setTimeout(function(){ show_device_confirm("confirmSelectOption", confirmationText, display_confirmation_message); //},1000); console.log('confirmTakeOrSelectPhoto',6); } else{ //show_device_alert('ERROR', 'Please select document type.'); //$("#configureAccount4Form").submit(); if(empty($('.proof' + n).prev().find(":selected").val())) show_device_alert('ERROR', "Please select document type."); else eval(''+proofOfBusinessUploaderAction+'('+n+')'); } //takePhoto(n); return false; } function setSelectOption(el){ console.log("Previous val > ", $(el).val()); proofOfBusinessUploaderPreviousOption = $(el).val(); } function confirmSelectOption(r){ console.log('confirmSelectOption',1); console.log('confirmSelectOption', r); console.log('proofOfBusinessUploaderAction', proofOfBusinessUploaderAction); console.log('proofOfBusinessUploaderNo', proofOfBusinessUploaderNo); if(r == 'yes'){ console.log('confirmSelectOption',2); //$('.' + proofOfBusinessUploaderAction).removeClass('hide-row'); console.log(''+proofOfBusinessUploaderAction+'('+proofOfBusinessUploaderNo+')'); console.log('confirmSelectOption',3); eval(''+proofOfBusinessUploaderAction+'('+proofOfBusinessUploaderNo+')'); console.log('confirmSelectOption',4); } else{ //$('.' + proofOfBusinessUploaderAction).prev().find("select").val(proofOfBusinessUploaderPreviousOption); } } /////////////////////////////////////////////////////////////// /// start: saveText function saveText(field, callerEvent) { var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_onBLUR.gate'; var fieldName = $(field).attr('name'); var fieldValue = $(field).val(); if(fieldName == 'tsys_us_direct_business_website'){ if(!empty(fieldValue)){ if(!/^(https?|ftp):\/\//i.test(fieldValue)) { fieldValue = 'http://'+fieldValue; // set both the value $(field).val(fieldValue); // also update the form element //saveText(field,'onblur'); $(field).focus(); $(field).blur(); } } } window.WHITELABEL_account_hash = ""; //alert("0: "+window.WHITELABEL_account_hash); /////////////////////////////////////// /// set account hash and names here var premiuum_account_hash = window.premiuum_account_hash = "60b7b3ac9bed4fad20d5e1e7a0a7fc8f"; if( (window.WHITELABEL_account_hash == premiuum_account_hash) && (fieldName == "additional_document_personal8810") ) { /// update additional personal document 2 $('#additional_document_personal8811').attr('disabled', false); /// get value from additional personal document 1 var pulldown_value = $("#additional_document_personal8810").find('option:selected').val(); //alert("1: "+pulldown_value); console.log("pulldown_value", pulldown_value); if(pulldown_value) { /// replace "Front" with "Back" var matching_pulldown_value = pulldown_value.replace("%28Front%29", "%28Back%29"); console.log("matching_pulldown_value", matching_pulldown_value); /// update additional personal document 2 $("#additional_document_personal8811").val(matching_pulldown_value); $("#additional_document_personal8811").val(matching_pulldown_value).trigger('change'); /// update additional personal document 2 $('#additional_document_personal8811').attr('disabled', true); /// works but only deletes. /// need to add "add" when they select another option else it jus keeps deleting options. //$("#additional_document_personal8812 option[value='"+pulldown_value+"']").remove(); } } if( (window.WHITELABEL_account_hash == premiuum_account_hash) && (fieldName == "additional_document_personal8812") ) { /// update additional personal document 2 $('#additional_document_personal8813').attr('disabled', false); /// get value from additional personal document 1 var pulldown_value = $("#additional_document_personal8812").find('option:selected').val(); //alert("2: "+pulldown_value); /// replace "Front" with "Back" var matching_pulldown_value = pulldown_value.replace("%28Front%29", "%28Back%29"); /// update additional personal document 2 $("#additional_document_personal8813").val(matching_pulldown_value).trigger('change'); /// update additional personal document 2 $('#additional_document_personal8813').attr('disabled', true); } if(typeof(callerEvent) != 'undefined') { if(callerEvent.toUpperCase() == "ONCHANGE") { url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_onCHANGE.gate'; } } if(fieldName == 'tsys_us_direct_social_security_number'){ $(field).attr('data-validation-status', ''); } else if(fieldName == 'authorization_to_email_EIN_FAQ'){ fieldValue = 'no'; if($('#authorization_to_email_EIN_FAQ').prop("checked")) fieldValue = 'yes'; if(fieldValue == 'yes'){ //$('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#authorization_to_email_EIN_FAQ').attr('disabled', 'disabled'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().addClass('hide-row'); } else{ //$('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().removeClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().removeClass('hide-row'); } } /* else if(fieldName == 'tsys_us_direct_business_type'){ if(empty(fieldValue)){ // } else if(fieldValue == 'unregistered'){ //openEINConfirmationPopup(); $('#authorization_to_email_EIN_FAQ').prop("checked", false); $('#authorization_to_email_EIN_FAQ').parent().parent().removeClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().addClass('hide-row'); } else if(fieldValue == 'Certified DBA'){ $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); if(empty($('#business_document_type').val())){ $('#business_document_type').val('State-Issued Sole Proprietor / DBA Certificate'); $('.proof2').removeClass('hide-row'); } //$('#btnActivateUSDirectFinalAccount').parent().removeClass('hide-row'); } else{ $('#authorization_to_email_EIN_FAQ').prop("checked", false); $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().removeClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().removeClass('hide-row'); } } */ else if(fieldName == 'is_advertise_website'){ fieldValue = 'no'; if($('#is_advertise_website').prop("checked")) fieldValue = 'yes'; } $('#' + fieldName).parent().addClass('hidden'); $('#saveText_processing').remove(); $('#' + fieldName).parent().append(''); //console.log('url, fieldName,fieldValue', url, fieldName, fieldValue); $.ajax({ type: "GET" ,url: url ,data: {member_hash: member_hash, business_account_hash: selected_account_hash, fieldName: fieldName, fieldValue: fieldValue} //,dataType: 'json' ,success:function(data){ if( (fieldName == 'authorization_to_email_EIN_FAQ' && fieldValue == 'yes') ){ show_device_alert('ALERT', "An email has been sent! Please check your Inbox or Spam Folder."); } else if(fieldName == 'business_description'){ KYC_getSESSION({'business_description': fieldValue}); } } ,error:function(){ } ,complete:function(){ $('#saveText_processing').remove(); $('#' + fieldName).parent().removeClass('hidden'); } }); } /// end: saveText /////////////////////////////////////////////////////////////// var kyc_session = null; window.global_kyc_session = null; function KYC_getSESSION(params) { console.log("520-KYC_getSESSION(params)",params); showProgressDialog("Working..."); setTimeout(function(){ var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/KYC_getSESSION.gate'; console.log("521-KYC_getSESSION(url)",url); var AJAX_DATA = $.extend( {member_hash: member_hash, business_account_hash: selected_account_hash, whitelabel_business_account_hash: whitelabel_business_account_hash, onboarding_preferences: 'TRUE'}, params); console.log("521-KYC_getSESSION(AJAX_DATA)",AJAX_DATA); $.ajax({ type: "GET" ,url: url ,data: AJAX_DATA ,dataType: 'json' ,success:function(data){ hideAllFields(); kyc_session = data; console.log("522-kyc_session(kyc_session)",kyc_session); theme_data = data; console.log("523-kyc_session(theme_data)",theme_data); window.onboarding_personal_minimum_date_of_birth = data.onboarding_preferences.onboarding_personal_minimum_date_of_birth; console.log("524-kyc_session()",data.onboarding_preferences.onboarding_personal_minimum_date_of_birth); window.onboarding_personal_minimum_age = data.onboarding_preferences.onboarding_personal_minimum_age; console.log("525-kyc_session()",data.onboarding_preferences.onboarding_personal_minimum_age); $.each(data, function(key, value) { console.log("526-kyc_session()", key, value); //// SINGLE PAGE FORM if(form_flow == 'single_page'){ $('#btnSignUpload').addClass('btn-sign-purple'); var onscreen_signature_button_url = getOnboardingPreference('onscreen_signature_button_url'); console.log('3.onscreen_signature_button_url', onscreen_signature_button_url); if(!empty(onscreen_signature_button_url)){ onscreen_signature_button_url = onscreen_signature_button_url.replace('https://', 'http://'); $('#btnSignUpload').html(''); setTimeout(function(){ $('#btnSignUpload img').attr('src', onscreen_signature_button_url + '?rnd=' + rand()); }, 500); } if( (!empty(kyc_session['onboarding_preferences'])) && (kyc_session['onboarding_preferences'] != null) ) { var terms_link = ''; if(!empty(kyc_session['onboarding_preferences']['onboarding_terms_of_service_url'])){ terms_link = 'Terms of Service'; } else if(!empty(kyc_session['onboarding_preferences']['onboarding_terms_of_service_text'])){ terms_link = 'Terms of Service
    '; } $('#singlepage_service_agreement').html(terms_link); } return; } //alert("key: "+key); var el = $('#' + key); console.log("527-kyc_session(el)", key, el); if(el.is('input')) { //we are dealing with an input var type = el.attr('type'); //will either be 'text', 'radio', or 'checkbox if(type == 'radio'){ if(key == 'business_accept_credit_card'){ //$("input[name=background][value='some value']").prop("checked",true); if(value.toLowerCase() == 'yes'){ $('#isBusinessAcceptCreditCardYes').prop("checked",true); } else{ $('#isBusinessAcceptCreditCardNo').prop("checked",false); } } } else if(type == 'checkbox' ){ if(key == 'is_advertise_website'){ if(value.toLowerCase() == 'true' || value.toLowerCase() == 'yes'){ $('#is_advertise_website').prop("checked", true); } else{ $('#is_advertise_website').prop("checked", false); } } /* else if(key == 'authorization_to_email_EIN_FAQ'){ if(value.toLowerCase() == 'true' || value.toLowerCase() == 'yes'){ if($('#tsys_us_direct_business_type').val() == 'unregistered'){ $('#authorization_to_email_EIN_FAQ').prop("checked",false); $('#authorization_to_email_EIN_FAQ').parent().parent().removeClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().addClass('hide-row'); } else if($('#tsys_us_direct_business_type').val() == 'Certified DBA'){ $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); } else{ $('#authorization_to_email_EIN_FAQ').prop("checked",false); $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().removeClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().removeClass('hide-row'); } } else{ if($('#tsys_us_direct_business_type').val() == 'unregistered'){ $('#authorization_to_email_EIN_FAQ').prop("checked",false); $('#authorization_to_email_EIN_FAQ').parent().parent().removeClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().addClass('hide-row'); } else if($('#tsys_us_direct_business_type').val() == 'Certified DBA'){ $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); } else{ $('#authorization_to_email_EIN_FAQ').prop("checked",false); $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().removeClass('hide-row'); //$('#btnActivateUSDirectFinalAccount').parent().removeClass('hide-row'); } } } */ } else{ if(key == 'tsys_us_direct_social_security_number'){ //value = ''; } $('#' + key).val(value); } } else if(el.is('select')) { //we are dealing with a select //console.log('KYC_getSESSION > select > key, value', key, value); //alert("key: "+key); if(key == 'verification_region'){ if(empty(value)) value = 'united_states'; } /* else if(key == 'tsys_us_direct_business_type'){ if(value == 'Certified DBA'){ $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); if(empty($('#business_document_type').val())){ $('#business_document_type').val('DBA Certificate'); $('.proof2').removeClass('hide-row'); } } } */ else if(key == 'selfie_document_type'){ if(empty(value)) $('.proof11').addClass('hide-row'); else $('.proof11').removeClass('hide-row'); } else if(key == 'personal_document_type'){ //alert("1-value: "+value); var pulldown_option_value_display = unescape(value); //alert("1-pulldown_option_value_display: "+pulldown_option_value_display); //console.log('KEY=personal_document_type(value)', value); if(empty(value)) $('.proof1').addClass('hide-row'); else $('.proof1').removeClass('hide-row'); } else if(key == 'business_document_type'){ if(empty(value)) $('.proof2').addClass('hide-row'); else $('.proof2').removeClass('hide-row'); } else if(key == 'pricing_document_type'){ if(empty(value)) $('.proof3').addClass('hide-row'); else $('.proof3').removeClass('hide-row'); } else if(key == 'processing_document_type'){ if(empty(value)) $('.proof4').addClass('hide-row'); else $('.proof4').removeClass('hide-row'); } else if(key == 'residence_document_type'){ if(empty(value)) $('.proof111').addClass('hide-row'); else $('.proof111').removeClass('hide-row'); } else if(key == 'tax_returns_document_type'){ if(empty(value)) $('.proof311').addClass('hide-row'); else $('.proof311').removeClass('hide-row'); } else if(key == 'additional_personal_document'){ if(empty(value)) $('.proof6').addClass('hide-row'); else $('.proof6').removeClass('hide-row'); } else if(key == 'additional_business_document_type'){ if(empty(value)) $('.proof6').addClass('hide-row'); else $('.proof6').removeClass('hide-row'); } try{ if ( $("#" + key + " option[value='" + escape(value) + "']").length > 0 ){ //alert("2-value: "+value); $('#' + key).val(escape(value)); jqeuryMobileSetSelectOption(key, escape(value)); } else if ( $("#" + key + " option[value='" + unescape(value) + "']").length > 0 ){ //alert("3-value: "+value); $('#' + key).val(unescape(value)); jqeuryMobileSetSelectOption(key, unescape(value)); } else if ( $("#" + key + " option[value='" + value + "']").length > 0 ){ //alert("4-value: "+value); $('#' + key).val(value); jqeuryMobileSetSelectOption(key, value); } else{ //$('#' + key).val(''); if(!empty(value)){ var test_if_option_exists = false; //alert("1-test_if_option_exists: "+test_if_option_exists); test_if_option_exists = $("#" + key + " option[value='"+ value +"']").length > 0; //alert("2-test_if_option_exists: "+test_if_option_exists); if(test_if_option_exists == false) { //alert("3-test_if_option_exists: "+test_if_option_exists); $("#" + key).prepend(""); } /* else { alert("1-key: "+key); alert("1-value: "+value); //jqeuryMobileSetSelectOption(key, unescape(value)); //$('#'+key+' [value=0]').attr('selected', 'true'); //$('#'+ key).val(value).trigger("change"); } */ $('#'+ key).val(value); } } //console.log(key, value); } catch(e){ } }else { //we are dealing with a textarea or others //alert(key); //code here if(key == 'additional_documents'){ var group_key = 0; $.each(value, function(document_key, additional_documents) { group_key++; $.each(additional_documents, function(item_key, additional_document) { var additional_document_type = ''; if(additional_document != undefined && additional_document.length>0) { var description_property = 'more_' + document_key + '_documents_' + (item_key + 1) + '_description'; var description_val = ''; $.each(additional_document, function(k, additional_document_item) { console.log('528-kyc_session(additional_document_item)', additional_document_item); //console.log('val_property', val_property, additional_document_item[description_property], additional_document_item['more_personal_documents_1_description'], ); if(description_val==''){ description_val = additional_document_item[description_property]; } }); var additional_document_number = '88' + group_key + item_key; var additional_document_type = 'additional_document_' + document_key + additional_document_number; console.log('528-kyc_session(additional_document_type)', additional_document_type); console.log('528-kyc_session(description_val)', description_val); console.log('528-kyc_session(additional_document_type_current)', $('#' + additional_document_type)); //Passport%20%28Front%20%2B%20Back%29 //Passport%2520%2528Front%2520%252B%2520Back%2529 $("#"+additional_document_type).val(description_val).trigger('change'); //$('#' + additional_document_type).val(unescape(description_val)).change(); //$('#' + additional_document_type).val(unescape(description_val)).change(); } }); }); } else if(key == 'business_document_3_type'){ var n = 1; try{ if ( $("#additional_business_document_type option[value='" + escape(value) + "']").length > 0 ){ $('#additional_business_document_type').val(escape(value)); jqeuryMobileSetSelectOption('additional_business_document_type', escape(value)); $('.proof6').removeClass('hide-row'); } else if ( $("#additional_business_document_type option[value='" + (value) + "']").length > 0 ){ $('#additional_business_document_type').val((value)); jqeuryMobileSetSelectOption('additional_business_document_type', value); $('.proof6').removeClass('hide-row'); } else{ if(!empty(value)){ $('#additional_business_document_type').prepend(''); jqeuryMobileSetSelectOption('additional_business_document_type', escape(value)); } $('.proof6').addClass('hide-row'); } //console.log(key, value); } catch(e){ } } } // if(!empty(value)){ $('#' + key).addClass('completed'); $('#' + key).closest('fieldset').addClass('completed'); $('#' + key).closest('.ui-body').addClass('completed'); $('tr.' + key + '_preview').addClass('completed'); } else{ $('#' + key).removeClass('completed'); $('#' + key).closest('fieldset').removeClass('completed'); $('#' + key).closest('.ui-body').removeClass('completed'); $('tr.' + key + '_preview').removeClass('completed'); } }); console.log("528-applyTheme()"); applyTheme(); } ,error:function(){ } ,complete:function(){ if(!empty(kyc_session) && !empty(kyc_session.onboarding_preferences)){ $.each(kyc_session.onboarding_preferences, function(key, value) { setOnboardingPreference(key, value); }); if(!empty(kyc_session.onboarding_preferences.additional_document)){ setOnboardingPreferenceForAdditionalDocuments(kyc_session.onboarding_preferences.additional_document); } } if(form_flow != 'single_page'){ resetAllImages(); getTermsAndConditionsAggreementText(); //START PAGE //TODO checkAndShowNextForm(1); //checkAndShowNextForm(5); } if(form_flow == 'single_page'){ $('#sign').parent().parent().parent().addClass(getOnboardingPreference('signature_url')); } console.log("529-hideProgressDialog()"); hideProgressDialog(); } }); }, 500); return false; } function hideAllFields(){ $('input, select, textarea').removeClass('required'); $('input, select, textarea').removeClass('optional'); $('input, select, textarea').removeClass('do_not_display'); /* $('input, select, textarea').closest('fieldset').addClass('do_not_display'); $('input, select, textarea').closest('.ui-body').addClass('do_not_display'); $('.tbl_confirm_and_active tr').addClass('do_not_display'); */ $('input, select, textarea').closest('fieldset').addClass('optional'); $('input, select, textarea').closest('.ui-body').addClass('optional'); $('.tbl_confirm_and_active tr').addClass('optional'); } function getOnboardingPreference(key){ var onboarding_preference_value = ''; //onboadring preferences if( (!empty(kyc_session['onboarding_preferences'])) && (kyc_session['onboarding_preferences'] != null) ) { var onboarding_preference_key = 'onboarding_' + key; if(!empty(kyc_session['onboarding_preferences'][onboarding_preference_key])){ onboarding_preference_value = kyc_session['onboarding_preferences'][onboarding_preference_key]; } } return onboarding_preference_value; } function setOnboardingPreference(key, value){ //console.log('setOnboardingPreference > key, value', key, value); if(empty(value)) value = 'optional'; var onboarding_preference_value = value;// getOnboardingPreference(key); if(!empty(onboarding_preference_value)) { if(typeof onboarding_preference_value === 'string'){ onboarding_preference_value = onboarding_preference_value.toLowerCase(); } } if(!empty(key)){ key = key.replace('onboarding_', ''); } //console.log(key, onboarding_preference_value); if(key == 'OCR_is_active_message' && !empty(value) && value !== "optional") { alert("value:"+value); $('#OCR_is_active_message').parent().remove(); $('#tsys_us_direct_first_name').parent().before('
    ' + value + '
    '); return; } $('#' + key).removeClass('required'); $('#' + key).removeClass('optional'); $('#' + key).removeClass('do_not_display'); $('#' + key).closest('fieldset').removeClass('required'); $('#' + key).closest('.ui-body').removeClass('required'); $('tr.' + key + '_preview').removeClass('required'); $('#' + key).closest('fieldset').removeClass('optional'); $('#' + key).closest('.ui-body').removeClass('optional'); $('tr.' + key + '_preview').removeClass('optional'); $('#' + key).closest('fieldset').removeClass('do_not_display'); $('#' + key).closest('.ui-body').removeClass('do_not_display'); $('tr.' + key + '_preview').removeClass('do_not_display'); $('#' + key).addClass(onboarding_preference_value); $('#' + key).closest('fieldset').addClass(onboarding_preference_value); $('#' + key).closest('.ui-body').addClass(onboarding_preference_value); $('tr.' + key + '_preview').addClass(onboarding_preference_value); if(onboarding_preference_value == 'do_not_display'){ $('#' + key).closest('fieldset').addClass('do_not_display'); $('#' + key).closest('.ui-body').addClass('do_not_display'); $('tr.' + key + '_preview').addClass('do_not_display'); } } function setOnboardingPreferenceForAdditionalDocuments(additional_documents){ var group_key = 0; if(!empty(additional_documents) ){ $.each(additional_documents, function(key, additional_document_group){ group_key++; //console.log('key', key); //console.log('additional_document_group', additional_document_group); $.each(additional_document_group, function(item_key, additional_document_group_item){ //console.log('setOnboardingPreferenceForAdditionalDocuments > item_key, value', item_key, additional_document_group_item); var additional_document_number = '88' + group_key + item_key; var additional_document_type = 'additional_document_' + key + additional_document_number; setOnboardingPreference(additional_document_type, additional_document_group_item); }); }); } } function jqeuryMobileSetSelectOption(key, value){ // Grab a select field var sel = $('#' + key); // Select the relevant option, de-select any others sel.val(value).attr("selected", true).siblings("option").removeAttr("selected"); // Initialize the selectmenu sel.selectmenu(); // jQM refresh sel.selectmenu("refresh", true); } function popForceUpdate(){ window.location.href = SITE_SCHEMA+'://actionBarItem?action=force_update'; return false; } function openEINConfirmationPopup(){ var buttons_html = ''; buttons_html += ''; buttons_html += '
    '; buttons_html += '
    '; buttons_html += '
    '; buttons_html += ''; buttons_html += '
    '; buttons_html += '
    '; buttons_html += '
    '; buttons_html += ''; buttons_html += 'CLICK HERE TO VISIT OUR TAX ID FAQ PAGE'; buttons_html += ''; $('#uploadingProgress .modal-title').html("Not a registered company (no Tax Identity Number, yet)."); $('#uploadingProgress .modal-body').html(buttons_html); $('#uploadingProgress .modal-footer').addClass('hide-row'); $('#uploadingProgress').modal({ backdrop: 'static', keyboard: false }); } function closeEINConfirmationPopup(){ $('#uploadingProgress').modal('hide'); } function openEIN_FAQ_Page(){ closeEINConfirmationPopup(); window.location.href = SITE_SCHEMA+'://actionBarItem?action=registerEIN'; return false; } function registerEIN(option){ closeEINConfirmationPopup(); //console.log('option', option); if(option.toLowerCase() == 'yes'){ $('#authorization_to_email_EIN_FAQ').prop("checked", true); $('#authorization_to_email_EIN_FAQ').parent().parent().removeClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().addClass('hide-row'); } else { $('#authorization_to_email_EIN_FAQ').prop("checked", false); $('#authorization_to_email_EIN_FAQ').parent().parent().addClass('hide-row'); $('#tsys_us_direct_business_tax_id').parent().parent().removeClass('hide-row'); } return false; } function displayConfirmValues(){ //remove all additional documents from display page , it will be rendered next $('.additional_document_type_preview').remove(); var isBusinessAcceptCreditCard = $('input[name=isBusinessAcceptCreditCard]:checked').val(); var year_doing_business = $('#year_doing_business').find('option:selected').text(); var estimated_average_transaction_value = $('#estimated_average_transaction_value').find('option:selected').text(); //US DIRECT form data var tsys_us_direct_first_name = $('#tsys_us_direct_first_name').val(); var tsys_us_direct_middle_name = $('#tsys_us_direct_middle_name').val(); var tsys_us_direct_last_name = $('#tsys_us_direct_last_name').val(); var tsys_us_direct_personal_email_address = $('#tsys_us_direct_personal_email_address').val(); var tsys_us_direct_business_name = $('#tsys_us_direct_business_name').val(); var tsys_us_direct_business_type = $('#tsys_us_direct_business_type').find('option:selected').text(); var tsys_us_direct_business_registered_country_iso3 = $('#tsys_us_direct_business_registered_country_iso3').find('option:selected').text(); var tsys_us_direct_business_registered_region = $('#tsys_us_direct_business_registered_region').val(); var tsys_us_direct_business_tax_id = $('#tsys_us_direct_business_tax_id').val(); var tsys_us_direct_business_email_address = $('#tsys_us_direct_business_email_address').val(); var tsys_us_direct_business_telephone_country_code = $('#tsys_us_direct_business_telephone_country_code').find('option:selected').text(); var tsys_us_direct_business_telephone = $('#tsys_us_direct_business_telephone').val(); var tsys_us_direct_business_mailing_street_1 = $('#tsys_us_direct_business_mailing_street_1').val(); var tsys_us_direct_business_mailing_street_2 = $('#tsys_us_direct_business_mailing_street_2').val(); var tsys_us_direct_business_mailing_city = $('#tsys_us_direct_business_mailing_city').val(); var tsys_us_direct_business_mailing_state = $('#tsys_us_direct_business_mailing_state').val(); var tsys_us_direct_business_mailing_postal_code = $('#tsys_us_direct_business_mailing_postal_code').val(); var tsys_us_direct_business_mailing_country_iso3 = $('#tsys_us_direct_business_mailing_country_iso3').val(); var tsys_us_direct_sell_what = $('#tsys_us_direct_sell_what').val(); var tsys_us_direct_business_website = $('#tsys_us_direct_business_website').val(); var is_advertise_website = document.configureAccount3Form['is_advertise_website'].checked; var tsys_us_direct_personal_telephone_country_code = $('#tsys_us_direct_personal_telephone_country_code').find('option:selected').text(); var tsys_us_direct_personal_telephone_number = $('#tsys_us_direct_personal_telephone_number').val(); var tsys_us_direct_street_address = $('#tsys_us_direct_street_address').val(); var tsys_us_direct_street_address_2 = $('#tsys_us_direct_street_address_2').val(); var tsys_us_direct_city = $('#tsys_us_direct_city').val(); var tsys_us_direct_state = $('#tsys_us_direct_state').val(); var tsys_us_direct_postal_code = $('#tsys_us_direct_postal_code').val(); var tsys_us_direct_country_iso3 = $('#tsys_us_direct_country_iso3').val(); var tsys_us_direct_social_security_number = $('#tsys_us_direct_social_security_number').val(); var tsys_us_direct_birth_date = $('#tsys_us_direct_birth_date').val(); var tsys_us_direct_gender = $('#tsys_us_direct_gender').val(); var personal_document_type = $('#personal_document_type').find('option:selected').text(); var business_document_type = $('#business_document_type').find('option:selected').text(); var pricing_document_type = $('#pricing_document_type').find('option:selected').text(); var processing_document_type = $('#processing_document_type').find('option:selected').text(); var residence_document_type = $('#residence_document_type').find('option:selected').text(); var tax_returns_document_type = $('#tax_returns_document_type').find('option:selected').text(); // var region = $('#verification_region').find('option:selected').text(); var business_category = $('#business_category').find('option:selected').text(); var business_description = $('#business_description').find('option:selected').text(); var authorization_to_email_EIN_FAQ = document.configureAccount3Form['authorization_to_email_EIN_FAQ'].checked?'Yes':'No'; $('#lbl_verification_region').html(region); $('#lbl_business_category').html(business_category); $('#lbl_business_description').html(business_description); $('#lbl_keywords').html(tsys_us_direct_sell_what); $('#lbl_years_doing_business').html(year_doing_business); $('#lbl_first_time_card_processing').html(isBusinessAcceptCreditCard); $('#lbl_estimated_average_transaction_value').html(estimated_average_transaction_value); $('#lbl_first_name').html(tsys_us_direct_first_name); $('#lbl_middle_name').html(tsys_us_direct_middle_name); $('#lbl_last_name').html(tsys_us_direct_last_name); $('#lbl_street_address').html(tsys_us_direct_street_address); $('#lbl_street_address_2').html(tsys_us_direct_street_address_2); $('#lbl_city').html(tsys_us_direct_city); $('#lbl_state').html(tsys_us_direct_state); $('#lbl_zip_code').html(tsys_us_direct_postal_code); $('#lbl_country_iso3').html(tsys_us_direct_country_iso3); $('#lbl_tsys_us_direct_personal_email_address').html(tsys_us_direct_personal_email_address); var tmp_tsys_us_direct_personal_telephone_country_code = tsys_us_direct_personal_telephone_country_code; var tmp_tsys_us_direct_personal_telephone_number = tsys_us_direct_personal_telephone_number; if( tsys_us_direct_personal_telephone_country_code.indexOf("Please Select One") > -1) { tmp_tsys_us_direct_personal_telephone_country_code = ""; } if(tmp_tsys_us_direct_personal_telephone_country_code) { var tmp_number_to_display = tmp_tsys_us_direct_personal_telephone_country_code + ' ' + tmp_tsys_us_direct_personal_telephone_number; } else { var tmp_number_to_display = tmp_tsys_us_direct_personal_telephone_number; } $('#lbl_tsys_us_direct_personal_telephone_number').html(tmp_number_to_display); $('#lbl_birthdate').html(tsys_us_direct_birth_date); $('#lbl_tsys_us_direct_gender').html(tsys_us_direct_gender); $('#lbl_personal_social_security_number').html(tsys_us_direct_social_security_number); $('#lbl_tsys_us_direct_business_name').html(tsys_us_direct_business_name); if(tsys_us_direct_business_type.indexOf("Please") > -1) tsys_us_direct_business_type = ""; $('#lbl_tsys_us_direct_business_type').html(tsys_us_direct_business_type); if(tsys_us_direct_business_registered_country_iso3.indexOf("Please") > -1) tsys_us_direct_business_registered_country_iso3 = ""; $('#lbl_tsys_us_direct_business_registered_country_iso3').html(tsys_us_direct_business_registered_country_iso3); $('#lbl_tsys_us_direct_business_registered_region').html(tsys_us_direct_business_registered_region); $('#lbl_tsys_us_direct_business_tax_id').html(tsys_us_direct_business_tax_id); if(tsys_us_direct_business_telephone_country_code.indexOf("Please") > -1) tsys_us_direct_business_telephone_country_code = ""; if(tsys_us_direct_business_telephone_country_code) { $('#lbl_tsys_us_direct_business_telephone_number').html(tsys_us_direct_business_telephone_country_code + ' ' + tsys_us_direct_business_telephone); } $('#lbl_tsys_us_direct_business_email_address').html(tsys_us_direct_business_email_address); $('#lbl_tsys_us_direct_business_mailing_street_1').html(tsys_us_direct_business_mailing_street_1); $('#lbl_tsys_us_direct_business_mailing_street_2').html(tsys_us_direct_business_mailing_street_2); $('#lbl_tsys_us_direct_business_mailing_city').html(tsys_us_direct_business_mailing_city); $('#lbl_tsys_us_direct_business_mailing_state').html(tsys_us_direct_business_mailing_state); $('#lbl_tsys_us_direct_business_mailing_postal_code').html(tsys_us_direct_business_mailing_postal_code); $('#lbl_tsys_us_direct_business_mailing_country_iso3').html(tsys_us_direct_business_mailing_country_iso3); $('#lbl_tsys_us_direct_business_website').html(tsys_us_direct_business_website); //$('#lbl_authorization_to_email_EIN_FAQ').html(authorization_to_email_EIN_FAQ); /* $('#lbl_proof_of_person_preview').html('
    '); $('#lbl_proof_of_business_preview').html('
    '); $('#lbl_proof_of_pricing_preview').html('
    '); */ $('#lbl_live_selfie_preview').html('
    ' + copyDocuments('.photo-container.photo11 img, .photo-container.photo11 embed') + '
    '); $('#lbl_proof_of_person_preview').html('
    ' + copyDocuments('.photo-container.photo1 img, .photo-container.photo1 embed') + '
    '); $('#lbl_proof_of_business_preview').html('
    ' + copyDocuments('.photo-container.photo2 img, .photo-container.photo2 embed') + '
    '); $('#lbl_proof_of_pricing_preview').html('
    ' + copyDocuments('.photo-container.photo3 img, .photo-container.photo3 embed') + '
    '); $('#lbl_proof_of_processing_preview').html('
    ' + copyDocuments('.photo-container.photo4 img, .photo-container.photo4 embed') + '
    '); $('#lbl_proof_of_residence_preview').html('
    ' + copyDocuments('.photo-container.photo111 img, .photo-container.photo111 embed') + '
    '); $('#lbl_proof_of_tax_returns_preview').html('
    ' + copyDocuments('.photo-container.photo311 img, .photo-container.photo311 embed') + '
    '); copyAdditionalDocuments('additional_document_personal'); copyAdditionalDocuments('additional_document_business'); //set sign images $('#sign').parent().removeClass('required'); $('#sign').parent().removeClass('optional'); $('#sign').parent().removeClass('do_not_display'); $('#sign').parent().addClass(getOnboardingPreference('signature_url')); if((!empty(kyc_session) && !empty(kyc_session['signature_url'])) || !empty($('#sign').attr('src'))){ $('#sign').attr('src', kyc_session['signature_url']); $('#btnSignUpload').html("Edit Your Signature"); $('#btnSignUpload').removeClass('btn-sign-purple'); $('#btnSignUpload').addClass('btn-sign-grey'); $('#sign').parent().removeClass('required'); $('#sign').parent().removeClass('optional'); $('#sign').parent().removeClass('do_not_display'); $('#sign').parent().addClass('completed'); } else{ //console.log('sign', 'do_not_display'); $('#sign').addClass('do_not_display'); $('#btnSignUpload').html("Add Your Signature"); $('#btnSignUpload').addClass('btn-sign-purple'); $('#btnSignUpload').removeClass('btn-sign-grey'); } var onscreen_signature_button_url = getOnboardingPreference('onscreen_signature_button_url'); console.log('onscreen_signature_button_url', onscreen_signature_button_url); if(!empty(onscreen_signature_button_url)){ $('#btnSignUpload').html(''); } } function copyAdditionalDocuments(additional_document){ if(additional_document != undefined && additional_document!=null && additional_document!=''){ $('#' + additional_document + ' select').each(function(i, item){ //console.log(i, item); console.log('copyAdditionalDocuments() i', i); console.log('copyAdditionalDocuments() item', item); var document_title_selected_value = $(this).find('option:selected').val(); console.log('copyAdditionalDocuments() document_title_selected_value', document_title_selected_value); if(document_title_selected_value!=''){ var document_title = $(this).closest('.row').find('p label').html(); var img_class = $(this).closest('.row').find('.photo-container:first').attr('class'); img_class = '.' + img_class.replace(' ', '.') + ''; console.log('copyAdditionalDocuments(): img_class', img_class); console.log('copyAdditionalDocuments(): document_title', document_title); console.log('copyAdditionalDocuments(): docs', docs); var docs = '
    ' + copyDocuments( img_class + ' img, ' + img_class + ' embed') + '
    ' var template = ''; template += ''; template += ' '; template += ' '+ document_title +''; template += ' '; template += ''; template += ''; template += ' '; template += ' ' + docs; template += ' '; template += ''; //$('#' + additional_document + '_preview').append(document_title + docs); var targetPlace = '.business_document_type_preview:first'; if(additional_document=='additional_document_business'){ targetPlace = '.additional_document_business_preview_dummy:first'; } $( template).insertBefore( targetPlace ); } }); } } function copyDocuments(images_selector){ //console.log('copyDocuments', $(images_selector)); var doc_type = ''; var doc = ''; $(images_selector).each(function(index, item){ console.log('images_selector > item', item); if(empty(doc_type)){ var dropdownId = $(item).closest('.selectedImage').parent().prev().find('select').attr('id'); //alert("dropdownId: "+dropdownId); console.log('dropdownId', dropdownId); doc_type = $('#' + dropdownId).find(":selected").text(); //alert("doc_type: "+doc_type); if(doc_type == 'Selfie') { //doc_type = $('label[for="'+dropdownId+'"').prev().prev().prop('outerHTML') + '
    ' + doc_type; doc_type = ""; } else { //doc_type = $('label[for="'+dropdownId+'"]').prev().prev().prop('outerHTML') + '
    ' + doc_type; } //alert("doc_type: "+doc_type); } doc += $($(item).prop('outerHTML')).removeAttr('onload').prop('outerHTML'); //alert("doc: "+doc); }); //$(images_selector).each(function(index, item){ doc += $(item).removeAttr('onload').prop('outerHTML'); }); //$(images_selector).each(function(index, item){ doc += ''; }); //alert("doc_type: "+doc_type); //alert("doc: "+doc); return '
    ' + doc_type + '
    ' + doc; } function savePostfixForm(field, callback) { // alert("QUALIFY_Wizard "+1); var url = siteProtocol + '//'+API_DOMAIN+'/link_gateway/QUALIFY_Wizard.gate'; var form_data = ''; if(field == 'form'){ form_data = $("#postfixformForm").serialize(); } else if(!empty(field)){ var fieldName = $(field).attr('name'); var fieldValue = $(field).val(); form_data = fieldName + '=' + fieldValue; } else if(empty(form_data)) return false; //console.log('url, fieldName,fieldValue', url, fieldName, fieldValue); if(field == 'form') showLoader("Working..."); // show for form saving, not for filed onblur $.ajax({ type: "POST" ,url: url ,data: {'action': 'save_postfix_form_user_data', 'member_hash': member_hash, 'business_account_hash': selected_account_hash , 'form_data' :form_data} ,dataType: 'json' ,success:function(data){ console.log('1-savePostfixForm: data', data); if( (field == 'form') && (!empty(data)) && (!empty(data.formData)) ) { $('tr.postfixformitem').remove(); var newPrevieItem = ''; newPrevieItem += ''; newPrevieItem += ' '; newPrevieItem += ' ' + $('#postfixformIcon').prop('outerHTML') + ''; if(!empty($('#postfixformForm .rendered-form>div>h1').prop('outerHTML'))){ newPrevieItem += $('#postfixformForm .rendered-form>div>h1').prop('outerHTML'); } if(!empty($('#postfixformForm .rendered-form>div>h2').prop('outerHTML'))){ newPrevieItem += $('#postfixformForm .rendered-form>div>h2').prop('outerHTML'); } if(!empty($('#postfixformForm .rendered-form>div>h3').prop('outerHTML'))){ newPrevieItem += $('#postfixformForm .rendered-form>div>h3').prop('outerHTML'); } newPrevieItem += ' '; newPrevieItem += ''; newPrevieItem += ''; newPrevieItem += ' '; newPrevieItem += ' '; newPrevieItem += ' '; newPrevieItem += ''; $('tr.slefie_document_type_preview:first').before(newPrevieItem); $.map( data.formData, function( value, key ) { console.log("slefie_document_type_preview: key",key); console.log("slefie_document_type_preview: value",value); //alert("slefie_document_type_preview: value: "+value); $("label[for='" + key + "'] .fb-required").remove(); var label = $.trim($("label[for='" + key + "']").text()); newPrevieItem = ''; newPrevieItem += ''; newPrevieItem += ' '; newPrevieItem += ' ' + label + ''; newPrevieItem += ' '; newPrevieItem += ''; newPrevieItem += ''; newPrevieItem += ' '; newPrevieItem += ' ' + value + ''; newPrevieItem += ' '; newPrevieItem += ''; $('tr.slefie_document_type_preview:first').before(newPrevieItem); }); } console.log('2-savePostfixForm: data', data); console.log('2-savePostfixForm: data.documents.personal', data.documents.personal); console.log('2-savePostfixForm: data.documents.personal.more_personal_documents_1_description', data.documents.personal.more_personal_documents_1_description); //console.log('2-savePostfixForm: data.documents.personal.1', data.documents.personal.1); //additional_document_personal8810 //$('#additional_document_personal8810').trigger('change'); ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /// START: UPDATE GUI: PERSONAL DOCUMENTS ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /// photo id if(data.documents.personal.document_description) { $("#personal_document_type").val(data.documents.personal.document_description); $(".proof1").removeClass('hide-row'); } /// proof of residence if(data.documents.personal.proof_of_residence_description) { $("#residence_document_type").val(data.documents.personal.proof_of_residence_description); $(".proof111").removeClass('hide-row'); } /// additional personal documents: var document_number = 0; if(data.documents.personal.more_personal_documents_1_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_1_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_2_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_2_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_3_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_3_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_4_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_4_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_5_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_5_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_6_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_6_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_7_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_7_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_8_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_8_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_9_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_9_description); $(".proof881"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.personal.more_personal_documents_10_description) { $("#additional_document_personal881"+document_number).val(data.documents.personal.more_personal_documents_10_description); $(".proof881"+document_number).removeClass('hide-row'); } ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /// END: UPDATE GUI: PERSONAL DOCUMENTS ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /// START: UPDATE GUI: BUSINESS DOCUMENTS ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /// PROOF OF BUSINESS if(data.documents.business.document_description) { $("#business_document_type").val(data.documents.business.document_description); $(".proof2").removeClass('hide-row'); } /// PROOF OF PRICING if(data.documents.business.proof_of_pricing_description) { $("#pricing_document_type").val(data.documents.business.proof_of_pricing_description); $(".proof3").removeClass('hide-row'); } /// PROOF OF TAXES if(data.documents.business.proof_of_tax_returns_description) { $("#tax_returns_document_type").val(data.documents.business.proof_of_tax_returns_description); $(".proof311").removeClass('hide-row'); } /// PROOF OF PROCESSING if(data.documents.business.proof_of_processing_description) { $("#processing_document_type").val(data.documents.business.proof_of_processing_description); $(".proof4").removeClass('hide-row'); } /// ADDITIONAL BUSINESS DOCUMENTS: var document_number = 0; if(data.documents.business.more_business_documents_1_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_1_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_2_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_2_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_3_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_3_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_4_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_4_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_5_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_5_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_6_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_6_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_7_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_7_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_8_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_8_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_9_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_9_description); $(".proof882"+document_number).removeClass('hide-row'); } document_number = document_number + 1; if(data.documents.business.more_business_documents_10_description) { $("#additional_document_business882"+document_number).val(data.documents.business.more_business_documents_10_description); $(".proof882"+document_number).removeClass('hide-row'); } ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /// END: UPDATE GUI: BUSINESS DOCUMENTS ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// } ,error:function(){ } ,complete:function(){ if(field == 'form') hideLoader(); if(!empty(callback)) callback(); } }); } function getPostFixFormData(){ showLoader("Working..."); // alert("QUALIFY_Wizard "+2); var url = siteProtocol + '//' + API_DOMAIN + '/link_gateway/QUALIFY_Wizard.gate'; console.log(url); $.ajax({ type: "GET" ,url:url ,data: { 'action': 'get_postfix_form', 'member_hash': member_hash, 'business_account_hash': selected_account_hash, 'whitelabel_business_account_hash' : whitelabel_business_account_hash } ,dataType: 'json' ,success:function(data){ showPostFixForm(data); } ,error:function(){ } ,complete:function(){ hideLoader(); } }); return false; } function showPostFixForm(data){ console.log("showPostFixForm(data)",data); if(empty(data) || (!empty(data.formData) && ($.trim(data.formData)=='[]' || $.trim(data.formData)=='"[]"'))) { //checkAndShowNextForm(5); //return false; } var newPageId = 'postfixform'; if($('#postfixform').length>0){ changePage('#postfixform'); } else{ var account_html = ''; account_html += '
    '; account_html += ''; account_html += '
    '; //account_html += ' '; account_html += '
    '; account_html += '

    '; var XXXXX_button_size = "210px"; account_html += '' account_html += '' account_html += ''; account_html += ''; account_html += ''; account_html += ''; account_html += '
    '; account_html += ' '; account_html += ''; account_html += ' '; account_html += ''; account_html += ' '; account_html += '
    '; account_html += '
    '; account_html += '
    '; account_html += '
    '; account_html += '
    '; account_html += '
    '; account_html += '
    '; account_html += '
    '; var newPageHtml = "
    "; //header newPageHtml += "
    Navigation
    "+SITE_TITLE+"
    Navigation "; //newPageHtml += "
    Navigation

    "+SITE_TITLE+"

    Navigation "; newPageHtml += '
    '; newPageHtml += $('#popupMenu').html(); newPageHtml += '
    '; newPageHtml += '
    '; newPageHtml += "
    "; if(!empty(LOGO_RECTANGLE)) { newPageHtml += "
    "; } newPageHtml += account_html; newPageHtml += "
    "; newPageHtml += ""; newPageHtml += ''; newPageHtml += '
    '; var newPage = $(newPageHtml); injectNewPage('#'+newPageId,newPage); } //setTimeout(function(){ $formContainer = $(document.getElementById('fb-rendered-form')); if(!empty(data) && !empty(data.formData)){ $('form', $formContainer).formRender({ formData: data.formData ,onRender: function(){ //$( "input[type='checkbox']" ).checkboxradio(); $('select, input, textarea').unbind('blur'); $('select, input, textarea').on('blur', function(event){ var name = $(this).attr('name'); //validateText(document.postfixformForm[name], 'onBlur'); savePostfixForm(document.postfixformForm[name]); return false; }); $('#postfixform #btnpostfixsave, #postfixform #btnpostfixback, #postfixform #btnpostfixfinishlater').unbind("click"); $('#postfixform #btnpostfixsave, #postfixform #btnpostfixback, #postfixform #btnpostfixfinishlater').bind("click", function(event){ switch($(this).attr('id')){ case 'btnpostfixsave': $('#postfixform label.error').remove(); var no_of_error = 0; //console.log('Can submit: ', document.postfixformForm.checkValidity()); $('[required="required"]').each(function() { //console.log($(this).find(':selected').val(), $(this)); //$(this).parent().find('label.error').remove(); var element = ''; var elementValue = ''; if($(this).is('input')) { element = $("input[name='"+$(this).attr('name')+"']"); console.log('input-element', element); var inputType = $(this).attr('type'); //console.log('inputType', inputType); if(inputType == 'radio' || inputType == 'checkbox' ) { //if($(this).prop("checked")) elementValue = $(this).val(); elementValue = $("input[name='"+$(this).attr('name')+"']:checked").val(); } else { elementValue = $(this).val(); } } else if($(this).is('select')) { element = $(this); console.log('select-element', element); elementValue = elementValue += $(this).val(); console.log('select-elementValue', elementValue); //elementValue = $(this).find(':selected').val(); $(this).find(':selected').each(function() { elementValue += $(this).val(); }); }else { /// text area elementValue = $(this).val(); } //console.log('elementValue', elementValue); $(element).closest('.form-group').find('label.error').remove(); //$(element).closest('.fb-textarea').find('label.error').remove(); if( (empty(elementValue)) || (elementValue == 'please_select_one') ){ $(element).closest('.form-group').append(""); //$(element).closest('.fb-textarea').append(""); //$(this).parent().append(""); no_of_error++; } }); if(no_of_error>0){ show_device_alert('ERROR', "Please complete the form."); } else{ savePostfixForm('form', function(){ //changePageWithHeaderFooter('#configureAccount4'); // alert(5.1); checkAndShowNextForm(5); }); } break; case 'btnpostfixfinishlater': savePostfixForm('form', function(){ changeBackPage('#accountLists'); }); break; case 'btnpostfixback': savePostfixForm('form', function(){ changeBackPage('#configureAccount'); }); break; default: break; } return false; }); } }); } //}, 1000); return false; } /* function displayPostfixConfirmValues(){ $('#postfixformForm input, #postfixformForm input, #postfixformForm input, ').each(function(){ //console.log($(this).find(':selected').val(), $(this)); //$(this).parent().find('label.error').remove(); var element = ''; var elementValue = ''; if($(this).is('input')){ element = $("input[name='"+$(this).attr('name')+"']"); var inputType = $(this).attr('type'); //console.log('inputType', inputType); if(inputType == 'radio' || inputType == 'checkbox' ){ //if($(this).prop("checked")) elementValue = $(this).val(); elementValue = $("input[name='"+$(this).attr('name')+"']:checked").val(); } else{ elementValue = $(this).val(); } } else if($(this).is('select')){ element = $(this); //elementValue = $(this).find(':selected').val(); $(this).find(':selected').each(function(){ elementValue += $(this).val(); }); } //console.log('elementValue', elementValue); $(element).closest('.form-group').find('label.error').remove(); if(empty(elementValue) || elementValue == 'please_select_one' ) { $(element).closest('.form-group').append(""); //$(this).parent().append(""); no_of_error++; } }); var inputLabel = $("label[for='"+$(this).attr('name')+"']").html(); var formValue = []; formValue.push(inputLabel); formValue.push(elementValue); displayPostfixFormValues.push(formValue); console.log('displayPostfixFormValues', displayPostfixFormValues); $(displayPostfixFormValues).each(function(key, val){}); } */ function empty(v){ if(v == '' || v == null || v == undefined) return true; return false; } function showLoader(msgText){ if(empty(msgText)) msgText="Working..."; $.mobile.loading( 'show', { text: msgText, textVisible: 'textVisible', theme: 'a' }); } function hideLoader(){ $.mobile.loading( "hide" ); } $(document).on('vclick', '[data-rel=back]', function (e) { e.stopImmediatePropagation(); e.preventDefault(); var back = $.mobile.activePage.prev('[data-role=page]'); $.mobile.changePage(back, { transition: 'slide', reverse: true }); }); function injectNewPage(id, newPage){ // Append the new page into pageContainer newPage.appendTo($.mobile.pageContainer); // Move to this page by ID '#page' changePage(id); } function changePage(id){ if (hashIndex > 0) { window.location = window.location.href.substring(0, hashIndex); } else{ //show/hide SAVE and Finish Later/SAVE and Back to Edit buttons START var formIdx = {}; $.each(formSequences, function( key, formId ) { formIdx[formId.ID.substr(1)] = key - 1; }) try{ //console.log('formIdx', formIdx); //$( "button:contains('Save & Finish Later'), .ui-header a[href='#configureAccount'], .ui-header a[href='#accountLists']" ).each(function(index, item){ $( "#btnpostfixfinishlater" ).each(function(index, item){ $(item).removeClass('hide-filed'); var i = formIdx[$(item).closest('div[data-role="page"]').attr('id')]; //console.log(i, item, $(item).closest('form').attr('id')); //console.log('accountMenus.button_save_and_finish_later', accountMenus.button_save_and_finish_later); if(!empty(accountMenus.button_save_and_finish_later) && !empty(accountMenus.button_save_and_finish_later[i])){ if(accountMenus.button_save_and_finish_later[i].toUpperCase() == 'DO_NOT_DISPLAY'){ $(item).addClass('hide-filed'); } } }); //$( "button:contains('SAVE and Back to Edit')" ).each(function(index, item){ $( "#btnpostfixback" ).each(function(index, item){ $(item).removeClass('hide-filed'); var i = formIdx[$(item).closest('div[data-role="page"]').attr('id')]; //console.log(i, item, $(item).closest('form').attr('id')); //console.log('accountMenus.button_save_and_back_to_edit', accountLists.button_save_and_back_to_edit); if(!empty(accountMenus.button_save_and_back_to_edit) && !empty(accountMenus.button_save_and_back_to_edit[i])){ if(accountMenus.button_save_and_back_to_edit[i].toUpperCase() == 'DO_NOT_DISPLAY'){ $(item).addClass('hide-filed'); } } }); } catch (e) { } //show/hide SAVE and Finish Later/SAVE and Back to Edit buttons END if(id == '#captureImage' || id == '#popupBottomMenu'){ $.mobile.changePage(id, { role: "dialog", closeBtn: "none", transition: 'slidedown', //changeHash: true }); } else { //$.mobile.changePage(id, { transition: "slide", changeHash: false }); $.mobile.changePage(id, { transition: "slide"}); if(id == '#configureAccountAcitve'){ displayConfirmValues(); } else if(id == '#configureAccount3'){ //fillStateList('verification_region', 'business_registered_region', ''); fillCountryStateList(); var selected_account_details = getSelectAccountDetails(); if(!empty(selected_account_details) && !empty(selected_account_details.business_type_options)){ var verification_region = $('#verification_region').val(); if(!empty(selected_account_details.business_type_options[verification_region])){ fillSelectOptions('#tsys_us_direct_business_type', selected_account_details.business_type_options[verification_region]); //alert("kyc_session.tsys_us_direct_business_type: "+kyc_session.tsys_us_direct_business_type); if(!empty(kyc_session) && !empty(kyc_session.tsys_us_direct_business_type) ){ $('#tsys_us_direct_business_type').val(kyc_session.tsys_us_direct_business_type); jqeuryMobileSetSelectOption('tsys_us_direct_business_type', kyc_session.tsys_us_direct_business_type); } } } if(!empty(kyc_session) && !empty(kyc_session.business_registered_region) ){ $('#business_registered_region').val(kyc_session.business_registered_region); jqeuryMobileSetSelectOption('business_registered_region', escape(kyc_session.business_registered_region)); } displayPersonalIdentity($('#tsys_us_direct_business_name'), '#tsys_us_direct_business_name'); } } } return false; } function changePageWithHeaderFooter(id){ addHeaderFooter(id.substr(1)); return changePage(id); } function changeBackPage(id){ $.mobile.changePage(id, { transition: 'slide', reverse: true }); return false; } function addHeaderFooter(page){ //adding header footer if(empty($.trim($('#' + page + ' .ui-header').text()))){ var newPageHtml = ''; ///// HOME BUTTON -- not sure where it appears. ///// var newPageHtml = " Navigation

    "+SITE_TITLE+"

    Navigation "; ////////////////////////////////////////////////// if(page == 'configureAccount' || page == 'configureAccountAdditionalIdentity'){ newPageHtml = " Navigation
    "+SITE_TITLE+"
    Navigation "; } else if(page == 'configureAccount2' || page == 'configureAccount3' || page == 'configureAccount4' || page == 'configureAccountAcitve'){ newPageHtml = " Navigation
    "+SITE_TITLE+"
    Navigation "; } else{ newPageHtml = " Navigation
    "+SITE_TITLE+"
    Navigation "; } newPageHtml += '
    '; newPageHtml += $('#popupMenu').html(); newPageHtml += '
    '; if(page == 'configureAccount4'){ } $('#' + page + ' .ui-header').html(newPageHtml); newPageHtml = ''; newPageHtml = '

     

    '; //newPageHtml += 'Power Icon'; $('#' + page + ' .ui-footer').html(newPageHtml); } } function takePhotoFromCamera(){ // Get access to the camera! if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { // Not adding `{ audio: true }` since we only want video now navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) { window.localStream = stream; /* video.src = window.URL.createObjectURL(stream); */ video.srcObject = stream; video.play(); }); } /* Legacy code below: getUserMedia else if(navigator.getUserMedia) { // Standard navigator.getUserMedia({ video: true }, function(stream) { video.src = stream; video.play(); }, errBack); } else if(navigator.webkitGetUserMedia) { // WebKit-prefixed navigator.webkitGetUserMedia({ video: true }, function(stream){ video.src = window.webkitURL.createObjectURL(stream); video.play(); }, errBack); } else if(navigator.mozGetUserMedia) { // Mozilla-prefixed navigator.mozGetUserMedia({ video: true }, function(stream){ video.src = window.URL.createObjectURL(stream); video.play(); }, errBack); } */ } // Converts canvas to an image function convertCanvasToImage(canvas, callback) { var image = new Image(); image.onload = function(){ //callback(image.src, gImageNo); $('#canvas').parent().prepend(image); } image.src = canvas.toDataURL("image/png"); } function closeSpanPopup(){ localStream.getVideoTracks()[0].stop(); $('#captureImage').dialog('close'); } // Grab elements, create settings, etc. var video = null; // Elements for taking the snapshot var canvas = null; var context = null; //var video = document.getElementById('video'); var pageId = ""; var capturedImageData = ''; $(document).ready(function(){ // Grab elements, create settings, etc. video = document.getElementById('video'); // Elements for taking the snapshot canvas = document.getElementById('canvas'); context = canvas.getContext('2d'); //var video = document.getElementById('video'); // Trigger photo take document.getElementById("snap").addEventListener("click", function() { context.drawImage(video, 0, 0, 640, 480); localStream.getVideoTracks()[0].stop(); //var imageData = canvas.toDataURL("image/png");; //showSelectedImage(imageData, gImageNo); //convertCanvasToImage(canvas, showSelectedImage) //changeBackPage('#configureAccount4'); $('#captureImage').dialog('close'); console.log('captureImage gImageNo', gImageNo); setTimeout(function(){ if(!empty(gImageNo)){ capturedImageData = canvas.toDataURL("image/png");; openSlideBottomMenu(); } }, 1000); }); if(form_flow == 'single_page') { KYC_getSESSION(); } else{ if(empty(account_hash)){ showLogin(); } else{ showHome(account_hash); } } $(document).on("pagechange", function() { var activePage = $.mobile.pageContainer.pagecontainer("getActivePage"); var activePageId = activePage[0].id; if(activePageId == 'accountLists'){ $('#frmSignIn').css('display', 'none'); $('#frmPayment').css('display', 'block'); } else if(activePageId == 'captureImage'){ takePhotoFromCamera(); } else if(activePageId == 'configureAccount3'){ $('#is_advertise_website').checkboxradio('refresh'); } }); $(document).on("pagebeforeshow", function() { var activePage = $.mobile.pageContainer.pagecontainer("getActivePage"); var activePageId = activePage[0].id; }); jQuery.validator.addMethod("complete_url", function(val, elem) { // if no url, don't do anything if (val.length == 0) { return true; } // if user has not entered http:// https:// or ftp:// assume they mean http:// if(!/^(https?|ftp):\/\//i.test(val)) { val = 'http://'+val; // set both the value $(elem).val(val); // also update the form element } return /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|www\.)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(val); }); $(document).on("pageshow", function(event, ui) { //console.log('$.mobile.activePage', $.mobile.activePage); try{ pageId = $.mobile.activePage.attr('id'); //Get the page id } catch (e) { } if (typeof (pageId) == 'undefined' && pageId == "") pageId = event.target.id; $.validator.addMethod("passmatch", function(value) { return value == $("#password").val(); }, 'Confirmation password must match.'); $('input[type="url"]').bind('invalid', function() { //alert('invalid'); return false; }); var activePage = $.mobile.pageContainer.pagecontainer("getActivePage"); var activePageId = activePage[0].id; $("#" + activePageId + "Form").validate({ /* rules: { url: "complete_url" }, */ errorPlacement: function(error, element) { if (element.is('select')) { error.insertAfter($(element).parent()); } else { //error.insertAfter(element); error.insertAfter($(element).parent()); } }, submitHandler: function(form) { // do other things for a valid form //form.submit(); } }); applyTheme(); }); $('#signatureDialog').on({ popupbeforeposition: function() { var maxWidth = $(window).width() - 120; var maxHeight = $(window).height() - 120; $('#signatureDialog iframe').css({'width': maxWidth + 'px', 'height': maxHeight + 'px'}); $('#signatureDialog').css('overflow', 'auto'); } }) ; });