Change order status to failed and add note when no payment tokens found

This commit is contained in:
dinamiko 2021-04-28 12:13:29 +02:00
parent a4e76afd4d
commit 17f1a91241

View file

@ -178,16 +178,24 @@ class RenewalHandler {
$tokens = $this->repository->all_for_user_id( (int) $customer->get_id() );
if ( ! $tokens ) {
$error_message = sprintf(
// translators: %d is the customer id.
__(
'Payment failed. No payment tokens found for customer %d.',
'woocommerce-paypal-payments'
),
(int) $customer->get_id()
);
$wc_order->update_status(
'failed',
$error_message
);
$this->logger->log(
'error',
sprintf(
// translators: %d is the customer id.
__(
'No payment tokens found for customer %d',
'woocommerce-paypal-payments'
),
(int) $customer->get_id()
),
$error_message,
array(
'customer' => $customer,
'order' => $wc_order,