• Resolved aloaax

    (@aloaax)


    Hello i got Problem With Plugin
    If The user Wallet Is have For Example 10$ and the order = 10$
    the Order For Normal going to progress and wallet – minus 10$ That’s Happened If wallet more than 10$
    But if the order Same The wallet amount = order got pending payment – and nothing happened at the wallet – if i change order to prossing and complete .
    Thanks,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Subrata Mal

    (@subratamal)

    @aloaax Is there is an issue in our plugin core and we will solve this issue in our next update.

    lo3ty

    (@lo3ty)

    do you have an estimate on when you will release the update that fixes this bug?

    lo3ty

    (@lo3ty)

    for anyone else facing this issue, you can easily fix it until there is an update:

    wp-content/plugins/woo-wallet/includes/class-woo-wallet-payment-method.php
    Line 150 replace “>” with “>=”

    Thread Starter aloaax

    (@aloaax)

    public function woocommerce_pre_payment_complete($order_id) {
                $order = wc_get_order($order_id);
                if('wallet' === $order->get_payment_method('edit') && !$order->get_transaction_id('edit') && $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_payment_complete', array( 'on-hold', 'pending', 'failed', 'cancelled' ), $order ) )){
                    if ( woo_wallet()->wallet->get_wallet_balance( $order->get_customer_id('edit'), 'edit' ) > $order->get_total( 'edit' ) ) {
                        $wallet_response = woo_wallet()->wallet->debit( $order->get_customer_id('edit'), $order->get_total( 'edit' ), apply_filters('woo_wallet_order_payment_description', __( 'For order payment #', 'woo-wallet' ) . $order->get_order_number(), $order) );
                        if ( $wallet_response) {
                            $order->set_transaction_id($wallet_response);
                            do_action( 'woo_wallet_payment_processed', $order_id, $wallet_response);
                            $order->save();
                        } else{
                            throw new Exception(__('Something went wrong with processing payment please try again.', 'woo-wallet'));
                        }
                    } else{
                        throw new Exception(__('Insufficient wallet balance', 'woo-wallet'));
                    }
                }
            }

    could u please tell me where to add “>=” at the Code

    Plugin Author Subrata Mal

    (@subratamal)

    @aloaax Use this code.

    /**
             * Debit user wallet on WooCommerce payment complete.
             * @param WC_Order $order_id
             * @throws Exception
             */
            public function woocommerce_pre_payment_complete($order_id) {
                $order = wc_get_order($order_id);
                if('wallet' === $order->get_payment_method('edit') && !$order->get_transaction_id('edit') && $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_payment_complete', array( 'on-hold', 'pending', 'failed', 'cancelled' ), $order ) )){
                    if ( woo_wallet()->wallet->get_wallet_balance( $order->get_customer_id('edit'), 'edit' ) >= $order->get_total( 'edit' ) ) {
                        $wallet_response = woo_wallet()->wallet->debit( $order->get_customer_id('edit'), $order->get_total( 'edit' ), apply_filters('woo_wallet_order_payment_description', __( 'For order payment #', 'woo-wallet' ) . $order->get_order_number(), $order) );
                        if ( $wallet_response) {
                            $order->set_transaction_id($wallet_response);
                            do_action( 'woo_wallet_payment_processed', $order_id, $wallet_response);
                            $order->save();
                        } else{
                            throw new Exception(__('Something went wrong with processing payment please try again.', 'woo-wallet'));
                        }
                    } else{
                        throw new Exception(__('Insufficient wallet balance', 'woo-wallet'));
                    }
                }
            }
    Plugin Author Subrata Mal

    (@subratamal)

    @aloaax Due to inactivity, I am marking this topic as resolved. Feel free to open a new one if you face any further issues.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem With Balance and Order Price’ is closed to new replies.