This commit is contained in:
root 2020-01-14 19:45:19 +08:00
parent 3e86cdcbbf
commit 9b6919e9c9
2 changed files with 16 additions and 1 deletions

View File

@ -9,6 +9,7 @@ use Omnipay\Omnipay;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Cache;
use Library\BitpayX;
use Library\PayTaro;
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)
{
$order = Order::where('trade_no', $tradeNo)->first();

View File

@ -39,7 +39,7 @@ class PayTaro
unset($params['sign']);
ksort($params);
reset($params);
$str = http_build_query($params) . $this->appId;
$str = http_build_query($params) . $this->appSecret;
if ($sign !== md5($str)) {
return false;
}