On the web, with more detail: Test code that takes payments.
# test/test_helper.exs (mix igniter.install mishka_pay writes it)
MishkaPay.Test.setup!()
MishkaPay.Test.await_plugin!(MishkaPay.Providers.Stripe)
ExUnit.start()
# config/test.exs
config :mishka_pay, req_options: [plug: {Req.Test, MishkaPay.Client}]MishkaPay.Test.put_keys/3gives keys for a test,MishkaPay.Test.stub_http/1answers every provider request; both belong to the test process, so tests can beasync: true.MishkaPay.Test.await_plugin!/1returns once a plugin the application starts is registered (a moment after boot);MishkaPay.Test.start_plugin!/1starts one for a test and returns once its event runs it (no sleeps).MishkaPay.Test.deliver_event/5posts a Stripe event signed the way Stripe signs it throughMishkaPay.Webhook;MishkaPay.Test.stripe_object/2gives one object of each kind.- Stripe's real request shapes: run
stripe/stripe-mockand forwardstub_http/1to it. - Live sandbox tests behind a tag, with
sk_test_keys only; renewals and plan changes on Stripe test clocks.mix mishka_pay.stripe.clean_clocksdeletes old ones. - A provider you write:
use MishkaPay.ProviderCase, provider: MyApp.Pay.Acmeruns the contract.