【发布时间】:2017-09-02 20:41:20
【问题描述】:
我已经在我的网站中实施了安全支付支付网关。它工作正常,但从昨天开始它不工作了。我没有得到安全服务器的任何响应。我也遇到了错误。
遇到了 PHP 错误
严重性:通知
消息:试图获取非对象的属性
文件名:libraries/securepay.php
行号:479
在securepay.php 479号行是
($this->_TranslateServerCode($this->ResponseTree->Status->statusCode) == SECUREPAY_STATUS_OK);
完整功能如下
function TestConnection() {
$this->RequestXml = $this->_ComposeEcho();
$this->ResponseXml = $this->_Dispatch($this->RequestXml);
$this->ResponseTree = simplexml_load_string($this->ResponseXml);
return ($this->_TranslateServerCode($this->ResponseTree->Status->statusCode) == SECUREPAY_STATUS_OK);
}
下面是我的示例代码:
include('securepay.php');
$sp = new SecurePay('ABC0001','abc123', TRUE);
$sp->TestMode();
$sp->TestConnection();
$sp->Cc = 4111111111111111;
$sp->ExpiryDate = '07/20';
$sp->ChargeAmount = 1500;
$sp->ChargeCurrency = 'AUD';
$sp->Cvv = 321;
$sp->OrderId = 'ORD34234';
if ($sp->Valid()) {
$response = $sp->Process();
if ($response == SECUREPAY_STATUS_APPROVED) {
echo "Transaction was a success\n";
} else {
echo "Transaction failed with the error code: $response\n";
echo "XML Dump: " . print_r($sp->ResponseXml,1) . "\n";
}
} else {
die("Your data is invalid\n");
}
请帮我解决一下。
【问题讨论】: