Skip to content

Instantly share code, notes, and snippets.

@ChaseWiseman
Created July 3, 2020 01:24
Show Gist options
  • Save ChaseWiseman/ce82a680cfe192c9b5bc882addf0e371 to your computer and use it in GitHub Desktop.
Save ChaseWiseman/ce82a680cfe192c9b5bc882addf0e371 to your computer and use it in GitHub Desktop.
Adds an order note with the returned AVS results for Elavon Credit Card transactions
<?php // only include this if needed
add_action( 'wc_payment_gateway_elavon_converge_credit_card_add_transaction_data', function( $order, $response ) {
if ( $order instanceof \WC_Order && $response instanceof \WC_Elavon_Converge_API_Credit_Card_Transaction_Response ) {
$message = sprintf(
'Elavon Fraud Results:<br />AVS Result: %s<br />CSC Result: %s',
esc_html( $response->get_avs_result() ),
esc_html( $response->get_csc_result() )
);
$order->add_order_note( $message );
}
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment