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.
|
|
Return values
isPropagationStopped() ¶
Event.php
:
38
|
|
Return values
bool
stopPropagation() ¶
Event.php
:
50
Stops the propagation of the event to further event listeners.
|
|
If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().