Authored by 郝肖肖

支付类 日志记录

... ... @@ -6,6 +6,7 @@ use DOMDocument;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
... ... @@ -107,6 +108,7 @@ class Service extends PayAbstract
/* 返回示例
* http://www.yohobuy.com/pay/notice/aliexpressgatewayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5
*/
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse);
if(isset($arrResponse['q'])){
unset($arrResponse['q']);
}
... ... @@ -129,6 +131,7 @@ class Service extends PayAbstract
$rsp->tradeNo = $arrResponse['trade_no'];
$rsp->bankBillNo = "";
}
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -77,15 +77,5 @@ class Config
'ip_enable' => false,
'timestamp_enable' => false
);
/**
* @var string 日志目录
*/
var $logDir = '/Data/logs/pc_pay/alibank';
/**
* @var int 日志等级
*/
var $logLevel = 2; // 记录信息日志
}
... ...
... ... @@ -6,12 +6,11 @@ use DOMDocument;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
public $config;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -21,8 +20,6 @@ class Service extends PayAbstract
$this->config->partner = $myConfig->merchant_id;
$this->config->alipay_key = $myConfig->merchant_key;
$this->config->sellerMail = $myConfig->merchant_other_code;
$this->log = new PhpLog($this->config->logDir, "PRC", $this->config->logLevel);
}
/**
... ... @@ -43,7 +40,7 @@ class Service extends PayAbstract
public function getPayRequestPars(Reqparams $params)
{
$baseUrl = $this->getBaseNoticeUrl($params->isTest);
$loseTime = intval(($params->orderTime + 7200 - time()) / 60);
// $loseTime = intval(($params->orderTime + 7200 - time()) / 60);
// $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60);
$parameter = array(
... ... @@ -112,22 +109,15 @@ class Service extends PayAbstract
/* 返回示例
* http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5
*/
$this->log->LogInfo("===开始解析支付宝银行的回调参数===");
$this->log->LogInfo("-----回调参数为---");
$this->log->LogInfo(var_export($arrResponse, true));
UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:parseResponse,回调参数", $arrResponse);
if (isset($arrResponse['q'])) {
unset($arrResponse['q']);
}
$rsp = new Rspparams();
if (!$this->checkResponse($arrResponse)) {
$this->log->LogInfo("---验证支付宝银行的回调参数失败---");
//验证不成功
$rsp->payResult = -1;
} else {
$this->log->LogInfo("---验证支付宝银行的回调参数成功---");
$rsp->bankName = "";
$outTradeNo = $arrResponse["out_trade_no"];
// if(strlen($outTradeNo) > 9) {
... ... @@ -150,11 +140,8 @@ class Service extends PayAbstract
$rsp->payOrderCode = $outTradeNo;
$rsp->tradeNo = $arrResponse['trade_no'];
$rsp->bankBillNo = $arrResponse['bank_seq_no'] ? $arrResponse['bank_seq_no'] : "";
$this->log->LogInfo('----支付宝银行回调处理结果为----');
$this->log->LogInfo(var_export($rsp, true));
}
UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:parseResponse,回调参数处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -6,7 +6,7 @@ use DOMDocument;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
... ... @@ -40,7 +40,7 @@ class Service extends PayAbstract
public function getPayRequestPars(Reqparams $params)
{
$baseUrl = $this->getBaseNoticeUrl($params->isTest);
$loseTime = intval(($params->orderTime + 7200 -time())/60);
// $loseTime = intval(($params->orderTime + 7200 -time())/60);
// $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点
$parameter = array(
'service' => $this->config->service,
... ... @@ -99,6 +99,7 @@ class Service extends PayAbstract
/* 返回示例
* http://www.yohobuy.com/pay/notice/alibarcodereturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5
*/
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse);
if(isset($arrResponse['q'])){
unset($arrResponse['q']);
}
... ... @@ -122,6 +123,7 @@ class Service extends PayAbstract
$rsp->tradeNo = $arrResponse['trade_no'];
$rsp->bankBillNo = "";
}
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -4,7 +4,7 @@ namespace WebPlugin\Pay\Alimobilemini;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
/**
* 手机支付返回
... ... @@ -14,7 +14,6 @@ use WebPlugin\PhpLog;
class Service extends PayAbstract
{
public $config;
private $log;
private $utils;
... ... @@ -23,8 +22,6 @@ class Service extends PayAbstract
$this->logProjectPrefix = 'alimobilemini';
$this->utils = new Utils();
$this->config = new Config();
$this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel);
}
... ... @@ -48,7 +45,7 @@ class Service extends PayAbstract
// $datastr=implode("&", $data);
// ##################################
UdpLog::info("【{$this->logProjectPrefix}-支付宝极简支付】,function:parseResponse,参数", $arrResponse);
$isVerify = $this->utils->getSignVeryfy($arrResponse);
if ($isVerify) {
//验证成功
... ... @@ -62,16 +59,11 @@ class Service extends PayAbstract
$rsp->payOrderCode = $arrResponse['out_trade_no'];
$rsp->tradeNo = $arrResponse['trade_no'];
$rsp->bankBillNo = "";
$this->log->LogInfo(var_export($arrResponse, true));
$this->log->LogInfo('======alimobilemini成功===');
} else {
//不成功
$rsp->payResult = -1;
$this->log->LogInfo(var_export($arrResponse, true));
$this->log->LogInfo('======alimobilemini失败===订单号----->' . $arrResponse['out_trade_no']);
}
UdpLog::info("【{$this->logProjectPrefix}-支付宝极简支付】,function:parseResponse,处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -80,14 +80,4 @@ class Config
'ip_enable' => false,
'timestamp_enable' => false
);
/**
* @var string 日志目录
*/
var $logDir = '/Data/logs/pc_pay/alipay';
/**
* @var string 日志等级
*/
var $logLevel = 2; // 记录信息日志
}
\ No newline at end of file
... ...
... ... @@ -5,13 +5,11 @@ namespace WebPlugin\Pay\Alipay;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
public $config;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -21,8 +19,6 @@ class Service extends PayAbstract
$this->config->partner = $myConfig->merchant_id;
$this->config->alipay_key = $myConfig->merchant_key;
$this->config->sellerMail = $myConfig->merchant_other_code;
$this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel);
}
/**
... ... @@ -46,10 +42,7 @@ class Service extends PayAbstract
*/
public function getPayRequestPars(Reqparams $params)
{
$this->log->LogInfo("===开始处理支付宝的请求参数===");
$this->log->LogInfo("-----请求参数为---");
$this->log->LogInfo(var_export($params, true));
UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:getPayRequestPars,参数", $params);
$baseUrl = $this->getBaseNoticeUrl($params->isTest);
// $loseTime = intval(($params->orderTime + 7200 -time())/60);
// $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点
... ... @@ -101,9 +94,7 @@ class Service extends PayAbstract
'reqType' => 'get'
);
$this->log->LogInfo('----支付宝请求处理结果为----');
$this->log->LogInfo(var_export($result, true));
UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:getPayRequestPars,请求处理结果", $result);
return $result;
}
... ... @@ -112,20 +103,15 @@ class Service extends PayAbstract
/* 返回示例
* http://www.yohobuy.com/pay/notice/alipayreturn?buyer_email=tds%40smartunite.com&buyer_id=2088302294447308&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3I7xtEV5W65QRToFQ5fPrXsVxt12e%252FExCtC1XNiKnuRwupLaVLAR&notify_time=2011-06-11+07%3A48%3A10&notify_type=trade_status_sync&out_trade_no=1061003000&payment_type=1&seller_email=shop%40yoho.cn&seller_id=2088001550230585&subject=YOHO%E5%95%86%E5%93%81&total_fee=0.01&trade_no=2011061199833830&trade_status=TRADE_SUCCESS&sign=ca1c49f58d17eaa57aac308d0ac64434&sign_type=MD5
*/
$this->log->LogInfo("===开始解析支付宝的回调参数===");
$this->log->LogInfo("-----回调参数为---");
$this->log->LogInfo(var_export($arrResponse, true));
UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:parseResponse,回调参数", $arrResponse);
if (isset($arrResponse['q'])) {
unset($arrResponse['q']);
}
$rsp = new Rspparams();
if (!$this->checkResponse($arrResponse)) {
$this->log->LogInfo("-----支付宝回调参数验证签名失败---");
//验证不成功
$rsp->payResult = -1;
} else {
$this->log->LogInfo("-----支付宝回调参数验证签名成功---");
$rsp->bankName = "";
$outTradeNo = $arrResponse["out_trade_no"];
$rsp->orderCode = $outTradeNo;
... ... @@ -139,9 +125,7 @@ class Service extends PayAbstract
$rsp->bankBillNo = "";
}
$this->log->LogInfo("-----解析支付宝回调参数的结果为---");
$this->log->LogInfo(var_export($rsp, true));
UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:parseResponse,回调参数的结果", $arrResponse);
return $rsp;
}
... ...
... ... @@ -62,15 +62,4 @@ class Config
* @var unknown_type
*/
var $payType = 0; //非直连为0
/**
* @var string 日志目录
*/
var $logDir = '/Data/logs/pc_pay/allinpay';
/**
* @var string 日志等级
*/
var $logLevel = 2; // 记录信息日志
}
\ No newline at end of file
... ...
... ... @@ -5,12 +5,11 @@ namespace WebPlugin\Pay\Allinpay;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
public $config;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -19,8 +18,6 @@ class Service extends PayAbstract
$myConfig = json_decode($paymentParams["pay_params"]);
$this->config->merchantId = $myConfig->merchant_id;
$this->config->merchantKey = $myConfig->merchant_key;
$this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel);
}
/**
... ... @@ -67,18 +64,11 @@ class Service extends PayAbstract
*/
public function parseResponse(array $arrResponse)
{
$this->log->LogInfo("===开始处理通联支付的回调参数===");
$this->log->LogInfo("-----回调参数为---");
$this->log->LogInfo(var_export($arrResponse, true));
UdpLog::info("【{$this->logProjectPrefix}-通联支付】,function:parseResponse,参数", $arrResponse);
$rsp = new Rspparams();
if (!$this->checkResponse($arrResponse)) {
$this->log->LogInfo("-----验证通联支付回调参数失败---");
$rsp->payResult = -1;
} else {
$this->log->LogInfo("-----验证通联支付回调参数成功---");
$rsp->bankName = "";
$rsp->orderCode = $arrResponse["orderNo"];
$rsp->payResult = $this->convertResult($arrResponse["payResult"]);
... ... @@ -90,7 +80,7 @@ class Service extends PayAbstract
$rsp->tradeNo = "";
$rsp->bankBillNo = "";
}
UdpLog::info("【{$this->logProjectPrefix}-通联支付】,function:parseResponse,回调参数处理结果", $arrResponse);
return $rsp;
}
... ...
... ... @@ -5,7 +5,7 @@ namespace WebPlugin\Pay\Chinabank;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
... ... @@ -53,6 +53,7 @@ class Service extends PayAbstract
* @return void|QCPay_Utils_Rspparams
*/
function parseResponse(Array $arrResponse){
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse);
// {"v_md5all":"8F7E33B3759DC55F0E776120B5C16A55","v_md5info":"e42e938417bd01d8eb69235c1ebe9be3","remark1":"110610002420","v_pmode":null,"remark2":"","v_idx":"5607406315","v_md5":"2E9135262B2729B23B049EBBE80E5183","v_pstatus":"20","v_pstring":null,"v_md5str":"2E9135262B2729B23B049EBBE80E5183","v_md5money":"9330e642e14622f4993ce5a6e9781bbd","v_moneytype":"CNY","v_oid":"110610002420","v_amount":"0.01"}
//把中文进行转码
$arrResponse["v_pmode"] = mb_convert_encoding($arrResponse["v_pmode"], "UTF-8", "GBK");
... ... @@ -75,6 +76,7 @@ class Service extends PayAbstract
$rsp->tradeNo = "";
$rsp->bankBillNo = "";
}
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,解析结果", $rsp);
return $rsp;
}
... ...
... ... @@ -5,13 +5,11 @@ namespace WebPlugin\Pay\Shengpay;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
public $config;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -20,8 +18,6 @@ class Service extends PayAbstract
$myConfig = json_decode($paymentParams["pay_params"]);
$this->config->merchant_no = $myConfig->merchant_id;
$this->config->merchant_key = $myConfig->merchant_key;
$this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel);
}
/**
... ... @@ -30,10 +26,7 @@ class Service extends PayAbstract
*/
public function getPayRequestPars(Reqparams $params)
{
$this->log->LogInfo("===开始处理盛付通的请求参数===");
$this->log->LogInfo("-----请求参数为---");
$this->log->LogInfo(var_export($params, true));
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:getPayRequestPars,参数", $params);
$bankCode = $params->paymentParameter == 'platform' ? '' : $params->paymentParameter;
$baseUrl = $this->getBaseNoticeUrl($params->isTest);
... ... @@ -60,7 +53,7 @@ class Service extends PayAbstract
'pars' => $parameters,
'reqType' => 'post'
);
UdpLog::info("【{$this->logProjectPrefix}-支付】,orderCode:{$params->orderCode},function:getPayRequestPars,处理结果", $result);
return $result;
}
... ... @@ -108,19 +101,12 @@ class Service extends PayAbstract
*/
function parseResponse(Array $arrResponse)
{
$this->log->LogInfo("===开始处理盛付通的回调参数===");
$this->log->LogInfo("-----回调参数为---");
$this->log->LogInfo(var_export($arrResponse, true));
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse);
$rsp = new Rspparams();
if (!$this->checkResponse($arrResponse)) {
$this->log->LogInfo("-----验证盛付通回调参数失败---");
//验证不成功
$rsp->payResult = -1;
} else {
$this->log->LogInfo("-----验证盛付通回调参数成功---");
$rsp->bankName = "";
$rsp->orderCode = $arrResponse["OrderNo"];
$rsp->payResult = $this->convertResult($arrResponse["Status"]);
... ... @@ -132,7 +118,7 @@ class Service extends PayAbstract
$rsp->tradeNo = "";
$rsp->bankBillNo = "";
}
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -5,13 +5,12 @@ namespace WebPlugin\Pay\Tenpay;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
public $config;
private $log;
/**
* Service constructor.
... ... @@ -24,8 +23,6 @@ class Service extends PayAbstract
$myConfig = json_decode($paymentParams["pay_params"]);
$this->config->bargainor_id = $myConfig->merchant_id;
$this->config->sp_key = $myConfig->merchant_key;
$this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel);
}
/**
... ... @@ -34,10 +31,7 @@ class Service extends PayAbstract
*/
public function getPayRequestPars(Reqparams $params)
{
$this->log->LogInfo("===开始处理财付通的请求参数===");
$this->log->LogInfo("-----请求参数为---");
$this->log->LogInfo(var_export($params, true));
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:getPayRequestPars,参数", $params);
parent::getPayRequestPars($params);
$baseUrl = $this->getBaseNoticeUrl($params->isTest);
... ... @@ -65,7 +59,7 @@ class Service extends PayAbstract
'pars' => $sign_text,
'reqType' => 'get'
);
UdpLog::info("【{$this->logProjectPrefix}-支付】,ordercode:{$params->orderCode},function:getPayRequestPars,处理结果", $result);
return $result;
}
... ... @@ -76,10 +70,7 @@ class Service extends PayAbstract
*/
public function parseResponse(array $arrResponse)
{
$this->log->LogInfo("===开始处理财付通的回调参数===");
$this->log->LogInfo("-----回调参数为---");
$this->log->LogInfo(var_export($arrResponse, true));
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,参数", $arrResponse);
$rsp = new Rspparams();
if (!$this->checkResponse($arrResponse)) {
//验证不成功
... ... @@ -96,6 +87,7 @@ class Service extends PayAbstract
$rsp->tradeNo = "";
$rsp->bankBillNo = "";
}
UdpLog::info("【{$this->logProjectPrefix}-支付】,function:parseResponse,处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -5,12 +5,11 @@ namespace WebPlugin\Pay\Unionpayweb;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
private $merId;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -19,7 +18,6 @@ class Service extends PayAbstract
include_once 'Func/common.php';
include_once 'Func/secureUtil.php';
$this->log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$this->merId = array(
'mobile' => '898111453110482',//手机支付
'pc_nocard' => '898111453110464',//无卡支付
... ... @@ -35,22 +33,17 @@ class Service extends PayAbstract
*/
public function parseResponse(array $package)
{
$this->log->LogInfo("===开始解析银联支付的回调参数===");
$this->log->LogInfo("===回调参数为===");
$this->log->LogInfo(var_export($package, true));
UdpLog::info("【{$this->logProjectPrefix}-银联支付】,function:parseResponse,参数", $package);
$verify = false;
$responseData = new Rspparams();
if (!isset($package['respCode']) || $package['respCode'] !== '00') {
$this->log->LogInfo('银联支付返回码有误');
$responseData->payResult = -1;
return $responseData;
}
if (isset($package['signature'])) { // TODO isset($package['signature']) && verify($package)验证签名待做
$verify = true;
$this->log->LogInfo('银联支付验签成功');
}
if ($verify) {
... ... @@ -68,9 +61,7 @@ class Service extends PayAbstract
} else {
$responseData->payResult = -1;
}
$this->log->LogInfo("===银联支付的回调参数处理结果为===");
$this->log->LogInfo(var_export($responseData, true));
UdpLog::info("【{$this->logProjectPrefix}-银联支付】,function:parseResponse,处理结果", $responseData);
return $responseData;
}
... ... @@ -108,8 +99,7 @@ class Service extends PayAbstract
'reqType' => 'post'
);
$this->log->LogInfo(var_export($requestParams, true));
UdpLog::info("【{$this->logProjectPrefix}-银联支付】,orderCode:{$params->orderCode},function:getPayRequestPars,处理结果", $result);
return $result;
}
... ...
... ... @@ -8,7 +8,7 @@ use WebPlugin\Pay\Rspparams;
use WebPlugin\Pay\Signature;
use WebPlugin\Pay\weixin\lib\WxPayApi;
use WebPlugin\Pay\weixin\lib\WxPayOrderQuery;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class Service extends PayAbstract
{
... ... @@ -19,7 +19,6 @@ class Service extends PayAbstract
private $appKey;
private $privateKey;
private $payCurl;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -30,8 +29,6 @@ class Service extends PayAbstract
$this->appKey = $this->config->app_key;
$this->privateKey = $this->config->private_key;
$this->paymentCode = $paymentParams['id'];
$this->log = new PhpLog($this->config->logDir, 'PRC', $this->config->logLevel);
}
public function getPayRequestPars(Reqparams $params)
... ... @@ -53,10 +50,7 @@ class Service extends PayAbstract
*/
public function pay(array $orderInfo)
{
$this->log->LogInfo("===开始处理微信扫码支付的请求参数===");
$this->log->LogInfo("-----请求参数为---");
$this->log->LogInfo(var_export($orderInfo, true));
UdpLog::info("【{$this->logProjectPrefix}-微信支付】,function:pay,参数", $orderInfo);
//生成签名
$this->orderCode = $orderInfo['order_code'];
$payParams = array(
... ... @@ -84,11 +78,8 @@ class Service extends PayAbstract
'pars' => trim($pars, '&')
);
$this->log->LogInfo("===开始处理微信扫码支付的支付地址===");
$this->log->LogInfo("-----支付地址数据为---");
$this->log->LogInfo(var_export($payUrlInfo, true));
$payUrl = $payUrlInfo['pay_url'] . '?' . $payUrlInfo['pars'];
UdpLog::info("【{$this->logProjectPrefix}-微信支付】,order_code:{$orderInfo['order_code']},function:pay,结果", $payUrl);
return array('pay_url' => $payUrl);
}
... ... @@ -98,17 +89,14 @@ class Service extends PayAbstract
/* 返回示例
* http://www.yohobuy.com/pay/notice/wechatqrcodereturn?ordercode=93465435
*/
$this->log->LogInfo("===开始查询微信扫码支付的结果===");
UdpLog::info("{$this->logProjectPrefix}-微信支付】,function:parseResponse,参数", $data);
// 组装微信支付的订单号
$tradeNo = 'YOHOBuy_' . $data['orderCode'];
$input = new WxPayOrderQuery();
$input->SetOut_trade_no($tradeNo);
$result = WxPayApi::orderQuery($input);
$this->log->LogInfo("===查询微信扫码支付的结果结束,结果为===");
$this->log->LogInfo(var_export($result, true));
UdpLog::info("【{$this->logProjectPrefix}-微信支付】,orderCode:{$data['orderCode']},function:parseResponse,组装微信支付的订单号", $result);
$rsp = new Rspparams();
// 支付成功
... ... @@ -124,13 +112,10 @@ class Service extends PayAbstract
$rsp->tradeNo = $result["out_trade_no"];
$rsp->bankBillNo = $result['bank_type'];
} else {
$this->log->LogInfo("===微信扫码支付失败===");
$rsp->payResult = -1;
}
$this->log->LogInfo("===微信扫码支付回调参数解析结果为===");
$this->log->LogInfo(var_export($rsp, true));
UdpLog::info("{$this->logProjectPrefix}-微信支付】,orderCode:{$data['orderCode']},function:parseResponse,处理结果", $rsp);
return $rsp;
}
... ...
... ... @@ -7,18 +7,13 @@ use LibModels\Web\Product\PayData;
use WebPlugin\Pay\weixin\lib\WxPayApi;
use WebPlugin\Pay\weixin\lib\WxPayNotify;
use WebPlugin\Pay\weixin\lib\WxPayOrderQuery;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
class PayNotifyCallBack extends WxPayNotify
{
// 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志
const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status';
// 日志等级,2表示记录信息等级的日志
const LOG_LEVEL = 2;
// 获取微信订单中的订单号需要截取的开始位置
// 获取微信订单中的orderCode需要截取的开始位置
const ORDER_CODE_START = 8;
private $log = null;
private $_uid;
/**
... ... @@ -27,8 +22,6 @@ class PayNotifyCallBack extends WxPayNotify
*/
public function __construct($uid)
{
// 初始化日志
$this->log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$this->_uid = $uid;
}
... ... @@ -38,12 +31,9 @@ class PayNotifyCallBack extends WxPayNotify
{
$input = new WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$this->log->LogInfo('微信扫码支付交易号:' . $transaction_id);
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:Queryorder,微信扫码支付交易号", $transaction_id);
$result = WxPayApi::orderQuery($input);
$this->log->LogInfo('begin PayNotifyCallBack->Queryorder');
$this->log->LogInfo('===开始查询微信扫码订单=====');
$this->log->LogInfo(var_export($result, true));
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:Queryorder,扫码订单结果", $result);
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
$orderCode = substr($result['out_trade_no'], self::ORDER_CODE_START);
... ... @@ -54,32 +44,21 @@ class PayNotifyCallBack extends WxPayNotify
$tradeNo = $result['out_trade_no'];
$bankBillNo = $result['bank_type'];
$this->log->LogInfo('===[' . $orderCode . ']===');
$this->log->LogInfo('==[' . $orderCode . ']=开始调用ERP提交订单状态接口,接口方法为web.SpaceOrders.submitOrderStatus===');
$this->log->LogInfo('==[' . $orderCode . ']=请求参数为orderCode=' . $orderCode . '===');
// ERP提交订单状态
$erpReturn = PayData::submitOrderStatus($orderCode, $payment, $bankName, $bankCode, $amount, $orderCode, $tradeNo, $bankBillNo);
$this->log->LogInfo('==[' . $orderCode . ']=结束调用ERP提交订单状态接口,返回结果为===');
$this->log->LogInfo(var_export($erpReturn, true));
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,ERP提交订单状态", $erpReturn);
$this->log->LogInfo('==[' . $orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
$orderInfo = OrderData::getOrderDetail('', $orderCode);
$this->log->LogInfo('==[' . $orderCode . ']=结束调用获取订单详情方式接口,返回结果为===');
$this->log->LogInfo(var_export($orderInfo, true));
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,订单详情", $orderInfo);
if (!isset($orderInfo['data']) || empty($orderInfo['data'])) {
$this->log->LogInfo('==[' . $orderCode . ']=微信支付状态同步中未获取到订单详情信息===');
UdpLog::error("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,微信支付状态同步中未获取到订单详情信息", $orderInfo);
return false;
}
$this->log->LogInfo('==[' . $orderCode . ']=开始调用更新订单状态接口,接口方法为web.SpaceOrders.updatePaymentStatus===');
$this->log->LogInfo('==[' . $orderCode . ']=请求参数为orderId=' . $orderInfo['data']['order_id'] . 'uid=' . $this->_uid . '===');
// 更新订单的状态
$updateOrderStatus = PayData::updateOrderStatus($orderInfo['data']['order_id'], $this->_uid, $payment, 'Y', $bankCode);
$this->log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为===');
$this->log->LogInfo(var_export($updateOrderStatus, true));
$this->log->LogInfo('==[' . $orderCode . ']=微信扫码订单支付成功===');
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,更新订单状态结果", $updateOrderStatus);
return true;
}
... ... @@ -90,23 +69,19 @@ class PayNotifyCallBack extends WxPayNotify
//重写回调处理函数
public function NotifyProcess($data, &$msg)
{
$this->log->LogInfo('begin notifyProcess');
$this->log->LogInfo(var_export($data, true));
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:NotifyProcess,参数", $data);
if (!array_key_exists("transaction_id", $data)) {
$msg = "输入参数不正确";
$this->log->LogInfo('=====微信扫码支付通知结果为:' . $msg . '=====');
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:NotifyProcess,输入参数不正确", $data);
return false;
}
//查询订单,判断订单真实性
if (!$this->Queryorder($data["transaction_id"])) {
$msg = "订单查询失败";
$this->log->LogInfo('=====微信扫码支付通知结果为:' . $msg . '=====');
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,function:NotifyProcess,订单查询失败", $data);
return false;
}
$this->log->LogInfo('=====微信扫码支付通知结果为:' . $msg . '=====');
return true;
}
... ...