32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\Core\Payment\Events;
|
|
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Modules\Core\Payment\DTOs\PaymentResult;
|
|
|
|
/**
|
|
* Dispatched by a driver's SupportsAuthorization::authorize() (or, for an
|
|
* async gateway, HandlesPaymentCallback::handleCallback() resolving that
|
|
* same authorize() call later) once a hold has been placed — no funds have
|
|
* moved yet, see SupportsCaptures/SupportsVoids for what happens next.
|
|
*
|
|
* Carries $result (the full PaymentResult, not just a reference) plus
|
|
* $type and $context — same reasoning throughout Payment's events: Payment
|
|
* has no concept of a cart, an order, or a checkout fingerprint, so
|
|
* whatever a listener needs to react travels through $context untouched,
|
|
* opaque to Payment itself.
|
|
*/
|
|
class PaymentAuthorized
|
|
{
|
|
use Dispatchable;
|
|
|
|
/**
|
|
* @param array<string, mixed> $context
|
|
*/
|
|
public function __construct(
|
|
public readonly string $type,
|
|
public readonly PaymentResult $result,
|
|
public readonly array $context = [],
|
|
) {}
|
|
} |