From 75fb07c3afc05ade5bf7c0a0f33e4f574972977b Mon Sep 17 00:00:00 2001 From: Andreas Allacher Date: Thu, 26 Sep 2024 11:35:59 +0200 Subject: [PATCH] Fixed #552 --- src/ScheduledTask/ProcessNotificationsHandler.php | 2 +- src/Service/CaptureService.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ScheduledTask/ProcessNotificationsHandler.php b/src/ScheduledTask/ProcessNotificationsHandler.php index 51cc374a..d1c88b81 100644 --- a/src/ScheduledTask/ProcessNotificationsHandler.php +++ b/src/ScheduledTask/ProcessNotificationsHandler.php @@ -244,7 +244,7 @@ public function run(): void * It will be marked as done. */ $this->logger->info($exception->getMessage(), $logContext); - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $logContext['errorMessage'] = $exception->getMessage(); $this->logger->error('Notification processing failed.', $logContext); $this->logNotificationFailure($notification, $exception->getMessage()); diff --git a/src/Service/CaptureService.php b/src/Service/CaptureService.php index 91b979e0..f3197fa9 100644 --- a/src/Service/CaptureService.php +++ b/src/Service/CaptureService.php @@ -334,11 +334,13 @@ private function getLineItemsObjectArray( continue; } + $highestTaxRate = $lineItem->getPrice()->getTaxRules()->highestRate(); + $lineItemData = [ 'amountIncludingTax' => ceil($lineItem->getPrice()->getTotalPrice() * 100), 'description' => $lineItem->getLabel(), 'taxAmount' => intval($lineItem->getPrice()->getCalculatedTaxes()->getAmount() * 100), - 'taxPercentage' => $lineItem->getPrice()->getTaxRules()->highestRate()->getPercentage() * 10, + 'taxPercentage' => null !== $highestTaxRate ? ($highestTaxRate->getPercentage() * 10) : 0, 'quantity' => $lineItem->getQuantity(), 'id' => $lineItem->getId() ];