0

首先,我是一名初学者,已开始在他们的网站上与我的雇主合作。在这里和那里添加小功能和特性。我遇到的问题是,我正在尝试将 reCaptcha 添加到我们的支付页面之一,并且当我在开发人员环境中测试直接从生产站点获取的代码时,有些功能不再起作用。选择信用卡或借记卡付款选项时,下拉单选按钮可添加在开发者网站上不再有效的其他付款信息。这是我正在处理的页面:这里这甚至是在添加验证码之前。我没有遇到问题的那部分,它与当前的功能相匹配。在将更改推送到生产之前,我需要它在开发站点上工作。我公司目前使用基于 Web 的 Interchange 应用服务器。这是一些代码:

$(document).ready(function(){
//payment type check
   var payType = $('input[name=paymentType]:checked', '#paymentForm').val();
   if( payType == null ) 
   { 
      alert('You have not selected a Payment Type') 
      return false; 
   }

   //credit card check
   if( payType == 'credit' ){
           if(IsEmpty(form.cc_type)) 
           { 
              alert('You have not entered a Credit Card Type') 
              form.cc_type.focus(); 
              return false; 
           } 
           if(IsEmpty(form.ccnum)) 
           { 
              alert('You have not entered a Credit Card Number') 
              form.ccnum.focus(); 
              return false; 
           } 
           if(IsEmpty(form.ccmo)) 
           { 
              alert('You have not entered a Credit Card Expiration Month') 
              form.ccmo.focus(); 
              return false; 
           } 
           if(IsEmpty(form.ccyr)) 
           { 
              alert('You have not entered a Credit Card Expiration Year') 
              form.ccyr.focus(); 
              return false; 
           }
           if(IsEmpty(form.cvv2_number)) 
           { 
           //   alert('You have not entered the Credit Card CVV2') 
           //   form.cvv2_number.focus(); 
           //   return false; 
           }
   }


   //checking account check
   if( payType == 'check' ){
	   var chkType = $('input[name=checkingType]:checked', '#paymentForm').val();
	   if( chkType == null ) 
	   { 
	      alert('You have not selected a Checking Type') 
	      return false; 
	   }
           if( !form.aba.value.match(/^\d{9}$/) )
           { 
              alert('Checking Routing Number must be 9 digits') 
              form.aba.focus(); 
              return false; 
           }
	   else{
		var n=form.aba.value.split('');
		var chkSum = ( 3 * (parseInt(n[0]) + parseInt(n[3]) + parseInt(n[6])) + 
				7 * (parseInt(n[1]) + parseInt(n[4]) + parseInt(n[7])) + 
				(parseInt(n[2]) + parseInt(n[5]) + parseInt(n[8]))) % 10;
		if( chkSum != 0 ){	
		      alert('Checking Routing Number is invalid') 
		      form.aba.focus(); 
		      return false; 
		}
	   } 
           if(IsEmpty(form.account)) 
           { 
              alert('You have not entered a Checking Account Number') 
              form.account.focus(); 
              return false; 
           } 
   }
});
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>

var submitted = false;
$(document).ready(function(){
	try {
		$('#item_1_cost').priceFormat({
			prefix: '',
			thousandsSeparator: ''
		});
	} catch (e) { console.log(e); }
	
	$('#item_1_cost').val('[scratch form-item_1_cost]');

	$('.trimMe').focusout(function(){
		$(this).val( $.trim($(this).val()) );
	});
	
	var updateBilling = function () {
		if (!$("#sameAsShipping").is(":checked")) { return }
		$("#address").val( $("#saddr").val() );
		$("#city").val( $("#scity").val() );
		$("#state").val( $("#sstate").val() );
		$("#zip").val( $("#szip").val() );	
	}

	$('.paymentTypeRadio').change(function(){
		$('#paymentCredit').hide();
		$('#paymentCheck').hide();
		var payType = $('input[name=paymentType]:checked', '#paymentForm').val();

		if(payType == "credit") {
			$('#pass_action').val('iTransact');
			document.paymentForm.action = "https://secure.paymentclearing.com/cgi-bin/rc/ord.cgi";		
			$('#paymentCredit').show();
			$('#aba').val('');
			$('#account').val('');
			$('#account_source').val('');
		} else if( payType == "check" ){
			$('#pass_action').val('@@MV_PAGE@@');
			document.paymentForm.action = "https://__SERVER_NAME__/@@MV_PAGE@@.html";
			$('#paymentCheck').show();
			$('#ccnum').val('');
			$('#ccmo').val('');
			$('#ccyr').val('');
			$('#cvv2_number').val('');
		}
	});

	$('.patientGroup').keyup(function(){ updateBilling() });
	$('.patientGroup').change(function(){ updateBilling() });
	$("#sstate").val("[scratch form-sstate]");
	$("#state").val("[scratch form-state]");
	
	
   // Add onclick handler to checkbox w/id checkme
   $("#sameAsShipping").click(function(){

		// If checked
		if ($("#sameAsShipping").is(":checked")) {
			$(".billingGroup").attr("readonly", true); 
  			$("#first_name").val( $("#sfname").val() );
			$("#last_name").val( $("#slname").val() );
			updateBilling();		
		} else {
			$(".billingGroup").val('');
  			$("#first_name").val('');
			$("#last_name").val('');
			$(".billingGroup").removeAttr("readonly"); 
		}
	});
}); // document ready 


var pop_window;
function popWin(pop_url) {
	pop_window = open(pop_url, 'package_info',',width=500,height=450,scrollbars=yes,resizable=yes'); 
}   

function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) || (aTextField.value==null)) return true;
	return false; // no need for else as if the statment is true this line will not run anyway
}       


function ValidateForm(form) {
	if( submitted == true ) { 
		alert("You have already submitted. Please wait while the page processes. Thank you.");
		return false;
	}
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>


<div class="mybinsonsform" style="width: 680px;">
	<input type="text" name="ccnum" id="ccnum" class="trimMe" VALUE="" size="30" maxlength="20">
</div>

<div class="mybinsonsform" style="width: 680px;">
	<select name="ccmo" id="ccmo">
		<option value="">Month</option>
		<option value="January">01 January</option>
		<option value="February">02 February</option>
		<option value="March">03 March</option>
		<option value="April">04 April</option>
		<option value="May">05 May</option>
		<option value="June">06 June</option>
		<option value="July">07 July</option>
		<option value="August">08 August</option>
		<option value="September">09 September</option>
		<option value="October">10 October</option>
		<option value="November">11 November</option>
		<option value="December">12 December</option>
	</select>
	<select name="ccyr" id="ccyr" style="width:70px;">
		<option value="">Year</option>
	</select>
</div>

<div class="mybinsonsform" style="width: 680px;">
	<input type="text" name="cvv2_number" id="cvv2_number" class="trimMe" value="" size="5" maxlength="5">
	<a href="[area href=special/cvv_pop]" target="package_info" onclick="popWin('[area href=special/cvv_pop]'); return false;">
		<small>Where is it?</small>
	</a>
</div>


<!-- Checking information -->
<div id="paymentCheck" style="display:none;">
	<div class="mybinsonsform" style="width: 680px;">
		<input type="radio" class="checkingTypeRadio" name="checkingType" value="acctChecking"> Checking Account
		<input type="radio" class="checkingTypeRadio" name="checkingType" value="acctSavings"> Savings Account
	</div>
	<div class="mybinsonsform" style="width: 680px;">
		<input type="text" name="aba" id="aba" class="trimMe" VALUE="" size="10">
	</div>
	<div class="mybinsonsform" style="width: 680px;">
		<input type="text" name="account" id="account" class="trimMe" VALUE="" size="10">
	</div>
</div>

如果我可以提供更多信息,请告诉我。我感谢任何帮助!先感谢您!-蒂姆

4

1 回答 1

0

您确定正在加载 JQuery 吗?负责显示/隐藏支付类型字段的代码如下:

$('.paymentTypeRadio').change(function() {
    $('#paymentCredit').hide();
    $('#paymentCheck').hide();
    var payType = $('input[name=paymentType]:checked', '#paymentForm').val();

    if (payType == "credit") {
        $('#pass_action').val('iTransact');
        document.paymentForm.action = "https://secure.paymentclearing.com/cgi-bin/rc/ord.cgi";      
        $('#paymentCredit').show();
        $('#aba').val('');
        $('#account').val('');
        $('#account_source').val('');
    } else if (payType == "check") {
        $('#pass_action').val('payment');
        document.paymentForm.action = "https://www.binsons.com/payment.html";
        $('#paymentCheck').show();
        $('#ccnum').val('');
        $('#ccmo').val('');
        $('#ccyr').val('');
        $('#cvv2_number').val('');
    }
});

它使用的是 JQuery,所以它可能没有在本地加载。在控制台中查找 404 错误,或类似$ is not a function.

于 2018-04-03T14:43:55.610 回答