Authored by 周少峰

Merge branch 'feature/unionpay' into release/4.9.1.0

... ... @@ -7,7 +7,6 @@ use WebPlugin\Pay\Reqparams;
use WebPlugin\Pay\Rspparams;
use WebPlugin\UdpLog;
use WebPlugin\Helpers;
use Api\Yohobuy;
class Service extends PayAbstract
{
... ... @@ -15,8 +14,7 @@ class Service extends PayAbstract
public function __construct(array $paymentParams)
{
$env = (APPLICATION_ENV === 'production' || APPLICATION_ENV === 'preview') ? 'release' : 'test';
include_once 'conf/' . $env . '/SDKConfig.php';
include_once 'conf/release/SDKConfig.php';
include_once 'Func/common.php';
include_once 'Func/secureUtil.php';
... ... @@ -39,12 +37,21 @@ class Service extends PayAbstract
$verify = false;
$responseData = new Rspparams();
if (!isset($package['respCode']) || $package['respCode'] !== '00') {
//https://open.unionpay.com/ajweb/help/faq/list?id=234&level=0&from=0&keyword=respCode 状态码
if (empty($package['respCode']) || in_array($package['respCode'], array('00', 'A6')) === false) {
$responseData->payResult = -1;
return $responseData;
}
if (isset($package['signature'])) { // TODO isset($package['signature']) && verify($package)验证签名待做
//去除为空的数组
foreach ($package as $key => $value) {
if ($value === '') {
unset($package[$key]);
}
}
if (verify($package)) {
//验证签名合法性
$verify = true;
}
... ... @@ -63,14 +70,16 @@ class Service extends PayAbstract
} else {
$responseData->payResult = -1;
}
UdpLog::info("【{$this->logProjectPrefix}-银联支付】,function:parseResponse,处理结果", $responseData);
return $responseData;
}
//https://open.unionpay.com/ajweb/help/faq/list?id=38&level=0&from=0
public function getPayRequestPars(Reqparams $params)
{
$front_notify_url = SDK_FRONT_NOTIFY_URL . '?order_code=' . $params->orderCode;
// $front_notify_url = SDK_FRONT_NOTIFY_URL . '?order_code=' . $params->orderCode;
$requestParams = array(
'version' => '5.0.0', //版本号
'encoding' => 'utf-8', //编码方式
... ... @@ -78,8 +87,8 @@ class Service extends PayAbstract
'txnType' => '01', //交易类型
'txnSubType' => '01', //交易子类
'bizType' => '000201', //业务类型
'frontUrl' => $front_notify_url, //前台通知地址--同步地址
'backUrl' => SDK_BACK_NOTIFY_URL,//后台通知地址--异步地址
'frontUrl' => Helpers::getHttpOrHttps() . Helpers::url(SDK_FRONT_NOTIFY_URL), //前台通知地址--同步地址
'backUrl' => SERVICE_NOTIFY . SDK_BACK_NOTIFY_URL,//后台通知地址--异步地址
'signMethod' => '01', //签名方法
'channelType' => '07', //渠道类型,07-PC,08-手机
'accessType' => '0', //接入类型
... ... @@ -88,8 +97,9 @@ class Service extends PayAbstract
'txnTime' => date('YmdHis', $params->orderTime), //订单发送时间
'txnAmt' => $params->totalFee, //交易金额,单位分
'currencyCode' => '156', //交易币种
'defaultPayType' => '0201', //默认支付方式
'defaultPayType' => '0201', //默认支付方式-网银支付
//'orderDesc' => '订单描述', //订单描述,网关支付和wap支付暂时不起作用
// 'payTimeout' => '',//超时时间
'reqReserved' => $params->goodsName //请求方保留域,透传字段,查询、通知、对账文件中均会原样出现
);
// 签名
... ...
... ... @@ -48,9 +48,9 @@ const SDK_App_Request_Url = 'https://gateway.95516.com/gateway/api/appTransReq.d
// 前台通知地址 (商户自行配置通知地址)
const SDK_FRONT_NOTIFY_URL = 'http://www.yohobuy.com/pay/notice/unionpaywebreturn';
const SDK_FRONT_NOTIFY_URL = '/pay/payreturn/unionpaywebreturn';
// 后台通知地址 (商户自行配置通知地址)
const SDK_BACK_NOTIFY_URL = 'http://www.yohobuy.com/pay/notice/unionpaywebnotice';
const SDK_BACK_NOTIFY_URL = 'payment/unionpay_newnotify';
//文件下载目录
const SDK_FILE_DOWN_PATH = '/Data/logs/pc_pay/unionpay/files/';
... ...
-----BEGIN CERTIFICATE-----
MIIEIDCCAwigAwIBAgIFEDRVM3AwDQYJKoZIhvcNAQEFBQAwITELMAkGA1UEBhMC
Q04xEjAQBgNVBAoTCUNGQ0EgT0NBMTAeFw0xNTEwMjcwOTA2MjlaFw0yMDEwMjIw
OTU4MjJaMIGWMQswCQYDVQQGEwJjbjESMBAGA1UEChMJQ0ZDQSBPQ0ExMRYwFAYD
VQ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ref59HuFZY4/LqyZysiMua4qyYfEfdKk5h27+z1MWy
nadnxA5QexHHck9Y4ZyisbUubW7wTaaWFd+cZ3P/zmIUskE/dAG0/HEvmOR6CGlM
55BFCVmJEufHtike3shu7lZGVm2adKNFFTqLoEFkfBO6Y/N6ViraBilcXjmWBJNE
MFF/yA==
-----END CERTIFICATE-----
\ No newline at end of file
... ...
<?php
// cvn2加密 1:加密 0:不加密
const SDK_CVN2_ENC = 0;
// 有效期加密 1:加密 0:不加密
const SDK_DATE_ENC = 0;
// 卡号加密 1:加密 0:不加密
const SDK_PAN_ENC = 0;
// ######(以下配置为PM环境:入网测试环境用,生产环境配置见文档说明)#######
// 签名证书路径
//const SDK_SIGN_CERT_PATH = 'D:\\wamp\\www\\yohobuy\\library\\WebPlugin\\Pay\\Unionpayweb\\conf\\test\\certs\\PM_700000000000001_acp.pfx';
const SDK_SIGN_CERT_PATH = 'conf/test/certs/PM_700000000000001_acp.pfx';
// 签名证书密码
const SDK_SIGN_CERT_PWD = '000000';
// 密码加密证书(这条用不到的请随便配)
const SDK_ENCRYPT_CERT_PATH = 'conf/test/certs/verify_sign_acp.cer';
//const SDK_ENCRYPT_CERT_PATH = 'D:\\wamp\\www\\yohobuy\\library\\WebPlugin\\Pay\\Unionpayweb\\conf\\test\\certs\\verify_sign_acp.cer';
// 验签证书路径(请配到文件夹,不要配到具体文件)
const SDK_VERIFY_CERT_DIR = 'conf/test/certs/';
// 前台请求地址
const SDK_FRONT_TRANS_URL = 'https://101.231.204.80:5000/gateway/api/frontTransReq.do';
// 后台请求地址
const SDK_BACK_TRANS_URL = 'https://101.231.204.80:5000/gateway/api/backTransReq.do';
// 批量交易
const SDK_BATCH_TRANS_URL = 'https://101.231.204.80:5000/gateway/api/batchTrans.do';
//单笔查询请求地址
const SDK_SINGLE_QUERY_URL = 'https://101.231.204.80:5000/gateway/api/queryTrans.do';
//文件传输请求地址
const SDK_FILE_QUERY_URL = 'https://101.231.204.80:9080/';
//有卡交易地址
const SDK_Card_Request_Url = 'https://101.231.204.80:5000/gateway/api/cardTransReq.do';
//App交易地址
const SDK_App_Request_Url = 'https://101.231.204.80:5000/gateway/api/appTransReq.do';
// 前台通知地址 (商户自行配置通知地址)
const SDK_FRONT_NOTIFY_URL = 'http://www.yohobuy.com/pay/notice/unionpaywebreturn';
// 后台通知地址 (商户自行配置通知地址)
const SDK_BACK_NOTIFY_URL = 'http://www.yohobuy.com/pay/notice/unionpaywebnotice';
//文件下载目录
const SDK_FILE_DOWN_PATH = '/Data/logs/pc_pay/unionpay/files/';
//日志 目录
const SDK_LOG_FILE_PATH = '/Data/logs/pc_pay/unionpay/';
//日志级别
const SDK_LOG_LEVEL = 2;
?>
\ No newline at end of file
-----BEGIN CERTIFICATE-----
MIIDpDCCAw2gAwIBAgIQQdwbgeStSukUTliGHkR2AjANBgkqhkiG9w0BAQUFADAk
MQswCQYDVQQGEwJDTjEVMBMGA1UEChMMQ0ZDQSBURVNUIENBMB4XDTEwMDYyNTAz
MDAzN1oXDTExMDYyNTAzMDAzN1owdTELMAkGA1UEBhMCQ04xFTATBgNVBAoTDENG
Q0EgVEVTVCBDQTERMA8GA1UECxMITG9jYWwgUkExFDASBgNVBAsTC0VudGVycHJp
c2VzMSYwJAYDVQQDFB0wNDFAWjVAMDAwNDAwMDA6U0lHTkAwMDAwMDAxODCBnzAN
BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5UPlV6wmGwpBFHX9n78V1O8KMx6D5yj4
j4Sg4BW3hJ6WU7TPzWPHrjOGulmdAYpdziZROS6ygtu6mtB6s/54u7un8JUB1H+t
3l4ll8DXvE2+vX6xoKqnmUuyAHA26oavHU2xIQrGb5OLQ0aSgCn9eYjsqLRZwaNP
EItSBP99xT0CAwEAAaOCAYQwggGAMB8GA1UdIwQYMBaAFEZy3CVynwJOVYO1gPkL
2+mTs/RFMB0GA1UdDgQWBBSFJUyNA4zif3+Z8b+ioyJZCw9qSjALBgNVHQ8EBAMC
BaAwDAYDVR0TBAUwA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TIFICATE-----
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -112,7 +112,7 @@ class PayModel
$oneType = array();
foreach ($payTypes['data'] as $key => $payType) {
if (empty($payType['payIcon'])) { // 排除图标不存在的支付方式
if (empty($payType['payIcon']) || $payType['id'] * 1 === 33) { // 排除图标不存在的支付方式
continue;
}
... ...
... ... @@ -121,7 +121,8 @@ class PaymentModel
$oneType = array();
foreach ($payTypes['data'] as $key => $payType) {
if (empty($payType['payIcon'])) { // 排除图标不存在的支付方式
if (empty($payType['payIcon']) || $payType['id'] * 1 === 33) { // 排除图标不存在的支付方式
//33为blk支付方式
continue;
}
... ...
... ... @@ -266,6 +266,7 @@ class NoticeController extends WebAction
*/
public function unionpaywebreturnAction()
{
UdpLog::info("【银联web支付同步返回】,function:unionpaywebreturn,json参数", json_encode($_REQUEST));
$res = $this->getParseResponse($_REQUEST, 25);
$dealResult = $this->payResultProc($res, 25);
$dealResult['payData'] = array('payWay' => '银联在线支付');
... ... @@ -277,6 +278,7 @@ class NoticeController extends WebAction
*/
public function unionpaywebnoticeAction()
{
UdpLog::info("【银联web支付异步返回】,function:unionpaywebnotice,json参数", json_encode($_REQUEST));
$res = $this->getParseResponse($_REQUEST, 25);
if ($res->payResult != -1) {
$this->payResultProc($res, 25);
... ...
... ... @@ -4,6 +4,7 @@ use Action\WebAction;
use Shopping\PaymentModel;
use WebPlugin\Pay\PayFactory;
use WebPlugin\Pay\Rspparams;
use WebPlugin\UdpLog;
/**
* 支付 同步通知页面
... ... @@ -65,6 +66,7 @@ class PayreturnController extends WebAction
*/
public function unionpaywebreturnAction()
{
UdpLog::info("【银联web支付同步返回】,function:unionpaywebreturn,json参数", json_encode($_REQUEST));
$res = $this->getParseResponse($_REQUEST, 25);
$dealResult = $this->payResultProc($res, 25);
$dealResult['payData'] = array('payWay' => '银联在线支付');
... ...