bling.cancel-nfse ​
Cancel an authorized NFS-e at Bling and reflect the cancellation on the commerce_entity row. Requires a justification.
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 | — | — |
nfse_external_ref | string | Yes | — | Bling-side NFS-e id (numeric, stringified) |
motivo | string | Yes | — | Free-text cancellation justification — required by municipality |
actor | string | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
connection_uuid | uuid | Yes | — | — |
nfse_external_ref | string | Yes | — | Bling-side NFS-e id (numeric, stringified) |
motivo | string | Yes | — | Free-text cancellation justification — required by municipality |
actor | string | No | — | — |
cancelled_at | string | No | — | — |
commerce_entity_uuid | uuid | No | — | — |
completed_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 | — | cancel | Cancel requested |
completed | No | Yes | Yes | — | NFS-e cancelled + recorded |
failed | No | Yes | No | — | Cancel failed |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
initiated | cancel | 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_NFSE_MISSING_MOTIVO | motivo (cancellation reason) is required by Bling/municipality |
BLING_NFSE_CANCEL_FAILED | Bling refused NFS-e cancellation: |
BLING_NFSE_PERSIST_FAILED | commerce_entity update failed after cancel: |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "bling.cancel-nfse",
"initial_data": {
"organization_uuid": "value",
"connection_uuid": "value",
"nfse_external_ref": "value",
"motivo": "value"
}
}