... ... @@ -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,14 +6,13 @@ use DOMDocument;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
use Api\Yohobuy;
use Plugin\Helpers;
class Service extends PayAbstract
{
public $config;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -23,8 +22,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);
}
/**
... ... @@ -47,7 +44,7 @@ class Service extends PayAbstract
// $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);
UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:getPayRequestPars,参数", $params);
$parameter = array(
'service' => $this->config->service,
'partner' => $this->config->partner,
... ... @@ -114,22 +111,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) {
... ... @@ -146,11 +136,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,7 +5,7 @@ namespace WebPlugin\Pay\Alipay;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
use Api\Yohobuy;
use Plugin\Helpers;
... ... @@ -13,7 +13,6 @@ class Service extends PayAbstract
{
public $config;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -23,8 +22,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);
}
/**
... ... @@ -48,10 +45,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); //第二天十点
... ... @@ -103,9 +97,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;
}
... ... @@ -114,20 +106,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;
... ... @@ -141,9 +128,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,14 +5,13 @@ namespace WebPlugin\Pay\Unionpayweb;
use WebPlugin\Pay\PayAbstract;
use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
use WebPlugin\Helpers;
use Api\Yohobuy;
class Service extends PayAbstract
{
private $merId;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -21,7 +20,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',//无卡支付
... ... @@ -37,22 +35,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) {
... ... @@ -70,9 +63,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;
}
... ... @@ -110,8 +101,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;
use WebPlugin\Helpers;
class Service extends PayAbstract
... ... @@ -20,7 +20,6 @@ class Service extends PayAbstract
private $appKey;
private $privateKey;
private $payCurl;
private $log;
public function __construct(array $paymentParams)
{
... ... @@ -31,8 +30,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)
... ... @@ -54,10 +51,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(
... ... @@ -85,11 +79,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);
}
... ... @@ -99,17 +90,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();
// 支付成功
... ... @@ -125,13 +113,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,21 +44,17 @@ class PayNotifyCallBack extends WxPayNotify
$tradeNo = $result['out_trade_no'];
$bankBillNo = $result['bank_type'];
$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;
}
//更新订单状态
$updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo);
$this->log->LogInfo(var_export($updateOrderStatus, true));
$this->log->LogInfo('==[' . $orderCode . ']=微信扫码订单支付成功===');
UdpLog::info("【{$this->logProjectPrefix}-微信扫码支付】,orderCode:{$orderCode},function:Queryorder,更新订单状态结果", $updateOrderStatus);
return true;
}
... ... @@ -78,23 +64,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;
}
... ...
<?php
/**
* Created by IntelliJ IDEA.
* User: hbomb_000
* Date: 2016/5/5
* Time: 18:17
*/
namespace WebPlugin;
/**
* Class UdpLog
* @useage:
* UdpLog::info('get payment list begin',array('order_code'=>123231));
* @package WebPlugin
*/
class UdpLog
{
//influxdb url
public static $url = 'influxdb.yohobuy.com';
//influxdb port
public static $port = '4444';
//influxdb measurement
public static $measurement = 'php_log';
public static $filePath = '/Data/logs/';
const RECORD_MODE_FILE = 'FILE';
const RECORD_MODE_UDP = 'UDP';
const RECORD_MODE = 'FILE';//mode: FILE | UDP
/**
* proc line and send log to influxdb
* @param $level
* @param $message
* @param $meta
*/
private static function procLog($level, $message, $debugInfo, $meta = '') {
date_default_timezone_set('PRC');
$level = str_replace(__CLASS__.'::','',$level);
$file = $debugInfo[0]["file"];
$line = $debugInfo[0]["line"];
$string = '';
//make tags
$tags = array(
'time' => date('Y-m-d H:i:s',time()),
'level' => $level,
'host'=> gethostname(),
'file'=> $file,
'line'=> $line,
'message' => $message,
'meta' => serialize($meta)
);
//make a line
$string = implode('|', $tags); //format: time|level|host|file|line|message|meta
if(self::RECORD_MODE == self::RECORD_MODE_UDP) {
self::send($string);
}
else if(self::RECORD_MODE == self::RECORD_MODE_FILE) {
self::fileLog($level, $string);
}
}
/**
* 文件日志记录
*
* @param string $level
* @param string $message
*/
private static function fileLog($level, $message)
{
$filename = $level . '.log'; //日志文件
$logFile = self::createPath(self::$filePath, $filename);
if (!file_exists(self::$filePath))//判断文件路径是否存在
{
if (!empty(self::$filePath))//判断路径是否为空
{
if (!(self::createDir(self::$filePath))) {
return false;
}
if (!is_writable($logFile)) {
return false;
}
}
}
@error_log($message."\r\n", 3, $logFile);
}
/**
* 作用:创建目录
* 输入:要创建的目录
* 输出:true | false
*/
private static function createDir($dir)
{
return is_dir($dir) or (self::createDir(dirname($dir)) and mkdir($dir, 0777));
}
/**
* 作用:构建路径
* 输入:文件的路径,要写入的文件名
* 输出:构建好的路径字串
*/
private static function createPath($dir, $filename)
{
if (empty($dir)) {
return $filename;
} else {
return $dir . "/" . $filename;
}
}
/**
* send by udp
* @param $string
*/
private static function send($string) {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$len = strlen($string);
socket_sendto($sock, $string, $len, 0, self::$url, self::$port);
socket_close($sock);
}
/**
* info log
* @param $message
* @param mixed $meta
*/
public static function info($message, $meta = '') {
self::procLog(__METHOD__, $message, debug_backtrace(), $meta);
}
/**
* warn log
* @param $message
* @param mixed $meta
*/
public static function warn($message, $meta = '') {
self::procLog(__METHOD__, $message, debug_backtrace(), $meta);
}
/**
* error log
* @param $message
* @param mixed $meta
*/
public static function error($message, $meta = '') {
self::procLog(__METHOD__, $message, debug_backtrace(), $meta);
}
/**
* debug log
* @param $message
* @param mixed $meta
*/
public static function debug($message, $meta = '') {
self::procLog(__METHOD__, $message, debug_backtrace(), $meta);
}
}
\ No newline at end of file
... ...
No preview for this file type
... ... @@ -16069,7 +16069,8 @@ var $ = require("jquery"),
showDiv,
imgAlt,
imgSrc,
orderCode;
orderCode,
payment;
$.jqtab = function(tabtit, tabcon) {
... ... @@ -16128,28 +16129,40 @@ $('.change').click(function() {
});
//支付方式选择按钮
function getData(payment,orderCode){
$.ajax({
type:"get",
url:"/common/addpaymentinterval",
dataType:'json',
data:{
orderCode:orderCode,
payment:payment
}
});
function getData(payment, orderCode) {
$.ajax({
type: 'get',
url: '/common/addpaymentinterval',
dataType: 'json',
data: {
orderCode: orderCode,
payment: payment
}
});
}
$("#btnby").click(function(){
payment = $(".choose-type").attr("data-id");
orderCode = $('.order-num').text();
getData(payment,orderCode);
$('#btnby').click(function() {
payment = $('.choose-type').attr('data-id');
orderCode = $('.order-num').text();
getData(payment, orderCode);
window.open($payUrl + '?order_code=' + orderCode + '&payment_type=' + $showValue);
$lightBox.show();
})
});
//发送支付确认
$('.pay-over').unbind('click').bind('click', function() {
var _this = this;
$.post('/shopping/pay/sendPay',
{
orderCode: orderCode,
paymentId: payment
},
function() {
window.location.href = $(_this).data('url');
}
);
});
});
define("js/pay/wechatqrcode", ["jquery"], function(require, exports, module){
/**
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -14,7 +14,7 @@ use WebPlugin\Pay\weixin\lib\WxPayConfig;
use WebPlugin\Pay\weixin\lib\WxPayNativePay;
use WebPlugin\Pay\weixin\lib\WxPayOrderQuery;
use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder;
use WebPlugin\PhpLog;
use WebPlugin\UdpLog;
/**
* 支付有关方法
... ... @@ -26,19 +26,6 @@ use WebPlugin\PhpLog;
*/
class PayModel
{
// 日志等级,2表示记录信息等级的日志
const LOG_LEVEL = 2;
// 支付方式有关接口调用日志
const PAYMENT_LIST_LOG = '/Data/logs/pc_pay/payment_list';
// 向ERP提交订单状态有关接口调用日志和更新订单状态有关接口调用日志
const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status';
// 获取或者更新订单支付银行的接口调用日志
const ORDER_BANK_LOG = '/Data/logs/pc_pay/order_bank';
// 根据用户UID获取订单数有关接口调用日志
const ORDER_COUNT_LOG = '/Data/logs/pc_pay/order_count';
// 发送短信有关接口调用日志
const SEND_MESSAGE_LOG = '/Data/logs/pc_pay/send_message';
// 是否老用户订单数判断值
const OLD_USER_LIMIT = 1;
... ... @@ -117,13 +104,7 @@ class PayModel
// 用户ID
$result['uid'] = $uid;
// 初始化日志
$log = new PhpLog(self::PAYMENT_LIST_LOG, 'PRC', self::LOG_LEVEL);
// 获取支付途径列表
$log->LogInfo('===开始调用支付方式列表接口,接口方法为web.SpaceOrders.getPaymentList===');
$payTypes = PayData::getPaymentList();
$log->LogInfo('===结束调用支付方式列表接口,返回结果为===');
$log->LogInfo(var_export($payTypes, true));
$defaultPayType = 0;
$types = array();
... ... @@ -154,27 +135,15 @@ class PayModel
// 无需付款
if (isset($order["payment_amount"]) && $order["payment_amount"] == 0) {
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===[' . $orderCode . ']===');
//无需付款-更新订单状态
$updateOrderStatus = PayData::pcpayNotify($orderCode, 0, 0);
$log->LogInfo('===无需付款---结束调用更新订单状态接口,返回结果为===');
$log->LogInfo(var_export($updateOrderStatus, true));
UdpLog::info("【无需付款】,orderCode:{$orderCode},更新订单状态结果", $updateOrderStatus);
$result['notNeedPay'] = true;
break;
}
// 记录支付方式
// 初始化日志
$log = new PhpLog(self::ORDER_BANK_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===开始调用记录支付方式接口,接口方法为web.SpaceOrders.getOrderPayBank===');
$log->LogInfo('===请求参数为orderCode=' . $orderCode . '===');
$bankRecord = PayData::getBankByOrder($orderCode);
$log->LogInfo('===结束调用记录支付方式接口,返回结果为===');
$log->LogInfo(var_export($bankRecord, true));
if (isset($bankRecord['data']['bankCode']) && !empty($bankRecord['data']['bankCode'])) {
$payRecord = $bankRecord['data']['bankCode'];
} else {
... ... @@ -198,12 +167,7 @@ class PayModel
// 是否是老用户(用于订单统计)
$orderCount = 0;
// 初始化日志
$log = new PhpLog(self::ORDER_COUNT_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===开始调用查询用户订单数接口,接口方法为web.SpaceOrders.getOrderCountByUid===');
$orders = PayData::getOrderCountByUid($uid);
$log->LogInfo('===结束调用查询用户订单数接口,返回结果为===');
$log->LogInfo(var_export($orders, true));
if (isset($orders['data']) && !empty($orders['data'])) {
$orderCount = $orders['data']['total'];
... ... @@ -394,12 +358,7 @@ class PayModel
$result = array();
do {
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('=====[' . $orderCode . ']===开始生成微信支付二维码========');
if (empty($orderCode)) {
$log->LogInfo('=====[' . $orderCode . ']===微信支付时,订单号为空========');
$result['error'] = true;
$result['message'] = '订单号不能为空';
break;
... ... @@ -408,7 +367,7 @@ class PayModel
/* 判断订单信息是否存在 */
$orderDetail = OrderData::getOrderDetail($uid, $orderCode);
if (!isset($orderDetail['data']) || empty($orderDetail['data'])) {
$log->LogInfo('=====[' . $orderCode . ']===微信支付时,订单信息未查到========');
UdpLog::info("【微信支付时】,function:weixinQrcode,orderCode:{$orderCode},订单信息未查到", array('uid' => $uid, 'orderCode' => $orderCode));
$result['error'] = true;
$result['message'] = '没有找到该订单';
break;
... ... @@ -435,8 +394,7 @@ class PayModel
$input->SetProduct_id($orderCode);
$notify = new WxPayNativePay();
$payResult = $notify->GetPayUrl($input);
$log->LogInfo('=====[' . $orderCode . ']===微信支付时,微信统一下单的返回结果为:========');
$log->LogInfo(var_export($payResult, true));
UdpLog::info("【微信支付时】,function:weixinQrcode,orderCode:{$orderCode},微信统一下单的返回结果为", array('uid' => $uid, 'payResult' => $payResult));
$orderData = $orderDetail['data'];
$firstGoods = current($orderData['order_goods']);
... ... @@ -452,8 +410,7 @@ class PayModel
);
} while (false);
$log->LogInfo('=====[' . $orderCode . ']===微信支付时,处理微信支付的结果为:========');
$log->LogInfo(var_export($result, true));
UdpLog::info("【微信支付】,function:weixinQrcode,orderCode:{$orderCode},处理微信支付的结果为", array('uid' => $uid, 'result' => $result));
return $result;
}
... ... @@ -477,26 +434,19 @@ class PayModel
break;
}
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('=====[' . $orderCode . ']===开始查询微信扫码支付状态========');
// 组装微信支付的订单号
$tradeNo = 'YOHOBuy_' . $orderCode;
$input = new WxPayOrderQuery();
$input->SetOut_trade_no($tradeNo);
$payResult = WxPayApi::orderQuery($input);
$log->LogInfo(var_export($payResult, true));
UdpLog::info("【微信支付】,function:checkWechatPayStatus,orderCode:{$orderCode},检查微信扫码支付结果", array('uid' => $uid, 'payResult' => $payResult));
if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') {
$log->LogInfo('====[' . $orderCode . ']====微信扫码支付成功========');
$result = array(
'code' => '200',
'message' => 'success'
);
}
$log->LogInfo('====[' . $orderCode . ']====微信扫码支付失败========');
} while (false);
return $result;
... ... @@ -518,18 +468,10 @@ class PayModel
);
do {
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('========[' . $payResult->orderCode . ']========');
$log->LogInfo(var_export($payResult, true));
$log->LogInfo('==[' . $payResult->orderCode . ']=开始调用获取订单详情方式接口,接口方法为app.SpaceOrders.detail===');
$orderInfo = OrderData::getOrderDetail($uid, $payResult->orderCode);
$log->LogInfo('==[' . $payResult->orderCode . ']=结束调用获取订单详情方式接口,返回结果为===');
$log->LogInfo(var_export($orderInfo, true));
UdpLog::info("【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},订单信息", $orderInfo);
if (!isset($orderInfo['data']) || empty($orderInfo['data'])) {
$log->LogInfo('==[' . $payResult->orderCode . ']=订单支付失败,未获取到订单详情信息===');
break;
}
... ... @@ -541,14 +483,11 @@ class PayModel
// 订单已取消
if ($orderData['is_cancel'] === 'Y' && $paymentStatus === 'N') {
// 给用户发送短信
// 初始化日志
$log = new PhpLog(self::SEND_MESSAGE_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===[' . $orderCode . ']===');
$log->LogInfo('==[' . $orderCode . ']=开始调用订单取消时给用户发短信接口,接口方法为app.message.sendMsg===');
$messageReturn = PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode);
$log->LogInfo('==[' . $orderCode . ']=结束调用给用户发短信接口,返回结果为===');
$log->LogInfo(var_export($messageReturn, true));
UdpLog::info(
"【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},支付成功,但订单已取消,给用户发信息",
array('orderInfo' => $orderInfo, 'messageReturn' => $messageReturn)
);
$result['code'] = 417;
$result['message'] = '支付成功,但订单已取消,需联系客服';
break;
... ... @@ -556,8 +495,10 @@ class PayModel
// 支付金额与订单金额不一致
if (round($amount, 2) != round($payResult->totalFee, 2)) {
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('==[' . $orderCode . ']=订单支付失败,支付金额与订单金额不一致===');
UdpLog::info(
"【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},订单支付失败,支付金额与订单金额不一致",
array('orderInfo' => $orderInfo)
);
$result['code'] = 415;
$result['message'] = '支付金额与订单金额不一致';
break;
... ... @@ -570,14 +511,12 @@ class PayModel
$bankName = $payResult->bankName;
$bankCode = $payResult->bankCode;
// 初始化日志
$log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
$log->LogInfo('===[' . $orderCode . ']===');
//更新订单状态
$updateOrderStatus = PayData::pcpayNotify($orderCode, $payment, $amount, $bankName, $bankCode, $tradeNo, $bankBillNo);
$log->LogInfo('==[' . $orderCode . ']=结束调用更新订单状态接口,返回结果为===');
$log->LogInfo(var_export($updateOrderStatus, true));
$log->LogInfo('==[' . $orderCode . ']=订单支付成功,请等待发货===');
UdpLog::info(
"【订单支付后处理】,function:procOrderData,orderCode:{$payResult->orderCode},更新订单状态",
array('orderInfo' => $orderInfo, 'updateOrderStatus' => $updateOrderStatus)
);
$result['code'] = 200;
$result['message'] = '支付成功,请等待发货';
... ...
... ... @@ -16,6 +16,8 @@ use WebPlugin\Pay\weixin\lib\WxPayNativePay;
use WebPlugin\Pay\weixin\lib\WxPayOrderQuery;
use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder;
use Api\Yohobuy;
use WebPlugin\UdpLog;
/**
* 支付有关方法 改版
* @copyright 2016/5/22 14:19 xiaoxiao<xiaoxiao.hao@yoho.cn>
... ... @@ -235,6 +237,10 @@ class PaymentModel
$amount = $orderData['payment_amount'];
if ($orderData['is_cancel'] === 'Y') {
UdpLog::warn(
"【支付成功】,但订单已取消,orderCode:{$orderData},参数",
array('payResult' => $payResult, 'orderData' => $orderData)
);
// 给用户发送短信
PayData::sendMessage($orderData['mobile'], 'error_sms', '支付成功,但订单已取消,订单号为' . $orderCode);
self::$code['code'] = 417;
... ... @@ -242,15 +248,19 @@ class PaymentModel
break;
}
// if ($orderData['payment_status'] === 'N') {
// UdpLog::info(
// '【用户支付成功,同步地址返回】,查询订单状态为未付款,有可能异步地址还未即时更新状态,参数',
// array('payResult' => $payResult, 'orderData' => $orderData)
// );
// }
if ($orderData['payment_status'] === 'N') {
UdpLog::warn(
"【支付成功,同步地址返回】,查询订单状态为未付款,有可能异步地址还未即时更新状态,orderCode:{$orderCode},参数",
array('payResult' => $payResult, 'orderData' => $orderData)
);
}
// 支付金额与订单金额不一致
if (round($amount, 2) !== round($payResult->totalFee, 2)) {
UdpLog::warn(
"【支付成功】,支付金额与订单金额不一致,orderCode:{$orderCode},参数",
array('payResult' => $payResult, 'orderData' => $orderData)
);
self::$code['code'] = 415;
self::$code['message'] = '支付金额与订单金额不一致,订单状态更新失败!';
break;
... ... @@ -422,7 +432,10 @@ class PaymentModel
*/
public static function sendPayConfirm($orderCode, $paymentId, $uid)
{
// UdpLog::info("【支付成功-发送确认接口】,function:sendPayConfirm,支付方式ID:{$paymentId},参数", $payResult);
UdpLog::info(
"【支付成功-发送确认接口】,function:sendPayConfirm,支付方式ID:{$paymentId},参数",
array('orderCode' => $orderCode, 'paymentId' => $paymentId, 'uid' => $uid)
);
if (empty($orderCode)) {
return self::$code;
}
... ... @@ -431,10 +444,10 @@ class PaymentModel
$uid = empty($uid) ? self::getUid($orderCode) : $uid;
$confirm = PayData::payConfirm($orderCode, $paymentId, $uid);
// UdpLog::info(
// "【支付成功-发送确认接口】,function:sendPayConfirm,orderCode:{$orderCode},支付方式ID:{$paymentId},接口返回",
// array('confirm' => $confirm, '$payResult' => $payResult)
// );
UdpLog::info(
"【支付成功-发送确认接口】,function:sendPayConfirm,orderCode:{$orderCode},支付方式ID:{$paymentId},接口返回",
array('orderCode' => $orderCode, 'paymentId' => $paymentId, 'uid' => $uid, 'confirm' => $confirm)
);
return $confirm;
}
... ...
... ... @@ -5,26 +5,17 @@ use Shopping\PayModel;
use WebPlugin\Pay\PayFactory;
use WebPlugin\Pay\Rspparams;
use WebPlugin\Pay\weixin\PayNotifyCallBack;
use WebPlugin\PhpLog;
/**
* 支付Notice
*/
class NoticeController extends WebAction
{
// 日志等级,2表示记录信息等级的日志
const LOG_LEVEL = 2;
// 向回调通知有关调用日志
const ORDER_STATUS_LOG = '/Data/logs/pc_pay/order_status';
// 存储的UID键名
const SESSION_UID_KEY = 'payUserid';
private $log = null;
public function init() {
parent::init();
$this->log = new PhpLog(self::ORDER_STATUS_LOG, 'PRC', self::LOG_LEVEL);
}
/**
... ... @@ -35,8 +26,6 @@ class NoticeController extends WebAction
$payment = PayModel::getPaymentById(2);
$payService = PayFactory::factory($payment);
$this->log->LogInfo("begin alipaynoticeAction");
$res = $payService->parseResponse($_POST); //支付宝通知使用的
if ($res->payResult != -1) {
$this->payResultProc($res, 2);
... ... @@ -50,8 +39,6 @@ class NoticeController extends WebAction
*/
public function alipayreturnAction()
{
$this->log->LogInfo("begin alipayreturnAction");
$payment = PayModel::getPaymentById(2);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_GET);
... ... @@ -65,7 +52,6 @@ class NoticeController extends WebAction
*/
public function alibarcodenoticeAction()
{
$this->log->LogInfo("begin alibarcodenoticeAction");
$payment = PayModel::getPaymentById(17);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST); //支付宝通知使用的
... ... @@ -81,7 +67,6 @@ class NoticeController extends WebAction
*/
public function alibarcodereturnAction()
{
$this->log->LogInfo("begin alibarcodereturnAction");
$payment = PayModel::getPaymentById(17);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_GET);
... ... @@ -95,7 +80,6 @@ class NoticeController extends WebAction
*/
public function allinpaynoticeAction()
{
$this->log->LogInfo("begin allinpaynoticeAction");
$payment = PayModel::getPaymentById(16);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -111,7 +95,6 @@ class NoticeController extends WebAction
*/
public function allinpayreturnAction()
{
$this->log->LogInfo("begin allinpayreturnAction");
$payment = PayModel::getPaymentById(16);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -125,7 +108,6 @@ class NoticeController extends WebAction
*/
public function aliexpressgatewayreturnAction()
{
$this->log->LogInfo("begin aliexpressgatewayreturnAction");
$payment = PayModel::getPaymentById(13);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_GET);
... ... @@ -139,7 +121,6 @@ class NoticeController extends WebAction
*/
public function aliexpressgatewaynoticeAction()
{
$this->log->LogInfo("begin aliexpressgatewaynoticeAction");
$payment = PayModel::getPaymentById(13);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST); //支付宝通知使用的
... ... @@ -155,7 +136,6 @@ class NoticeController extends WebAction
*/
public function alibanknoticeAction()
{
$this->log->LogInfo("begin alibanknoticeAction");
$payment = PayModel::getPaymentById(12);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -173,7 +153,6 @@ class NoticeController extends WebAction
*/
public function alibankreturnAction()
{
$this->log->LogInfo("begin alibanknoticeAction");
$payment = PayModel::getPaymentById(12);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_GET);
... ... @@ -187,7 +166,6 @@ class NoticeController extends WebAction
*/
public function chinabankAction()
{
$this->log->LogInfo("begin chinabankAction");
$payment = PayModel::getPaymentById(4);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -201,7 +179,6 @@ class NoticeController extends WebAction
*/
public function chinabankautorevAction()
{
$this->log->LogInfo("begin chinabankautorevAction");
$payment = PayModel::getPaymentById(4);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -219,7 +196,6 @@ class NoticeController extends WebAction
*/
public function tenpayAction()
{
$this->log->LogInfo("begin tenpayAction");
$payment = PayModel::getPaymentById(1);
$payService = PayFactory::factory($payment);
$rspParams = $payService->parseResponse($_GET); //财付通是以get方式回复的。
... ... @@ -235,7 +211,6 @@ class NoticeController extends WebAction
*/
public function shengpayreturnAction()
{
$this->log->LogInfo("begin shengpayreturnAction");
$payment = PayModel::getPaymentById(11);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -249,7 +224,6 @@ class NoticeController extends WebAction
*/
public function shengpaynoticeAction()
{
$this->log->LogInfo("begin shengpaynoticeAction");
$payment = PayModel::getPaymentById(11);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST);
... ... @@ -265,7 +239,6 @@ class NoticeController extends WebAction
*/
public function wechatcallbackAction()
{
$this->log->LogInfo("begin wechatcallbackAction");
$callback = $this->get('callback');
$orderCode = $this->get('ordercode');
... ... @@ -280,14 +253,11 @@ class NoticeController extends WebAction
*/
public function wechatqrcodenotifyAction()
{
$this->log->LogInfo("begin wechatqrcodenotifyAction");
$uid = $this->getUid();
if (empty($uid)) { // cookie中获取为空时再从之前保存的session中获取
$uid = $this->getSession(self::SESSION_UID_KEY);
$this->setSession(self::SESSION_UID_KEY, null);
}
$this->log->LogInfo($uid);
$notify = new PayNotifyCallBack($uid);
$notify->handle(false);
}
... ... @@ -297,7 +267,6 @@ class NoticeController extends WebAction
*/
public function wechatqrcodereturnAction()
{
$this->log->LogInfo("begin wechatqrcodereturnAction");
$dealResult = array(
'code' => 500,
'message' => '支付失败'
... ... @@ -324,7 +293,6 @@ class NoticeController extends WebAction
*/
public function unionpaywebreturnAction()
{
$this->log->LogInfo("begin unionpaywebreturnAction");
$payment = PayModel::getPaymentById(25);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_REQUEST);
... ... @@ -338,7 +306,6 @@ class NoticeController extends WebAction
*/
public function unionpaywebnoticeAction()
{
$this->log->LogInfo("begin unionpaywebnoticeAction");
$payment = PayModel::getPaymentById(25);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_REQUEST);
... ... @@ -355,7 +322,6 @@ class NoticeController extends WebAction
*/
public function alimobilenoticeminiAction()
{
$this->log->LogInfo("begin alimobilenoticeminiAction");
$payment = PayModel::getPaymentById(20);
$payService = PayFactory::factory($payment);
$res = $payService->parseResponse($_POST); //支付宝通知使用的
... ... @@ -408,12 +374,6 @@ class NoticeController extends WebAction
*/
private function payResultProc($payResult, $payment)
{
// 初始化日志
$log = $this->log;
$log->LogInfo('================开始验证登录状态============');
$log->LogInfo('================支付结果数据为============');
$log->LogInfo(var_export($payResult, true));
//判断是否登录
$uid = $this->getUid();
if (empty($uid)) { // cookie中获取为空时再从之前保存的session中获取
... ... @@ -421,8 +381,6 @@ class NoticeController extends WebAction
$this->setSession(self::SESSION_UID_KEY, null);
}
$log->LogInfo('================已登录,获取到用户ID============');
$result = array(
'code' => 500,
'message' => '支付失败'
... ... @@ -433,9 +391,6 @@ class NoticeController extends WebAction
$result = PayModel::procOrderData($uid, $payResult, $payment);
}
$log->LogInfo('================支付结果为============');
$log->LogInfo(var_export($result, true));
return $result;
}
}
... ...