Coder Social home page Coder Social logo

wilmerm / alanube-python Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 217 KB

Python library to establish connections with the Alanube API.

Home Page: https://pypi.org/project/alanube/

Python 100.00%
dgii dominican-republic facturacion-electronica invoice library python script alanube

alanube-python's Introduction

Alanube Python API

Python library to connect with Alanube API

Instalation

To install the Alanube library, you can use pip:

pip install alanube

Usage

# Import the Alanube class specific to the country,
# in this case from `alanube.do` for the Dominican Republic
from alanube.do import Alanube

# Connect to the API
Alanube.connect("[TOKEN]")

payload = {...}

data = Alanube.send_document(encf_type=31, payload)

Now you can easily and efficiently use the Alanube API with this Python library!

Contents

The do directory contains the following files and directories.

Links

Licence

This project is licensed under the MIT License.

Proyect Status

This project is under development

Contribution 💗

If you find value in this project and would like to show your support, please consider making a donation via PayPal:

Donate on PayPal

Your generosity helps us to continue improving and maintaining this project. We appreciate every contribution, however small. Thanks for being part of our community!

alanube-python's People

Contributors

wilmerm avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

joguzmandev

alanube-python's Issues

New version 0.1.0

Complete Rebuild of Alanube API Client - Version 0.1.0

Description

This issue documents the complete rewrite of the Alanube API client from scratch. The new version, 0.1.0, includes several significant improvements and changes to enhance the functionality, maintainability, and usability of the application.

Changes

Major Changes

  • Complete Rewrite: The entire codebase has been rewritten from the ground up.
  • Country-Specific Implementations: Added specific support for the Dominican Republic (DGII) under the do directory. Future support for Panama, Costa Rica, and Bolivia will be added.

Documentation

  • New README.md: Added a new README.md for the main project and a specific README.md for the do directory.
  • Renamed Old README: Renamed the old README.md to README_OLD.md and moved it to the old directory.
  • LICENSE: Added a LICENSE file with the MIT License.
  • Additional Documentation: Included CONTRIBUTING.md, CODE_OF_CONDUCT.md, and INSTALL.md to improve project documentation.

Code Improvements

  • Improved Structure: The new structure is more modular and maintainable.
  • Enhanced API Integration: Improved the way the client interacts with the Alanube API.
  • Error Handling: Enhanced error handling mechanisms.

New Features

  • Connect to Alanube API: Simplified method to connect to the API.
  • Company Management: Methods to create, update, and retrieve company information.
  • Document Management: Methods to send and track various types of electronic documents (e.g., fiscal invoices, consumer invoices, debit notes, credit notes, etc.).
  • Cancellation Management: Methods to send and track document cancellation requests.

Future Plans

  • Support for Other Countries: Implementations for Panama, Costa Rica, and Bolivia will be added in future versions.

Migration

  • Legacy Code: The old version of the application is available in the old directory for reference. It is not maintained or supported.

How to Use the New Version

Installation

To install the new version, run:

pip install alanube

Identificar y resolver problema de validación en la DGII

legalStatus: ACCEPTED_WITH_OBSERVATIONS

Comentario recibido:

1934 El campo MontoGravadoI1 del área Totales de la sección Encabezado no coincide con la sumatoria de los valores del detalle gravado con tasa 18% menos descuentos mas recargos.

Datos enviados:

"buyer": {
  "rnc": "XXXXXXXXX",
  "mail": "[email protected]",
  "companyName": "CLIENTE SRL"
},
"idDoc": {
  "encf": "E310000XXXXXX",
  "incomeType": 1,
  "paymentType": 1,
  "sequenceDueDate": "2025-12-31",
  "taxAmountIndicator": 1
},
"config": {
  "pdf": {
    "type": "generic"
  }
},
"sender": {
  "rnc": "XXXXXXXXX",
  "address": "Santo Domingo",
  "webSite": "example",
  "stampDate": "2023-09-30",
  "tradename": "MI EMPRESA",
  "sellerCode": "None",
  "companyName": "MI EMPRESA SRL",
  "phoneNumber": [],
  "branchOffice": "01",
  "internalInvoiceNumber": 13
},
"totals": {
  "itbisS1": 18,
  "itbisS2": 16,
  "itbisS3": 0,
  "itbisTotal": 90,
  "itbis1Total": 90,
  "itbis2Total": 0,
  "itbis3Total": 0,
  "totalAmount": 590,
  "amountPeriod": 590,
  "exemptAmount": 0,
  "i1AmountTaxed": 500,
  "i2AmountTaxed": 0,
  "i3AmountTaxed": 0,
  "totalTaxedAmount": 500,
  "nonBillableAmount": 0
},
"companyId": "XXXXXXXXXXXXXXXXXXXXX",
"itemDetails": [
  {
    "itemName": "ARTICULO Y SERVICIO GENERICO",
    "itemAmount": 500,
    "lineNumber": 1,
    "quantityItem": 1,
    "unitPriceItem": 500,
    "billingIndicator": 1,
    "goodServiceIndicator": 2
  }
]

Remove `response.raise_for_status()` so errors can be processed

The call to response.raise_for_status() is causing the error to propagate (obviously) without giving the user a chance to address the errors in validation.

The ideal is to encapsulate the response in an alanube.api.Response object, and then check its status with ok (for example) and its errors with the errors property.

response = requests.post(url, data=data, json=json, headers=self.headers)
# response.raise_for_status() Delete this
return Response(response)
if not response.ok:
    print(response.errors)

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.