Void missing in process_refund
-
Void for authorization only transactions is missing in the process_refund function.
The code below fixes allows for the admin to refund a non-captured transaction by doing a void instead of refund in the process_refund.
Add this code on line 371 of /includes/abstract/abstract-wc-gateway-ppec.php:
// Process a void instead of refund if transaction is authorized only $trans_id = get_post_meta( $order_id, '_transaction_id', true ); $trans_details = wc_gateway_ppec()->client->get_transaction_details( array( 'TRANSACTIONID' => $trans_id ) ); if ( $trans_id && wc_gateway_ppec()->admin->is_authorized_only( $trans_details ) ) { $params['AUTHORIZATIONID'] = $trans_id; $result = wc_gateway_ppec()->client->do_express_checkout_void( $params ); if ( is_wp_error( $result ) ) { $order->add_order_note( __( 'Unable to void charge!', 'woocommerce-gateway-paypal-express-checkout' ) . ' ' . $result->get_error_message() ); return new WP_Error( 'paypal_refund_error', "This order cannot be voided, please process this order manually via PayPal." ); } else { $order->add_order_note( sprintf( __( 'PayPal Checkout charge voided (Charge ID: %s)', 'woocommerce-gateway-paypal-express-checkout' ), $trans_id ) ); return true; } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Void missing in process_refund’ is closed to new replies.