Refactoring

This commit is contained in:
dinamiko 2022-10-05 09:46:16 +02:00
parent b946386eaf
commit abf3a0e5d0
4 changed files with 38 additions and 38 deletions

View file

@ -167,17 +167,8 @@ class OXXOGateway extends WC_Payment_Gateway {
}
} catch ( RuntimeException $exception ) {
$error = $exception->getMessage();
if ( is_a( $exception, PayPalApiException::class ) && is_array( $exception->details() ) ) {
$details = '';
foreach ( $exception->details() as $detail ) {
$issue = $detail->issue ?? '';
$field = $detail->field ?? '';
$description = $detail->description ?? '';
$details .= $issue . ' ' . $field . ' ' . $description . '<br>';
}
$error = $details;
if ( is_a( $exception, PayPalApiException::class ) ) {
$error = $exception->get_details( $error );
}
$this->logger->error( $error );

View file

@ -246,17 +246,8 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
);
} catch ( RuntimeException $exception ) {
$error = $exception->getMessage();
if ( is_a( $exception, PayPalApiException::class ) && is_array( $exception->details() ) ) {
$details = '';
foreach ( $exception->details() as $detail ) {
$issue = $detail->issue ?? '';
$field = $detail->field ?? '';
$description = $detail->description ?? '';
$details .= $issue . ' ' . $field . ' ' . $description . '<br>';
}
$error = $details;
if ( is_a( $exception, PayPalApiException::class ) ) {
$error = $exception->get_details( $error );
}
$this->logger->error( $error );