Skip to content

Commit

Permalink
Added sync tipos documentos identidad
Browse files Browse the repository at this point in the history
  • Loading branch information
J. Marcelo Aviles Paco authored and J. Marcelo Aviles Paco committed Feb 22, 2023
1 parent d538b8c commit a6c2f15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Binary file modified src/.DS_Store
Binary file not shown.
22 changes: 16 additions & 6 deletions src/Classes/MonoInvoicesApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function anularFactura(int $id, int $codigoMotivo)
public function obtenerFactura(int $id)
{
$this->validateToken();
$endpoint = '/invoices/siat/v2/invoices/' . $id;
$endpoint = $this->baseUrl . '/invoices/siat/v2/invoices/' . $id;
$res = $this->getRequest()->get($endpoint);
if( $res->statusCode != 200 )
throw new ExceptionApi('Error obteniendo factura', $res);
Expand All @@ -141,7 +141,7 @@ public function obtenerFactura(int $id)
public function crearEvento(Evento $evento)
{
$this->validateToken();
$endpoint = '/invoices/siat/v2/eventos';
$endpoint = $this->baseUrl . '/invoices/siat/v2/eventos';
$data = json_encode($evento);
$res = $this->getRequest()->post($endpoint, $data);

Expand All @@ -152,7 +152,7 @@ public function crearEvento(Evento $evento)
public function cerrarEvento(int $id)
{
$this->validateToken();
$endpoint = '/invoices/siat/v2/eventos/'. $id .'/cerrar';
$endpoint = $this->baseUrl . '/invoices/siat/v2/eventos/'. $id .'/cerrar';
$res = $this->getRequest()->get($endpoint, $data);
if( $res->statusCode != 200 )
throw new ExceptionApi('Error anulando factura', $res);
Expand All @@ -168,7 +168,7 @@ public function cerrarEvento(int $id)
public function obtenerPdf(int $id, $tpl = null)
{
$this->validateToken();
$endpoint = '/invoices/'. $id .'/pdf';
$endpoint = $this->baseUrl . '/invoices/'. $id .'/pdf';
if( $tpl )
$endpoint .= '?tpl=' . $tpl;

Expand All @@ -186,7 +186,7 @@ public function obtenerPdf(int $id, $tpl = null)
public function crearCliente(Cliente $cliente)
{
$this->validateToken();
$endpoint = '/customers';
$endpoint = $this->baseUrl . '/customers';
$data = json_encode($client);
$res = $this->getRequest()->post($endpoint, $data);
if( $res->statusCode != 200 )
Expand All @@ -205,7 +205,7 @@ public function crearCliente(Cliente $cliente)
public function obtenerCliente(int $id)
{
$this->validateToken();
$endpoint = '/customers/' . $id;
$endpoint = $this->baseUrl . '/customers/' . $id;
$res = $this->getRequest()->get($endpoint);
if( $res->statusCode != 200 )
throw new ExceptionApi('Error obtiendo el PDF de la factura', $res);
Expand All @@ -214,4 +214,14 @@ public function obtenerCliente(int $id)

return $cliente;
}
public function tiposDocumentoIdentidad()
{
$this->validateToken();
$endpoint = $this->baseUrl . '/invoices/siat/v2/sync-documentos-identidad/';
$res = $this->getRequest()->get($endpoint);
if( $res->statusCode != 200 )
throw new ExceptionApi('Error obtiendo el PDF de la factura', $res);

return $res->json();
}
}

0 comments on commit a6c2f15

Please sign in to comment.