Payum - 未找到特征 'Payum\Core\GatewayAwareTrait'
Payum - Trait 'Payum\Core\GatewayAwareTrait' not found
当我运行phpapp/consolepayum:gateway:debug
我有这条错误消息
PHP Fatal error: Trait 'Payum\Core\GatewayAwareTrait' not found in /var/www/myapplication/vendor/payum/paypal-express-checkout-nvp/Payum/Paypal/ExpressCheckout/Nvp/Action/PurchaseAction.php on line 26
有人可以帮助我了解问题所在吗?
谢谢 ;)
我的控制器:
我的应用程序提供定期付款订阅
/**
* @Extra\Route(
* "/prepare_recurring_payment_agreement",
* name="acme_paypal_express_checkout_prepare_recurring_payment_agreement"
* )
*
* @Extra\Template
*/
public function createAgreementAction(Request $request)
{
$gatewayName = 'paypal_express_checkout_recurring_payment_and_doctrine_orm';
$subscription = $this->getWeatherForecastSubscriptionDetails($request->request->get('abo'));
if ($request->isMethod('POST')) {
$storage = $this->getPayum()->getStorage('MyApplication\UserBundle\Entity\AgreementDetails');
/** @var $agreement AgreementDetails */
$agreement = $storage->create();
$agreement['ABO'] = $request->request->get('abo');
$agreement['PAYMENTREQUEST_0_AMT'] = 0;
$agreement['L_BILLINGTYPE0'] = Api::BILLINGTYPE_RECURRING_PAYMENTS;
$agreement['L_BILLINGAGREEMENTDESCRIPTION0'] = $subscription['description'];
$agreement['NOSHIPPING'] = 1;
$storage->update($agreement);
$captureToken =$this->getPayum()->getTokenFactory()->createCaptureToken(
$gatewayName,
$agreement,
'acme_paypal_express_checkout_create_recurring_payment'
);
$agreement['RETURNURL'] = $captureToken->getTargetUrl();
$agreement['CANCELURL'] = $captureToken->getTargetUrl();
$agreement['INVNUM'] = $agreement->getId();
$storage->update($agreement);
return $this->redirect($captureToken->getTargetUrl());
}
return array(
'subscription' => $subscription,
'gatewayName' => $gatewayName
);
}
我的composer.json:
这里我表示敬意payum
"php": ">=5.3.3",
"symfony/symfony": "2.8.*",
"payum/payum-bundle": "^2.0",
"payum/offline": "^1.2",
"payum/paypal-express-checkout-nvp": "^1.0",
AppKernel.php
这里我直接调用PayumBundle
new Payum\Bundle\PayumBundle\PayumBundle(),
PHP版本:
PHP 5.5.9-1ubuntu4.16 (cli) (built: Apr 20 2016 14:31:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
我自己回答:
只需添加
"php-http/guzzle6-adapter": "^1.0"
解决依赖关系。
你应该添加到 composer.json:
"payum/core": "^1.2",
当我运行phpapp/consolepayum:gateway:debug
我有这条错误消息
PHP Fatal error: Trait 'Payum\Core\GatewayAwareTrait' not found in /var/www/myapplication/vendor/payum/paypal-express-checkout-nvp/Payum/Paypal/ExpressCheckout/Nvp/Action/PurchaseAction.php on line 26
有人可以帮助我了解问题所在吗?
谢谢 ;)
我的控制器:
我的应用程序提供定期付款订阅
/**
* @Extra\Route(
* "/prepare_recurring_payment_agreement",
* name="acme_paypal_express_checkout_prepare_recurring_payment_agreement"
* )
*
* @Extra\Template
*/
public function createAgreementAction(Request $request)
{
$gatewayName = 'paypal_express_checkout_recurring_payment_and_doctrine_orm';
$subscription = $this->getWeatherForecastSubscriptionDetails($request->request->get('abo'));
if ($request->isMethod('POST')) {
$storage = $this->getPayum()->getStorage('MyApplication\UserBundle\Entity\AgreementDetails');
/** @var $agreement AgreementDetails */
$agreement = $storage->create();
$agreement['ABO'] = $request->request->get('abo');
$agreement['PAYMENTREQUEST_0_AMT'] = 0;
$agreement['L_BILLINGTYPE0'] = Api::BILLINGTYPE_RECURRING_PAYMENTS;
$agreement['L_BILLINGAGREEMENTDESCRIPTION0'] = $subscription['description'];
$agreement['NOSHIPPING'] = 1;
$storage->update($agreement);
$captureToken =$this->getPayum()->getTokenFactory()->createCaptureToken(
$gatewayName,
$agreement,
'acme_paypal_express_checkout_create_recurring_payment'
);
$agreement['RETURNURL'] = $captureToken->getTargetUrl();
$agreement['CANCELURL'] = $captureToken->getTargetUrl();
$agreement['INVNUM'] = $agreement->getId();
$storage->update($agreement);
return $this->redirect($captureToken->getTargetUrl());
}
return array(
'subscription' => $subscription,
'gatewayName' => $gatewayName
);
}
我的composer.json:
这里我表示敬意payum
"php": ">=5.3.3",
"symfony/symfony": "2.8.*",
"payum/payum-bundle": "^2.0",
"payum/offline": "^1.2",
"payum/paypal-express-checkout-nvp": "^1.0",
AppKernel.php
这里我直接调用PayumBundle
new Payum\Bundle\PayumBundle\PayumBundle(),
PHP版本:
PHP 5.5.9-1ubuntu4.16 (cli) (built: Apr 20 2016 14:31:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
我自己回答:
只需添加
"php-http/guzzle6-adapter": "^1.0"
解决依赖关系。
你应该添加到 composer.json:
"payum/core": "^1.2",