MishkaPay.Ash.Inbox.Listener (Mishka Pay v0.0.1)

Copy Markdown View Source

Makes a module the mishka_pay:webhook:received listener that stores each checked event in an inbox resource (the :inbox kind of MishkaPay.Ash.Resource):

defmodule MyApp.Pay.Inbox do
  use MishkaPay.Ash.Inbox.Listener, resource: MyApp.Pay.WebhookEvent
end

MishkaPay.Ash.Resource makes one for each resource that listens (listen? true), as <Resource>.MishkaPayListener; write one by hand with listen? false, such as to give it another :priority. Supervise it like any plugin. It answers the webhook as soon as the event is stored, so the provider gets its 200 at once; an event it cannot store is answered as failed, so the provider sends it again. :priority places it among the other listeners (50 by default).