public function process_payment($order_id)
 {
     try {
         global $woocommerce;
         $customer_order = new WC_Order($order_id);
         PayU_Middleware::$api_key = $this->api_key;
         PayU_Middleware::$api_login = $this->api_login;
         PayU_Middleware::$merchant_id = $this->merchant_id;
         PayU_Middleware::$account_id = $this->account_id;
         PayU_Middleware::$test_mode = $this->environment == 'yes';
         $cardNumber = str_replace(array(' ', ''), '', $_POST['GP_PayU_online_Gateway-card-number']);
         $expirationArray = explode('/', $_POST['GP_PayU_online_Gateway-card-expiry']);
         $expirationDate = '20' . $expirationArray[1] . '/' . $expirationArray[0];
         $expirationDate = str_replace(' ', '', $expirationDate);
         $payerName = $customer_order->billing_first_name . ' ' . $customer_order->billing_last_name;
         $cvv = $_POST['GP_PayU_online_Gateway-card-cvc'];
         $res = PayU_Middleware::do_payment($order_id, $this->payment_description . $order_id, $customer_order->order_total, $customer_order->billing_email, $payerName, '111', $cardNumber, $cvv, $expirationDate, '', false);
         if (isset($res['code']) == true && isset($res['state']) == true && $res['code'] == 'SUCCESS' && $res['state'] == "APPROVED") {
             do_action('gp_order_online_completed_successfully', $res);
             if ($this->mark_order == 'yes') {
                 $woocommerce->cart->empty_cart();
                 $customer_order->payment_complete();
                 $customer_order->update_status('completed');
             }
             return array('result' => 'success', 'redirect' => $this->thankyou_page_url . '?order_id=' . $order_id);
         } else {
             do_action('gp_order_online_completed_failed', $res);
         }
     } catch (PayUException $e) {
         do_action('gp_error_occurred', $e);
     } catch (Exception $e) {
         do_action('gp_error_occurred', $e);
     }
 }
 public function process_payment($order_id)
 {
     try {
         global $woocommerce;
         $customer_order = new WC_Order($order_id);
         PayU_Middleware::$api_key = $this->api_key;
         PayU_Middleware::$api_login = $this->api_login;
         PayU_Middleware::$merchant_id = $this->merchant_id;
         PayU_Middleware::$account_id = $this->account_id;
         PayU_Middleware::$test_mode = $this->environment == 'yes';
         $payerName = $customer_order->billing_first_name . ' ' . $customer_order->billing_last_name;
         $method = $_POST["GP_PayU_offline_Gateway-offlinemethod"];
         $res = PayU_Middleware::do_payment($order_id, $this->payment_description . $order_id, $customer_order->order_total, $customer_order->billing_email, $payerName, '123', '', '', '', $method, true);
         if ($res['code'] == 'SUCCESS' && $res['state'] == "PENDING") {
             if ($this->mark_order == 'yes') {
                 $woocommerce->cart->empty_cart();
                 $customer_order->update_status('pending');
             }
             return array('result' => 'success', 'redirect' => $this->thankyou_page_url . '?order_id=' . $order_id . '&receipt_url=' . $res['payment_url']);
         }
     } catch (PayUException $e) {
         do_action('gp_error_occurred', $e);
     } catch (Exception $e) {
         do_action('gp_error_occurred', $e);
     }
 }