Authored by Rock Zhang

修复微信扫码支付中类大小写导致错误的bug

<?php
namespace WebPlugin\Pay\weixin\lib;
use WebPlugin\PhpLog;
/**
*
... ... @@ -11,6 +12,10 @@ namespace WebPlugin\Pay\weixin\lib;
*/
class WxPayApi
{
// 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志
const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status';
// 日志等级,2表示记录信息等级的日志
const LOG_LEVEL = 2;
/**
*
... ... @@ -409,8 +414,13 @@ class WxPayApi
*/
public static function notify($callback, &$msg)
{
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('begin WxPayApi->notify');
//获取通知的数据
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
$log->LogInfo(var_export($xml));
//如果返回成功则验证签名
try {
$result = WxPayResults::Init($xml);
... ... @@ -418,6 +428,7 @@ class WxPayApi
$msg = $e->errorMessage();
return false;
}
$log->LogInfo(var_export($result, true));
return call_user_func($callback, $result);
}
... ...
... ... @@ -29,7 +29,7 @@ class WxPayNotify extends WxPayNotifyReply
$msg = "OK";
//当返回false的时候,表示notify中调用NotifyCallBack回调失败获取签名校验失败,此时直接回复失败
$result = WxpayApi::notify(array($this, 'NotifyCallBack'), $msg);
$result = WxPayApi::notify(array($this, 'NotifyCallBack'), $msg);
$log->LogInfo(var_export($result, true));
if ($result == false) {
$log->LogInfo('===微信扫码支付Handle失败===');
... ... @@ -70,13 +70,20 @@ class WxPayNotify extends WxPayNotifyReply
*/
final public function NotifyCallBack($data)
{
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('begin WxPayNotify->NotifyCallBack');
$log->LogInfo(var_export($data, true));
$msg = "OK";
$result = $this->NotifyProcess($data, $msg);
if ($result == true) {
$log->LogInfo('===微信支付NotifyCallBack成功===');
$this->SetReturn_code("SUCCESS");
$this->SetReturn_msg("OK");
} else {
$log->LogInfo('===微信支付NotifyCallBack失败===');
$this->SetReturn_code("FAIL");
$this->SetReturn_msg($msg);
}
... ...
... ... @@ -8,6 +8,7 @@
*/
namespace WebPlugin\Pay\weixin\lib;
use WebPlugin\PhpLog;
/**
*
... ... @@ -17,6 +18,10 @@ namespace WebPlugin\Pay\weixin\lib;
*/
class WxPayResults extends WxPayDataBase
{
// 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志
const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status';
// 日志等级,2表示记录信息等级的日志
const LOG_LEVEL = 2;
/**
*
... ... @@ -80,6 +85,10 @@ class WxPayResults extends WxPayDataBase
*/
public static function Init($xml)
{
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('begin WxPayResults::notify');
$obj = new self();
$obj->FromXml($xml);
//fix bug 2015-06-29
... ...