1var url = adminlocalUrl; 2if(environment == 'production' && adminlocalUrl.indexOf('https') < 0) { 3 url = adminlocalUrl.replace("http", "https"); 4} 5 6function submit_upgrade_plan(){ 7 8 validate = validate_required("#myFirstPayment"); 9 if(!validate) { 10 return false; 11 } 12 13 if($("#myFirstPayment .add_new_card:visible").length){ 14 15 var exp_year = $('#exp-year').val(); 16 var exp_month = $('#exp-month').val(); 17 var currentTime = new Date(); 18 var currentYear = currentTime.getFullYear(); 19 var currentMonth = ("0" + (currentTime.getMonth() + 1)).slice(-2) ; 20 21 if($('#exp-month').hasClass('require')){ 22 if((exp_year == currentYear) && (exp_month < currentMonth)){ 23 $('#exp-month').css('border','2px solid red'); 24 return false; 25 }else { 26 $("#exp-month").css('border','1px solid #ddd'); 27 } 28 } 29 30 if($('#exp-year').hasClass('require')){ 31 if(exp_year < currentYear){ 32 $('#exp-year').css('border','2px solid red'); 33 return false; 34 }else { 35 $("#exp-year").css('border','1px solid #ddd'); 36 } 37 } 38 } 39 40 showPaymentLoader(); 41 42 setTimeout(function () { 43 $.ajax({
44 'url' : "/admin/api/payments/ajax.php?task=submit_payment_form", 45 'type' : 'POST', 46 'data' : $("#upgrade_plan_payment_form").serialize(), 47 'async': false, 48 'success' : function(data) { 49 console.log(data); 50 var data_json = data; 51 var data_obj = JSON.parse(data_json); 52 hidepaymentLoader(); 53 54 if(data_obj.success) { 55 $("#alert_message").html('<div class="alert alert-success"><strong>Success: </strong>'+data_obj.message+'</div>').show(); 56 // Redirect to Success page to show the receipt 57 setTimeout(function () { 58 window.top.location.href = "http://"+window.location.hostname+"/admin/plan_payment_success.php?token="+data_obj.invoice_id_base64; 59 }, 500); 60 61 }else{ 62 $("#alert_message").html('<div class="alert alert-danger"><strong>Payment Error: </strong>'+data_obj.message+'</div>').show(); 63 } 64 65 } 66 }); 67 }, 500); 68 69} 70 71 72// Payment form submission 73function submit_first_payment(page_name) { 74 75 // Validate form 76 validate = validate_required("#myFirstPayment"); 77 if(!validate) { 78 return false; 79 } 80 81 // Validate month and year 82 if($("#myFirstPayment .add_new_card:visible").length){ 83 84 var exp_year = $('#exp-year').val(); 85 var exp_month = $('#exp-month').val(); 86 var currentTime = new Date(); 87 var currentYear = currentTime.getFullYear(); 88 var currentMonth = ("0" + (currentTime.getMonth() + 1)).slice(-2) ; 89 90 if($('#exp-month').hasClass('require')){ 91 if((exp_year == currentYear) && (exp_month < currentMonth)){ 92 $('#exp-month').css('border','2px solid red').focus(); 93 return false; 94 }else { 95 $("#exp-month").css('border','1px solid #ddd'); 96 } 97 } 98 99 if($('#exp-year').hasClass('require')){ 100 if(exp_year < currentYear){ 101 $('#exp-year').css('border','2px solid red').focus(); 102 return false; 103 }else { 104 $("#exp-year").css('border','1px solid #ddd'); 105 } 106 } 107 } 108 109 // SUBMIT FINAL FORM AJAX 110 showPaymentLoader(); 111 setTimeout(function () { 112 $.ajax({
113 'url' : url+"/api/payments/ajax.php?task=submit_payment_form", 114 'type' : 'POST', 115 'data' : $("#first-payment-form").serialize(), 116 'async': false, 117 'success' : function(data) { 118 console.log(data); 119 var data_json = data; 120 var data_obj = JSON.parse(data_json); 121 hidepaymentLoader(); 122 123 if(data_obj.success) { 124 125 //ON SUCCESSFULL PAYMENT 126 // Hide error message if any 127 $(".error_message_container").hide(); 128 129 // Show sucess message 130 $(".success_message_container").html("<strong>Success! </strong>"+data_obj.message).show(); 131 132 // Scroll to top to show the message 133 $('html, body, #myFirstPayment').animate({ scrollTop: 0 }, 'fast'); 134 135 // Redirect to Success page to show the receipt 136 setTimeout(function () { 137 window.top.location.href = "http://"+window.location.hostname+"/admin/"+page_name+".php?token="+data_obj.invoice_id_base64; 138 }, 500); 139 } else { 140 $(".error_message_container").html("<strong>Payment Error: </strong>"+data_obj.message).show(); 141 $(".success_message_container").hide(); 142 $('html, body, #myFirstPayment').animate({ scrollTop: 0 }, 'fast'); 143 } 144 145 //$("#shipping_price").html(data); 146 }, 147 'error' : function(request,error) 148 { 149 console.log("Request: "+JSON.stringify(request)); 150 } 151 }); 152 }, 500); 153 154} 155 156// Validate required fields 157function validate_required(parent){ 158 159 var retrunvar = true; 160 $(parent+" .require:visible").each(function(index){ 161 if($(this).val() == "") { 162 $(this).css('border','2px solid red'); 163 retrunvar = false; 164 } else { 165 $(this).css('border','1px solid #ddd'); 166 } 167 168 }); 169 170 return retrunvar; 171 172} 173 174function showPaymentLoader(message) { 175 console.log(typeof message); 176 if(typeof message == "undefined") { 177 message = "Processing, Please Wait..."; 178 } 179 $(".loader_text").html(message); 180 $("#page-loader").show(); 181} 182 183function hidepaymentLoader() { 184 setTimeout(function () { 185 $("#page-loader").hide(); 186 }, 1000); 187}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.