mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update
This commit is contained in:
		| @@ -9,6 +9,7 @@ use Omnipay\Omnipay; | |||||||
| use Illuminate\Support\Facades\Log; | use Illuminate\Support\Facades\Log; | ||||||
| use Illuminate\Support\Facades\Cache; | use Illuminate\Support\Facades\Cache; | ||||||
| use Library\BitpayX; | use Library\BitpayX; | ||||||
|  | use Library\PayTaro; | ||||||
|  |  | ||||||
| class OrderController extends Controller | class OrderController extends Controller | ||||||
| { | { | ||||||
| @@ -130,6 +131,20 @@ class OrderController extends Controller | |||||||
|         ]); |         ]); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public function payTaroNotify(Request $request) | ||||||
|  |     { | ||||||
|  |         Log::info('payTaroNotify: ' . json_encode($request->input())); | ||||||
|  |  | ||||||
|  |         $payTaro = new PayTaro(config('v2board.paytaro_app_id'), config('v2board.paytaro_app_secret')); | ||||||
|  |         if (!$payTaro->verify($request->input())) { | ||||||
|  |             abort('fail'); | ||||||
|  |         } | ||||||
|  |         if (!$this->handle($request->input('out_trade_no'), $request->input('trade_no'))) { | ||||||
|  |             abort('fail'); | ||||||
|  |         } | ||||||
|  |         die('success'); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     private function handle($tradeNo, $callbackNo) |     private function handle($tradeNo, $callbackNo) | ||||||
|     { |     { | ||||||
|         $order = Order::where('trade_no', $tradeNo)->first(); |         $order = Order::where('trade_no', $tradeNo)->first(); | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ class PayTaro | |||||||
|         unset($params['sign']); |         unset($params['sign']); | ||||||
|         ksort($params); |         ksort($params); | ||||||
|         reset($params); |         reset($params); | ||||||
|         $str = http_build_query($params) . $this->appId; |         $str = http_build_query($params) . $this->appSecret; | ||||||
|         if ($sign !== md5($str)) { |         if ($sign !== md5($str)) { | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user