Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
14.29% covered (danger)
14.29%
1 / 7
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
InvoicesCallCenter
14.29% covered (danger)
14.29%
1 / 7
50.00% covered (danger)
50.00%
1 / 2
8.67
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 handle
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Console\Commands;
4
5use App\Services\FacturasService;
6use Illuminate\Console\Command;
7use Illuminate\Support\Facades\Log;
8
9class InvoicesCallCenter extends Command
10{
11    /**
12     * The name and signature of the console command.
13     *
14     * @var string
15     */
16    protected $signature = 'invoices:call-center';
17
18    /**
19     * The console command description.
20     *
21     * @var string
22     */
23    protected $description = 'Synchronizes the call center invoices';
24
25    /**
26     * Create a new command instance.
27     */
28    public function __construct(protected FacturasService $facturasService)
29    {
30        parent::__construct();
31    }
32
33    /**
34     * Execute the console command.
35     */
36    public function handle(): int
37    {
38
39        try {
40            $this->info('Synchronizing call center invoices');
41
42            $this->facturasService->sendCallCenterInvoices();
43
44            return Command::SUCCESS;
45        } catch (\Exception $e) {
46            Log::channel('g3w')->error('Synchronization failed for sync the missing quotations, Error: '.$e->getMessage());
47
48            return Command::FAILURE;
49        }
50    }
51}