Compare commits
3 Commits
52f17b62e3
...
f6a9446e32
| Author | SHA1 | Date |
|---|---|---|
|
|
f6a9446e32 | 2 weeks ago |
|
|
d7fd5eacc0 | 2 weeks ago |
|
|
a73b161413 | 2 weeks ago |
3 changed files with 164 additions and 34 deletions
@ -0,0 +1,15 @@ |
|||
# AFIP Lua Scripts |
|||
|
|||
These Lua scripts are intended to be used by the **bot-bunny** project. |
|||
|
|||
They provide AFIP-related functionality that is consumed by bot-bunny services and tools. This repository is not meant to be used standalone; instead, it should be included or referenced from the main bot-bunny project. |
|||
|
|||
## Usage |
|||
|
|||
- **Include in bot-bunny:** Add this repository as a dependency or submodule of your main **bot-bunny** project. |
|||
- **Load scripts:** Configure your bot-bunny services to load and execute the relevant Lua scripts as needed. |
|||
- **Develop here, test there:** Any changes or additions to these scripts should be tested within the context of the bot-bunny project. |
|||
|
|||
## Related Project |
|||
|
|||
- **bot-bunny** – main project that uses these scripts. |
|||
@ -0,0 +1,89 @@ |
|||
--[[ |
|||
{ |
|||
"uid": "53935f27-5cf0-4281-9a29-a68f100ee981", |
|||
"execution_status": "Borrador", |
|||
"tipo_comprobante": "factura c", |
|||
"fecha_comprobante": "13/11/2025", |
|||
"tipo_concepto": "servicios", |
|||
"servicio_fecha_desde": "01/10/2025", |
|||
"servicio_fecha_hasta": "01/10/2025", |
|||
"servicio_fecha_vencimiento_pago": "13/11/2025", |
|||
"referencia": "", |
|||
"tipo_iva_receptor": "consumidor final", |
|||
"cuit_receptor": "", |
|||
"forma_pago": "contado", |
|||
"monto_unitario": "10000", |
|||
"cantidad": "1", |
|||
"descripcion": "Clase de apoyo" |
|||
} |
|||
--]] |
|||
|
|||
|
|||
log("Inicio afip_ingresar_datos_operacion from LUA!!") |
|||
local err |
|||
print("BEFORE JSON LOADING payload: " .. json_payload) |
|||
local json = require("json") |
|||
print("AFTER JSON LOADING") |
|||
-- Parse the JSON string |
|||
local obj, err = json.decode(json_payload) |
|||
if err then |
|||
message = "Error parsing JSON: " .. err |
|||
log(message) |
|||
error(message) |
|||
end |
|||
|
|||
local error_on_page |
|||
|
|||
descripcion = obj["descripcion"] |
|||
monto_unitario = obj["monto_unitario"] |
|||
tipo_comprobante = obj["tipo_comprobante"] |
|||
|
|||
--[[ |
|||
if string.match(tipo_comprobante, "factura") then |
|||
log("Setting tipo_comprobante to factura") |
|||
tipo_comprobante = "factura" |
|||
else |
|||
log("Setting tipo_comprobante to ") |
|||
tipo_comprobante = "recibo" |
|||
end |
|||
--]] |
|||
|
|||
-- TODO: handle factura AND recibo! |
|||
log("Descripcion: " .. descripcion .. " Monto: " .. monto_unitario .. " Tipo: " .. tipo_comprobante) |
|||
|
|||
descripcion_selector = "#detalle_descripcion1" |
|||
precio_selector = "#detalle_precio1" |
|||
|
|||
err = waitVisibleByQuerySelector(descripcion_selector) |
|||
if err then |
|||
message = "Error waiting for detalle_descripcion1: " .. err |
|||
log(message) |
|||
error(message) |
|||
end |
|||
|
|||
err = setTextFieldByQuerySelector(descripcion_selector, descripcion) |
|||
if err then |
|||
message = "Error setting detalle_descripcion1: " .. err |
|||
log(message) |
|||
error(message) |
|||
end |
|||
|
|||
waitSecs(1) |
|||
|
|||
err = waitVisibleByQuerySelector(precio_selector) |
|||
if err then |
|||
message = "Error waiting for detalle_precio1: " .. err |
|||
log(message) |
|||
error(message) |
|||
end |
|||
|
|||
err = setTextFieldByQuerySelector(precio_selector, monto_unitario) |
|||
if err then |
|||
message = "Error setting detalle_precio1: " .. err |
|||
log(message) |
|||
error(message) |
|||
end |
|||
|
|||
waitSecs(1) |
|||
|
|||
log("Finishing afip_ingresar_datos_operacion from LUA!!") |
|||
Loading…
Reference in new issue