Architecture
System Overview
Credit Device uses a modern, service-oriented architecture that enables seamless integration between Business Central and the CreditDevice platform via REST APIs and webhooks.
Architecture Diagram
graph TB
BC[Business Central] --> CD[Credit Device App]
CD --> API[CreditDevice API]
API --> CDP[CreditDevice Platform]
CDP -.->|Webhook| WH[Webhook Handler]
WH --> CD
CD --> JQ[Job Queue]
JQ --> CD
subgraph "Business Central Environment"
BC
CD
JQ
end
subgraph "External Services"
API
CDP
endMain Components
1. Business Central Integration Layer
Codeunits:
- QTEAMCreditDeviceMgt (11195976): Main management for import/export logic
- QTEAMCDJSONBulkProvider (11195975): JSON bulk data preparation
- QTEAMRESTWebserviceMgt (11195979): REST API communication
- QTEAMJSONMethods (11195978): JSON parsing utilities
- QTEAMInstCreditDeviceSetup (11195977): Setup and upgrade management
Tables:
- QTEAMCreditDeviceSetup (11195975): Configuration storage
- QTEAMRESTWebServiceArgmts (11195976): API call arguments
Pages:
- QTEAMCreditDeviceSetup (11195975): Setup interface
- QTEAMAccountantRoleCenter.PageExt: Role center integration
2. API Communication Layer
REST API Endpoints
- Authentication endpoint: For API key validation
- Data import endpoint: For receiving debtors/invoices
- Data export endpoint: For sending Business Central data
- Status endpoint: For system status checks
Webhook Integration
- Inbound webhooks: Real-time notifications from CreditDevice platform
- Webhook validation: Security and data integrity checks
- Automatic processing: Immediate response to webhook events
3. Data Processing Layer
JSON Data Processing
{
"debtors": [
{
"id": "CUST001",
"name": "Customer Name",
"email": "customer@example.com",
"creditLimit": 10000.00
}
],
"invoices": [
{
"invoiceNo": "INV-2026-001",
"customerId": "CUST001",
"amount": 1500.00,
"dueDate": "2026-04-21"
}
]
}Bulk Data Operations
- Batch processing for large datasets
- Efficient memory usage
- Progress tracking
- Error handling and retry logic
4. Background Processing
Job Queue Integration
- Scheduled imports: Automated data imports
- Periodic exports: Regular data synchronization
- Error recovery: Automatic retry on errors
- Monitoring: Status tracking and logging
Data Flow
Import Process
- Trigger: Job Queue or webhook event
- Authentication: API key validation
- Data Retrieval: REST API call to CreditDevice
- JSON Processing: Parse and validate received data
- Business Central Update: Import data into BC tables
- Logging: Record results and any errors
Export Process
- Data Collection: Gather BC data (customers, invoices)
- JSON Generation: Convert to CreditDevice format
- API Call: Send data via REST API
- Response Handling: Process API response
- Status Update: Update last export status
Security Architecture
API Authentication
- API Key based authentication
- Secure storage of credentials in BC
- Token refresh mechanisms
- Request signing for data integrity
Data Security
- HTTPS required for all communication
- Data encryption in transit
- Audit logging of all transactions
- Role-based access control
Webhook Security
- Signature validation for incoming webhooks
- IP whitelist support
- Replay attack prevention
- Secure endpoint URLs
Scalability Considerations
Performance Optimization
- Asynchronous processing via Job Queue
- Batch processing for large datasets
- Connection pooling for API calls
- Caching of configuration data
Resource Management
- Memory efficient JSON processing
- Database connection optimization
- Background thread management
- Error recovery strategies
Monitoring and Diagnostics
- Application Insights integration
- Custom telemetry tracking
- Performance counters
- Health check endpoints
Deployment Architecture
Business Central SaaS
- App installation via AppSource
- Automatic updates
- Cloud-native scaling
- Shared infrastructure
Business Central On-Premises
- Manual app deployment
- Custom update cycles
- Local infrastructure
- Dedicated resources
Integration Points
Business Central Tables
- Customer table integration
- Sales Invoice Header linking
- Custom setup tables
- Audit and logging tables
External Dependencies
- Q-Team App Authenticator required
- CreditDevice API platform
- Microsoft Graph (for webhooks)
- Azure Application Insights (for telemetry)