我正在使用Payum 0.12 + Paypal Express Checkout并在完成操作时遇到此错误:
尝试在类“ArrayObject”中调用方法“getClientId” DetailsController.php在线...
这是控制器代码:
<?php
namespace Custom\CustomBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Payum\Core\Registry\RegistryInterface;
use Payum\Core\Security\HttpRequestVerifierInterface;
use Payum\Core\Exception\RequestNotSupportedException;
use Payum\Core\Model\OrderInterface;
use Payum\Core\Request\GetHumanStatus;
use Payum\Core\Request\Sync;
class DetailsController extends Controller
{
public function completeAction(Request $request) {
$token = $this->get('payum.security.http_request_verifier')->verify($request);
$payment = $this->get('payum')->getPayment($token->getPaymentName());
try {
$payment->execute(new Sync($token));
} catch (RequestNotSupportedException $e) {}
$payment->execute($status = new GetHumanStatus($token));
/** @var OrderInterface $order */
$order = $status->getModel();
return $this->render('CustomBundle:Default:complete.html.twig', array(
'status' => $status->getValue(),
'order' => htmlspecialchars(json_encode(
array(
'client' => array(
'id' => $order->getClientId(), //<--- Error here
'email' => $order->getClientEmail(),
),
'number' => $order->getNumber(),
'description' => $order->getCurrencyCode(),
'total_amount' => $order->getTotalAmount(),
'currency_code' => $order->getCurrencyCode(),
'currency_digits_after_decimal_point' => $order->getCurrencyDigitsAfterDecimalPoint(),
'details' => $order->getDetails(),
),
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
)),
'paymentTitle' => ucwords(str_replace(array('_', '-'), ' ', $token->getPaymentName()))
));
}
}
即使我在没有Paypal Exress Checkout的情况下使用“离线”付款选项,我也会收到此错误消息。我错过了什么吗?