Wiring up verifactu sending
This commit is contained in:
parent
c5c9c4325e
commit
af926a394c
|
|
@ -23,7 +23,7 @@ use Illuminate\Support\Collection;
|
|||
class InvoiceBackup implements Castable
|
||||
{
|
||||
public function __construct(
|
||||
public string $guid = '', // The E-INVOICE SENT GUID reference
|
||||
public string $guid = '', // The E-INVOICE SENT GUID reference - or enum to advise the document has been successfully sent.
|
||||
public Cancellation $cancellation = new Cancellation(0,0),
|
||||
public ?string $parent_invoice_id = null, // The id of the invoice that was cancelled
|
||||
public ?string $parent_invoice_number = null, // The number of the invoice that was cancelled
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class RetrySendRequest extends Request
|
|||
return true;
|
||||
}
|
||||
|
||||
return $user->account->isPaid() && $user->isAdmin() && $user->company()->legal_entity_id != null;
|
||||
return $user->account->isPaid() && $user->isAdmin() && ($user->company()->legal_entity_id != null || $user->company()->verifactuEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -73,6 +73,12 @@ class SendToAeat implements ShouldQueue
|
|||
|
||||
$invoice = Invoice::withTrashed()->find($this->invoice_id);
|
||||
|
||||
if($invoice->client->country->iso_3166_2 != 'ES') {
|
||||
$invoice->backup->guid = 'NOT_ES';
|
||||
$invoice->saveQuietly();
|
||||
return;
|
||||
}
|
||||
|
||||
switch($this->action) {
|
||||
case 'create':
|
||||
$this->createInvoice($invoice);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class TriggeredActions extends AbstractService
|
|||
$company->save();
|
||||
}
|
||||
|
||||
if($this->request->has('retry_e_send') && $this->request->input('retry_e_send') == 'true' && strlen($this->invoice->backup->guid ?? '') < 2 && $this->invoice->client->peppolSendingEnabled()) {
|
||||
if($this->request->has('retry_e_send') && $this->request->input('retry_e_send') == 'true' && strlen($this->invoice->backup->guid ?? '') == 0 && $this->invoice->client->peppolSendingEnabled()) {
|
||||
\App\Services\EDocument\Jobs\SendEDocument::dispatch(get_class($this->invoice), $this->invoice->id, $this->invoice->company->db);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue