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

时间:2016-04-03 11:37:52

标签: php symfony paypal payment payum

我试图实施PayumBundle,但是当我点击Button Pay时出现此错误:

  
    

尝试调用名为" getTokenFactory"的未定义方法。班级     " Payum \捆绑\ PayumBundle \注册表\ ContainerAwareRegistry"

  
     

$ captureToken =   $这 - >获得(' 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 个答案:

没有答案