Skip to content

Commit

Permalink
Merge pull request #402 from Chenxi-Chris/master
Browse files Browse the repository at this point in the history
添加支付路由判断 [ 群友思路 ]
  • Loading branch information
assimon authored Dec 25, 2022
2 parents cc4068e + 640d1fc commit 47a069c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/AlipayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'error';
}
if($payGateway->pay_handleroute != '/pay/alipay'){
return 'fail';
}
$config = [
'app_id' => $payGateway->merchant_id,
'ali_public_key' => $payGateway->merchant_key,
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/CoinbaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'fail';
}
if($payGateway->pay_handleroute != 'pay/coinbase'){
return 'fail';
}
$secret = $payGateway->merchant_pem;//共享密钥
$sig2 = hash_hmac( 'sha256', $payload, $secret );
$result_str=array("confirmed","resolved");//返回的结果字符串数组
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/EpusdtController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'fail';
}
if($payGateway->pay_handleroute != 'pay/epusdt'){
return 'fail';
}
$signature = $this->epusdtSign($data, $payGateway->merchant_id);
if ($data['signature'] != $signature) { //不合法的数据
return 'fail'; //返回失败 继续补单
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/MapayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'fail';
}
if($payGateway->pay_handleroute != '/pay/mapay'){
return 'fail';
}
$query = signquery_string($data);
if (!$data['pay_no'] || md5($query . $payGateway->merchant_pem ) != $data['sign']) { //不合法的数据
return 'fail'; //返回失败 继续补单
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/PayjsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'error';
}
if($payGateway->pay_handleroute != '/pay/payjs'){
return 'fail';
}
config(['payjs.mchid' => $payGateway->merchant_id, 'payjs.key' => $payGateway->merchant_pem]);
$notify_info = Payjs::notify();
$totalFee = bcdiv($notify_info['total_fee'], 100, 2);
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/PaypalPayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public function returnUrl(Request $request)
if (!$payGateway) {
return 'error';
}
if($payGateway->pay_handleroute != '/pay/paypal'){
return 'error';
}
$paypal = new ApiContext(
new OAuthTokenCredential(
$payGateway->merchant_key,
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Pay/PaysapiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'error';
}

if($payGateway->pay_handleroute != '/pay/paysapi'){
return 'error';
}
$temps = md5($data['orderid'] . $data['orderuid'] . $data['paysapi_id'] . $data['price'] . $data['realprice'] . $payGateway->merchant_pem);
if ($temps != $data['key']){
return 'fail';
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/WepayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public function notifyUrl()
if (!$payGateway) {
return 'error';
}
if($payGateway->pay_handleroute != '/pay/wepay'){
return 'error';
}
$config = [
'app_id' => $payGateway->merchant_id,
'mch_id' => $payGateway->merchant_key,
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/Pay/YipayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function notifyUrl(Request $request)
if (!$payGateway) {
return 'fail';
}
if($payGateway->pay_handleroute != '/pay/yipay'){
return 'fail';
}
ksort($data); //重新排序$data数组
reset($data); //内部指针指向数组中的第一个元素
$sign = '';
Expand Down

0 comments on commit 47a069c

Please sign in to comment.