Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
InvoicesCallCenter
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 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\Http\Request;
8use Illuminate\Support\Facades\Log;
9
10class InvoicesCallCenter extends Command
11{
12    /**
13     * The name and signature of the console command.
14     *
15     * @var string
16     */
17    protected $signature = 'invoices:call-center';
18
19    /**
20     * The console command description.
21     *
22     * @var string
23     */
24    protected $description = 'Synchronizes the call center invoices';
25
26    /**
27     * The PresupuestoService instance.
28     *
29     * @var FacturasService
30     */
31    protected $facturasService;
32
33    /**
34     * Create a new command instance.
35     *
36     * @return void
37     */
38    public function __construct(FacturasService $facturasService)
39    {
40        parent::__construct();
41        $this->facturasService = $facturasService;
42    }
43
44    /**
45     * Execute the console command.
46     *
47     * @return int
48     */
49    public function handle()
50    {
51
52        try {
53            $this->info("Synchronizing call center invoices");
54
55            $this->facturasService->sendCallCenterInvoices();
56            
57            return Command::SUCCESS;
58        } catch (\Exception $e) {
59            Log::channel('g3w')->error("Synchronization failed for sync the missing quotations, Error: " . $e->getMessage());
60            return Command::FAILURE;
61        }
62    }
63}