From 704bc9cbf06d16e19030819ac0692319f3072e5d Mon Sep 17 00:00:00 2001 From: Narek Zakarian Date: Wed, 31 Jan 2024 17:18:25 +0400 Subject: [PATCH] Store the fraud result in meta --- modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php | 1 + .../src/Processor/CreditCardOrderInfoHandlingTrait.php | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php index da490e70d..b787be582 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php @@ -52,6 +52,7 @@ class PayPalGateway extends \WC_Payment_Gateway { const REFUND_FEES_META_KEY = '_ppcp_paypal_refund_fees'; const REFUNDS_META_KEY = '_ppcp_refunds'; const THREE_D_AUTH_RESULT_META_KEY = '_ppcp_paypal_3DS_auth_result'; + const FRAUD_RESULT_META_KEY = '_ppcp_paypal_fraud_result'; /** * The Settings Renderer. diff --git a/modules/ppcp-wc-gateway/src/Processor/CreditCardOrderInfoHandlingTrait.php b/modules/ppcp-wc-gateway/src/Processor/CreditCardOrderInfoHandlingTrait.php index f4d988b04..71e96b90a 100644 --- a/modules/ppcp-wc-gateway/src/Processor/CreditCardOrderInfoHandlingTrait.php +++ b/modules/ppcp-wc-gateway/src/Processor/CreditCardOrderInfoHandlingTrait.php @@ -135,5 +135,13 @@ trait CreditCardOrderInfoHandlingTrait { sprintf( __( 'CVV2 Match: %s', 'woocommerce-paypal-payments' ), esc_html( $fraud_responses['cvv_match'] ) ) ); $wc_order->add_order_note( $cvv_response_order_note ); + + $wc_order->update_meta_data( PayPalGateway::FRAUD_RESULT_META_KEY, $fraud_responses ); + $wc_order->save_meta_data(); + + /** + * Fired when the fraud result information is added to WC order. + */ + do_action( 'woocommerce_paypal_payments_fraud_result_added', $wc_order, $order ); } }