QR Codes for Verifactu
This commit is contained in:
parent
212ca0c38c
commit
f4b98b552c
|
|
@ -200,15 +200,14 @@ class Verifactu extends AbstractService
|
|||
public function calculateQrCode(VerifactuLog $log)
|
||||
{
|
||||
|
||||
|
||||
$csv = $log->status;
|
||||
$nif = $log->nif;
|
||||
$invoiceNumber = $log->invoice_number;
|
||||
$date = $log->date->format('Y-m-d');
|
||||
$date = $log->date->format('d-m-Y');
|
||||
$total = round($log->invoice->amount, 2);
|
||||
|
||||
$url = sprintf(
|
||||
'https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?csv=%s&nif=%s&num=%s&fecha=%s&importe=%s',
|
||||
$this->aeat_client->base_qr_url,
|
||||
urlencode($csv),
|
||||
urlencode($nif),
|
||||
urlencode($invoiceNumber),
|
||||
|
|
@ -228,26 +227,8 @@ class Verifactu extends AbstractService
|
|||
->labelFont(new OpenSans(14))
|
||||
->build();
|
||||
|
||||
// header('Content-Type: ' . $result->getMimeType());
|
||||
return $result->getString();
|
||||
|
||||
// try {
|
||||
// $renderer = new ImageRenderer(
|
||||
// new RendererStyle(200),
|
||||
// new SvgImageBackEnd()
|
||||
// );
|
||||
// $writer = new Writer($renderer);
|
||||
|
||||
// $qr = $writer->writeString($this->encodeMessage(), 'utf-8');
|
||||
|
||||
// return htmlspecialchars("<svg viewBox='0 0 200 200' width='200' height='200' x='0' y='0' xmlns='http://www.w3.org/2000/svg'>
|
||||
// <rect x='0' y='0' width='100%'' height='100%' />{$qr}</svg>");
|
||||
|
||||
// } catch (\Throwable $e) {
|
||||
// nlog("EPC QR failure => ".$e->getMessage());
|
||||
// return '';
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public function send(string $soapXml): array
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@ class AeatClient
|
|||
|
||||
private string $sandbox_url = 'https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP';
|
||||
|
||||
public string $base_qr_url = 'https://www2.agenciatributaria.gob.es/wlpl/TIKE-CONT/ValidarQR?csv=%s&nif=%s&numserie=%s&fecha=%s&importe=%s';
|
||||
|
||||
private string $sandbox_qr_url = 'https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?csv=%s&nif=%s&numserie=%s&fecha=%s&importe=%s';
|
||||
|
||||
|
||||
public function __construct(private ?string $certificate = null, private ?string $ssl_key = null)
|
||||
{
|
||||
$this->init();
|
||||
|
|
@ -47,9 +52,10 @@ class AeatClient
|
|||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setTestMode(?string $base_url = null): self
|
||||
public function setTestMode(): self
|
||||
{
|
||||
$this->base_url = $base_url ?? $this->sandbox_url;
|
||||
$this->base_url = $this->sandbox_url;
|
||||
$this->base_qr_url = $this->sandbox_qr_url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue