Instead of such code repetation just do:
```php
if ($blah) {
    $type = 'success';
    $msg  = 'sylius.checkout.success';
} elseif ($blah && $bleh) {
    $type = 'error';
    $msg  = 'sylius.checkout.error';
}

$this->get('session')->getFlashBag()->add($type, $translator->trans($msg, array(), 'flashes');