1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Fixes for signing certificates

This commit is contained in:
David Bomba 2023-05-25 13:35:06 +10:00
parent ce8fc061ed
commit 3e07acb5bb
2 changed files with 22 additions and 5 deletions

View File

@ -904,4 +904,18 @@ class Company extends BaseModel
return $item->id == $this->getSetting('date_format_id');
})->first()->format;
}
public function getInvoiceCert()
{
if($this->e_invoice_certificate)
return base64_decode($this->e_invoice_certificate);
return false;
}
public function getSslPassPhrase()
{
return $this->e_invoice_certificate_passphrase;
}
}

View File

@ -174,9 +174,9 @@ class FacturaEInvoice extends AbstractService
$disk = config('filesystems.default');
if (!Storage::disk($disk)->exists($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()))) {
Storage::makeDirectory($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()));
}
// if (!Storage::disk($disk)->exists($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()))) {
// Storage::makeDirectory($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()));
// }
$this->fac->export(Storage::disk($disk)->path($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig")));
@ -386,9 +386,12 @@ class FacturaEInvoice extends AbstractService
private function signDocument(): self
{
// $ssl_cert = file_get_contents(base_path('e_invoice_cert.p12'));
// $this->fac->sign($ssl_cert, null, "SuperSecretPassword");
$ssl_cert = $this->invoice->company->getInvoiceCert();
$ssl_passphrase = $this->invoice->company->getSslPassPhrase();
if($ssl_cert)
$this->fac->sign($ssl_cert, null, $ssl_passphrase);
return $this;
}