Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
whb
9 years ago
Commit
00e6c910bca836bb2c696d0aa5c2a0dd5fbf7f79
2 parents
db32a4fc
f7d63d90
Merge branch 'temp'
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
38 deletions
library/WebPlugin/Pay/Unionpayweb/Func/common.php
library/WebPlugin/Pay/Unionpayweb/Func/secureUtil.php
library/WebPlugin/Pay/Unionpayweb/Service.php
library/WebPlugin/Pay/Unionpayweb/conf/release/SDKConfig.php
library/WebPlugin/Pay/Unionpayweb/conf/release/certs/UpopRsaCert.cer
library/WebPlugin/Pay/Unionpayweb/conf/test/SDKConfig.php
yohobuy/www.yohobuy.com/application/modules/Pay/controllers/Notice.php
library/WebPlugin/Pay/Unionpayweb/Func/common.php
View file @
00e6c91
...
...
@@ -19,7 +19,6 @@ function coverParamsToString($params)
continue
;
}
$sign_str
.=
sprintf
(
"%s=%s&"
,
$key
,
$val
);
// $sign_str .= $key . '=' . $val . '&';
}
return
substr
(
$sign_str
,
0
,
strlen
(
$sign_str
)
-
1
);
}
...
...
library/WebPlugin/Pay/Unionpayweb/Func/secureUtil.php
View file @
00e6c91
...
...
@@ -47,20 +47,22 @@ function sign(&$params)
function
verify
(
$params
)
{
$log
=
new
PhpLog
(
SDK_LOG_FILE_PATH
,
"PRC"
,
SDK_LOG_LEVEL
);
$log
->
LogInfo
(
'=====返回参数===='
);
$log
->
LogInfo
(
var_export
(
$params
,
true
));
// 公钥
$public_key
=
getPulbicKeyByCertId
(
$params
[
'certId'
]);
// echo $public_key.'<br/>';
$public_key
=
getPulbicKeyByCertId
(
$params
[
'certId'
]);
// 签名串
$signature_str
=
$params
[
'signature'
];
unset
(
$params
[
'signature'
]);
$signature_str
=
$params
[
'signature'
];
unset
(
$params
[
'signature'
]);
$params_str
=
coverParamsToString
(
$params
);
$log
->
LogInfo
(
'报文去[signature] key=val&串>'
.
$params_str
);
$signature
=
base64_decode
(
$signature_str
);
// echo date('Y-m-d',time());
$params_sha1x16
=
sha1
(
$params_str
,
FALSE
);
$log
->
LogInfo
(
'摘要shax16>'
.
$params_sha1x16
);
$isSuccess
=
openssl_verify
(
$params_sha1x16
,
$signature
,
$public_key
,
OPENSSL_ALGO_SHA1
);
$log
->
LogInfo
(
$isSuccess
?
'验签成功'
:
'验签失败'
);
return
$isSuccess
;
}
...
...
library/WebPlugin/Pay/Unionpayweb/Service.php
View file @
00e6c91
...
...
@@ -35,24 +35,26 @@ class Service extends PayAbstract
*/
public
function
parseResponse
(
array
$package
)
{
$this
->
log
->
LogInfo
(
var_export
(
$package
,
true
));
$verify
=
false
;
if
(
isset
(
$package
[
'signature'
])
&&
verify
(
$package
))
{
$verify
=
true
;
$this
->
log
->
LogInfo
(
'验签成功'
);
}
else
{
return
false
;
}
$responseData
=
new
Rspparams
();
if
(
$package
[
'respCode'
]
!==
'00'
)
{
if
(
!
isset
(
$package
[
'respCode'
])
||
$package
[
'respCode'
]
!==
'00'
)
{
$this
->
log
->
LogInfo
(
'支付返回码有误'
);
return
false
;
$responseData
->
payResult
=
-
1
;
return
$responseData
;
}
if
(
isset
(
$package
[
'signature'
]))
{
// TODO isset($package['signature']) && verify($package)验证签名待做
$verify
=
true
;
$this
->
log
->
LogInfo
(
'验签成功'
);
}
$responseData
=
new
Rspparams
();
if
(
$verify
)
{
//更改订单状态
$responseData
->
orderCode
=
$package
[
'orderId'
];
$responseData
->
payResult
=
0
;
$responseData
->
payResult
=
20
0
;
$responseData
->
payTime
=
time
();
$responseData
->
totalFee
=
$package
[
'txnAmt'
]
*
0.01
;
$responseData
->
bankName
=
''
;
...
...
@@ -65,6 +67,8 @@ class Service extends PayAbstract
$responseData
->
payResult
=
-
1
;
}
$this
->
log
->
LogInfo
(
var_export
(
$responseData
,
true
));
return
$responseData
;
}
...
...
library/WebPlugin/Pay/Unionpayweb/conf/release/SDKConfig.php
View file @
00e6c91
...
...
@@ -50,7 +50,7 @@ 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_BACK_NOTIFY_URL
=
'http://
pay.yohobuy.com/notify
/unionpaywebnotice'
;
const
SDK_BACK_NOTIFY_URL
=
'http://
www.yohobuy.com/pay/notice
/unionpaywebnotice'
;
//文件下载目录
const
SDK_FILE_DOWN_PATH
=
'/tmp/unionpay/files/'
;
...
...
library/WebPlugin/Pay/Unionpayweb/conf/release/certs/UpopRsaCert.cer
View file @
00e6c91
-----BEGIN CERTIFICATE-----
MIIDNjCCAh6gAwIBAgIQEAAAAAAAAAAAAAAQBQdAIDANBgkqhkiG9w0BAQUFADAh
MQswCQYDVQQGEwJDTjESMBAGA1UEChMJQ0ZDQSBPQ0ExMB4XDTEyMTIxODAyMDA1
MVoXDTE1MTIxODAyMDA1MVowfDELMAkGA1UEBhMCQ04xDTALBgNVBAoTBE9DQTEx
ETAPBgNVBAsTCENGQ0EgTFJBMRkwFwYDVQQLExBPcmdhbml6YXRpb25hbC0xMTAw
LgYDVQQDFCc4MzEwMDAwMDAwMDgzMDQwQDAwMDQwMDAwOlNJR05AMDAwMDAwMDEw
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDFG+NnBXN++aUUAbgVFOt/
pi2McB79P+tmkS98Pnlj+pEvCc2nltq2VZzfJvGb1UE6lXKXoCG+NosZMj64uda9
Du2up78Z92HGdT2tkZ0RaoouR4jCY0Bmz0+5zObjR607vwBTvln9idG9ZGK2Lm35
QSxjpLolRPEnz/rgxFG9ezxVfI9eQ7JmuBk/OXyzjA1JQwAMh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BTvln9idG9ZGK2Lm35
QSxjpLolRPEnz/rgxFG9ezxVfI9eQ7JmuBk/OXyzjA1JQwAMhdAT3GJO0JMmMDvC
Q0pNyTsu1oyQPJoCaV3qPfpcvatMKYsVxo2Zeogqw2x2L6KE8BODrj6m6Ue1aUMn
9Ch1XbR/dB8M2M+nVtOAVb6DA6kVuNFlMl2uzxD8MQlhos8aT+vCx1v9p21k3+jz
AgMBAAGjDzANMAsGA1UdDwQEAwIGwDANBgkqhkiG9w0BAQUFAAOCAQEAhgW/gcDa
fqs0oWDH81XnTVvDCp5mwDo+wxgzVRTEtudU6seKcc2kiBe1RqegtUX2le/eAzcD
mo7nxHMy73ANdP/wha+P2gp+mo3buhO244pQphMV+Yu8djHTFH8+hRkCbnsrndYc
qNiJ/yhsUpaJ4nY+oEoyut0id6QddKiNPYoTFz0fy/VqNP6g+23zFy6sIg+gffVZ
6o3CsZVu9z5umUjzfV384iSWovq+/IdSZ4g/jerdPtje/CKYTmzG5nsCa/s+i7Rf
D5scSlfi7iW2Q7Sc/HlrtOAglt7IyjRSsFPPxuBXmSITc2GDKyKI46u8RXpccAUh
YspJ5MXOYLZN7A==
-----END CERTIFICATE-----
\ No newline at end of file
...
...
library/WebPlugin/Pay/Unionpayweb/conf/test/SDKConfig.php
View file @
00e6c91
...
...
@@ -46,7 +46,7 @@ const SDK_App_Request_Url = 'https://101.231.204.80:5000/gateway/api/appTransReq
// 前台通知地址 (商户自行配置通知地址)
const
SDK_FRONT_NOTIFY_URL
=
'http://www.yohobuy.com/pay/notice/unionpaywebreturn'
;
// 后台通知地址 (商户自行配置通知地址)
const
SDK_BACK_NOTIFY_URL
=
'http://
pay.test.yohobuy.com/notify
/unionpaywebnotice'
;
const
SDK_BACK_NOTIFY_URL
=
'http://
www.yohobuy.com/pay/notice
/unionpaywebnotice'
;
//文件下载目录
const
SDK_FILE_DOWN_PATH
=
'/tmp/unionpay/files/'
;
...
...
yohobuy/www.yohobuy.com/application/modules/Pay/controllers/Notice.php
View file @
00e6c91
...
...
@@ -294,7 +294,7 @@ class NoticeController extends WebAction
{
$payment
=
PayModel
::
getPaymentById
(
25
);
$payService
=
PayFactory
::
factory
(
$payment
);
$res
=
$payService
->
parseResponse
(
$_
GE
T
);
$res
=
$payService
->
parseResponse
(
$_
REQUES
T
);
if
(
$res
->
payResult
!=
-
1
)
{
$this
->
payResultProc
(
$res
,
25
);
echo
"OK"
;
...
...
Please
register
or
login
to post a comment