Plaid.Sandbox (elixir_plaid v0.2.4) View Source

Plaid Sandbox API calls and schema.

Only used for sandbox testing purposes. None of these calls will work in development or production.

Link to this section Summary

Functions

Create a valid processor_token for an arbitrary institution ID and test credentials.

Create a valid public_token with arbitrary details.

Fire a fake webhook to an Item's webhook endpoint.

Force an item into a "login required" state.

Link to this section Functions

Link to this function

create_processor_token(institution_id, options \\ %{}, config)

View Source

Specs

create_processor_token(String.t(), options, Plaid.config()) ::
  {:ok, Plaid.Sandbox.CreateProcessorTokenResponse.t()}
  | {:error, Plaid.Error.t()}
when options: %{
       optional(:override_username) => String.t(),
       optional(:override_password) => String.t()
     }

Create a valid processor_token for an arbitrary institution ID and test credentials.

Does a POST /sandbox/processor_token/create call to create a valid processor_token to use with all the processor endpoints in the sandbox.

Params:

  • institution_id - The ID of the institution the Item will be associated with.

Options:

  • :override_username - Test username to use for the creation of the Sandbox Item.
  • :override_password - Test password to use for the creation of the Sandbox Item.

Examples

Sandbox.create_processor_token("ins_1", client_id: "123", secret: "abc")
{:ok, %Sandbox.CreateProcessorTokenResponse{}}
Link to this function

create_public_token(institution_id, initial_products, options \\ %{}, config)

View Source

Specs

create_public_token(String.t(), [String.t()], options, Plaid.config()) ::
  {:ok, Plaid.Sandbox.CreatePublicTokenResponse.t()} | {:error, Plaid.Error.t()}
when options: %{
       optional(:webhook) => String.t(),
       optional(:override_username) => String.t(),
       optional(:override_password) => String.t(),
       optional(:transactions) => Plaid.Sandbox.TransactionsOptions.t()
     }

Create a valid public_token with arbitrary details.

Does a POST /sandbox/public_token/create call to create a new sandbox public token.

Params:

  • institution_id - The ID of the institution the Item will be associated with.
  • initial_products - The products to initially pull for the Item.

Options:

  • :webhook - Specify a webhook to associate with the new Item.
  • :override_username - Test username to use for the creation of the Sandbox Item.
  • :override_password - Test password to use for the creation of the Sandbox Item.
  • :transactions - Options for transactions on the new Item.

Examples

Sandbox.create_public_token("ins_1", ["auth"], client_id: "123", secret: "abc")
{:ok, %Sandbox.CreatePublicTokenResponse{}}
Link to this function

fire_item_webhook(access_token, webhook_code, config)

View Source

Specs

fire_item_webhook(String.t(), String.t(), Plaid.config()) ::
  {:ok, Plaid.Sandbox.FireItemWebhookResponse.t()} | {:error, Plaid.Error.t()}

Fire a fake webhook to an Item's webhook endpoint.

Does a POST /sandbox/item/fire_webhook call which forces an item into the ITEM_LOGIN_REQUIRED state to simulate and item whose login is no longer valid.

Params:

  • access_token - The access token associated with the Item to fire the webhook for.
  • webhook_code - The webhook code to send.

webhook_code only supports DEFAULT_UPDATE for now.

Examples

Sandbox.fire_item_webhook("access-prod-123xxx", "DEFAULT_UPDATE", client_id: "123", secret: "abc")
{:ok, %Sandbox.FireItemWebhookResponse{}}
Link to this function

reset_item_login(access_token, config)

View Source

Specs

reset_item_login(String.t(), Plaid.config()) ::
  {:ok, Plaid.Sandbox.ResetItemLoginResponse.t()} | {:error, Plaid.Error.t()}

Force an item into a "login required" state.

Does a POST /sandbox/item/reset_login call which forces an item into the ITEM_LOGIN_REQUIRED state to simulate and item whose login is no longer valid.

Params:

  • access_token - The access token associated with the Item to reset the login for.

Examples

Sandbox.reset_item_login("access-prod-123xxx", client_id: "123", secret: "abc")
{:ok, %Sandbox.ResetItemLoginResponse{}}
Link to this function

set_item_verification_status(access_token, account_id, verification_status, config)

View Source

Specs

set_item_verification_status(String.t(), String.t(), String.t(), Plaid.config()) ::
  {:ok, Plaid.SimpleResponse.t()} | {:error, Plaid.Error.t()}

Change the verification status of an item.

Does a POST /sandbox/item/set_verification_status call to change the status of an item in order to simulate the Automated Micro-deposit flow.

Params:

  • access_token - The access token associated with the Item data is being requested for.
  • account_id - The ID of the account whose verification status is to be modified.
  • verification_status - The verification status to set the account to.

Examples

Sandbox.set_item_verification_status("access-prod-123xxx", "39flxk4ek2xs", "verification_expired", client_id: "123", secret: "abc")
{:ok, %Plaid.SimpleResponse{request_id: "9bkemelske"}}