Sets a Phoenix project up to take payments with Mishka Pay.
mix igniter.install mishka_pay --ash --pubsubIt adds, and never twice:
MishkaPay.Registryfirst, which starts mishka_installer's plugin registry when nothing else does (as in a project's test run), then a keys plugin (<App>.Pay.Keys) to the application's children; the keys plugin answers each site's Stripe keys at runtime, from the environment until the project keeps them per site;- the webhook endpoint (
plug MishkaPay.Webhook, at: "/pay/webhooks") beforePlug.Parsersin the endpoint, which needs the raw body; MishkaPay.Test.setup!/0andMishkaPay.Test.await_plugin!/1beforeExUnit.start(), so tests start once Stripe is registered;- mishka_installer's plugin registry in
.mnesia/<env>(left out of git), where providers, keys and listeners are kept; - the test config that lets
MishkaPay.Test.stub_http/1answer every provider call, andconfig :ex_money, auto_start_exchange_rate_service: false(Mishka Pay converts no currencies).
Options:
--ash: the Ash layer: a<App>.Paydomain with the webhook inbox, payments, subscriptions, customers and disputes as resources of the project (MishkaPay.Ash.Resource), the listener the extension makes for each in the application's children, the inbox's Oban queue,config :ash, default_string_length_count: :codepointswhen the project has no such setting, and:mishka_payin the formatter'simport_deps(its DSL is written without parentheses). It needs ash_postgres and ash_oban (mix igniter.install ash_postgres ash_oban), thenmix ash.codegen mishka_pay.--admin: with--ash(which it turns on), the provider objects a site manages from its admin as resources too: products, prices, coupons, promotion codes, payment links and bills, each synced by its webhooks (MishkaPay.Ash.Object.Spec). Run it again on a project installed without it to add them.--pubsub:<App>.Pay.Broadcast, Mishka Pay's PubSub plugin on the project's<App>.PubSub.