Coder Social home page Coder Social logo

giansalex / lycet Goto Github PK

View Code? Open in Web Editor NEW
80.0 12.0 41.0 1.18 MB

API REST de Facturación Electrónica Sunat utilizando Greenter.

License: MIT License

PHP 92.34% HTML 2.78% Dockerfile 4.31% Shell 0.51% Procfile 0.05%
greenter facturacion-electronica sunat docker php symfony api-rest

lycet's Introduction

Lycet - Greenter

Symfony PPM Compatible

Lycet es un API REST basado en greenter y Symfony Framework, UBL 2.1 es soportado.

Objetivo: Ofrecer una interfaz a greenter desde otros lenguajes de programación.

LIVE (Pruebas)

🚀
URL https://greenter-lycet.herokuapp.com/
API TOKEN greenter

Requerimientos

  • Php 7.4 o superior
  • Php Extensions habilitadas (soap, xml, openssl, zlib)
  • WkhtmltoPdf executable (PDF report)
  • Pem Certificate - convert pfx to pem

Pasos

Instalar Lycet

git clone https://github.com/giansalex/lycet
cd lycet
composer install -o

Configuraciones

En el archivo .env ubicado en la raíz del proyecto, podrá cambiar estas configuraciones.

###> greenter/greenter ###
WKHTMLTOPDF_PATH=full/path/wkhtmltopdf.exe
CLIENT_TOKEN=123456
SOL_USER=20000000001MODDATOS
SOL_PASS=moddatos
FE_URL=https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService
RE_URL=https://e-beta.sunat.gob.pe/ol-ti-itemision-otroscpe-gem-beta/billService
GUIA_URL=https://e-beta.sunat.gob.pe/ol-ti-itemision-guia-gem-beta/billService
###< greenter/greenter ###

Tener en cuenta que SOL_USER es la concatenación del RUC + Usuario SOL

Archivos Requeridos

Se necesita almacenar el certificado y logo en la carpeta /data, los archivos deben tener nombres específicos que se indican a continuación.

/data
├── cert.pem
├── logo.png
├── empresas.json (opcional para multiples empresas)

También puede usar lycet-ui-config como interfaz de usuario, siendo mas útil esta opción cuando emplea contenedores.

Ejemplo de contenido del archivo empresas.json, tambien puede cambiar la URL de los servicios para apuntar a un OSE.

{
  "20000000001": {
    "SOL_USER": "20000000001MODDATOS",
    "SOL_PASS": "moddatos",
    "certificate": "20000000001-cert.pem",
    "logo": "20000000001-logo.png"
  },
  "20000000002": {
    "SOL_USER": "20000000002MODDATOS",
    "SOL_PASS": "moddatos",
    "certificate": "20000000002-cert.pem",
    "logo": "20000000002-logo.png",
    "FE_URL": "https://my-ose.com/billService",
    "RE_URL": "https://my-ose.com/billService",
    "GUIA_URL": "https://my-ose.com/billService",
    "AUTH_URL": "https://api-test-seguridad.sunat.gob.pe/v1",
    "API_URL": "https://api-test.sunat.gob.pe/v1",
    "CLIENT_ID": "85e5b0ae-255c-4891-a595-0b98c65c9854",
    "CLIENT_SECRET": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
}

Para pruebas de Guia de remision, utilizar la siguiente configuración issue#605

Ejecutar

Usando Php Built-in Web Server.

php -S 0.0.0.0:8000 -t public

Ir a http://localhost:8000/

Docker

Desplegar con Docker.

git clone https://github.com/giansalex/lycet
cd lycet
docker build -t lycet .

# copiar certificado y logo de prueba (puedes reemplazar por uno personal)
cp tests/Resources/* data
# ejecutar el contenedor
docker run -d -p 8000:8000  -v ./data:/var/www/html/data --name lycet_app lycet

Abrir el navegador, y dirígete a http://localhost:8000/

Docs

Puedes visitar greenter en postman que contiene ejemplos del envío de algunos comprobantes.

Ver swagger documentation, puedes crear un cliente en swagger editor, para tu lenguaje de preferencia.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.