Integration API Processor
Synchronous REST processor that acts as both input and processor in a single step. Receives ERP entity data via HTTP, persists it directly to comerzzia database and returns the result immediately — no messaging broker required.
Purpose
-
Exposes REST endpoints for each supported entity
-
Validates and processes entity data synchronously
-
Persists to comerzzia database via integration services
-
Returns processed/failed entity counts in the response
Processing Flow
flowchart TD
A[HTTP POST] --> B{Validation}
B -->|Invalid| E[400 Bad Request]
B -->|Valid| C[Processing]
C -->|ok| D[(comerzzia DB)]
C -->|error| ERR[(Error Tables)]
style A fill:none,stroke:#666,stroke-width:3px
style B fill:none,stroke:#666,stroke-width:3px
style C fill:none,stroke:#666,stroke-width:3px
style D fill:none,stroke:#666,stroke-width:3px
style ERR fill:none,stroke:#666,stroke-width:3px
style E fill:none,stroke:#666,stroke-width:3px
Response format
{
"status": 2,
"processed": 8,
"failed": 2
}
| status | HTTP Status | Meaning |
|---|---|---|
0 |
200 |
All entities processed successfully |
1 |
500 |
Processing failed entirely |
2 |
200 |
Processed with partial errors |
-
processed: number of entities successfully persisted -
failed: number of entities that failed
Individual promotions
Besides the bulk promotionsIntegration endpoint, /promotionIntegration manages one promotion per request:
| Method | Path | Description |
|---|---|---|
POST |
/promotionIntegration/{type} |
Creates or updates one promotion of the given type and returns it as saved |
GET |
/promotionIntegration/{promotionId} |
Returns one promotion by its comerzzia id |
GET |
/promotionIntegration/erp/{promotionERPId} |
Returns one promotion by its ERP id |
GET |
/promotionIntegration |
Searches promotions |
PUT |
/promotionIntegration/{promotionId}/status?active=true|false |
Activates or deactivates a promotion |
-
New promotions are created without activating. They are activated from the comerzzia backoffice or with the status endpoint. Updating an already active promotion keeps it active.
-
A POST with an existing
promotionERPIdupdates the same promotion instead of creating a new one. WithpromotionERPId0 a new promotion is always created, using its comerzzia id as ERP id. -
The search uses the same filters as the backoffice search screen:
promotionTypeId,status(NOT_ACTIVATED,ACTIVE,FINISHED,EXPIRED),description(starts with),rateCode,applyToRates(R/S),startDateFrom,startDateTo,endDateFrom,endDateTo(yyyy-MM-dd),pageandpageSize(max 100). Results are ordered from newest to oldest. There is no creation date filter, as comerzzia does not store it. -
Errors are returned as JSON:
400for invalid data or parameters and500for processing errors, with the reason inmessage.
Configuration
Database connection is configured via comerzzia.xml external configuration file loaded at runtime.
Docker container execution
docker run -it --rm --name processor-integration-api --env-file processor-dev.env --pull=always -p 8080:8080 europe-west3-docker.pkg.dev/czz-devops/comerzzia/erp-to-czz/processor-integration-api:1.0
uidActividad=MYACTIVITY
uidInstancia=MYINSTANCE
SPRING_PROFILES_ACTIVE=jsonlogs
COMERZZIA_DB_CLASS=com.mysql.jdbc.Driver
COMERZZIA_DB_DRIVER=mysql
COMERZZIA_DB_USER=comerzzia
COMERZZIA_DB_PASS=comerzzia
COMERZZIA_DB_URL=jdbc:mysql://127.0.0.1:3306/comerzzia