omise v0.1.3 Omise.Cards

Provides Cards API interfaces.

Summary

Functions

Destroy a card

List all cards that belongs to the customer

Retrieve a card

Functions

destroy(customer, card)

Specs

destroy(Omise.Customer.t, Omise.Card.t) ::
  {:ok, Omise.Card.t} |
  {:error, Omise.Error.t}

Destroy a card.

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

Examples

{:ok, customer} = Omise.Customers.retrieve("cust_test_520j6g67py52xa7qbu2")
{:ok, card} = customer |> Omise.Cards.retrieve("card_test_520j6g4rxrmurw16b2d")
{:ok, updated_card} = customer |> Omise.Cards.destroy(card)
list(customer, params \\ [])

Specs

list(Omise.Customer.t, Keyword.t) ::
  {:ok, [Omise.Card.t]} |
  {:error, Omise.Error.t}

List all cards that belongs to the customer.

Returns {:ok, cards} 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.
  • order - (optional, default: chronological) The order of the list returned.

Examples

{:ok, customer} = Omise.Customers.retrieve("cust_test_520j6g67py52xa7qbu2")
{:ok, cards} = customer |> Omise.Cards.list
retrieve(customer, id)

Specs

retrieve(Omise.Customer.t, String.t) ::
  {:ok, Omise.Card.t} |
  {:error, Omise.Error.t}

Retrieve a card.

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

Examples

{:ok, customer} = Omise.Customers.retrieve("cust_test_520j6g67py52xa7qbu2")
{:ok, card} = customer |> Omise.Cards.retrieve("card_test_520j6g4rxrmurw16b2d")
update(customer, card, params)

Specs

Update a card.

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

Request Parameters:

  • name - (optional) The cardholder name as printed on the card.
  • expiration_month - (optional) The expiration month printed on the card.
  • expiration_year - (optional) The expiration year printed on the card in the format YYYY.
  • postal_code - (optional) The postal code from the city where the card was issued.
  • city - (optional) The city where the card was issued.

Examples

{:ok, customer} = Omise.Customers.retrieve("cust_test_520j6g67py52xa7qbu2")
{:ok, card} = customer |> Omise.Cards.retrieve("card_test_520j6g4rxrmurw16b2d")
{:ok, updated_card} = customer |> Omise.Cards.update(card, name: "George Ezra", city: "London")