Custom Adapter Development
Build a custom ERP adapter for TaprNext when native integration isn’t available.
Architecture Overview
Section titled “Architecture Overview”The system uses a layered design where your custom adapter implements the ERPAdapter base class interface, sitting between TaprNext and your ERP system to handle all integration communication.
Adapter Interface
Section titled “Adapter Interface”Your implementation must extend ERPAdapter and provide these core methods:
- test_connection() - Verify ERP connectivity
- get_vendors() - Retrieve supplier list from ERP
- get_purchase_orders() - Fetch open POs
- post_invoice() - Submit approved invoices to ERP
- get_posting_status() - Check invoice posting results
The constructor accepts a settings dictionary containing connection parameters like API endpoints and authentication credentials.
Data Models
Section titled “Data Models”Invoice Structure
Section titled “Invoice Structure”Invoices include vendor information, line items, tax details, dates, amounts, and optional PO references. Each line item contains description, quantity, unit pricing, tax rates, and accounting codes.
Vendor Model
Section titled “Vendor Model”Vendor objects store ERP IDs, names, tax identifiers, addresses, preferred currencies, and payment terms.
Error Handling
Section titled “Error Handling”Use standardized exceptions:
ERPConnectionError- Network/connectivity failuresERPAuthenticationError- Invalid credentialsERPPostingError- Invoice submission failuresERPValidationError- Data format problems
Field Mapping
Section titled “Field Mapping”Define a FIELD_MAP dictionary to translate TaprNext field names to your ERP’s naming conventions, handling differences in terminology and structure.
Testing Requirements
Section titled “Testing Requirements”Unit tests verify individual methods with mock data. Integration tests validate full cycles using actual ERP test environments with real vendors and purchase orders.
Registration Process
Section titled “Registration Process”Place your adapter file in taprnext/adapters/, register it in the adapters module, add configuration fields if needed, then deploy and validate.
Deployment Checklist
Section titled “Deployment Checklist”Ensure all interface methods are implemented, error modes are handled, tests pass, field mappings are documented, settings are configured, and the adapter is properly registered.
Best Practices
Section titled “Best Practices”- Implement idempotent operations for duplicate handling
- Log all API interactions comprehensively
- Configure appropriate request timeouts
- Add retry logic for transient failures
- Validate data before posting