mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Use wc email id to ensure customer is processing order
This commit is contained in:
parent
950ae2eeb1
commit
c013db5526
1 changed files with 4 additions and 4 deletions
|
@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||||
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice;
|
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway\PayUponInvoice;
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use WC_Email;
|
||||||
use WC_Order;
|
use WC_Order;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint;
|
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint;
|
||||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\CaptureFactory;
|
use WooCommerce\PayPalCommerce\ApiClient\Factory\CaptureFactory;
|
||||||
|
@ -257,13 +258,12 @@ class PayUponInvoice {
|
||||||
|
|
||||||
add_action(
|
add_action(
|
||||||
'woocommerce_email_before_order_table',
|
'woocommerce_email_before_order_table',
|
||||||
function( WC_Order $order, bool $sent_to_admin ) {
|
function( WC_Order $order, bool $sent_to_admin, bool $plain_text, WC_Email $email ) {
|
||||||
$action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING ) ?? '';
|
|
||||||
if (
|
if (
|
||||||
! $sent_to_admin
|
! $sent_to_admin
|
||||||
&& PayUponInvoiceGateway::ID === $order->get_payment_method()
|
&& PayUponInvoiceGateway::ID === $order->get_payment_method()
|
||||||
&& $order->has_status( 'processing' )
|
&& $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()}." );
|
$this->logger->info( "Adding Ratepay payment instructions to email for order #{$order->get_id()}." );
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ class PayUponInvoice {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
10,
|
10,
|
||||||
2
|
4
|
||||||
);
|
);
|
||||||
|
|
||||||
add_filter(
|
add_filter(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue