Bling ​
| Workflow | Type | Description |
|---|---|---|
| bling.cancel-nfse | Atomic | Cancel an authorized NFS-e at Bling and reflect the cancellation on the commerce_entity row. Requires a justification. |
| bling.create-journal-entry | Atomic | Direct creation of a Bling lançamento. Caller supplies the Bling-side linked_receivable_external_ref or linked_payable_external_ref + amount; this workflow POSTs to /contas/{kind}/{id}/lancamentos and persists the result into commerce_entity. |
| bling.create-payable | Atomic | Create a new accounts-payable row at Bling (POST /contas/pagar). Persists the result into commerce_entity (entity_type='payable'). |
| bling.create-receivable | Atomic | Create a new accounts-receivable row at Bling (POST /contas/receber). Persists into commerce_entity (entity_type='receivable'). |
| bling.emit-nfse | Linear | Multi-step emission of an NFS-e (Brazilian services electronic invoice). Validates input, submits via Bling /nfse, polls until the municipality returns AUTHORIZED or REJECTED, and persists the result. The load-bearing piece of the Stripe → NF flow. |
| bling.fetch-category | Atomic | Fetch one page of Bling product categories (categorias/produtos) via LTIP. |
| bling.fetch-company | Atomic | Fetch the connected Bling tenant identity via LTIP commerce_company and persist it as a commerce_entity row (entity_type='company'). Singleton — no pagination. |
| bling.fetch-contact | Atomic | Fetch one page of Bling contacts (contatos) via LTIP. |
| bling.fetch-cost-center | Atomic | Fetch one page of Bling cost centers (centros-de-custos) via LTIP. |
| bling.fetch-dre | Atomic | Fetch the DRE (Demonstração do Resultado do ExercÃcio / P&L) report for a date range and persist into commerce_entity. |
| bling.fetch-faturamento | Atomic | Fetch the faturamento (billing summary) report for a date range and persist into commerce_entity. |
| bling.fetch-financial-category | Atomic | Fetch one page of Bling financial categories (chart of accounts) via LTIP. |
| bling.fetch-invoice | Atomic | Fetch one page of Bling NF-e invoices (nfe) via LTIP. Read-only. |
| bling.fetch-journal-entry | Atomic | Fetch one page of Bling lançamentos (journal entries) scoped to a specific receivable or payable. Returns items + has_next_page. |
| bling.fetch-order | Atomic | Fetches one page of Bling sales orders (pedidos/vendas) via LTIP. Returns items + has_next_page; a paginating DAG resumes from page+1. |
| bling.fetch-payable | Atomic | Fetch one page of Bling accounts payable (contas/pagar) via LTIP. |
| bling.fetch-payment-method | Atomic | Fetch one page of Bling payment methods (formas-de-pagamento) via LTIP. |
| bling.fetch-product | Atomic | Fetches one page of products from Bling via LTIP. Returns the page's items in state_data plus has_next_page so a paginating DAG can resume. |
| bling.fetch-receivable | Atomic | Fetch one page of Bling accounts receivable (contas/receber) via LTIP. |
| bling.fetch-regime | Atomic | Read the connected Bling tenant's tax regime (regimeTributario) by calling bling.fetch-company under the hood. Persists into commerce_entity with entity_type='tax_regime'. |
| bling.fetch-service-invoice | Atomic | Fetch one page of Bling NFS-e (nfse) via LTIP. Read + sync side. |
| bling.fetch-stock-balance | Atomic | Fetch one page of Bling stock balances (estoques/saldos) via LTIP. |
| bling.fetch-tax-obligation | Atomic | Fetch one page (or a single resource by id) of Bling tax-calendar obligations (obrigacoes-acessorias). |
| bling.fetch-user | Atomic | Fetch the OAuth-authenticated Bling user identity via LTIP commerce_user and persist it as a commerce_entity row (entity_type='user'). Singleton — no pagination. |
| bling.fetch-warehouse | Atomic | Fetch one page of Bling warehouses (depositos) via LTIP. |
| bling.initial-sync | Atomic | Runs the per-entity Bling sync workflows in dependency order — first the catalog support (categories, warehouses, contacts), then products, then stock, then sales documents. |
| bling.list-orders | Atomic | List one page of Bling sales orders without persistence or OAuth token rotation. This is the tenant-safe read surface for interactive callers. |
| bling.oauth-callback | Linear | Validates the OAuth state, exchanges the authorization code for access/refresh tokens at Bling, and delegates persistence to connection.setup. |
| bling.oauth-start | Atomic | Produces the Bling OAuth2 authorize URL and a signed state token. Front-end redirects the user to authorize_url; bling.oauth-callback validates the returned state. |
| bling.receive-webhook | Atomic | Dispatch a persisted Bling webhook delivery to the right entity-specific fetch workflow. Re-fetches the affected resource so platform state stays in sync with Bling. Marks commerce_webhook_event.processed_at on success. |
| bling.refresh-token | Linear | Loads an existing Bling CloudConnection, exchanges its refresh_token for a fresh access/refresh pair at Bling, and persists the rotated credentials. |
| bling.refresh-token-due | Atomic | Scans active Bling connections, refreshes any whose access_token expires within window_minutes. Designed to be invoked on a schedule so tokens never silently expire mid-API call. |
| bling.settle-payable | Linear | Convenience wrapper: settles a payable by creating an EXPENSE lançamento at Bling and refreshing the parent payable. |
| bling.settle-receivable | Linear | Convenience wrapper: settles a receivable by creating an INCOME lançamento at Bling and refreshing the parent receivable. Used by the Stripe webhook handler when a charge succeeds. |
| bling.sync-categories | Linear | Iterate every page of Bling product categories, persist into commerce_entity. |
| bling.sync-contacts | Linear | Iterate every page of Bling /contatos, persist into commerce_entity. |
| bling.sync-cost-centers | Linear | Iterate every page of Bling cost centers, persist into commerce_entity. |
| bling.sync-financial-categories | Linear | Iterate every page of Bling financial categories, persist into commerce_entity. |
| bling.sync-invoices | Linear | Iterate every page of Bling NF-e, persist into commerce_entity. Read-only. |
| bling.sync-journal-entries | Linear | Iterate every page of Bling lançamentos for a single bill and persist each into commerce_entity (entity_type='journal_entry'). |
| bling.sync-orders | Linear | Iterates every page of Bling /pedidos/vendas (optionally filtered by since), persists each item via data.commerce.entity.persist, and writes a sync cursor at completion. Retries inherit from the underlying bling.fetch-order workflow. |
| bling.sync-payables | Linear | Iterate every page of Bling /contas/pagar, persist into commerce_entity. |
| bling.sync-payment-methods | Linear | Iterate every page of Bling payment-methods catalog, persist into commerce_entity. |
| bling.sync-products | Linear | Iterates through every page of Bling /produtos (optionally filtered by since for incremental sync), aggregating counts. Each page is fetched via the bling.fetch-product workflow, so retries and rate limiting are inherited from that workflow. |
| bling.sync-receivables | Linear | Iterate every page of Bling /contas/receber, persist into commerce_entity. |
| bling.sync-service-invoices | Linear | Iterate every page of Bling NFS-e, persist into commerce_entity. |
| bling.sync-stock-balances | Linear | Iterates every page of Bling /estoques/saldos and persists each row into commerce_entity. No incremental cursor on Bling's side — full scan every run; rely on diffs at the persist layer. |
| bling.sync-tax-obligations | Linear | Iterate every page of Bling tax obligations, persist into commerce_entity. |
| bling.sync-warehouses | Linear | Iterate every page of Bling warehouses, persist into commerce_entity. |
| bling.upsert-contact | Atomic | Create or update a Bling contact (contato). Routes to POST /contatos or PUT /contatos/{id} based on whether contact_external_ref is supplied. Persists the result into commerce_entity. |
