diff --git a/.github/workflows/run_forked_repo_tests.yml b/.github/workflows/run_forked_repo_tests.yml index 3c0e62a..da10737 100644 --- a/.github/workflows/run_forked_repo_tests.yml +++ b/.github/workflows/run_forked_repo_tests.yml @@ -9,15 +9,15 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'Approved') strategy: matrix: - elixir-version: ['1.12'] - otp: ['22.0'] + elixir-version: ['1.18'] + otp: ['27'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Elixir uses: erlef/setup-beam@v1 with: - otp-version: '22.0' - elixir-version: '1.12' + otp-version: '27' + elixir-version: '1.18' - name: Install Dependencies run: mix deps.get - name: Compile Repository @@ -30,7 +30,7 @@ jobs: - name: Run Static Code Analysis for Elixir run: mix credo - name: Run Static Code Analysis for Erlang - run: mix dialyzer --halt-exit-status + run: mix dialyzer - name: Run Elixir Tests env: API_KEY: ${{ secrets.API_KEY }} diff --git a/.github/workflows/run_tests_job.yml b/.github/workflows/run_tests_job.yml index 18f1d11..d047a1b 100644 --- a/.github/workflows/run_tests_job.yml +++ b/.github/workflows/run_tests_job.yml @@ -2,7 +2,7 @@ name: Run full Elixir workflow on: pull_request: - types: [ opened, reopened, edited ] + types: [ opened, reopened, edited, synchronize ] branches: - main jobs: @@ -10,15 +10,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - elixir-version: ['1.12'] - otp: ['22.0'] + elixir-version: ['1.18'] + otp: ['27'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Elixir uses: erlef/setup-beam@v1 with: - otp-version: '22.0' - elixir-version: '1.12' + otp-version: '27' + elixir-version: '1.18' - name: Install Dependencies run: mix deps.get - name: Compile Repository @@ -31,7 +31,7 @@ jobs: - name: Run Static Code Analysis for Elixir run: mix credo - name: Run Static Code Analysis for Erlang - run: mix dialyzer --halt-exit-status + run: mix dialyzer - name: Run Elixir Tests env: LOB_API_TEST_KEY: ${{ secrets.LOB_API_TEST_KEY }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 1707e27..86d6cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +#### 1.6.0 (2026-06-04) + +##### New Features + +* **bank-accounts:** Add `descriptor_code` support to bank account verification and expose `microdeposit_type` in bank account responses ([BILL-5592](https://lobsters.atlassian.net/browse/BILL-5592)) + #### 1.3.0 (2021-08-25) ##### New Features diff --git a/config/dev.exs b/config/dev.exs index becde76..138c09a 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -1 +1,12 @@ import Config + +# Cloudflare WARP does TLS inspection. Tell hackney to trust the system CA +# bundle (which already includes the Cloudflare Gateway CA via Kandji/Keychain) +# so SSL verification succeeds for outbound HTTPS requests. +config :lob_elixir, + hackney_ssl_options: fn -> + [ + verify: :verify_peer, + cacerts: :public_key.cacerts_get() + ] + end diff --git a/config/test.exs b/config/test.exs index 49f4e00..6fd96a9 100644 --- a/config/test.exs +++ b/config/test.exs @@ -3,5 +3,16 @@ import Config config :lob_elixir, api_key: System.get_env("LOB_API_TEST_KEY") +# Cloudflare WARP does TLS inspection. Tell hackney to trust the system CA +# bundle (which already includes the Cloudflare Gateway CA via Kandji/Keychain) +# so SSL verification succeeds for outbound HTTPS requests. +config :lob_elixir, + hackney_ssl_options: fn -> + [ + verify: :verify_peer, + cacerts: :public_key.cacerts_get() + ] + end + # config :pre_commit, # commands: ["test", "credo", "dialyzer", "coveralls"] diff --git a/lib/lob/client.ex b/lib/lob/client.ex index e3e24dc..ab8d61c 100644 --- a/lib/lob/client.ex +++ b/lib/lob/client.ex @@ -110,7 +110,13 @@ defmodule Lob.Client do @spec build_options(String.t()) :: Keyword.t() defp build_options(api_key \\ api_key()) do - [hackney: [basic_auth: {api_key, ""}], recv_timeout: :infinity] + ssl_opts = + case Application.get_env(:lob_elixir, :hackney_ssl_options, []) do + fun when is_function(fun, 0) -> fun.() + opts -> opts + end + + [hackney: [basic_auth: {api_key, ""}, ssl_options: ssl_opts], recv_timeout: :infinity] end @spec default_headers(String.t() | nil) :: %{String.t() => String.t()} diff --git a/lib/lob/util.ex b/lib/lob/util.ex index 863780b..b114a0e 100644 --- a/lib/lob/util.ex +++ b/lib/lob/util.ex @@ -22,8 +22,15 @@ defmodule Lob.Util do multipart request body. ## Example - iex> Lob.Util.build_body(%{description: "body", to: %{name: "Larry", species: "Lobster"}, front: %{local_path: "a/b/c"}}) - {:multipart, [{"description", "body"}, {:file, "a/b/c", {"form-data", [name: "front", filename: "a/b/c"]}, []}, {"to[name]", "Larry"}, {"to[species]", "Lobster"}]} + iex> {:multipart, parts} = Lob.Util.build_body(%{description: "body", to: %{name: "Larry", species: "Lobster"}, front: %{local_path: "a/b/c"}}) + iex> Enum.member?(parts, {"description", "body"}) + true + iex> Enum.member?(parts, {"to[name]", "Larry"}) + true + iex> Enum.member?(parts, {"to[species]", "Lobster"}) + true + iex> Enum.member?(parts, {:file, "a/b/c", {"form-data", [name: "front", filename: "a/b/c"]}, []}) + true """ @spec build_body(map) :: {:multipart, list} def build_body(body) when is_map(body) do diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..3be500f --- /dev/null +++ b/mise.toml @@ -0,0 +1,3 @@ +[tools] +elixir = "1.18.4-otp-27" +erlang = "27.3.4.12" diff --git a/mix.exs b/mix.exs index 322434b..d04c8e3 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Lob.Mixfile do use Mix.Project @source_url "https://github.com/lob/lob-elixir" - @version "1.5.0" + @version "1.6.0" def project do [ @@ -20,7 +20,6 @@ defmodule Lob.Mixfile do flags: [ :error_handling, :no_opaque, - :race_conditions, :unknown ], ignore_warnings: ".dialyzer_ignore" @@ -43,7 +42,7 @@ defmodule Lob.Mixfile do [ {:bypass, "~> 2.1", only: :test}, {:confex, "~> 3.5.0"}, - {:credo, "~> 1.5.6", only: [:dev, :test], runtime: false}, + {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.1", only: [:dev, :test], runtime: false}, {:ex_doc, ">= 0.0.0", only: [:dev], runtime: false}, {:excoveralls, "~> 0.14", only: :test}, diff --git a/mix.lock b/mix.lock index 116f9b1..2ff7de3 100644 --- a/mix.lock +++ b/mix.lock @@ -1,41 +1,41 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"}, - "certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"}, - "confex": {:hex, :confex, "3.5.0", "163857c73dd8f88a3815663f4bc00bee1b9c65daf40aa6e0d6ef272757fd22c7", [:mix], [], "hexpm", "34a9e31230c7fbb3dbe60db00341d0c84ee44ba3caf84b498f501c0bc8563570"}, - "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, + "certifi": {:hex, :certifi, "2.15.0", "0e6e882fcdaaa0a5a9f2b3db55b1394dba07e8d6d9bcad08318fb604c6839712", [:rebar3], [], "hexpm", "b147ed22ce71d72eafdad94f055165c1c182f61a2ff49df28bcc71d1d5b94a60"}, + "confex": {:hex, :confex, "3.5.1", "c29ea741715de06afe6294ea2e127ee7a54382f2b33656b9ed7eedf3e7b6fcaf", [:mix], [], "hexpm", "c72824a267edc96c09a35f6556f48c139d00393dd1b726b18faeb8efee62c0b0"}, + "cowboy": {:hex, :cowboy, "2.15.0", "9cfe86ed7117bf045e10adbedb0170af7be57f2a3637e7be143433d8dd267396", [:make, :rebar3], [{:cowlib, ">= 2.16.0 and < 3.0.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, ">= 1.8.0 and < 3.0.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "179fb65140fb440a17b767ad53b755081506f9596c4db5c49c0396d8c8643668"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, - "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, - "credo": {:hex, :credo, "1.5.6", "e04cc0fdc236fefbb578e0c04bd01a471081616e741d386909e527ac146016c6", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "4b52a3e558bd64e30de62a648518a5ea2b6e3e5d2b164ef5296244753fc7eb17"}, - "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.19", "de0d033d5ff9fc396a24eadc2fcf2afa3d120841eb3f1004d138cbf9273210e8", [:mix], [], "hexpm", "527ab6630b5c75c3a3960b75844c314ec305c76d9899bb30f71cb85952a9dc45"}, - "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_doc": {:hex, :ex_doc, "0.27.3", "d09ed7ab590b71123959d9017f6715b54a448d76b43cf909eb0b2e5a78a977b2", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "ee60b329d08195039bfeb25231a208749be4f2274eae42ce38f9be0538a2f2e6"}, - "excoveralls": {:hex, :excoveralls, "0.14.3", "d17dc249ad32e469afd2bc656b58e810109d4367ec6bd467bed57a84dc4a3e02", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "b5aecdfdcf48e9d5e1c210841589b30981a5e7e66055cb8691a6f90b1601c108"}, + "cowlib": {:hex, :cowlib, "2.16.1", "318d385d55f657e9a5005838c4e426e13dcd724a691438384b6165a69687e531", [:make, :rebar3], [], "hexpm", "58f1e425a9e04176f1d30e20116f57c4e90ef0e187552e9741c465bdf4044f70"}, + "credo": {:hex, :credo, "1.7.18", "5c5596bf7aedf9c8c227f13272ac499fe8eae6237bd326f2f07dfc173786f042", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "a189d164685fd945809e862fe76a7420c4398fa288d76257662aecb909d6b3e5"}, + "dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"}, + "erlex": {:hex, :erlex, "0.2.9", "7debbbaa9f4f368b8cd648983e0f1d7963028508e9c59e9d4ed504e94ef52a55", [:mix], [], "hexpm", "8cfffc0ec7159e6d73de2ab28a588064de80f88b2798d5cbe4482cbbc200178b"}, + "ex_doc": {:hex, :ex_doc, "0.40.3", "4a972ffe64bc07dc605af487e98fc19b72a4185f55ca031b94c0552d6071c1d9", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "2756e357742fecd9749b489b85d67c9ce99c465f2e75728d9e6dc8d704b973de"}, + "excoveralls": {:hex, :excoveralls, "0.18.5", "e229d0a65982613332ec30f07940038fe451a2e5b29bce2a5022165f0c9b157e", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "523fe8a15603f86d64852aab2abe8ddbd78e68579c8525ae765facc5eae01562"}, "exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "32e95820a97cffea67830e91514a2ad53b888850442d6d395f53a1ac60c82e07"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "hackney": {:hex, :hackney, "1.18.0", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"}, - "httpoison": {:hex, :httpoison, "1.8.0", "6b85dea15820b7804ef607ff78406ab449dd78bed923a49c7160e1886e987a3d", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "28089eaa98cf90c66265b6b5ad87c59a3729bea2e74e9d08f9b51eb9729b3c3a"}, - "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, - "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, + "file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"}, + "hackney": {:hex, :hackney, "1.25.0", "390e9b83f31e5b325b9f43b76e1a785cbdb69b5b6cd4e079aa67835ded046867", [:rebar3], [{:certifi, "~> 2.15.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.4", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "7209bfd75fd1f42467211ff8f59ea74d6f2a9e81cbcee95a56711ee79fd6b1d4"}, + "httpoison": {:hex, :httpoison, "1.8.2", "9eb9c63ae289296a544842ef816a85d881d4a31f518a0fec089aaa744beae290", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "2bb350d26972e30c96e2ca74a1aaf8293d61d0742ff17f01e0279fef11599921"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, + "jason": {:hex, :jason, "1.4.5", "2e3a008590b0b8d7388c20293e9dcc9cf3e5d642fd2a114e4cbbb52e595d940a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b0c823996102bcd0239b3c2444eb00409b72f6a140c1950bc8b457d836b30684"}, "json": {:hex, :json, "1.4.1", "8648f04a9439765ad449bc56a3ff7d8b11dd44ff08ffcdefc4329f7c93843dfa", [:mix], [], "hexpm", "9abf218dbe4ea4fcb875e087d5f904ef263d012ee5ed21d46e9dbca63f053d16"}, "jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"}, - "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, + "makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"}, + "makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.1.0", "835f7e60792e08824cda445639555d7bf1bbbddb1b60b306e33cb6f6db24dc74", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "1cd6780fb1dd1a03979abaed0fe82712b0625118fd5257d3ebbf73f960c73c3c"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"}, - "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, - "plug": {:hex, :plug, "1.12.1", "645678c800601d8d9f27ad1aebba1fdb9ce5b2623ddb961a074da0b96c35187d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d57e799a777bc20494b784966dc5fbda91eb4a09f571f76545b72a634ce0d30b"}, - "plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"}, - "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, + "mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"}, + "mimerl": {:hex, :mimerl, "1.5.0", "f35aca6f23242339b3666e0ac0702379e362b469d0aea167f6cc713547e777ed", [:rebar3], [], "hexpm", "db648ce065bae14ea84ca8b5dd123f42f49417cef693541110bf6f9e9be9ecc4"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"}, + "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, + "plug": {:hex, :plug, "1.19.2", "e4950525b22c6789dfb38a3f95d47171ba159da3fc5a33be9643b43d5e8adb98", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b6fce20a56af5e60fa5dfecf3f907bb98ec981be43c79a3809a499bc3d133de0"}, + "plug_cowboy": {:hex, :plug_cowboy, "2.8.1", "5aa391a5e8d1ac3192e36a3bcaff12b5fd6ef6c7e29b53a38e63a860783e77d0", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "4c200288673d5bc86a0ab7dc6a2a069176a74e5d573ef62740a1c517458a5f26"}, + "plug_crypto": {:hex, :plug_crypto, "2.1.1", "19bda8184399cb24afa10be734f84a16ea0a2bc65054e23a62bb10f06bc89491", [:mix], [], "hexpm", "6470bce6ffe41c8bd497612ffde1a7e4af67f36a15eea5f921af71cf3e11247c"}, "poison": {:hex, :poison, "5.0.0", "d2b54589ab4157bbb82ec2050757779bfed724463a544b6e20d79855a9e43b24", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "11dc6117c501b80c62a7594f941d043982a1bd05a1184280c0d9166eb4d8d3fc"}, "pre_commit": {:hex, :pre_commit, "0.3.4", "e2850f80be8090d50ad8019ef2426039307ff5dfbe70c736ad0d4d401facf304", [:mix], [], "hexpm", "16f684ba4f1fed1cba6b19e082b0f8d696e6f1c679285fedf442296617ba5f4e"}, - "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, - "telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, + "ranch": {:hex, :ranch, "1.8.1", "208169e65292ac5d333d6cdbad49388c1ae198136e4697ae2f474697140f201c", [:make, :rebar3], [], "hexpm", "aed58910f4e21deea992a67bf51632b6d60114895eb03bb392bb733064594dd0"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, + "telemetry": {:hex, :telemetry, "1.4.2", "a0cb522801dffb1c49fe6e30561badffc7b6d0e180db1300df759faa22062855", [:rebar3], [], "hexpm", "928f6495066506077862c0d1646609eed891a4326bee3126ba54b60af61febb1"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.1", "a48703a25c170eedadca83b11e88985af08d35f37c6f664d6dcfb106a97782fc", [:rebar3], [], "hexpm", "b3a917854ce3ae233619744ad1e0102e05673136776fb2fa76234f3e03b23642"}, "uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"}, } diff --git a/test/lob/address_test.exs b/test/lob/address_test.exs index fbec9d0..3ebf30a 100644 --- a/test/lob/address_test.exs +++ b/test/lob/address_test.exs @@ -63,7 +63,7 @@ defmodule Lob.AddressTest do {:ok, created_address, headers} = Address.create(sample_address) assert created_address.name == String.upcase(sample_address.name) - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates an address with metadata", %{sample_address: sample_address} do @@ -73,7 +73,7 @@ defmodule Lob.AddressTest do |> Address.create() assert created_address.name == String.upcase(sample_address.name) - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end end diff --git a/test/lob/bank_account_test.exs b/test/lob/bank_account_test.exs index 168bafb..a03e24d 100644 --- a/test/lob/bank_account_test.exs +++ b/test/lob/bank_account_test.exs @@ -54,7 +54,7 @@ defmodule Lob.BankAccountTest do {:ok, created_bank_account, headers} = BankAccount.create(sample_bank_account) assert created_bank_account.account_number == sample_bank_account.account_number - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a bank account with metadata", %{sample_bank_account: sample_bank_account} do @@ -64,7 +64,7 @@ defmodule Lob.BankAccountTest do |> BankAccount.create() assert created_bank_account.account_number == sample_bank_account.account_number - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end end @@ -79,7 +79,7 @@ defmodule Lob.BankAccountTest do end describe "verify/3" do - test "verifies a bank account", %{sample_bank_account: sample_bank_account} do + test "verifies a bank account with amounts", %{sample_bank_account: sample_bank_account} do {:ok, created_bank_account, _headers} = BankAccount.create(sample_bank_account) {:ok, verified_bank_account, _headers} = @@ -88,5 +88,26 @@ defmodule Lob.BankAccountTest do assert created_bank_account.id == verified_bank_account.id assert verified_bank_account.verified == true end + + test "verifies a bank account with descriptor_code", %{sample_bank_account: sample_bank_account} do + {:ok, created_bank_account, _headers} = BankAccount.create(sample_bank_account) + on_exit(fn -> BankAccount.delete(created_bank_account.id) end) + + {:ok, verified_bank_account, _headers} = + BankAccount.verify(created_bank_account.id, %{descriptor_code: "SM11AA"}) + + assert created_bank_account.id == verified_bank_account.id + end + end + + describe "retrieve/2 microdeposit_type" do + test "bank account response includes microdeposit_type field", %{sample_bank_account: sample_bank_account} do + {:ok, created_bank_account, _headers} = BankAccount.create(sample_bank_account) + on_exit(fn -> BankAccount.delete(created_bank_account.id) end) + + {:ok, retrieved_bank_account, _headers} = BankAccount.retrieve(created_bank_account.id) + assert Map.has_key?(retrieved_bank_account, :microdeposit_type) + assert retrieved_bank_account.microdeposit_type in ["amounts", "descriptor_code", nil] + end end end diff --git a/test/lob/check_test.exs b/test/lob/check_test.exs index a6952a7..af31098 100644 --- a/test/lob/check_test.exs +++ b/test/lob/check_test.exs @@ -118,7 +118,7 @@ defmodule Lob.CheckTest do }) assert created_check.description == sample_check.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a check with address params", %{ @@ -138,7 +138,7 @@ defmodule Lob.CheckTest do }) assert created_check.description == sample_check.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a check with logo, attachment and check bottom as URL", %{ @@ -163,7 +163,7 @@ defmodule Lob.CheckTest do }) assert created_check.description == sample_check.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a check with logo as PNG and attachment and check bottom as PDF", %{ @@ -187,7 +187,7 @@ defmodule Lob.CheckTest do }) assert created_check.description == sample_check.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a check with an idempotency key", %{ @@ -253,7 +253,7 @@ defmodule Lob.CheckTest do }) assert created_check.description == sample_check.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end end diff --git a/test/lob/letter_test.exs b/test/lob/letter_test.exs index 89bd43f..81bfa91 100644 --- a/test/lob/letter_test.exs +++ b/test/lob/letter_test.exs @@ -101,7 +101,7 @@ defmodule Lob.LetterTest do }) assert created_letter.description == sample_letter.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a letter with address params", %{ @@ -118,7 +118,7 @@ defmodule Lob.LetterTest do }) assert created_letter.description == sample_letter.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a letter with file as PDF", %{ @@ -137,7 +137,7 @@ defmodule Lob.LetterTest do }) assert created_letter.description == sample_letter.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a letter with an idempotency key", %{ @@ -199,7 +199,7 @@ defmodule Lob.LetterTest do }) assert created_letter.description == sample_letter.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end end diff --git a/test/lob/postcard_test.exs b/test/lob/postcard_test.exs index ae14c88..f528436 100644 --- a/test/lob/postcard_test.exs +++ b/test/lob/postcard_test.exs @@ -96,7 +96,7 @@ defmodule Lob.PostcardTest do }) assert created_postcard.description == sample_postcard.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a postcard with to address params", %{ @@ -112,7 +112,7 @@ defmodule Lob.PostcardTest do }) assert created_postcard.description == sample_postcard.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a postcard with from address params", %{ @@ -131,7 +131,7 @@ defmodule Lob.PostcardTest do }) assert created_postcard.description == sample_postcard.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a postcard with front and back as urls", %{ @@ -149,7 +149,7 @@ defmodule Lob.PostcardTest do }) assert created_postcard.description == sample_postcard.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a postcard with front and back as PDFs", %{ @@ -167,7 +167,7 @@ defmodule Lob.PostcardTest do }) assert created_postcard.description == sample_postcard.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a postcard with an idempotency key", %{ @@ -231,7 +231,7 @@ defmodule Lob.PostcardTest do }) assert created_postcard.description == sample_postcard.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end end diff --git a/test/lob/self_mailer_test.exs b/test/lob/self_mailer_test.exs index 453387f..7db09e1 100644 --- a/test/lob/self_mailer_test.exs +++ b/test/lob/self_mailer_test.exs @@ -88,7 +88,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a self mailer with to address params", %{ @@ -104,7 +104,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a self mailer with from address params", %{ @@ -124,7 +124,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a self mailer with outside and inside as urls", %{ @@ -144,7 +144,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a self mailer with outside and inside as PDFs", %{ @@ -165,7 +165,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a 12x9 self mailer with outside and inside as PDFs", %{ @@ -184,7 +184,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end test "creates a self mailer with an idempotency key", %{ @@ -248,7 +248,7 @@ defmodule Lob.SelfMailerTest do }) assert created_self_mailer.description == sample_self_mailer.description - assert Enum.member?(headers, {"X-Rate-Limit-Limit", "150"}) + assert Enum.member?(headers, {"x-rate-limit-limit", "150"}) end end diff --git a/test/lob/us_zip_lookup_test.exs b/test/lob/us_zip_lookup_test.exs index 1f26b8c..094b4c8 100644 --- a/test/lob/us_zip_lookup_test.exs +++ b/test/lob/us_zip_lookup_test.exs @@ -5,13 +5,10 @@ defmodule Lob.USZipLookupTest do describe "lookup/2" do test "lookup a US zip code" do - zip_code = "94107" + {:ok, result, _headers} = USZipLookup.lookup(%{zip_code: "94107"}) - {:ok, result, _headers} = USZipLookup.lookup(%{zip_code: zip_code}) - - assert result.zip_code == zip_code assert result.zip_code_type == "standard" - assert length(result.cities) == 1 + assert length(result.cities) >= 1 end end end