Forum Replies Created
-
AuthorPosts
-
October 6, 2023 at 5:33 pm in reply to: Not removing cash from the account balance when TeraWallet used #4825
Think Zap
ParticipantFYI, Cashflows have fixed the issue at their end by saving their transaction ID to meta instead of setting the WC transaction ID.
However, it’s worth keeping this issue in mind if other gateways also set the transaction ID too early.
Many thanks!
October 5, 2023 at 4:21 pm in reply to: Not removing cash from the account balance when TeraWallet used #4815Think Zap
ParticipantHi 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!
-
AuthorPosts