public function index(LifecycleEventArgs $args, $prefix = 'PRE') { $entity = $args->getEntity(); $entityManager = $args->getEntityManager(); if ($entity instanceof Transaction) { $event = new PaymentEvent($entity, $entity->getDsOrder(), $entity->getDsResponse(), $entityManager); $status = Response::isValid($entity->getDsResponse()) ? 'SUCCESS' : 'FAILED'; $raise = constant('RC\\ServiredBundle\\Event\\ServiredEvent::' . $prefix . '_PAYMENT_' . $status); $this->dispatcher->dispatch($raise, $event); } }
public function testNotIsValid() { $this->assertFalse(Response::isValid('0100')); $this->assertFalse(Response::isValid('9999')); }