本文介绍了Payum - 完成操作中的 PaymentDetails 对象在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经完成了动作,但不知道如何获取 paymentDetails 对象...
im on done aciton and dont know how to get paymentDetails object...
这里是手册:http://payum.forma-dev.com/documentation/0.8/PayumBundle/purchase_done_action
我尝试从之前的步骤中获取对象 PaymentDetailshttp://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout
i try get object PaymentDetails from step before http://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout
更新1
public function doneAction(){
$request = $this->getRequest();
/**
* @var $token PayumSecurityToken
*/
$token = $this->get('payum.security.http_request_verifier')->verify($request);
/**
* @var $details PaymentDetails
*/
$details = $token->getDetails();
var_dump($details);
给
object(Payum\Core\Model\Identificator)[345]
protected 'class' => string 'ed\partnerBundle\Entity\PaymentDetails' (length=38)
protected 'id' => int 1
更新2
$details = unserialize($token->getDetails());
ContextErrorException: Notice: unserialize(): Error at offset 0 of 40 bytes in /home/grek/public_html/edpartner/src/ed/partnerBundle/Controller/PaymentController.php line 110
推荐答案
Payum\Core\Model\Identificator
是预期的结果.有两种方法可以获取详细信息:
Payum\Core\Model\Identificator
is expected result. There two ways to get details:
使用存储:
Using storage:
<?php
$registry = $this->get('payum');
$storage = $registry->getStorageForClass(
$token->getDetails()->getClass(),
$token->getPaymentName()
);
$details = $storage->findModelByIdentificator($token->getDetails());
执行请求.这里 StorageExtension
将其设置为请求.
<?php
$status = new BinaryMaskStatusRequest($token);
$this->get('payum')->getPayment($token->getPaymentName())->execute($status);
$details = $status->getModel();
这篇关于Payum - 完成操作中的 PaymentDetails 对象在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!