Overview
The Cofase (Coface) integration provides access to international credit insurance services and business risk assessment. This integration enables company lookup, credit limit verification, risk rating analysis, and product delivery tracking for B2B transactions.Architecture
The integration consists of:- ApiCofase - Main service for authentication and API calls (
Helpers/ApiCofase.cs) - ApiCofaseRepository - Data persistence layer (
Services/ApiCofase/ApiCofaseRepository.cs) - ApiCofaseSettings - Configuration management
Authentication Flow
Cofase uses a two-factor authentication approach:- API Key: Sent via
x-api-keyheader - OAuth Token: Password grant type authentication
Authentication Sequence
Helpers/ApiCofase.cs:30-89
Service Methods
SearchCompanyByIdentifier
Searches for company information using a tax identifier (RUC). Location:Helpers/ApiCofase.cs:91+
Parameters
Client information for logging and context
Valid authentication token from AuthenticateAsync
Company identifier (RUC number for Ecuador)
Request Format
Response Structure
List of matching companies
Number of companies found
GetProductDetailsByDeliveryId
Retrieves product details and credit decisions for a specific delivery.Parameters
Client information
Document identifier
Response Structure
Returns anApiProductDelivery object containing:
Product information and credit decision details
Stored Cofase data from database
Data Models
ApiAuthCofase
Authentication response structure:Companies
Company information structure:Product
Credit product details:Address
Address structure for company locations:Repository Operations
TheApiCofaseRepository provides database operations:
Location: Services/ApiCofase/ApiCofaseRepository.cs
Create
Stores a new Cofase record.GetById
Retrieves a Cofase record by ID.Update
Updates an existing Cofase record.GraphQL Integration
GetApiCofaseByClientId
Retrieves Cofase information for a client by document number. Location:Schema/Query/Query.cs:1231-1246
Parameters
Client document identifier (Cédula or RUC)
Response Fields
Unique identifier for the Cofase record
Company catalog information (JSON)
Credit decision type code
Amount billed for the service
Requested credit amount
Underwriter information
Current period identifiers
Credit limit period information
Outstanding notification document information
Customer comments or notes
Effective date of the credit decision
OCL (Outstanding Credit Limit) data
Risk rating score
Date when credit decision was made
Position information
Source of the delivery
Date when order was placed
Unique order identifier
Unique delivery identifier
Current status of the delivery
Product family type code
Specific product code
Record creation timestamp
Last update timestamp
Error Handling
CLIENTEDTO_NOT_FOUND
Thrown when client doesn’t exist in the database.ApiCofaseDTO_NOT_FOUND
Thrown when no Cofase record exists for the client.Logging
All Cofase API calls are logged to theApiLog table including:
- Request body
- Response body
- URL endpoint
- User ID
- Timestamps
- Status (enviado/received)
Data Persistence
Cofase data is stored in theind_ac_api_cofase database table with automatic timestamp tracking.
Example Usage
Response Example
Configuration
Required configuration inappsettings.json:
Best Practices
- Token Management: Tokens expire - always check expiration and re-authenticate as needed
- Error Logging: All API calls are logged for audit and debugging purposes
- Cache Utilization: Use database records to avoid unnecessary API calls
- Document Validation: Validate RUC format before querying Cofase
- Policy Number: Ensure correct policy number is configured for your account