bling.fetch-dre
Fetch the DRE (Demonstração do Resultado do Exercício / P&L) report for a date range and persist into commerce_entity.
Overview
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-bling |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
period_start | string | Yes | — | ISO date — inclusive start |
period_end | string | Yes | — | ISO date — inclusive end |
actor | string | No | — | — |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
period_start | string | Yes | — | ISO date — inclusive start |
period_end | string | Yes | — | ISO date — inclusive end |
actor | string | No | — | — |
provider_resource_ref | string | No | — | Synthetic period key (start_end) |
commerce_entity_uuid | uuid | No | — | — |
report | json | No | — | Full DRE contract dump |
fetched_at | string | No | — | — |
failure_reason | string | No | — | — |
failed_at | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | json | No | — | — |
failed_layer | json | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | fetch | Fetch DRE request received |
completed | No | Yes | Yes | — | DRE fetched + persisted |
failed | No | Yes | No | — | Fetch failed |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
initiated | fetch | completed | — |
initiated | fail | failed | — |
Business Errors
| Code | Message Template |
|---|---|
BLING_CONNECTION_NOT_FOUND | Bling connection {connection_uuid} not found in organization |
BLING_CONNECTION_WRONG_PROVIDER | Connection {connection_uuid} is not a Bling connection |
BLING_DRE_MISSING_PERIOD | {field} is required (ISO date YYYY-MM-DD) |
BLING_DRE_FETCH_FAILED | Bling refused DRE for {period_start}..{period_end}: |
BLING_DRE_PERSIST_FAILED | commerce_entity persist failed: |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "bling.fetch-dre",
"initial_data": {
"organization_uuid": "value",
"connection_uuid": "value",
"period_start": "value",
"period_end": "value"
}
}