Open Alcpaone opened 2 months ago
hi @Alcpaone , sorry to hear that, do you know which php and sdk version you are using ?
@thibault-mambour
PHP 8.2.18 SDK i tried with php -i but can't get any SDK information. How can i get the SDK Version?
hi @Alcpaone , we have a potential fix, it looked to have work on our end, do you think you could confirm to make sure it is solving the problem
in PostFinanceCheckoutNameOrderUpdateTransactionStrategy.php and in PostFinanceCheckoutNameOrderUpdateTransactionInvoiceStrategy.php in method updateOrderStatus replace
$orderNr = $transaction->getMetaData()[‘order_nr’];
$orderData = $this->transactionService->getOrderIfExists($orderNr);
$orderId = (int)$orderData->kBestellung;
$transactionState = $transaction->getState();
to
$orderNr = $transaction->getMetaData()['order_nr'] ?? null;
// Fallback for older plugin versions
if ($orderNr === null) {
$transactionId = $transaction->getId();
$localTransaction = $this->transactionService->getLocalPostFinanceCheckoutTransactionById((string)$transactionId);
$orderId = (int)$localTransaction->order_id;
} else {
$orderData = $this->transactionService->getOrderIfExists($orderNr);
$orderId = (int)$orderData->kBestellung;
}
$transactionState = $transaction->getState();
@thibault-mambour sorry, I didnt saw your message. I'm out of office until tomorrow.
hi @Alcpaone , we have a potential fix, it looked to have work on our end, do you think you could confirm to make sure it is solving the problem
in PostFinanceCheckoutNameOrderUpdateTransactionStrategy.php and in PostFinanceCheckoutNameOrderUpdateTransactionInvoiceStrategy.php in method updateOrderStatus replace
$orderNr = $transaction->getMetaData()[‘order_nr’]; $orderData = $this->transactionService->getOrderIfExists($orderNr); $orderId = (int)$orderData->kBestellung; $transactionState = $transaction->getState();
to ```
$orderNr = $transaction->getMetaData()['order_nr'] ?? null;
// Fallback for older plugin versions if ($orderNr === null) { $transactionId = $transaction->getId(); $localTransaction = $this->transactionService->getLocalPostFinanceCheckoutTransactionById((string)$transactionId); $orderId = (int)$localTransaction->order_id; } else { $orderData = $this->transactionService->getOrderIfExists($orderNr); $orderId = (int)$orderData->kBestellung; } $transactionState = $transaction->getState();
"I can only find the code that needs to be replaced in the PostFinanceCheckoutNameOrderUpdateTransactionStrategy.php. This code does not exist in the PostFinanceCheckoutNameOrderUpdateTransactionInvoiceStrategy.php."
hi @cuneyt2002 sorry, can you In file PostFinanceCheckoutNameOrderUpdateTransactionInvoiceStrategy replace method updateOrderStatus to this: public function updateOrderStatus(string $entityId): void { $transactionInvoice = $this->transactionService->getTransactionInvoiceFromPortal($entityId);
$transaction = $transactionInvoice->getCompletion()
->getLineItemVersion()
->getTransaction();
$transactionId = $transaction->getId();
$orderNr = $transaction->getMetaData()['order_nr'] ?? null;
// Fallback for older plugin versions
if ($orderNr === null) {
$transactionId = $transaction->getId();
$localTransaction = $this->transactionService->getLocalPostFinanceCheckoutTransactionById((string)$transactionId);
$orderId = (int)$localTransaction->order_id;
} else {
$orderData = $this->transactionService->getOrderIfExists($orderNr);
$orderId = (int)$orderData->kBestellung;
}
switch ($transactionInvoice->getState()) {
case TransactionInvoiceState::DERECOGNIZED:
$this->orderService->updateOrderStatus($orderId, \BESTELLUNG_STATUS_IN_BEARBEITUNG, \BESTELLUNG_STATUS_STORNO);
$this->transactionService->updateTransactionStatus($transactionId, TransactionState::DECLINE);
print 'Order ' . $orderId . ' status was updated to cancelled. Triggered by Transaction Invoice webhook.';
break;
//case TransactionInvoiceState::NOT_APPLICABLE:
case TransactionInvoiceState::PAID:
if (!$this->orderService->updateOrderStatus($orderId, \BESTELLUNG_STATUS_OFFEN, \BESTELLUNG_STATUS_BEZAHLT)) {
$this->orderService->updateOrderStatus($orderId, \BESTELLUNG_STATUS_IN_BEARBEITUNG, \BESTELLUNG_STATUS_BEZAHLT);
}
$order = new Bestellung($orderId);
$this->transactionService->addIncommingPayment((string)$transactionId, $order, $transaction);
print 'Order ' . $orderId . ' status was updated to paid. Triggered by Transaction Invoice webhook.';
break;
}
}
With the actual version 1.0.32 we get a lot of webhook errors and messages from Checkout.
If we try to call the webhook, there is a internal server error. Please fix this.
Here the php log.
`thrown in /var/DOMAIN/plugins/jtl_postfinancecheckout/Services/PostFinanceCheckoutTransactionService.php on line 582 [29-Sep-2024 10:16:56 Europe/Berlin] PHP Fatal error: Uncaught TypeError: Plugin\jtl_postfinancecheckout\Services\PostFinanceCheckoutTransactionService::getOrderIfExists(): Argument #1 ($orderNr) must be of type string, null given, called in /var/DOMAIN/plugins/jtl_postfinancecheckout/Webhooks/Strategies/PostFinanceCheckoutNameOrderUpdateTransactionStrategy.php on line 50 and defined in /var/DOMAIN/plugins/jtl_postfinancecheckout/Services/PostFinanceCheckoutTransactionService.php:582 Stack trace:
0 /var/DOMAIN/plugins/jtl_postfinancecheckout/Webhooks/Strategies/PostFinanceCheckoutNameOrderUpdateTransactionStrategy.php(50): Plugin\jtl_postfinancecheckout\Services\PostFinanceCheckoutTransactionService->getOrderIfExists()
1 /var/DOMAIN/plugins/jtl_postfinancecheckout/Webhooks/PostFinanceCheckoutOrderUpdater.php(34): Plugin\jtl_postfinancecheckout\Webhooks\Strategies\PostFinanceCheckoutNameOrderUpdateTransactionStrategy->updateOrderStatus()
2 /var/DOMAIN/plugins/jtl_postfinancecheckout/Webhooks/PostFinanceCheckoutWebhookManager.php(85): Plugin\jtl_postfinancecheckout\Webhooks\PostFinanceCheckoutOrderUpdater->updateOrderStatus()
3 /var/DOMAIN/plugins/jtl_postfinancecheckout/frontend/postfinancecheckout_webhook.php(7): Plugin\jtl_postfinancecheckout\Webhooks\PostFinanceCheckoutWebhookManager->listenForWebhooks()
4 /var/DOMAIN/includes/src/Router/Controller/PageController.php(280): include('...')
5 /var/DOMAIN/includes/src/Router/Controller/PageController.php(233): JTL\Router\Controller\PageController->getPluginPage()
6 /var/DOMAIN/includes/src/Router/Controller/DefaultController.php(118): JTL\Router\Controller\PageController->getResponse()
7 /var/DOMAIN/includes/src/Router/Strategy/SmartyStrategy.php(40): JTL\Router\Controller\DefaultController->getResponse()
8 /var/DOMAIN/includes/vendor/league/route/src/Route.php(167): JTL\Router\Strategy\SmartyStrategy->invokeRouteCallable()
9 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): League\Route\Route->process()
10 /var/DOMAIN/includes/src/Router/Middleware/MaintenanceModeMiddleware.php(40): League\Route\Dispatcher->handle()
11 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\MaintenanceModeMiddleware->process()
12 /var/DOMAIN/includes/src/Router/Middleware/PhpFileCheckMiddleware.php(36): League\Route\Dispatcher->handle()
13 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\PhpFileCheckMiddleware->process()
14 /var/DOMAIN/includes/src/Router/Middleware/OptinMiddleware.php(49): League\Route\Dispatcher->handle()
15 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\OptinMiddleware->process()
16 /var/DOMAIN/includes/src/Router/Middleware/CurrencyCheckMiddleware.php(26): League\Route\Dispatcher->handle()
17 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\CurrencyCheckMiddleware->process()
18 /var/DOMAIN/includes/src/Router/Middleware/LocaleCheckMiddleware.php(34): League\Route\Dispatcher->handle()
19 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\LocaleCheckMiddleware->process()
20 /var/DOMAIN/includes/src/Router/Middleware/CartcheckMiddleware.php(25): League\Route\Dispatcher->handle()
21 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\CartcheckMiddleware->process()
22 /var/DOMAIN/includes/src/Router/Middleware/WishlistCheckMiddleware.php(24): League\Route\Dispatcher->handle()
23 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\WishlistCheckMiddleware->process()
24 /var/DOMAIN/includes/src/Router/Middleware/SSLRedirectMiddleware.php(43): League\Route\Dispatcher->handle()
25 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\SSLRedirectMiddleware->process()
26 /var/DOMAIN/includes/src/Router/Middleware/MaintenanceModeMiddleware.php(40): League\Route\Dispatcher->handle()
27 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\MaintenanceModeMiddleware->process()
28 /var/DOMAIN/includes/src/Router/Middleware/LocaleRedirectMiddleware.php(38): League\Route\Dispatcher->handle()
29 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\LocaleRedirectMiddleware->process()
30 /var/DOMAIN/includes/vendor/league/route/src/Strategy/ApplicationStrategy.php(37): League\Route\Dispatcher->handle()
31 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): Psr\Http\Server\MiddlewareInterface@anonymous->process()
32 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(53): League\Route\Dispatcher->handle()
33 /var/DOMAIN/includes/vendor/league/route/src/Router.php(111): League\Route\Dispatcher->dispatchRequest()
34 /var/DOMAIN/includes/src/Router/Router.php(703): League\Route\Router->dispatch()
35 /var/DOMAIN/includes/src/Shop.php(501): JTL\Router\Router->dispatch()
36 /var/DOMAIN/index.php(7): JTL\Shop::dispatch()
37 {main}
thrown in /var/DOMAIN/plugins/jtl_postfinancecheckout/Services/PostFinanceCheckoutTransactionService.php on line 582 [29-Sep-2024 10:36:23 Europe/Berlin] PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /var/DOMAIN/includes/src/Filter/Items/PriceRange.php:189 Stack trace:
0 /var/DOMAIN/includes/src/Filter/Items/PriceRange.php(189): array_keys()
1 /var/DOMAIN/includes/src/Filter/Items/PriceRange.php(479): JTL\Filter\Items\PriceRange->init()
2 /var/DOMAIN/includes/src/Filter/Items/PriceRange.php(637): JTL\Filter\Items\PriceRange->getAutomaticRangeOptions()
3 /var/DOMAIN/includes/src/Filter/SearchResults.php(714): JTL\Filter\Items\PriceRange->getOptions()
4 /var/DOMAIN/includes/src/Filter/ProductFilter.php(1629): JTL\Filter\SearchResults->setFilterOptions()
5 /var/DOMAIN/includes/src/Router/Controller/ProductListController.php(83): JTL\Filter\ProductFilter->generateSearchResults()
6 /var/DOMAIN/includes/src/Router/Controller/CategoryController.php(78): JTL\Router\Controller\ProductListController->getResponse()
7 /var/DOMAIN/includes/src/Router/Controller/DefaultController.php(118): JTL\Router\Controller\CategoryController->getResponse()
8 /var/DOMAIN/includes/src/Router/Strategy/SmartyStrategy.php(40): JTL\Router\Controller\DefaultController->getResponse()
9 /var/DOMAIN/includes/vendor/league/route/src/Route.php(167): JTL\Router\Strategy\SmartyStrategy->invokeRouteCallable()
10 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): League\Route\Route->process()
11 /var/DOMAIN/includes/src/Router/Middleware/MaintenanceModeMiddleware.php(40): League\Route\Dispatcher->handle()
12 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\MaintenanceModeMiddleware->process()
13 /var/DOMAIN/includes/src/Router/Middleware/PhpFileCheckMiddleware.php(36): League\Route\Dispatcher->handle()
14 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\PhpFileCheckMiddleware->process()
15 /var/DOMAIN/includes/src/Router/Middleware/OptinMiddleware.php(49): League\Route\Dispatcher->handle()
16 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\OptinMiddleware->process()
17 /var/DOMAIN/includes/src/Router/Middleware/CurrencyCheckMiddleware.php(26): League\Route\Dispatcher->handle()
18 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\CurrencyCheckMiddleware->process()
19 /var/DOMAIN/includes/src/Router/Middleware/LocaleCheckMiddleware.php(34): League\Route\Dispatcher->handle()
20 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\LocaleCheckMiddleware->process()
21 /var/DOMAIN/includes/src/Router/Middleware/CartcheckMiddleware.php(25): League\Route\Dispatcher->handle()
22 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\CartcheckMiddleware->process()
23 /var/DOMAIN/includes/src/Router/Middleware/WishlistCheckMiddleware.php(24): League\Route\Dispatcher->handle()
24 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\WishlistCheckMiddleware->process()
25 /var/DOMAIN/includes/src/Router/Middleware/SSLRedirectMiddleware.php(43): League\Route\Dispatcher->handle()
26 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\SSLRedirectMiddleware->process()
27 /var/DOMAIN/includes/src/Router/Middleware/MaintenanceModeMiddleware.php(40): League\Route\Dispatcher->handle()
28 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\MaintenanceModeMiddleware->process()
29 /var/DOMAIN/includes/src/Router/Middleware/LocaleRedirectMiddleware.php(38): League\Route\Dispatcher->handle()
30 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): JTL\Router\Middleware\LocaleRedirectMiddleware->process()
31 /var/DOMAIN/includes/vendor/league/route/src/Strategy/ApplicationStrategy.php(37): League\Route\Dispatcher->handle()
32 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(59): Psr\Http\Server\MiddlewareInterface@anonymous->process()
33 /var/DOMAIN/includes/vendor/league/route/src/Dispatcher.php(53): League\Route\Dispatcher->handle()
34 /var/DOMAIN/includes/vendor/league/route/src/Router.php(111): League\Route\Dispatcher->dispatchRequest()
35 /var/DOMAIN/includes/src/Router/Router.php(703): League\Route\Router->dispatch()
36 /var/DOMAIN/includes/src/Shop.php(501): JTL\Router\Router->dispatch()
37 /var/DOMAIN/index.php(7): JTL\Shop::dispatch()
38 {main}
thrown in /var/DOMAIN/includes/src/Filter/Items/PriceRange.php on line 189`