Plugin Directory

Changeset 3284057


Ignore:
Timestamp:
04/29/2025 11:33:17 AM (11 months ago)
Author:
masterhomepage
Message:

fixing issues on same processId and unused shipping data

Location:
riskcube-von-creditreform-schweiz/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • riskcube-von-creditreform-schweiz/trunk/readme.txt

    r3275998 r3284057  
    55Tested up to: 6.7.1
    66Requires PHP: 7.4
    7 Stable Tag: 2.4.12.12
     7Stable Tag: 2.4.12.14
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    145145== Changelog ==
    146146
     147= 2.4.12.14 =
     148**Bug Fixes**
     149- Fixed shipping fields reset on checkout
     150
    147151= 2.4.12.12 =
    148152**Bug Fixes**
  • riskcube-von-creditreform-schweiz/trunk/riskcube.php

    r3275998 r3284057  
    66 * Plugin Name: RiskCUBE von Creditreform Schweiz
    77 * Plugin URI:
    8  * Version: 2.4.12.12
     8 * Version: 2.4.12.14
    99 * Description: RiskCube
    1010 * Author: Masterhomepage GmbH
  • riskcube-von-creditreform-schweiz/trunk/src/Core/Connector.php

    r3074156 r3284057  
    138138        $res = $this->sendRequest('claim', (array)$requestData);
    139139
    140 
    141140        self::setSessionData($res, $requestData, $id_order);
    142141
  • riskcube-von-creditreform-schweiz/trunk/src/Core/RiskCube.php

    r3275998 r3284057  
    6565                wp_enqueue_script(basename($jsFile), RISKCUBE__PLUGIN_URL . $jsFile, [], FileHelper::get_file_version($jsFile), true);
    6666            }
    67          
    6867
    6968            if (get_option('wc_riskcube_invoice_payment_gateway', 0) == 1) {
     
    7170            }
    7271
    73             add_action('woocommerce_order_status_changed', [__CLASS__, 'on_order_state_change'], 20, 3);
     72            add_action('woocommerce_order_status_changed', [__CLASS__, 'on_order_state_change'], 20, 1);
    7473            add_action('woocommerce_new_order', [__CLASS__, 'woocommerce_new_order'], 10, 1);
    7574            add_action('woocommerce_checkout_update_order_review', [__CLASS__, 'woocommerce_checkout_update_order_review']);
     
    249248        //cancel the shipping address if the checkbox is not checked
    250249        if (!$ship_to_different_address) {
    251             WC()->customer->set_props([
    252                 'shipping_first_name' => '',
    253                 'shipping_last_name'  => '',
    254                 'shipping_company'    => '',
    255                 'shipping_phone'      => '',
    256                 'shipping_email'      => '',
    257                 'shipping_country'    => '',
    258                 'shipping_state'      => '',
    259                 'shipping_postcode'   => '',
    260                 'shipping_city'       => '',
    261                 'shipping_address_1'  => '',
    262                 'shipping_address_2'  => '',
    263             ]);
    264             // Save changes to customer
    265             WC()->customer->save();
    266         }
     250            WC()->customer->set_shipping_first_name( '' );
     251            WC()->customer->set_shipping_last_name( '' );
     252            WC()->customer->set_shipping_company( '' );
     253            WC()->customer->set_shipping_address_1( '' );
     254            WC()->customer->set_shipping_address_2( '' );
     255            WC()->customer->set_shipping_city( '' );
     256            WC()->customer->set_shipping_state( '' );
     257            WC()->customer->set_shipping_postcode( '' );
     258            WC()->customer->set_shipping_country( null );
     259            WC()->customer->set_shipping_phone( '' );
     260        }
     261        // Save changes to customer
     262        WC()->customer->save();
    267263    }
    268264
    269265    public static function woocommerce_new_order($id_order)
    270266    {
    271         static::on_order_state_change($id_order, 'new', 'pending');
    272     }
    273 
    274     public static function on_order_state_change($id_order, $from, $to_status)
     267        static::on_order_state_change($id_order);
     268    }
     269
     270    public static function on_order_state_change($id_order)
    275271    {
    276272        $order = wc_get_order($id_order);
    277273
    278         if (get_option('wc_riskcube_fk_confirm_state') === 'wc-' . $to_status ) {
     274        if (get_option('wc_riskcube_fk_confirm_state') === 'wc-'.$order->get_status() ) {
    279275            // NXTLVL-182 in wc classic, the hooks are called in the wrong order.
    280276            // with this workaround, the order is checked wether it has been confirmed
  • riskcube-von-creditreform-schweiz/trunk/src/Helper/ClaimDataHelper.php

    r3074156 r3284057  
    147147    {
    148148        if ($orderId) {
    149             $session_id = md5(time());
     149            // Generate a unique ID using order ID and current timestamp
     150            $session_id = md5($orderId . time());
    150151        } else {
    151152            $session = RiskCube::getSession();
     
    166167                throw new Exception('CLAIM : NO SESSION TOKEN');
    167168            }
     169        }
     170
     171        // Clear the session ID after use to ensure uniqueness for subsequent orders
     172        if (!$orderId) {
     173            $session->set('riskcube_session_id', null);
     174            $session->save_data();
    168175        }
    169176
Note: See TracChangeset for help on using the changeset viewer.