Event dispatched after a payment is updated.
Typical use case is to perform additional operations after payment update (e.g. logging, cache purge, reindexing, etc.)
The following example log the update of the payment:
final class PaymentEventSubscriber implements EventSubscriberInterface
{
private function __construct(private LoggerInterface $logger)
{
}
public static function getSubscribedEvents(): array
{
return [
UpdatePaymentEvent::class => 'onUpdatePayment',
];
}
public function onUpdatePayment(UpdatePaymentEvent $event): void
{
$payment = $event->getPaymentResult();
$this->logger->info(
'Payment {identifier} has been updated',
[
'identifier' => $payment->getIdentifier(),
]
);
}
}
Tags
Methods¶
__construct() ¶
UpdatePaymentEvent.php
:
60
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$payment | PaymentInterface | - | - |
$updateStruct | PaymentUpdateStruct | - | - |
$paymentResult | PaymentInterface | - | - |
getPayment() ¶
UpdatePaymentEvent.php
:
73
Returns the payment that has been updated (state before the update).
|
|
Return values
getPaymentResult() ¶
UpdatePaymentEvent.php
:
89
Returns the payment that has been updated (state after the update).
|
|
Return values
getUpdateStruct() ¶
UpdatePaymentEvent.php
:
81
Returns update struct used to update payment.
|
|