duanan2732 2016-04-03 11:37
浏览 30

试图调用名为“getTokenFactory”的未定义方法[PayumBundle - Symfony2]

I'm trying to implement PayumBundle, but when i Click on the Button Pay i have this error:

Attempted to call an undefined method named "getTokenFactory" of class "Payum\Bundle\PayumBundle\Registry\ContainerAwareRegistry".

$captureToken = $this->get('payum')->getTokenFactory()->createCaptureToken(

PaymentController.php

/**
 * @Route("/paypal")
 */
class PaymentController extends Controller
{


    /**
     * @Route("/{id}/paypal", name="paypal")
     */
    public function paypalAction()
    {
        $gatewayName = 'express_euro';

        $storage = $this->get('payum')->getStorage('FLY\BookingsBundle\Entity\Commandes');

        /** @var \FLY\BookingsBundle\Entity\Commandes $commande */
        $commande = $storage->create();
        $commande->setCurrencyCode('AUD');
        $commande->setAmount($commande->getAmount()."00");


        $storage->update($commande);

        $captureToken = $this->get('payum')->getTokenFactory()->createCaptureToken(
            $gatewayName,
            $commande,
            'acme_payment_done' // the route to redirect after capture;
        );

        return $this->redirect($captureToken->getTargetUrl());
    }


}

Config.yml

payum:
    security:
        token_storage:
            FLY\PaymentBundle\Entity\PaymentToken: { doctrine: orm }
    storages:
        FLY\BookingsBundle\Entity\Commandes: { doctrine: orm }


    gateways:
        express_euro:
            paypal_express_checkout_nvp:
                username:  'XXXXXXXXXXX-facilitator_api1.gmail.com'
                password:  'XXXXXXXXX'
                signature: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
                sandbox: true
  • 写回答

0条回答 默认 最新

    报告相同问题?