invoice = $invoice; $this->client = $client ?? $invoice->client; $this->base_repository = new BaseRepository(); } /** * Execute the job. * * @return void */ public function handle() { if ($this->client->getSetting('auto_archive_invoice')) { /* Throws: Payment amount xxx does not match invoice totals. */ $this->base_repository->archive($this->invoice); } //@TODO this setting should only fire for recurring invoices // if ($this->client->getSetting('auto_email_invoice')) { // $this->invoice->invitations->each(function ($invitation, $key) { // $this->invoice->service()->sendEmail($invitation->contact); // }); // } } }