0

我在完成 aciton 并且不知道如何获取 paymentDetails 对象...

这是手册: http: //payum.forma-dev.com/documentation/0.8/PayumBundle/purchase_done_action

我尝试从http://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout之前的步骤获取对象 PaymentDetails

更新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
4

2 回答 2

5

Payum\Core\Model\Identificator是预期的结果。有两种获取详细信息的方法:

  1. 使用存储:

    <?php
    $registry = $this->get('payum');
    $storage = $registry->getStorageForClass(
        $token->getDetails()->getClass(), 
        $token->getPaymentName()
    );
    
    $details = $storage->findModelByIdentificator($token->getDetails());
    
  2. 执行请求。这里StorageExtension将它设置为请求。

    <?php
    $status = new BinaryMaskStatusRequest($token);
    
    $this->get('payum')->getPayment($token->getPaymentName())->execute($status);
    
    $details = $status->getModel();
    
于 2014-01-23T17:57:05.480 回答
0
<?php
$registry = $this->get('payum');
$storage = $registry->getStorage(
    $token->getDetails()->getClass(), 
    $token->getPaymentName()
);

如果您使用的是 0.13,请确保包含使用 Payum\Core\Request\GetHumanStatus;为了获得人类可读的状态。要在 0.13 中执行此操作,请使用文档中提供的代码

这是一个代码示例

$token = $this->get('payum.security.http_request_verifier')->verify($request);
$payment = $this->get('payum')->getPayment($token->getPaymentName());
$status->getValue();
于 2014-12-30T10:32:37.447 回答