title: Woocommerce payment gateway integration
body: <p>Have a problem with latest woocommerce version payment gateway integration.
  I recently started using woocommerce for a friend and he was having woocommerce version 1.6.5.2. But now he updated his woocommerce to latest version (2.0.12).
  He had some custom made payment gateway that worked on the 1.6 version but now it doesnt.
  This is the custom payment gateway code:</p>
  
  <pre><code>/*
  Plugin Name ......
  .../*
  $post_perma = trim( esc_url ( $_SERVER['REQUEST_URI'] ), '/' );
  add_action('plugins_loaded', 'woocommerce_rba_etomitreba_init', 0);
  if($post_perma == 'uspjeh'||$post_perma == 'greska') {
      add_filter('the_content', 'after_processing');
  }
  function after_processing() {
      global $post, $post_perma, $woocommerce;
      if($post_perma == 'uspjeh') {
          if(isset($_POST['OrderID'])&amp;&amp;isset($_POST['ApprovalCode'])) {
              echo '&lt;div class="notify notify-success"&gt;Not Important;)&lt;/div&gt;';
              $order = new WC_Order( $_POST['OrderID'] );
              $order-&gt;payment_complete();
              $order-&gt;status = 'completed';
              $woocommerce-&gt;cart-&gt;empty_cart();
              unset($_SESSION['order_awaiting_payment']);
          }
          else {
              echo '&lt;div class="notify notify-error"&gt;Not Important&lt;/div&gt;';
          }
      }
      if($post_perma == 'greska') {
          echo '&lt;div class="notify notify-error"&gt;DNot Important&lt;/div&gt;';
      }
  }
  function woocommerce_rba_etomitreba_init() {
      if ( !class_exists( 'WC_Payment_Gateway' ) ) return;
      class WC_Raiffeisen_Bank_eToMiTreba extends WC_Payment_Gateway {
          public function __construct() {
              $this-&gt;id = 'rba_etomitreba';
              $this-&gt;method_title = __( 'Raiffeisen Bank', 'woocommerce' );
              $this-&gt;icon = apply_filters('woocommerce_cheque_icon', '');
              $this-&gt;has_fields = false;
  
              // Load the form fields.
              $this-&gt;form_fields = array(
                  'enabled' =&gt; array(
                      'title' =&gt; __( 'Not Important', 'woothemes' ),
                      'type' =&gt; 'checkbox',
                      'label' =&gt; __( 'Not Important', 'woothemes' ),
                      'default' =&gt; 'yes'
                  ),
                  'merchant-id' =&gt; array(
                      'title' =&gt; __( 'Not Important', 'woothemes' ),
                      'type' =&gt; 'text',
                      'description' =&gt; __( 'Not Important', 'woothemes' ),
                      'default' =&gt; __( '', 'woothemes' )
                  ),
                  'terminal-id' =&gt; array(
                      'title' =&gt; __( 'Not Important', 'woothemes' ),
                      'type' =&gt; 'text',
                      'description' =&gt; __( 'Not Important', 'woothemes' ),
                      'default' =&gt; __( '', 'woothemes' )
                  ),
                  'rsa-private-key' =&gt; array(
                      'title' =&gt; __( 'Not Important', 'woothemes' ),
                      'type' =&gt; 'textarea',
                      'description' =&gt; __( 'Not Important', 'woothemes' ),
                      'default' =&gt; __( '', 'woothemes' )
                  ),
                  'title' =&gt; array(
                      'title' =&gt; __( 'Not Important', 'woothemes' ),
                      'type' =&gt; 'text',
                      'description' =&gt; __( '', 'woothemes' ),
                      'default' =&gt; __( 'Not Important', 'woothemes' )
                  ),
                  'description' =&gt; array(
                      'title' =&gt; __( 'Not Important', 'woothemes' ),
                      'type' =&gt; 'textarea',
                      'description' =&gt; __( '', 'woothemes' ),
                      'default' =&gt; 'Not Important.'
                  )
              );
              // Load the settings.
              $this-&gt;init_settings();
              $this-&gt;title = $this-&gt;settings['title'];
              $this-&gt;description = $this-&gt;settings['description'];
  
              // Actions
              add_action('woocommerce_update_options_payment_gateways', array(&amp;$this, 'process_admin_options'));
          }
  
          public function process_payment( $order_id ) {
                  $order = new WC_Order( $order_id );
                  $order-&gt;shipping_first_name;
                  $order-&gt;shipping_last_name;
                  $order-&gt;get_shipping_address();
                  $url_gateway = 'Not Important';
  
                  $merchant_id = 'xxxxx';
                  $terminal_id = 'xxxxx';
                  $total = $order-&gt;get_total()*100; // kn to lp conversion
                  $currency_id = 191;
                  $time = new DateTime('', new DateTimeZone('Europe/Zagreb'));
                  $purchase_time = $time-&gt;format('ymdHis');
                  $locale = 'hr';
                  $ordered_items = $order-&gt;get_items();
                  foreach($ordered_items as $item) {
                      $ordered_items_array[] = $item['name'];
                  }
                  $ordered_items = implode(', ',$ordered_items_array);
                  $purchase_desc = $time-&gt;format('d.m.Y. H:i:s').' - '.$order-&gt;shipping_first_name.' '.$order-&gt;shipping_last_name.' : '.$ordered_items;
                  $session_id = session_id();
                  $data = "$merchant_id;$terminal_id;$purchase_time;$order_id;$currency_id;$total;$session_id;";
                  $priv_key = $this-&gt;settings['rsa-private-key'];
                  $pkeyid = openssl_get_privatekey($priv_key);
                  openssl_sign($data, $signature, $pkeyid);
                  openssl_free_key($pkeyid);
                  $b64sign = base64_encode($signature);
                  $signature = $b64sign;
  
                  //$order-&gt;update_status('on-hold', __('Not Important', 'woothemes'));
                  echo '
              &lt;form name="ordersend" action="'.$url_gateway.'" method="post"&gt;
                  &lt;input name="Version" type="hidden" value="1" &gt;
                  &lt;input name="MerchantID" type="hidden" value="'.$merchant_id.'"  &gt;
                  &lt;input name="TerminalID" type="hidden" value="'.$terminal_id.'"  &gt;
                  &lt;input name="TotalAmount" type="hidden" value="'.$total.'"&gt;
                  &lt;input name="SD" type="hidden" value="'.$session_id.'"&gt;
                  &lt;input name="Currency" type="hidden" value="'.$currency_id.'" &gt;
                  &lt;input name="Locale" type="hidden" value="'.$locale.'"&gt;
                  &lt;input name="OrderID" type="hidden" value="'.$order_id.'"  &gt;
                  &lt;input name="PurchaseTime" type="hidden" value="'.$purchase_time.'"&gt;
                  &lt;input name="PurchaseDesc" type="hidden" value="'.$purchase_desc.'" &gt;
                  &lt;input name="Signature" type="hidden" value="'.$signature.'" &gt;
              &lt;/form&gt;
              &lt;script language="javascript"&gt;
              &lt;!--
              document.forms["ordersend"].submit();
              --&gt;&lt;/script&gt;
              ';
  
              /*
              return array (
                  'result'    =&gt; 'success'
              );*/
          }
  
          public function admin_options() {
              ?&gt;
              &lt;img src="&lt;?php echo 'Not Important ?&gt;" width="664" height="114" /&gt;
              &lt;h3&gt;&lt;?php _e('Not Important', 'woothemes'); ?&gt;&lt;/h3&gt;
              &lt;p&gt;&lt;?php _e('Not Important'); ?&gt;&lt;/p&gt;
              &lt;table class="form-table"&gt;
              &lt;?php
                  // Generate the HTML For the settings form.
                  $this-&gt;generate_settings_html();
              ?&gt;
              &lt;/table&gt;
              &lt;?php
          } // End admin_options()
      }
  
      function woocommerce_raiffeisen_bank_etomitreba_gateway($methods) {
          $methods[] = 'WC_Raiffeisen_Bank_eToMiTreba';
          return $methods;
      }
      add_filter('woocommerce_payment_gateways', 'woocommerce_raiffeisen_bank_etomitreba_gateway' );
  }
  </code></pre>
  
  <p>Its just a compatibility issue but as i said, i am new to woocommerce and not so experienced with php. Any help would be greatly appreciated.</p>