我在使用贝宝调用通知功能时遇到问题,我认为我已经正确设置了所有内容,但是关于此的可用文档很少
use Maxim\CMSBundle\Entity\NotificationDetails;
use Payum\Action\ActionInterface;
use Payum\Request\NotifyTokenizedDetailsRequest;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Maxim\CMSBundle\Entity\Visitor;
class StoreNotificationAction implements ActionInterface
{
protected $doctrine;
protected $logger;
public function __construct(RegistryInterface $doctrine, $logger) {
$this->doctrine = $doctrine;
$this->logger = $logger;
}
/**
* {@inheritDoc}
*/
public function execute($request)
{
/** @var NotifyTokenizedDetailsRequest $request */
$this->logger->err("hi");
$notification = new NotificationDetails;
$notification->setPaymentName($request->getTokenizedDetails()->getPaymentName());
$notification->setDetails($request->getNotification());
$notification->setCreatedAt(new \DateTime);
$this->doctrine->getManager()->persist($notification);
$this->doctrine->getManager()->flush();
}
/**
* {@inheritDoc}
*/
public function supports($request)
{
return $request instanceof NotifyTokenizedDetailsRequest;
}
}
我正在使用 services.yml 中定义的服务调用它,这也是我根据 git 示例的配置:
payum:
contexts:
paypal_express_checkout_plus_doctrine:
paypal_express_checkout_nvp:
api:
options:
username: 'MYUSER'
password: 'MYPAS'
signature: 'MYSIGNATURE'
sandbox: true
actions:
- myname.action.store_notification
storages:
myname\mybundle\Entity\PaypalExpressPaymentDetails:
doctrine:
driver: orm
payment_extension: true
myname\mybundle\Entity\TokenizedDetails:
doctrine:
driver: orm
payment_extension: true