Do not call get PayPal order if order id is empty

This commit is contained in:
emilicastells 2022-11-28 11:28:09 +01:00
parent e5cced2008
commit fda789228c
No known key found for this signature in database
GPG key ID: 1520C07081754570

View file

@ -162,7 +162,12 @@ class OrderProcessor {
*/
public function process( \WC_Order $wc_order ): bool {
$order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
$order = $this->session_handler->order() ?? $this->order_endpoint->order( $order_id );
if ( ! $order_id ) {
$this->last_error = __( 'No PayPal order ID found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
return false;
}
$order = $this->session_handler->order() ?? $this->order_endpoint->order( $order_id );
if ( ! $order ) {
$this->last_error = __( 'No PayPal order found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
return false;