Closed mlocati closed 1 month ago
The log providers could implement an interface like this:
<?php
declare(strict_types=1);
namespace Concrete\Package\CommunityStore\Src\CommunityStore\Payment;
use Concrete\Package\CommunityStore\Src\CommunityStore\Order\Order;
use DateTimeInterface;
interface LogProvider
{
/**
* Get the handle that uniquely identifies this log provider.
*/
public function getHandle(): string;
/**
* Get the display name of this log provider.
*/
public function getName(): string;
/**
* Find the log entries in the specified date/time range.
*
* @return \Concrete\Package\CommunityStore\Src\CommunityStore\Payment\LogEntry[]
*/
public function findByDate(DateTimeInterface $from, DateTimeInterface $to): array;
/**
* Find the log entries associated to a specific order.
*
* @return \Concrete\Package\CommunityStore\Src\CommunityStore\Payment\LogEntry[]
*/
public function findByOrder(Order $order): array;
}
Is the main benefit of this that it's a different log 'channel'? Im just looking to understand why we'd use this, and not just standard logs.
It'd be rather hard to find order-specific entries in the standard logs...
That makes sense. Would you then suggest that once this is place that all payment gateways should be adjusted to work with logs the same way?
That's just an opt-in feature, which requires that the payment gateways store the data of each step.
Of course that'd be nice.
And here's an example of a session of the code I'm developing:
That's very cool - I see what you're looking to do here. With there being so many different ways that payment gateways work, each one has their own quirks and sometimes fiddly ways to debug.
And here it is: #878
I developed two payment methods (this and this) that store the details of the payment messages associated to every order (e.g. the data sent to the payment servers and the data received back from them).
At the moment, the only way to check these messages is by accessing the database directly.
What about adding to Community Store a new dashboard page where users can see the details of such messages?
I was thinking about something like this:
in the on_start method of packages providing payment methods, we could introduce some code like this:
If that's ok, I can create a pull request that implements this new feature.