payum - 参数2中未给出的HttpClientInterface传递

时间:2016-04-24 23:09:08

标签: symfony paypal payum

我在api电话中遇到500错误:

Catchable Fatal Error: Argument 2 passed to Payum\Paypal\ExpressCheckout\Nvp\Api::__construct() must implement interface Payum\Core\HttpClientInterface, none given, called in /var/www/myapp/src/App/UserBundle/Controller/SubscriptionController.php on line 65 and defined

我认为构造函数https://github.com/Payum/PaypalExpressCheckoutNvp/blob/master/Api.php存在问题。 关于2个参数没有默认的valeur ... 有什么问题吗?

这是我的作曲家:

    "payum/paypal-express-checkout-nvp": "^1.3",
    "payum/payum-bundle": "^2.0",
    "php-http/guzzle6-adapter": "^1"

这是我的控制器:

protected function getPaypalOptions()
{
    return array(
        'username' => $this->container->getParameter('paypal.express_checkout.username'),
        'password' => $this->container->getParameter('paypal.express_checkout.password'),
        'signature' => $this->container->getParameter('paypal.express_checkout.signature'),
        'return_url' => null,
        'cancel_url' => null,
        'sandbox' => $this->container->getParameter('paypal.sandbox'),
        'useraction' => $useraction,
        'cmd' => Api::CMD_EXPRESS_CHECKOUT,
    );
}


public function indexAction(Request $request)
{
    $em = $this->getDoctrine()->getManager();
    $entity = $em->getRepository('AppUserBundle:Subscription')->findBy(
        array('companies' => $this->get('security.context')->getToken()->getUser()->getCompanies()),
        array('id' => 'DESC')
    );

    for ($i=0;$i<count($entity);$i++)
    {
        if ($entity[$i]->getProfileId()!='') {
            $details['PROFILEID'] = $entity[$i]->getProfileId();

            $api = new Api($this->getPaypalOptions());

            $arrStatus = $api->getRecurringPaymentsProfileDetails($details);
            $entity[$i]->paypalstatus = $arrStatus['STATUS'];
        }
    }


    return $this->render('AppUserBundle:Subscription:index.html.twig', array(
        'entities' => $entity

    ));
}

1 个答案:

答案 0 :(得分:0)

我最终降级到

"payum/paypal-express-checkout-nvp": "1.2"

由于