<?php
namespace Rawafed\PaymentBundle\EventListener;
use Rawafed\PaymentBundle\Event\TransactionProcessedEvent;
class PaymentTransactionListener
{
public function onTransactionProcessed(TransactionProcessedEvent $event)
{
// Disabled until needed
return;
$status = $event->getStatus();
// Payment instance of Entity Payment
$transaction = $status->getFirstModel();
if($status->isCaptured()) {
//If succeeded
dump('Transaction succeeded');
}
if ($status->isPending()) {
//If pending
dump('Transaction status: pending');
}
if ($status->isFailed()) {
//If failed
dump('Transaction status: failed');
}
if ($status->isExpired()) {
//If expired
dump('Transaction status: expired');
}
if ($status->isCanceled()) {
//If canceled
dump('Transaction status: canceled');
}
dump($status, $transaction, get_class($transaction)); die;
}
}