PayumBundle を実装しようとしていますが、Button Pay をクリックすると次のエラーが発生します。
クラス「Payum\Bundle\PayumBundle\Registry\ContainerAwareRegistry」の「getTokenFactory」という名前の未定義のメソッドを呼び出そうとしました。
$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());
}
}
構成.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