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\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     * The PresupuestoService instance.
27     *
28     * @var FacturasService
29     */
30    protected $facturasService;
31
32    /**
33     * Create a new command instance.
34     *
35     * @return void
36     */
37    public function __construct(FacturasService $facturasService)
38    {
39        parent::__construct();
40        $this->facturasService = $facturasService;
41    }
42
43    /**
44     * Execute the console command.
45     *
46     * @return int
47     */
48    public function handle()
49    {
50
51        try {
52            $this->info('Synchronizing call center invoices');
53
54            $this->facturasService->sendCallCenterInvoices();
55
56            return Command::SUCCESS;
57        } catch (\Exception $e) {
58            Log::channel('g3w')->error('Synchronization failed for sync the missing quotations, Error: '.$e->getMessage());
59
60            return Command::FAILURE;
61        }
62    }
63}