diff --git a/config/config.exs b/config/config.exs index 8233fe9..1a4913e 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,3 +1,10 @@ use Mix.Config import_config "#{Mix.env()}.exs" + +config :plaid, + root_uri: "https://development.plaid.com/", + client_id: "your_client_id", + secret: "your_secret", + public_key: "your_public_key", + httpoison_options: [timeout: 10_000, recv_timeout: 30_000] diff --git a/lib/plaid/institutions.ex b/lib/plaid/institutions.ex index e0bfc1c..1a4cf9f 100644 --- a/lib/plaid/institutions.ex +++ b/lib/plaid/institutions.ex @@ -48,7 +48,8 @@ defmodule Plaid.Institutions do url: nil, url_account_locked: nil, url_account_setup: nil, - url_forgotten_password: nil + url_forgotten_password: nil, + auth_metadata: nil @type t :: %__MODULE__{ brand_name: String.t(), @@ -73,7 +74,8 @@ defmodule Plaid.Institutions do url: String.t(), url_account_locked: String.t(), url_account_setup: String.t(), - url_forgotten_password: String.t() + url_forgotten_password: String.t(), + auth_metadata: Plaid.Institutions.Institution.SupportedMethods.t() } defmodule Colors do @@ -101,6 +103,33 @@ defmodule Plaid.Institutions do defstruct label: nil, name: nil, type: nil @type t :: %__MODULE__{label: String.t(), name: String.t(), type: String.t()} end + + defmodule AuthMetadata do + @moduledoc """ + Plaid Institution auth_metadata structure. + """ + + @derive Jason.Encoder + defstruct supported_methods: nil + @type t :: %__MODULE__{supported_methods: Plaid.Institutions.Institution.SupportedMethods.t() } + end + + defmodule SupportedMethods do + @moduledoc """ + Plaid Institution supported_methods structure (nested inside auth_metadata). + """ + + @derive Jason.Encoder + defstruct automated_micro_deposits: nil, + instant_auth: nil, + instant_match: nil + + @type t :: %__MODULE__{ + automated_micro_deposits: Boolean.t(), + instant_auth: Boolean.t(), + instant_match: Boolean.t() + } + end end @doc """ diff --git a/test/support/factory.ex b/test/support/factory.ex index 2b10ad0..3a1d9de 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -244,7 +244,14 @@ defmodule Plaid.Factory do "institution_id" => "ins_109509", "mfa" => ["code", "list", "questions", "selections"], "name" => "First Gingham Credit Union", - "products" => ["balance", "credit_details", "auth", "transactions"] + "products" => ["balance", "credit_details", "auth", "transactions"], + "auth_metadata" => %{ + "supported_methods" => %{ + "automated_micro_deposits" => true, + "instant_auth" => true, + "instant_match" => true + } + } } ], "request_id" => "DLVvK" @@ -272,7 +279,14 @@ defmodule Plaid.Factory do "iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAMAAAAvHNATAAAANlBMVEVHcEwOW6f///8IVqUPW6gQXKgRXKkPW6gTYKwPW6gbYqsxcbJ3ocza5vDs8/b0+Pmlwt1Vir96WNmQAAAACnRSTlMA////5HhLoCDGuAtrFAAABQNJREFUeNrt3H9vpCAQBuACIuC6wn7/L3vuXttb8UX5MdjJpVya3D9tngDiqDPz8dE67KiNcc4NgxDDsP7HGD3aj58cVhu3avAYnNE/wbOjSZredObauctCveGuWsAC1aet/6Ja7UTVcF1t1oiGYSxLVjdaO6sLjYZFT9OTIBuTpju2nCAdbmS2irTrOQ6iwxiaJ02LTqNtp9n07lJT7kjtNNtjGdUt3JfMMSvq5Uwvo3osMn+kZLXLaTDp9jyL7rJkBJGgGTKXeCw3teqKXH6VCTKZw/Pl/RM2y8KRnDNHcjk+t1YdTIZJUVycdsCX4rrlK2Fp2WBb11Hcnlu+FibvU/tq4nV8uaphXt5vrTJz4KqfMemTMtNyTny6GmBStsnwef99pLbA5JKSZdwDRnzH/j7qm2ByeSRkY9VBoaYgKWA+LTs9NNAFqUSQkmbG1t9PyFzNBguSDiZ9ItjQxRts42qHJWVj6QYLkhaWCtAOtpk5d5HAEjJTtJCxgQSWCNDG/CtyT6CB4QDNZV+RQEAEwzJ4ZdoJBazdYDBAm2zWzkcuOhgM0MD+t3kuQphHMns+YYlnRzoYDNDM6YS9Avy+MBig2bMJS7hoYUBmjifsK5DuDQNhkD2asLSLGuZ3MnMwYQcuahiYM5s+9NdA2l8G24WOOnWXVIfvcuhhcYDmEiv5HuBfA4vDIAtX8uXyJ7DHnXg88FoOyUAaw8REPjahLAwQg8yArSFL0b+/v5L8UYmA0aQD6RSs7zC7lVx3te8CU2dDgLW04A0FMWwKx2OO/qiNt1gnmLqdrUP0MWCMt1g32FJ2/Jv4sPg5mAwq3mRWsIDdp3iTaY4wHYVibGAmiizYwFx0o2QDe+5+wREmoliMD8xuQws+sHEb7vOB6e2DGx+Y4QtzPGHuF1YMG3jCBr4wwRMm+MJ+91gp7Pcc+29gv9FFKYxtoMg2tGb7MML28Y3vAy/bVwRsX6qwfQ3F9sUdk1edG9jA5+XwFmbi1+mKCWyMP0BkfO+7BGb3H98CB9gAvtRP890fjqUTbJn2H7m2eWPT7XjUfOLK+DLyPmMj/JAqSr6TkcHeM0OG/jU+2bDNBtHwY70iHxmwbe6FRekN6jETj+fH/RPY1uVwQsitrIAmK3XhBBZlhGicQnOSdtEBFmeq2FTSEbHsDBYnEpuDNK1wHczvknXtUWJbuG7GZnWcC7hN71HhKtiszrInzVY2XwML6jTf1J7kWHeBhdPcSZANOPvusH1as8lIacb5uZSwkJfSvLuVE8mSMJBsrfPS5svqTkthwOVyCw1IZBDmYQr4mFuaoRTBLR3PWGZqerKYhUAGYagK7qhmahT0MgSD1XljWcFUswzAoEuXlpg9AzRPCoNPgK6iKK8tQNvBYF3eeSXvKIhlMQzXC45VhZ+qJUCLYLhaUNeWyjYEaFsYdjUU8dbLtrC5wYVrzapDx3cYrmBsLRSf606Nd1irK1FoObfCoGsoa0YAa3mrArR/sADnq7SDCZYtDbDQuo5H12aF7AsG6xapWoSoCtknDNagVrnw+7zyYOMF87DdRXXvHtgep1D2Kn65IVdLtyN0cRbO2WvLT8Dl2vpD6TbZkuw/09zsCyynmkrec8IxEHT6svDqzH8zDK9GmrZt1Y3RUj1U6Do+Mm0lx7j5Ht92hYwbPDJuicm4iSjjtqucG9Vybu37vagMmyG/z12X9tF/APITr9CCbDsMAAAAAElFTkSuQmCC", "mfa" => ["code", "list", "questions", "selections"], "name" => "Houndstooth Bank", - "products" => ["balance", "credit_details", "auth", "transactions"] + "products" => ["balance", "credit_details", "auth", "transactions"], + "auth_metadata" => %{ + "supported_methods" => %{ + "automated_micro_deposits" => true, + "instant_auth" => true, + "instant_match" => true + } + } }, "request_id" => "9VpnU" }