chore: code styling via pint
This commit is contained in:
@@ -2,15 +2,16 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Log;
|
||||
use Exception;
|
||||
use App\NotifyMe;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
|
||||
class WebhookController extends Controller
|
||||
{
|
||||
use NotifyMe;
|
||||
|
||||
public function oxapay(Request $request)
|
||||
{
|
||||
// Get the request data
|
||||
@@ -18,8 +19,9 @@ class WebhookController extends Controller
|
||||
$data = json_decode($postData, true);
|
||||
|
||||
// Validate request data
|
||||
if (!$data || !isset($data['type']) || !in_array($data['type'], ['invoice', 'payment_link', 'payout'])) {
|
||||
if (! $data || ! isset($data['type']) || ! in_array($data['type'], ['invoice', 'payment_link', 'payout'])) {
|
||||
Log::warning('Invalid Oxapay webhook data', ['data' => $data]);
|
||||
|
||||
return response('Invalid data.type', 400);
|
||||
}
|
||||
|
||||
@@ -53,11 +55,11 @@ class WebhookController extends Controller
|
||||
'date' => $date,
|
||||
]);
|
||||
|
||||
$message = "✅ Oxapay Invoice Payment Success\n" .
|
||||
"Track ID: {$trackId}\n" .
|
||||
"Email: {$email}\n" .
|
||||
"Amount: {$amount} {$currency}\n" .
|
||||
"Order ID: {$orderId}\n" .
|
||||
$message = "✅ Oxapay Invoice Payment Success\n".
|
||||
"Track ID: {$trackId}\n".
|
||||
"Email: {$email}\n".
|
||||
"Amount: {$amount} {$currency}\n".
|
||||
"Order ID: {$orderId}\n".
|
||||
"Time: {$date}";
|
||||
self::sendTelegramNotification($message);
|
||||
} elseif ($data['type'] === 'payout') {
|
||||
@@ -83,13 +85,13 @@ class WebhookController extends Controller
|
||||
'date' => $date,
|
||||
]);
|
||||
|
||||
$message = "📤 Oxapay Payout Confirmed\n" .
|
||||
"Track ID: {$trackId}\n" .
|
||||
"Amount: {$amount} {$currency}\n" .
|
||||
"Network: {$network}\n" .
|
||||
"Address: {$address}\n" .
|
||||
"Transaction Hash: {$txHash}\n" .
|
||||
"Description: {$description}\n" .
|
||||
$message = "📤 Oxapay Payout Confirmed\n".
|
||||
"Track ID: {$trackId}\n".
|
||||
"Amount: {$amount} {$currency}\n".
|
||||
"Network: {$network}\n".
|
||||
"Address: {$address}\n".
|
||||
"Transaction Hash: {$txHash}\n".
|
||||
"Description: {$description}\n".
|
||||
"Date: {$date}";
|
||||
self::sendTelegramNotification($message);
|
||||
}
|
||||
@@ -100,13 +102,15 @@ class WebhookController extends Controller
|
||||
self::sendTelegramNotification("
|
||||
Failed to process Oxapay webhook\n
|
||||
Type: {$data['type']}\n
|
||||
Email/Track ID: " . ($data['type'] === 'invoice' ? ($data['email'] ?? 'Unknown') : ($data['track_id'] ?? 'Unknown')) . "\n
|
||||
Email/Track ID: ".($data['type'] === 'invoice' ? ($data['email'] ?? 'Unknown') : ($data['track_id'] ?? 'Unknown'))."\n
|
||||
Error: {$e->getMessage()}
|
||||
");
|
||||
|
||||
return response('Processing error', 400);
|
||||
}
|
||||
} else {
|
||||
Log::warning('Invalid Oxapay HMAC signature', ['hmac_header' => $hmacHeader, 'calculated_hmac' => $calculatedHmac]);
|
||||
|
||||
return response('Invalid HMAC signature', 400);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user