Sonata\PaymentBundle\Controller\PaymentController::sendbankAction PHP Method

sendbankAction() public method

this action redirect the user to the bank.
public sendbankAction ( ) : Symfony\Bundle\FrameworkBundle\Controller\Response
return Symfony\Bundle\FrameworkBundle\Controller\Response
    public function sendbankAction()
    {
        $basket = $this->getBasket();
        if ($this->get('request')->getMethod() !== 'POST') {
            return $this->redirect($this->generateUrl('sonata_basket_index'));
        }
        if (!$basket->isValid()) {
            $this->get('session')->getFlashBag()->set('error', $this->container->get('translator')->trans('basket_not_valid', array(), 'SonataPaymentBundle'));
            return $this->redirect($this->generateUrl('sonata_basket_index'));
        }
        $payment = $basket->getPaymentMethod();
        // check if the basket is valid/compatible with the bank gateway
        if (!$payment->isBasketValid($basket)) {
            $this->get('session')->getFlashBag()->set('error', $this->container->get('translator')->trans('basket_not_valid_with_current_payment_method', array(), 'SonataPaymentBundle'));
            return $this->redirect($this->generateUrl('sonata_basket_index'));
        }
        // transform the basket into order
        $order = $this->getPaymentHandler()->getSendbankOrder($basket);
        $this->getBasketFactory()->reset($basket);
        // the payment must handle everything when calling the bank
        return $payment->sendbank($order);
    }