View Source Gringotts.Adapter (gringotts v1.1.1)
Validates the "required" configuration.
All gateway modules must use this module, which provides a run-time
configuration validator.
Gringotts picks up the merchant's Gateway authentication secrets from the
Application config. The configuration validator can be customized by providing
a list of required_config keys. The validator will check if these keys are
available at run-time, before each call to the Gateway.
example
Example
Say a merchant must provide his secret_user_name and secret_password to
some Gateway XYZ. Then, Gringotts expects that the GatewayXYZ module
would use Adapter in the following manner:
defmodule Gringotts.Gateways.GatewayXYZ do
use Gringotts.Adapter, required_config: [:secret_user_name, :secret_password]
use Gringotts.Gateways.Base
# the rest of the implentation
endAnd, the merchant woud provide these secrets in the Application config,
possibly via config/config.exs like so,
# config/config.exs
config :gringotts, Gringotts.Gateways.GatewayXYZ,
adapter: Gringotts.Gateways.GatewayXYZ,
secret_user_name: "some_really_secret_user_name",
secret_password: "some_really_secret_password"