Omise.Recipient (omise v0.9.0)
Provides Recipient API interfaces.
Link to this section Summary
Functions
Create a recipient.
Destroy a recipient.
List all recipients.
List all transfer schedules for a given recipient.
Retrieve a recipient.
Search all the recipients.
Update a recipient.
Link to this section Types
Specs
t() :: %Omise.Recipient{
active: boolean(),
bank_account: Omise.BankAccount.t(),
created: String.t(),
default: boolean(),
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(),
schedule: String.t(),
tax_id: String.t(),
type: String.t(),
verified: boolean()
}
Link to this section Functions
create(params, opts \\ [])
Specs
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 \\ [])
Specs
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 \\ [])
Specs
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)
list_schedules(id, params \\ [], opts \\ [])
Specs
list_schedules(String.t(), Keyword.t(), Keyword.t()) :: {:ok, Omise.List.t()} | {:error, Omise.Error.t()}
List all transfer schedules for a given recipient.
Returns {:ok, schedules} 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_schedules("recp_test_556jkf7u174ptxuytac")
retrieve(id, opts \\ [])
Specs
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 \\ [])
Specs
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 \\ [])
Specs
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)