MishkaPay.Check (Mishka Pay v0.0.1)

Copy Markdown View Source

Checks one site's setup before it takes money, the way a deploy or CI step would: each check is {name, :ok | {:error, reason}}, in order, and run/1 never raises. mix mishka_pay.check prints them.

MishkaPay.Check.run(provider: "stripe", tenant: site.id,
  webhook_url: "https://shop.test/pay/webhooks/stripe/#{site.id}", domain: MyApp.Pay)

What it checks:

  • :provider: the provider is installed and offered (MishkaPay.Provider.fetch/1);
  • :keys: the site's keys plugin answers keys for it (MishkaPay.Credentials);
  • :keys_accepted: the provider takes the keys, with one read call (MishkaPay.Provider check_keys/1, when the provider has it);
  • :webhook_secret: the keys carry the secret webhooks are checked with;
  • :webhook_endpoint: with webhook_url:, the provider sends every event Mishka Pay acts on to it (Stripe: MishkaPay.Providers.Stripe.WebhookEndpoint);
  • :listeners: with domain: (an Ash domain), each of its Mishka Pay listeners is started;
  • :inbox: with domain:, it has an :inbox resource, and Oban runs its queue.

Summary

Functions

Whether every check of results passed.

Runs every check that applies to opts, and answers them in order.

Types

result()

@type result() :: {atom(), :ok | {:error, String.t()}}

Functions

ok?(results)

@spec ok?([result()]) :: boolean()

Whether every check of results passed.

run(opts)

@spec run(keyword()) :: [result()]

Runs every check that applies to opts, and answers them in order.