public function sendbankAction()
    {
        $basket = $this->getBasket();

        if ('POST' !== $this->getCurrentRequest()->getMethod()) {
            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', [], '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', [], '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);
    }
public function sendbankAction()
    {
        $basket = $this->getBasket();

        if ('POST' !== $this->getCurrentRequest()->getMethod()) {
            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', [], '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', [], '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);
    }
public function sendbankAction ( ) { $ basket = $ this -> getBasket ( ) ; if ( 'POST' !== $ this -> getCurrentRequest ( ) -> getMethod ( ) ) { 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' , [ ] , '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' , [ ] , '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 ) ; }
this action redirect the user to the bank.

@return Response
this action redirect the user to the bank .