CorvoNfse.Types.Webhook (Corvo NFS-e v0.1.1)

Copy Markdown View Source

Wire shapes of webhook configs, deliveries and delivery stats, plus the canonical list of webhook events.

Summary

Types

Stats returned by Deliveries.stats/2: a plain JSON string-keyed map of integers under the keys total, sent, failed, pending, delayed.

Environment wire value: "test" | "live".

Webhook event wire value - one of the canonical 9 events from events/0: nfse.invoice.authorized, nfse.invoice.rejected, nfse.invoice.failed, nfse.invoice.reconciliation_required, nfse.invoice.manual_review, nfse.invoice.documents_ready, nfse.invoice.email_sent, nfse.invoice.email_failed, nfse.invoice.fiscal_discrepancy. The webhook.test event is only sent by Webhooks.test/2 and cannot be subscribed.

t()

A webhook config including its signing secret - returned only by CorvoNfse.Resources.Webhooks.create/2.

Functions

The canonical 9 webhook events.

Types

create_params()

@type create_params() :: map()

Params for CorvoNfse.Resources.Webhooks.create/2: %{url:, events:}.

delivery()

@type delivery() :: CorvoNfse.Types.Webhook.Delivery.t()

delivery_stats()

@type delivery_stats() :: %{optional(String.t()) => term()}

Stats returned by Deliveries.stats/2: a plain JSON string-keyed map of integers under the keys total, sent, failed, pending, delayed.

environment()

@type environment() :: String.t()

Environment wire value: "test" | "live".

event()

@type event() :: String.t()

Webhook event wire value - one of the canonical 9 events from events/0: nfse.invoice.authorized, nfse.invoice.rejected, nfse.invoice.failed, nfse.invoice.reconciliation_required, nfse.invoice.manual_review, nfse.invoice.documents_ready, nfse.invoice.email_sent, nfse.invoice.email_failed, nfse.invoice.fiscal_discrepancy. The webhook.test event is only sent by Webhooks.test/2 and cannot be subscribed.

t()

@type t() :: %CorvoNfse.Types.Webhook{
  active: boolean(),
  createdAt: String.t(),
  events: [String.t()],
  id: String.t(),
  updatedAt: String.t(),
  url: String.t()
}

with_secret()

@type with_secret() :: map()

A webhook config including its signing secret - returned only by CorvoNfse.Resources.Webhooks.create/2.

Functions

events()

@spec events() :: [String.t()]

The canonical 9 webhook events.