View Source Dwolla.Customer (dwolla v1.0.3)

Functions for customers endpoint.

Link to this section Summary

Functions

Creates a customer.

Creates a customer beneficial owner.

Creates a customer funding source.

Creates an unverified customer.

Creates a verified customer.

Gets a customer by id.

List beneficial owners

Lists a customer's funding sources.

Searches customer by first name, last name and email. Results paginated.

Searchs a customer's transfers. Results paginated.

Suspends a customer.

Updates a customer's metadata.

Updates a customer to verified status.

Link to this section Types

Specs

error() :: HTTPoison.Error.t() | Dwolla.Errors.t() | atom() | tuple()

Specs

id() :: String.t()

Specs

location() :: %{id: String.t()}

Specs

params() :: %{required(atom()) => String.t() | integer() | map()}

Specs

t() :: %Dwolla.Customer{
  address1: String.t(),
  address2: String.t(),
  certify_beneficial_ownership: boolean(),
  city: String.t(),
  created: String.t(),
  email: String.t(),
  first_name: String.t(),
  id: String.t(),
  last_name: String.t(),
  phone: String.t(),
  postal_code: String.t(),
  state: String.t(),
  status: String.t(),
  type: String.t(),
  verify_beneficial_ownership: boolean()
}

Specs

token() :: String.t()

Link to this section Functions

Specs

create(token(), params()) :: {:ok, location()} | {:error, error()}

Creates a customer.

See Dwolla.Customer.create_unverified/2 and Dwolla.Customer.create_verified/2.

Link to this function

create_beneficial_owner(token, id, params)

View Source

Specs

create_beneficial_owner(token(), id(), params()) ::
  {:ok, location()} | {:error, error()}

Creates a customer beneficial owner.

Parameters

%{
  first_name: "John",
  last_name: "Smith",
  date_of_birth: "1900-01-01",
  ssn: "000-00-0000",
  address: %{
    address1: "1 Main St.",
    address2: "Apt 1", # optional
    city: "New York",
    state_province_region: "NY",
    postal_code: "10019",
    country: "US
  }
}
Link to this function

create_funding_source(token, id, params)

View Source

Specs

create_funding_source(token(), id(), params()) ::
  {:ok, location()} | {:error, error()}

Creates a customer funding source.

Parameters

%{
  routing_number: "222222226",
  account_number: "123456789",
  type: "checking",
  name: "Ben's checking"
}
Link to this function

create_unverified(token, params)

View Source

Specs

create_unverified(token(), params()) :: {:ok, location()} | {:error, error()}

Creates an unverified customer.

Validates payload for required fields before calling Dwolla API.

Parameters

%{first_name: "Steve", last_name: "Rogers", email: "cap@example.com"}
Link to this function

create_verified(token, params)

View Source

Specs

create_verified(token(), params()) :: {:ok, location()} | {:error, error()}

Creates a verified customer.

Validates payload for required fields before calling Dwolla API.

Parameters

%{
  first_name: "Steve",
  last_name: "Rogers",
  email: "cap@example.com",
  type: "personal",
  address1: "1600 Pennsylvania Ave",
  city: "Washington",
  state: "DC",
  postal_code: "20500",
  date_of_birth: "1918-07-04",
  ssn: "1776"
}

Specs

get(token(), id()) :: {:ok, t()} | {:error, error()}

Gets a customer by id.

Link to this function

list_beneficial_owners(token, id)

View Source

Specs

list_beneficial_owners(token(), id()) ::
  {:ok, [Dwolla.BeneficialOwner.t()]} | {:error, error()}

List beneficial owners

Link to this function

list_funding_sources(token, id, removed \\ true)

View Source

Specs

list_funding_sources(token(), id(), boolean()) ::
  {:ok, [Dwolla.FundingSource.t()]} | {:error, error()}

Lists a customer's funding sources.

Link to this function

search(token, params \\ %{})

View Source

Specs

search(token(), params()) :: {:ok, [t()]} | {:error, error()}

Searches customer by first name, last name and email. Results paginated.

Parameters (optional)

%{limit: 50, offset: 0, search: "Steve"}
Link to this function

search_transfers(token, id, params \\ %{})

View Source

Specs

search_transfers(token(), id(), params()) ::
  {:ok, %{transfers: [Dwolla.Transfer.t()], total: integer()}}
  | {:error, error()}

Searchs a customer's transfers. Results paginated.

Parameters

%{start_date: "2017-04-01", end_date: "2017-04-30", status: "pending"}

Specs

suspend(token(), id()) :: {:ok, t()} | {:error, error()}

Suspends a customer.

Link to this function

update(token, id, params)

View Source

Specs

update(token(), id(), params()) :: {:ok, t()} | {:error, error()}

Updates a customer's metadata.

Link to this function

verify(token, id, params)

View Source

Specs

verify(token(), id(), params()) :: {:ok, t()} | {:error, error()}

Updates a customer to verified status.

Parameters

%{
  first_name: "Steve",
  last_name: "Rogers",
  email: "cap@example.com",
  address1: "1600 Pennsylvania Ave",
  city: "Washington",
  state: "DC",
  postal_code: "20500",
  date_of_birth: "1918-07-04",
  ssn: "1776"
}