Reads the mishka_pay setup of a resource (MishkaPay.Ash.Resource): each option as
mishka_pay_<option>/1, such as mishka_pay_kind/1 and mishka_pay_listen?/1, the actions it
took from its kind, and the listener made for it.
Summary
Functions
The actions the resource took from its kind: its actions option, else all of them.
The webhook listener module made for the resource (listen? true), or nil.
Only these actions of the kind, besides the primary :read. Every action of the kind
when left out. An :inbox needs all of its own.
Only these actions of the kind, besides the primary :read. Every action of the kind
when left out. An :inbox needs all of its own.
Fires mishka_pay:<kind>:changed after each write the provider answered. The inbox
announces nothing either way.
A :user belongs_to relationship to the host's user resource, on :user_id, or on
another attribute with {MyApp.Accounts.User, attribute: :owner_id}. A payment or a
subscription gets its user from the checkout's owner, which :start_checkout takes from
the actor and every sync writes again (MishkaPay.Ash.Owner); a customer's :register
takes it as an input. It may be nil, for a sale with no owner.
A :user belongs_to relationship to the host's user resource, on :user_id, or on
another attribute with {MyApp.Accounts.User, attribute: :owner_id}. A payment or a
subscription gets its user from the checkout's owner, which :start_checkout takes from
the actor and every sync writes again (MishkaPay.Ash.Owner); a customer's :register
takes it as an input. It may be nil, for a sale with no owner.
Defines a code interface function for each action it adds, such as
MyApp.Pay.Subscription.cancel!(row, %{at: :now}). The inbox's :receive is
receive_event.
For an :inbox: how many days a processed event is kept before its daily :forget
trigger deletes it, or :forever. Failed and pending events are always kept.
For an :inbox: how many days a processed event is kept before its daily :forget
trigger deletes it, or :forever. Failed and pending events are always kept.
What the resource keeps: :inbox (each checked webhook event), :payment,
:subscription, :customer or :dispute; or what a site manages from its admin:
:product, :price, :coupon, :promotion_code, :payment_link or :invoice
(MishkaPay.Ash.Object.Spec).
What the resource keeps: :inbox (each checked webhook event), :payment,
:subscription, :customer or :dispute; or what a site manages from its admin:
:product, :price, :coupon, :promotion_code, :payment_link or :invoice
(MishkaPay.Ash.Object.Spec).
Makes <Resource>.MishkaPayListener, the webhook listener that keeps the resource
current. MishkaPay.Ash.listeners/1 lists them for the application's children.
mishka_pay DSL options
Hours after which a row still open at its provider is read again by an hourly AshOban
trigger running :resync, in case a webhook never came: a pending or authorized
payment, a subscription that has not ended, an open dispute, a draft or open bill.
Runs on the inbox's queue, mishka_pay_inbox. Off unless given.
Hours after which a row still open at its provider is read again by an hourly AshOban
trigger running :resync, in case a webhook never came: a pending or authorized
payment, a subscription that has not ended, an open dispute, a draft or open bill.
Runs on the inbox's queue, mishka_pay_inbox. Off unless given.
The host's own attribute that holds the tenant, such as :site_id (an attribute, or the
source attribute of a belongs_to :site), for a host that keeps sites apart without Ash
multitenancy. Each create action writes its tenant there too; the row's :tenant still
picks the provider keys. With Ash multitenancy on that attribute, Ash fills it and this is
not needed. Not for an :inbox, which stays global.
The host's own attribute that holds the tenant, such as :site_id (an attribute, or the
source attribute of a belongs_to :site), for a host that keeps sites apart without Ash
multitenancy. Each create action writes its tenant there too; the row's :tenant still
picks the provider keys. With Ash multitenancy on that attribute, Ash fills it and this is
not needed. Not for an :inbox, which stays global.
The attribute belongs_to_user keeps the user in (:user_id unless named), or nil.
Functions
@spec actions(Spark.Dsl.t() | Ash.Resource.t()) :: [atom()]
The actions the resource took from its kind: its actions option, else all of them.
@spec listener(Spark.Dsl.t() | Ash.Resource.t()) :: module() | nil
The webhook listener module made for the resource (listen? true), or nil.
Only these actions of the kind, besides the primary :read. Every action of the kind
when left out. An :inbox needs all of its own.
Only these actions of the kind, besides the primary :read. Every action of the kind
when left out. An :inbox needs all of its own.
Fires mishka_pay:<kind>:changed after each write the provider answered. The inbox
announces nothing either way.
@spec mishka_pay_belongs_to_user(dsl_or_extended :: module() | map()) :: {:ok, atom() | {atom(), keyword()}} | :error
A :user belongs_to relationship to the host's user resource, on :user_id, or on
another attribute with {MyApp.Accounts.User, attribute: :owner_id}. A payment or a
subscription gets its user from the checkout's owner, which :start_checkout takes from
the actor and every sync writes again (MishkaPay.Ash.Owner); a customer's :register
takes it as an input. It may be nil, for a sale with no owner.
@spec mishka_pay_belongs_to_user!(dsl_or_extended :: module() | map()) :: (atom() | {atom(), keyword()}) | no_return()
A :user belongs_to relationship to the host's user resource, on :user_id, or on
another attribute with {MyApp.Accounts.User, attribute: :owner_id}. A payment or a
subscription gets its user from the checkout's owner, which :start_checkout takes from
the actor and every sync writes again (MishkaPay.Ash.Owner); a customer's :register
takes it as an input. It may be nil, for a sale with no owner.
Defines a code interface function for each action it adds, such as
MyApp.Pay.Subscription.cancel!(row, %{at: :now}). The inbox's :receive is
receive_event.
@spec mishka_pay_keep_events_for(dsl_or_extended :: module() | map()) :: {:ok, pos_integer() | :forever} | :error
For an :inbox: how many days a processed event is kept before its daily :forget
trigger deletes it, or :forever. Failed and pending events are always kept.
@spec mishka_pay_keep_events_for!(dsl_or_extended :: module() | map()) :: (pos_integer() | :forever) | no_return()
For an :inbox: how many days a processed event is kept before its daily :forget
trigger deletes it, or :forever. Failed and pending events are always kept.
@spec mishka_pay_kind(dsl_or_extended :: module() | map()) :: {:ok, :invoice | :payment_link | :promotion_code | :coupon | :price | :product | :dispute | :customer | :subscription | :payment | :inbox} | :error
What the resource keeps: :inbox (each checked webhook event), :payment,
:subscription, :customer or :dispute; or what a site manages from its admin:
:product, :price, :coupon, :promotion_code, :payment_link or :invoice
(MishkaPay.Ash.Object.Spec).
@spec mishka_pay_kind!(dsl_or_extended :: module() | map()) :: (:invoice | :payment_link | :promotion_code | :coupon | :price | :product | :dispute | :customer | :subscription | :payment | :inbox) | no_return()
What the resource keeps: :inbox (each checked webhook event), :payment,
:subscription, :customer or :dispute; or what a site manages from its admin:
:product, :price, :coupon, :promotion_code, :payment_link or :invoice
(MishkaPay.Ash.Object.Spec).
Makes <Resource>.MishkaPayListener, the webhook listener that keeps the resource
current. MishkaPay.Ash.listeners/1 lists them for the application's children.
mishka_pay DSL options
Returns a map containing the and any configured or default values.
@spec mishka_pay_resync_after(dsl_or_extended :: module() | map()) :: {:ok, pos_integer()} | :error
Hours after which a row still open at its provider is read again by an hourly AshOban
trigger running :resync, in case a webhook never came: a pending or authorized
payment, a subscription that has not ended, an open dispute, a draft or open bill.
Runs on the inbox's queue, mishka_pay_inbox. Off unless given.
@spec mishka_pay_resync_after!(dsl_or_extended :: module() | map()) :: pos_integer() | no_return()
Hours after which a row still open at its provider is read again by an hourly AshOban
trigger running :resync, in case a webhook never came: a pending or authorized
payment, a subscription that has not ended, an open dispute, a draft or open bill.
Runs on the inbox's queue, mishka_pay_inbox. Off unless given.
The host's own attribute that holds the tenant, such as :site_id (an attribute, or the
source attribute of a belongs_to :site), for a host that keeps sites apart without Ash
multitenancy. Each create action writes its tenant there too; the row's :tenant still
picks the provider keys. With Ash multitenancy on that attribute, Ash fills it and this is
not needed. Not for an :inbox, which stays global.
The host's own attribute that holds the tenant, such as :site_id (an attribute, or the
source attribute of a belongs_to :site), for a host that keeps sites apart without Ash
multitenancy. Each create action writes its tenant there too; the row's :tenant still
picks the provider keys. With Ash multitenancy on that attribute, Ash fills it and this is
not needed. Not for an :inbox, which stays global.
@spec user_attribute(Spark.Dsl.t() | Ash.Resource.t()) :: atom() | nil
The attribute belongs_to_user keeps the user in (:user_id unless named), or nil.