Country Support
This document provides detailed information about country-specific features and implementations in the Alanube Python API.
Table of Contents
- Supported Countries
- Dominican Republic (DGII)
- Planned Countries
- Country-Specific Features
- Implementation Guidelines
Supported Countries
🇩🇴 Dominican Republic (DGII) - ✅ Fully Implemented
The Dominican Republic implementation is fully functional and supports all major e-invoicing operations through the DGII (Dirección General de Impuestos Internos) system.
Module: alanube.do
Features:
- ✅ Company registration and management
- ✅ All document types (NCF-E, invoices, credit/debit notes, etc.)
- ✅ Document cancellation
- ✅ Received documents handling
- ✅ DGII status checking
- ✅ Directory validation
- ✅ Comprehensive error handling
Document Types Supported: | Type | Code | Description | DGII Name | |——|——|————-|———–| | Fiscal Invoice | 31 | Electronic fiscal invoice | NCF-E | | Invoice | 32 | Regular invoice | Factura | | Debit Note | 33 | Debit note | Nota de Débito | | Credit Note | 34 | Credit note | Nota de Crédito | | Purchase | 41 | Purchase document | Comprobante de Compra | | Minor Expense | 43 | Minor expense document | Comprobante de Consumo | | Special Regime | 44 | Special regime document | Comprobante de Régimen Especial | | Governmental | 45 | Governmental document | Comprobante Gubernamental | | Export Support | 46 | Export support document | Comprobante de Exportación | | Payment Abroad Support | 47 | Payment abroad support document | Comprobante de Pago en el Exterior |
Usage Example:
from alanube.do import Alanube
# Connect to DGII API
Alanube.connect("your_api_token", developer_mode=True)
# Send a fiscal invoice (NCF-E)
payload = {
"company_id": "your_company_id",
"customer": {
"rnc": "123456789",
"name": "Customer Name",
"address": "Customer Address"
},
"items": [
{
"description": "Product Description",
"quantity": 1,
"unit_price": 100.00,
"tax_rate": 18.00
}
]
}
response = Alanube.send_document(encf_type=31, payload=payload)
print(f"NCF-E generated: {response['document_number']}")
DGII-Specific Features:
- RNC Validation
- Automatic RNC (Registro Nacional de Contribuyentes) validation
- Directory status checking
- Company information retrieval
- Tax Calculations
- ITBIS (Impuesto sobre Transferencias de Bienes Industrializados y Servicios) calculation
- Support for different tax rates (0%, 18%, etc.)
- Automatic total calculations
- Document Numbering
- Automatic NCF (Número de Comprobante Fiscal) generation
- Sequential numbering per company
- Format validation
- Legal Compliance
- DGII format compliance
- Required field validation
- Legal status tracking
Planned Countries
🇵🇦 Panama - 🚧 Planned
Status: Development planned Expected Features:
- Company registration
- Electronic invoicing
- Tax calculations
- DGI (Dirección General de Ingresos) integration
Document Types:
- Electronic invoices
- Credit notes
- Debit notes
- Purchase receipts
🇨🇷 Costa Rica - 🚧 Planned
Status: Development planned Expected Features:
- Company registration
- Electronic invoicing
- Hacienda integration
- Tax calculations
Document Types:
- Electronic invoices
- Credit notes
- Debit notes
- Purchase receipts
🇵🇪 Peru - 🚧 Planned
Status: Development planned Expected Features:
- Company registration
- Electronic invoicing
- SUNAT integration
- Tax calculations
Document Types:
- Electronic invoices
- Credit notes
- Debit notes
- Purchase receipts
🇧🇴 Bolivia - 🚧 Planned
Status: Development planned Expected Features:
- Company registration
- Electronic invoicing
- SIN integration
- Tax calculations
Document Types:
- Electronic invoices
- Credit notes
- Debit notes
- Purchase receipts
Country-Specific Features
Tax Systems
Each country has its own tax system and requirements:
Dominican Republic (DGII):
- ITBIS: 18% (standard), 0% (exempt)
- ISC: Selective consumption tax
- IT-1: Income tax withholding
Panama (DGI):
- ITBMS: 7% (standard), 0% (exempt)
- ISR: Income tax
Costa Rica (Hacienda):
- IVA: 13% (standard), 0% (exempt)
- ISR: Income tax
Peru (SUNAT):
- IGV: 18% (standard), 0% (exempt)
- ISC: Selective consumption tax
Bolivia (SIN):
- IVA: 13% (standard), 0% (exempt)
- ICE: Special consumption tax
Document Numbering Systems
Dominican Republic:
- NCF (Número de Comprobante Fiscal)
- Format: A0100000001
- Sequential numbering per company
Panama:
- FEC (Factura Electrónica de Consumo)
- Format: TBD
- Sequential numbering
Costa Rica:
- FE (Factura Electrónica)
- Format: TBD
- Sequential numbering
Peru:
- CPE (Comprobante de Pago Electrónico)
- Format: TBD
- Sequential numbering
Bolivia:
- FE (Factura Electrónica)
- Format: TBD
- Sequential numbering
Validation Requirements
Each country has specific validation requirements:
Dominican Republic:
- RNC validation
- Customer information validation
- Tax rate validation
- Document format validation
Other Countries:
- Tax ID validation
- Customer information validation
- Tax rate validation
- Document format validation
Implementation Guidelines
Adding New Country Support
To add support for a new country, follow these guidelines:
- Create Country Module
# alanube/pa/__init__.py (for Panama) from .api import AlanubeAPI class Alanube: # Implement country-specific methods pass - Implement Required Methods
connect()- API connectioncreate_company()- Company registrationsend_document()- Document sendingget_document()- Document retrievalget_documents()- Document listing- Country-specific validation methods
- Add Configuration
# alanube/pa/config.py class APIConfig: def __init__(self, token, developer_mode): self.token = token self.developer_mode = developer_mode # Country-specific configuration - Implement Error Handling
# alanube/pa/exceptions.py class PanamaException(AlanubeException): pass - Add Type Definitions
# alanube/pa/types.py from dataclasses import dataclass @dataclass class DocumentResponse: # Country-specific response structure pass - Create Tests
# alanube/pa/tests/test_api.py import unittest class TestPanamaAPI(unittest.TestCase): def test_send_document(self): # Test implementation pass
Country-Specific Considerations
- API Endpoints
- Each country may have different API endpoints
- Authentication methods may vary
- Rate limiting policies may differ
- Data Formats
- Document structures may vary
- Required fields may differ
- Validation rules may be country-specific
- Tax Calculations
- Tax rates and rules vary by country
- Calculation methods may differ
- Exemptions and special cases
- Legal Requirements
- Document retention requirements
- Reporting requirements
- Compliance deadlines
Testing Strategy
- Unit Tests
- Test individual methods
- Mock API responses
- Test error conditions
- Integration Tests
- Test with real API endpoints
- Test end-to-end workflows
- Test country-specific features
- Compliance Tests
- Test legal compliance
- Test format validation
- Test tax calculations
Documentation Requirements
For each new country implementation:
- API Reference
- Document all methods
- Provide usage examples
- List country-specific parameters
- Installation Guide
- Country-specific setup instructions
- Configuration requirements
- Usage Examples
- Common use cases
- Best practices
- Error handling examples
- Compliance Guide
- Legal requirements
- Format specifications
- Validation rules
Migration Guide
When migrating from one country implementation to another:
- API Changes
- Different method signatures
- Different parameter names
- Different response formats
- Data Migration
- Company data format changes
- Document format changes
- Tax calculation changes
- Configuration Changes
- Different API endpoints
- Different authentication methods
- Different rate limits
Support and Maintenance
Current Support
- Dominican Republic: Full support with regular updates
- Other Countries: Development in progress
Maintenance Schedule
- Bug Fixes: As needed
- Feature Updates: Quarterly
- Compliance Updates: As regulations change
- Security Updates: Monthly
Contributing
To contribute to country implementations:
- Fork the repository
- Create a feature branch
- Implement the country-specific code
- Add comprehensive tests
- Update documentation
- Submit a pull request
For more information about contributing, see the Contributing Guide.