WordPress.org

Plugin Directory

Changeset 1324806


Ignore:
Timestamp:
01/09/16 15:59:48 (2 years ago)
Author:
baba_mmx
Message:

v 20160109 - aggiunte correzioni alla currency e filtro per i parametri

Location:
woocommerce-gestpay
Files:
1 edited
4 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-gestpay/tags/20160109/gateway-gestpay-starter.php

    r1256394 r1324806  
    44  Plugin URI: http://wordpress.org/plugins/woocommerce-gestpay/ 
    55  Description: Estende WooCommerce fornendo il gateway di pagamento GestPay Starter di Banca Sella. 
    6   Version: 20150930 
     6  Version: 20160109 
    77  Author: Mauro Mascia (baba_mmx) 
    88  Author URI: http://www.mauromascia.com 
     
    1010  Support: info@mauromascia.com 
    1111 
    12   Copyright © 2013-2015 Mauro Mascia 
    13  
    14   This program is free software; you can redistribute it and/or modify 
    15   it under the terms of the GNU General Public License, version 2, as 
    16   published by the Free Software Foundation. 
    17   This program is distributed in the hope that it will be useful, 
    18   but WITHOUT ANY WARRANTY; without even the implied warranty of 
    19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    20   GNU General Public License for more details. 
    21   You should have received a copy of the GNU General Public License 
    22   along with this program; if not, write to the Free Software 
    23   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
     12  Copyright © 2013-2016 Mauro Mascia 
     13 
     14  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as 
     15  published by the Free Software Foundation. This program is distributed in the hope that it will be useful, 
     16  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17  GNU General Public License for more details. You should have received a copy of the GNU General Public License 
     18  along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    2419 */ 
    2520 
     
    399394        return array( 
    400395          'result' => 'failed', 
    401           'redirect' => add_query_arg( 'order', $order->id, add_query_arg( 'key', 'FAILED', $this->get_wc_url('pay', $order) ) ) 
     396          'redirect' => add_query_arg( 
     397              array( 
     398                'order' => $order->id, 
     399                'key' => 'FAILED', 
     400                'utm_nooverride' => '1' 
     401              ), 
     402              $this->get_wc_url('pay', $order) 
     403            ) 
    402404        ); 
    403405      } 
    404  
    405       return array( 
    406         'result' => 'success', 
    407         'redirect' => $this->liveurl . '?a=' . $this->shopLogin . '&b=' . $b_param 
    408       ); 
     406      else { 
     407        return array( 
     408          'result' => 'success', 
     409          'redirect' => add_query_arg( 
     410                array( 
     411                  'a' => $this->shopLogin, 
     412                  'b' => $b_param, 
     413                  'utm_nooverride' => '1' 
     414                ), 
     415                $this->liveurl 
     416              ) 
     417        ); 
     418      } 
    409419    } 
    410420 
     
    433443    function get_gestpay_args( $order ) { 
    434444      $order_id = $order->id; 
     445      // Aelia 
     446      // Payments must use the order currency, not  shop's base currency 
     447      $order_currency = $order->get_order_currency(); 
    435448 
    436449      if ( $this->debug ) 
     
    447460      ); 
    448461 
    449       if ( in_array( get_option( 'woocommerce_currency' ), array_keys( $gestpay_allowed_currency_codes ) ) ) { 
    450         $this->currency = $gestpay_allowed_currency_codes[get_option( 'woocommerce_currency' )]; 
     462      if ( in_array( $order_currency, array_keys( $gestpay_allowed_currency_codes ) ) ) { 
     463        $this->currency = $gestpay_allowed_currency_codes[$order_currency]; 
    451464      } 
    452465      else { 
     
    462475      $params->amount = $order->order_total; 
    463476      $params->shopTransactionId = $order_id; 
     477       
     478      // Aelia 
     479      // Allow 3rd parties to process the arguments, if needed 
     480      $params = apply_filters('woocommerce_gestpay_request_args', $params, $order, $this); 
    464481 
    465482      $crypted_string = $this->gestpay_encrypt( $params, $order_id ); 
  • woocommerce-gestpay/trunk/gateway-gestpay-starter.php

    r1256394 r1324806  
    44  Plugin URI: http://wordpress.org/plugins/woocommerce-gestpay/ 
    55  Description: Estende WooCommerce fornendo il gateway di pagamento GestPay Starter di Banca Sella. 
    6   Version: 20150930 
     6  Version: 20160109 
    77  Author: Mauro Mascia (baba_mmx) 
    88  Author URI: http://www.mauromascia.com 
     
    1010  Support: info@mauromascia.com 
    1111 
    12   Copyright © 2013-2015 Mauro Mascia 
    13  
    14   This program is free software; you can redistribute it and/or modify 
    15   it under the terms of the GNU General Public License, version 2, as 
    16   published by the Free Software Foundation. 
    17   This program is distributed in the hope that it will be useful, 
    18   but WITHOUT ANY WARRANTY; without even the implied warranty of 
    19   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    20   GNU General Public License for more details. 
    21   You should have received a copy of the GNU General Public License 
    22   along with this program; if not, write to the Free Software 
    23   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
     12  Copyright © 2013-2016 Mauro Mascia 
     13 
     14  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as 
     15  published by the Free Software Foundation. This program is distributed in the hope that it will be useful, 
     16  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17  GNU General Public License for more details. You should have received a copy of the GNU General Public License 
     18  along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    2419 */ 
    2520 
     
    399394        return array( 
    400395          'result' => 'failed', 
    401           'redirect' => add_query_arg( 'order', $order->id, add_query_arg( 'key', 'FAILED', $this->get_wc_url('pay', $order) ) ) 
     396          'redirect' => add_query_arg( 
     397              array( 
     398                'order' => $order->id, 
     399                'key' => 'FAILED', 
     400                'utm_nooverride' => '1' 
     401              ), 
     402              $this->get_wc_url('pay', $order) 
     403            ) 
    402404        ); 
    403405      } 
    404  
    405       return array( 
    406         'result' => 'success', 
    407         'redirect' => $this->liveurl . '?a=' . $this->shopLogin . '&b=' . $b_param 
    408       ); 
     406      else { 
     407        return array( 
     408          'result' => 'success', 
     409          'redirect' => add_query_arg( 
     410                array( 
     411                  'a' => $this->shopLogin, 
     412                  'b' => $b_param, 
     413                  'utm_nooverride' => '1' 
     414                ), 
     415                $this->liveurl 
     416              ) 
     417        ); 
     418      } 
    409419    } 
    410420 
     
    433443    function get_gestpay_args( $order ) { 
    434444      $order_id = $order->id; 
     445      // Aelia 
     446      // Payments must use the order currency, not  shop's base currency 
     447      $order_currency = $order->get_order_currency(); 
    435448 
    436449      if ( $this->debug ) 
     
    447460      ); 
    448461 
    449       if ( in_array( get_option( 'woocommerce_currency' ), array_keys( $gestpay_allowed_currency_codes ) ) ) { 
    450         $this->currency = $gestpay_allowed_currency_codes[get_option( 'woocommerce_currency' )]; 
     462      if ( in_array( $order_currency, array_keys( $gestpay_allowed_currency_codes ) ) ) { 
     463        $this->currency = $gestpay_allowed_currency_codes[$order_currency]; 
    451464      } 
    452465      else { 
     
    462475      $params->amount = $order->order_total; 
    463476      $params->shopTransactionId = $order_id; 
     477       
     478      // Aelia 
     479      // Allow 3rd parties to process the arguments, if needed 
     480      $params = apply_filters('woocommerce_gestpay_request_args', $params, $order, $this); 
    464481 
    465482      $crypted_string = $this->gestpay_encrypt( $params, $order_id ); 
Note: See TracChangeset for help on using the changeset viewer.