• Hello, we are a payment gateway. After the new update, our plugin has a problem and the order_total is sent to the server as none. What is the problem? Please tell me what has changed in this function

            public function get_zibal_trackId() {
    
                if ( $this->get_form_data() ) {
    
                    $checkout = LearnPress::instance()->checkout();
    
                    $data = [
    
                        'merchant' => $this->merchant,
    
                        'amount' => $this->order->order_total,
    
                        'description' => $this->form_data['description'],
    
                        // 'Email' => (!empty($this->posted['email'])) ? $this->posted['email'] : "",
    
                        'mobile' => (!empty($this->posted['mobile'])) ? $this->posted['mobile'] : "",
    
                        'callbackUrl' => get_site_url() . '/?' . learn_press_get_web_hook( 'zibal' ) . '=1&order_id='.$this->order->get_id(),
    
                    ];
    
                    $result = $this->rest_payment_request($data);
    
                    if($result->result == 100) {
    
                        $this->trackId = $result->trackId;
    
                        return true;
    
                    }
    
                }
    
                return false;
    
            }
    
            /**
    
             * Handle a web hook
    
             *
    
             */
    
            public function web_hook_process_zibal() {
    
                $request = $_REQUEST;
    
                if(isset($request['learn_press_zibal']) && intval($request['learn_press_zibal']) === 1) {
    
                    if ($request['status'] == '2') {
    
                        $order = new LP_Order( $request['order_id'] );
    
                        $currency_code = learn_press_get_currency();
    
                        if ($currency_code == 'IRR') {
    
                            $amount = $order->order_total;
    
                        } else {
    
                            $amount = $order->order_total * 10;
    
                        }  
    
                        $data = array(
    
                            'merchant' => $this->merchant,
    
                            'trackId' => $_GET['trackId'],
    
                        );
    
                        $result = $this->rest_payment_verification($data);
    
                        if($result->result == 100 || $result->result == 201) {
    
                            if($amount == $result->amount) {
    
                                $this->trackId = intval($_GET['trackId']);
    
                                $this->payment_status_completed($order , $request);
    
                                wp_redirect(esc_url( $this->get_return_url( $order ) ));
    
                                exit();
    
                            }
    
                        }
    
                    }
    
                    if(!isset($_SESSION))
    
                        session_start();
    
                    $_SESSION['zibal_error'] = 1;
    
                    wp_redirect(esc_url( learn_press_get_page_link( 'checkout' ) ));
    
                    exit();
    
                }
    
            }
Viewing 1 replies (of 1 total)
  • Plugin Author ThimPress

    (@thimpress)

    Hi pegahszi,

    We don’t know how to you code to intergrate your new gateway. But on this code, you try change something:

    $order->order_total
    - This code is old, it error (PHP 8 or higher will warning) because class LP_Order don't has attribute. So you need change it to: $order->get_data( 'order_total' )

    Thanks so much.
    Best Regard!

Viewing 1 replies (of 1 total)
  • The topic ‘The total order is not sent to the server’ is closed to new replies.