omise v0.4.2 Omise.Recipient

Provides Recipient API interfaces.

https://www.omise.co/recipients-api

Summary

Functions

Create a recipient

Destroy a recipient

List all recipients

Retrieve a recipient

Search all the recipients

Update a recipient

Types

t()
t() :: %Omise.Recipient{active: boolean, bank_account: Omise.BankAccount.t, created: String.t, deleted: boolean, description: String.t, email: String.t, failure_code: String.t, id: String.t, livemode: boolean, location: String.t, name: String.t, object: String.t, tax_id: String.t, type: String.t, verified: boolean}

Functions

create(params, opts \\ [])
create(Keyword.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Create a recipient.

Returns {:ok, recipient} if the request is successful, {:error, error} otherwise.

Request Parameters:

  • name - The recipient’s name.
  • email - (optional) The recipient’s email.
  • description - (optional) The recipient’s description.
  • type - Either individual or corporation.
  • tax_id - (optional) The recipient’s tax id.
  • bank_account - A valid bank account.

Examples

params = [
  name: "Nanna",
  email: "anna@omise.co",
  description: "Though the truth may vary, this ship will carry our bodies safe to shore",
  type: "individual",
  bank_account: [
    brand: "bbl",
    number: "1234567890",
    name: "Nanna"
  ]
]

Omise.Recipient.create(params)
destroy(id, opts \\ [])
destroy(String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Destroy a recipient.

Returns {:ok, recipient} if the request is successful, {:error, error} otherwise.

Examples

Omise.Recipient.destroy("recp_test_4z6p7e0m4k40txecj5o")
list(params \\ [], opts \\ [])
list(Keyword.t, Keyword.t) ::
  {:ok, Omise.List.t} |
  {:error, Omise.Error.t}

List all recipients.

Returns {:ok, recipients} if the request is successful, {:error, error} otherwise.

Query Parameters:

  • offset - (optional, default: 0) The offset of the first record returned.
  • limit - (optional, default: 20, maximum: 100) The maximum amount of records returned.
  • from - (optional, default: 1970-01-01T00:00:00Z, format: ISO 8601) The UTC date and time limiting the beginning of returned records.
  • to - (optional, default: current UTC Datetime, format: ISO 8601) The UTC date and time limiting the end of returned records.

Examples

Omise.Recipient.list

Omise.Recipient.list(limit: 5)
retrieve(id, opts \\ [])
retrieve(String.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Retrieve a recipient.

Returns {:ok, recipient} if the request is successful, {:error, error} otherwise.

Examples

Omise.Recipient.retrieve("recp_test_4z6p7e0m4k40txecj5o")
search(params \\ [], opts \\ [])
search(Keyword.t, Keyword.t) ::
  {:ok, Omise.Search.t} |
  {:error, Omise.Error.t}

Search all the recipients.

Returns {:ok, recipients} if the request is successful, {:error, error} otherwise.

Query Parameters:

https://www.omise.co/search-query-and-filters

Examples

Omise.Recipient.search(filters: [kind: "individual"])

Omise.Recipient.search(query: "recp_235k46kl6ljl")
update(id, params, opts \\ [])
update(String.t, Keyword.t, Keyword.t) ::
  {:ok, t} |
  {:error, Omise.Error.t}

Update a recipient.

Returns {:ok, recipient} if the request is successful, {:error, error} otherwise.

Request Parameters:

  • name - The recipient’s name.
  • email - (optional) The recipient’s email.
  • description - (optional) The recipient’s description.
  • type - Either individual or corporation.
  • tax_id - (optional) The recipient’s tax id.
  • bank_account - A valid bank account.

Examples

params = [
  name: "Emma Stone",
  email: "emma@omise.co",
  bank_account: [
    brand: "kbank",
    name: "Emma Stone"
  ]
]

Omise.Recipient.update("recp_test_4z6p7e0m4k40txecj5oparams", params)