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

Copy Markdown View Source

Makes a module the mishka_pay:event:process listener that syncs the subscription an event concerns into a subscription resource (the :subscription kind of MishkaPay.Ash.Resource):

defmodule MyApp.Pay.SubscriptionSync do
  use MishkaPay.Ash.Subscription.Listener, resource: MyApp.Pay.Subscription
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. An event about no subscription is left alone; a subscription the provider cannot give fails the event, so the inbox tries it again later.