• October 5, 2023 at 10:51 am #4815

    Hi Subrata,

    The issue is with the Cashflows plugin:
    https://wordpress.org/support/topic/terawallet-conflict-with-latest-version/

    What is happening is that Cashflows is setting a transaction ID when the user begins a payment flow (before the payment is complete). The user can cancel the payment, return to checkout, and then proceed with Tera.

    class-woo-wallet-payment-method.php Ln 158 is checking for a transaction ID (! $order->get_transaction_id( ‘edit’ )). As this is set by cashflows, the statement is returning false, and the order can proceed without deducting payment from the user’s balance:

    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 ) ) ) {
    ...
    }
    

    I’ve managed to fix this by removing the transaction ID from the order if it is in pending payment status when a payment request is sent via Tera:

    Ln 127: public function process_payment( $order_id ):

    // Clear ID when previous payment attempt failed.
    if ( $order->has_status( 'pending' ) && $order->get_transaction_id( 'edit' ) ) {
    	$order->set_transaction_id( '' );
    	$order->save();
    }
    

    This seems to be working.

    Let me know if you need any further clarification. Thanks for your help!

  • WhatsApp