Log license fetch failures and surface honest warning toast on save#324
Conversation
When the Saferpay Management API license lookup fails during credentials save, the previous flow showed a misleading green success toast that asked merchants to verify credentials they had just successfully validated. - Log the underlying error to the SaferPay module Logs tab via LoggerInterface - Return a 'warning' flag in the save credentials response - Render an amber warning toast with a clearer message that points to the Logs
There was a problem hiding this comment.
Code Review
This pull request enhances the credential saving process by implementing error handling for license retrieval failures. It introduces server-side logging for these errors and adds a new 'warning' toast variant to the frontend to inform users when settings are saved but license verification could not be completed. A review comment suggests refactoring the logging context to adhere to PSR-3 standards by removing a redundant 'context' key in the array.
| $logger->error('License fetch failed on credentials save: ' . $e->getMessage(), [ | ||
| 'context' => ['exception_class' => get_class($e)], | ||
| ]); |
There was a problem hiding this comment.
The LoggerInterface extends \Psr\Log\LoggerInterface, which follows the PSR-3 standard. In PSR-3, the second argument to logging methods is the context array itself. Wrapping the context data in a redundant 'context' key is unnecessary and may lead to nested structures in the log output (e.g., context.context.exception_class instead of context.exception_class).
$logger->error('License fetch failed on credentials save: ' . $e->getMessage(), [
'exception_class' => get_class($e),
]);
Summary
LoggerInterfaceinstead of swallowing it silentlywarningflag fromajaxProcessSaveCredentialsso the React layer can render the new variantTest plan