feat(logging): implement dedicated logging for Telepagos events and update logging configuration

This commit is contained in:
2026-08-19 13:37:21 -03:00
parent 16bc657a31
commit d6574bfd0d
7 changed files with 148 additions and 27 deletions

View File

@@ -163,6 +163,11 @@ class PurchaseController extends Controller
try {
$accountInfo = $telepagosService->getAccountInfo();
Log::channel('telepagos')->info('Telepagos account information retrieved.', [
'tenant_code' => $tenant->codigo,
'purchase_id' => $compra->id,
]);
return response()->json([
'payment_method' => 'transfer',
'transfer_data' => [
@@ -174,9 +179,10 @@ class PurchaseController extends Controller
],
]);
} catch (\Exception $e) {
Log::error('Unable to retrieve TelePagos account information.', [
Log::channel('telepagos')->error('Unable to retrieve TelePagos account information.', [
'tenant_code' => $tenant->codigo,
'purchase_id' => $compra->id,
'exception' => $e,
'error' => $e->getMessage(),
]);
return response()->json([
@@ -191,7 +197,11 @@ class PurchaseController extends Controller
$telepagosService->forTenant($tenant->codigo);
try {
Log::info("Generating QR for purchase ID: {$compra->id}, amount: {$totalAmount}");
Log::channel('telepagos')->info('Generating Telepagos QR.', [
'tenant_code' => $tenant->codigo,
'purchase_id' => $compra->id,
'amount' => $totalAmount,
]);
$qrResponse = $telepagosService->generateQr(
$totalAmount,
'Compra',
@@ -202,10 +212,17 @@ class PurchaseController extends Controller
'qr_order_id' => (string) ($qrResponse['qr_order_id'] ?? ''),
'qr_code' => $qrResponse['qr_code'] ?? '',
]);
} catch (\Exception $e) {
Log::error('Unable to generate TelePagos QR code.', [
Log::channel('telepagos')->info('Telepagos QR generated successfully.', [
'tenant_code' => $tenant->codigo,
'purchase_id' => $compra->id,
'exception' => $e,
'qr_order_id' => $telepagosQr->qr_order_id,
]);
} catch (\Exception $e) {
Log::channel('telepagos')->error('Unable to generate TelePagos QR code.', [
'tenant_code' => $tenant->codigo,
'purchase_id' => $compra->id,
'error' => $e->getMessage(),
]);
return response()->json([