mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 20:17:32 +08:00
refactor: 规范Expection处理
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Payments;
|
||||
use App\Exceptions\ApiException;
|
||||
|
||||
class Coinbase {
|
||||
public function __construct($config) {
|
||||
@@ -50,7 +51,7 @@ class Coinbase {
|
||||
$ret = @json_decode($ret_raw, true);
|
||||
|
||||
if(empty($ret['data']['hosted_url'])) {
|
||||
abort(500, "error!");
|
||||
throw new ApiException(500, "error!");
|
||||
}
|
||||
return [
|
||||
'type' => 1,
|
||||
@@ -70,7 +71,7 @@ class Coinbase {
|
||||
$computedSignature = \hash_hmac('sha256', $payload, $this->config['coinbase_webhook_key']);
|
||||
|
||||
if (!self::hashEqual($signatureHeader, $computedSignature)) {
|
||||
abort(400, 'HMAC signature does not match');
|
||||
throw new ApiException(400, 'HMAC signature does not match');
|
||||
}
|
||||
|
||||
$out_trade_no = $json_param['event']['data']['metadata']['outTradeNo'];
|
||||
|
||||
Reference in New Issue
Block a user