));
}
+
+ // Add script to checkout page to block
+ add_action( 'woocommerce_after_checkout_form', array($this, 'glmAddCheckoutPageScript'));
+
+ }
+
+ public function glmAddCheckoutPageScript() {
+ echo '
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+ $(window).keydown(function(event){
+ if(event.keyCode == 13) {
+ event.preventDefault();
+ return false;
+ }
+ });
+ });
+ </script>
+ ';
}
// Tell WooCommerce that we exist
global $woocommerce;
$this->cust_order = new WC_Order($order_id);
- // Check for a maximum number of attempts
- if ($this->check_max_attempts()) {
-
- wc_add_notice(
- __(
- '<p><h4><b style="color: red;">We\'re sorry, there was a problem with your payment...</b></h4><p><b>Reason:</b><br>' .
- 'You have exceeded the maximum number of attempts to process your credit card.<br>
- Please contact us for assistance.',
- 'woothemes'), 'notice');
-
- // Add a note to the customer order for reference
- $this->cust_order->add_order_note( 'Error: '. 'Number of credit card processing attempts exceeded.' );
-
- if (GLM_MES_DEBUG && ! GLM_MES_DEBUG_VERBOSE) {
- wc_add_notice(
- 'GLM MeS Gateway: Maximum attempts exceeded!', 'notice');
- }
-
- return array(
- 'result' => 'failure',
- 'redirect' => $this->get_return_url($this->cust_order)
- );
-
- }
-
// Get our invoice number
$this->invNumb = str_replace("#", "", $this->cust_order->get_order_number());
$this->cc_cvc = (isset($_POST[GLM_MES_ID . '-card-cvc'])) ? $_POST[GLM_MES_ID .
'-card-cvc'] : '';
+ // Check for required credit card data
+ if (trim($this->ccNumb) == '' || trim($this->cc_exp) == '' || trim($this->cc_cvc) == '') {
+
+ wc_add_notice(
+ __(
+ '<p><h4><b style="color: red;">You have not supplied the required Credit Card information!</b></h4>
+ Please complete the credit card number, expiration date, and card code in the form below at the bottom of the page.',
+ 'woothemes'), 'notice');
+
+ return array(
+ 'result' => 'failure',
+ 'redirect' => $this->get_return_url($this->cust_order)
+ );
+
+ }
+
/*
* Other data available from WooCommerce
*
print_r($this->cust_order, 1) . '</pre></p>', 'success');
}
+ // Check for a maximum number of attempts
+ if ($this->check_max_attempts()) {
+
+ wc_add_notice(
+ __(
+ '<p><h4><b style="color: red;">We\'re sorry, there was a problem with your payment...</b></h4><p><b>Reason:</b><br>' .
+ 'You have exceeded the maximum number of attempts to process your credit card.<br>
+ Please contact us for assistance.',
+ 'woothemes'), 'notice');
+
+ // Add a note to the customer order for reference
+ $this->cust_order->add_order_note( 'Error: '. 'Number of credit card processing attempts exceeded.' );
+
+ if (GLM_MES_DEBUG && ! GLM_MES_DEBUG_VERBOSE) {
+ wc_add_notice(
+ 'GLM MeS Gateway: Maximum attempts exceeded!', 'notice');
+ }
+
+ return array(
+ 'result' => 'failure',
+ 'redirect' => $this->get_return_url($this->cust_order)
+ );
+
+ }
+
// Check if Address Verification is required
if ($this->settings['address_verification'] == 'yes') {