code_corps v0.0.1 CodeCorps.StripeEvent View Source

Represents a reference to single Stripe API Event object

Fields

  • endpoint - “connect” or “platform”
  • id_from_stripe - Stripe’s id
  • status - “unprocessed”, “processed”, or “errored”

Note on status

When the event is received via a webhook, it is stored as “unprocessed”. If during processing, there is an issue, it is set to “errored”. Once successfuly processed, it is set to “processed”.

There are cases where Stripe can send multiple webhooks for the same event, so when such a request is received, an event that is “errored” or “unprocessed” can be processed again, while a “processed” event is ignored.

Link to this section Summary

Functions

Builds a changeset for storing a new event reference into the database. The status field is set to “unprocessed” by default

Builds a changeset for updating the status of an existing event reference. Accepts :status only and ensures it’s one of “unprocessed”, “processed” or “errored”

Link to this section Types

Link to this type t() View Source
t() :: %CodeCorps.StripeEvent{__meta__: term(), endpoint: term(), id: term(), id_from_stripe: term(), ignored_reason: term(), inserted_at: term(), object_id: term(), object_type: term(), status: term(), type: term(), updated_at: term(), user_id: term()}

Link to this section Functions

Link to this function create_changeset(struct, params \\ %{}) View Source

Builds a changeset for storing a new event reference into the database. The status field is set to “unprocessed” by default.

Link to this function update_changeset(struct, params) View Source

Builds a changeset for updating the status of an existing event reference. Accepts :status only and ensures it’s one of “unprocessed”, “processed” or “errored”.