From 71ce52e41c887d9abd861de89ad32dd10f9fd8ea Mon Sep 17 00:00:00 2001 From: "J. Marcelo Aviles Paco" Date: Sat, 20 May 2023 10:31:32 -0400 Subject: [PATCH] Added get invoice html --- src/Classes/MonoInvoicesApi.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Classes/MonoInvoicesApi.php b/src/Classes/MonoInvoicesApi.php index a5e82dc..164889b 100644 --- a/src/Classes/MonoInvoicesApi.php +++ b/src/Classes/MonoInvoicesApi.php @@ -304,4 +304,23 @@ public function listadoPuntosVenta(int $sucursal = 0, int $page = 1, int $limit return $res->json()->data; } + /** + * + * @param int $id + * @param string $tpl Plantilla de la factura pagina|rollo + * @throws ExceptionApi + * @return mixed + */ + public function obtenerHtml(int $id, $tpl = null) + { + $this->validateToken(); + $endpoint = $this->baseUrl . '/invoices/'. $id .'/html'; + if( $tpl ) + $endpoint .= '?tpl=' . $tpl; + + $res = $this->getRequest()->get($endpoint); + if( $res->statusCode != 200 ) + throw new ExceptionApi('Error obtiendo el HTML de la factura', $res); + return $res->json(); + } } \ No newline at end of file