使用 PPMessage::init() 函数时无法从 PPMessage.php 核心文件获得正确的支付响应?

Trouble getting the correct pay response from the PPMessage.php Core File when using PPMessage::init() function?

我在自定义 PAYPAL 自适应支付网关中工作,但在 php 中获得正确的支付响应(新的 PayResponse)时遇到问题。我已经跟踪了错误,我在核心文件 PPMessage.php 中找到了它。我的支付网关可以使用 Paypal 自适应支付创建以下 paykey:

$resp = array (
  'responseEnvelope.timestamp' => '2016-02-05T06:57:57.098-08:00',
  'responseEnvelope.ack' => 'Success',
  'responseEnvelope.correlationId' => 'e24f3c602852a',
  'responseEnvelope.build' => '17820627',
  'payKey' => 'AP-62K58588W7248331V',
  'paymentExecStatus' => 'CREATED',
);

当我想将其转换为付费响应时,我会执行以下操作:

    $ret = new PayResponse;

    $ret->init($resp);

PayResponse 扩展了定义方法 init 的 PPMessage。然而,核心文件 PPMessage 给了我以下答案:

ret=PayResponse::__set_state(
        array( 
            'responseEnvelope' => NULL, 
            'payKey' => 'AP-62K58588W7248331V', 
            'paymentExecStatus' => 'CREATED', 
            'payErrorList' => NULL, 
            'paymentInfoList' => NULL, 
            'sender' => NULL, 
            'defaultFundingPlan' => NULL, 
            'warningDataList' => NULL, 
            'error' => NULL, 
        ))

问题出在 responseEnvelop 键上,因为它应该是一个数组,但我得到的是 NULL。我不知道如何修改 PPMessage::init 方法来解决问题。谁能帮我?正确的支付响应应该如下:

PayResponse::__set_state(array(
   'responseEnvelope' =>  ResponseEnvelope::__set_state(array(
          'timestamp' => '2016-02-05T06:57:57.098-08:00',
          'ack' => 'Success',
     'correlationId' => 'e24f3c602852a',
     'build' => '17820627',
  )),
   'payKey' => 'AP-62K58588W7248331V',
   'paymentExecStatus' => 'CREATED',
   'payErrorList' => NULL,
   'defaultFundingPlan' => NULL,
   'error' => NULL,
))

请注意,在正确的响应中,responseEnvelope 是一个对象。

这里是 link 到 PPMessage 文件格式 GitHub。了解贝宝核心文件的人的任何帮助将不胜感激。任何人都可以检查此错误是一般性错误还是我的设置所特有的问题?

谢谢。

仔细检查我的设置后,我发现问题出在我的 PayPal 安装上。我无法加载 ResponseEnvelope class。出现错误,class 未加载。所以我要结束这个问题。谢谢您阅读此篇。