From c013db5526036b933906f5708e620c387924c738 Mon Sep 17 00:00:00 2001 From: dinamiko Date: Fri, 30 Sep 2022 11:13:52 +0200 Subject: [PATCH] Use wc email id to ensure customer is processing order --- .../src/Gateway/PayUponInvoice/PayUponInvoice.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php index 1b16a11d6..2369f54bc 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayUponInvoice/PayUponInvoice.php @@ -10,6 +10,7 @@ declare(strict_types=1); namespace WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice; use Psr\Log\LoggerInterface; +use WC_Email; use WC_Order; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Factory\CaptureFactory; @@ -257,13 +258,12 @@ class PayUponInvoice { add_action( 'woocommerce_email_before_order_table', - function( WC_Order $order, bool $sent_to_admin ) { - $action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) ?? ''; + function( WC_Order $order, bool $sent_to_admin, bool $plain_text, WC_Email $email ) { if ( ! $sent_to_admin && PayUponInvoiceGateway::ID === $order->get_payment_method() && $order->has_status( 'processing' ) - && ( $action && $action !== 'woocommerce_refund_line_items' ) + && $email->id === 'customer_processing_order' ) { $this->logger->info( "Adding Ratepay payment instructions to email for order #{$order->get_id()}." ); @@ -315,7 +315,7 @@ class PayUponInvoice { } }, 10, - 2 + 4 ); add_filter(