View Source Dwolla.Utils (dwolla v1.0.3)

Utility functions.

Link to this section Summary

Functions

Encodes HTTP request.

Handles HTTP response from Dwolla.

Creates a idempotency header with an MD5 hash of the parameters submitted or provided binary value.

Converts request payload to Dwolla-friendly camel case.

Converts keys in Dwolla response to Elixir-friendly snake case.

Validates parameter payload against a list of required fields.

Link to this section Functions

Link to this function

encode_params(params, cred \\ %{})

View Source

Specs

encode_params(map(), map()) :: String.t()

Encodes HTTP request.

Link to this function

handle_resp(arg, schema)

View Source

Specs

handle_resp(
  {:ok, HTTPoison.Response.t()} | {:error, HTTPoison.Error.t()},
  atom()
) ::
  {:ok, any()} | {:error, HTTPoison.Error.t() | Dwolla.Errors.t() | any()}

Handles HTTP response from Dwolla.

Link to this function

idempotency_header(idempotency_key)

View Source

Specs

idempotency_header(map()) :: map()

Creates a idempotency header with an MD5 hash of the parameters submitted or provided binary value.

Converts request payload to Dwolla-friendly camel case.

Converts keys in Dwolla response to Elixir-friendly snake case.

Link to this function

validate_params(params, fields)

View Source

Specs

validate_params(map(), list()) :: :ok | :error

Validates parameter payload against a list of required fields.