Log order status in payment captured webhook checker

This commit is contained in:
dinamiko 2022-06-22 11:11:16 +02:00
parent fcf9b6b19e
commit fff6c84e91
2 changed files with 9 additions and 3 deletions

View file

@ -218,7 +218,8 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
time() + ( 5 * MINUTE_IN_SECONDS ),
'woocommerce_paypal_payments_check_pui_payment_captured',
array(
'order_id' => $order_id,
'wc_order_id' => $order_id,
'order_id' => $order->id(),
)
);

View file

@ -235,8 +235,13 @@ class WCGatewayModule implements ModuleInterface {
add_action(
'woocommerce_paypal_payments_check_pui_payment_captured',
function ( int $order_id ) {
$wc_order = wc_get_order( $order_id );
function ( int $wc_order_id, string $order_id ) use ( $c ) {
$order_endpoint = $c->get( 'api.endpoint.order' );
$logger = $c->get( 'woocommerce.logger.woocommerce' );
$order = $order_endpoint->order( $order_id );
$logger->info( 'Checking payment captured webhook, order status: ' . $order->status() );
$wc_order = wc_get_order( $wc_order_id );
if ( ! is_a( $wc_order, WC_Order::class ) || $wc_order->get_status() !== 'on-hold' ) {
return;
}