recurly v0.1.1 Recurly.Transaction

Module for handling transactions in Recurly. See the developer docs on transactions for more details

Summary

Functions

Creates an transaction from a changeset. Supports nesting the billing_info

Finds an transaction given a transaction uuid. Returns the transaction or an error

Generates the path to an transaction given the transaction code

Updates an transaction from a changeset

Functions

create(changeset)

Creates an transaction from a changeset. Supports nesting the billing_info

Parameters

  • changeset Keyword list changeset

Examples

alias Recurly.ValidationError

case Recurly.Transaction.create(transaction_code: "mytransactioncode") do
  {:ok, transaction} ->
    # created the transaction
  {:error, %ValidationError{errors: errors}} ->
    # will give you a list of validation errors
end
find(uuid)

Finds an transaction given a transaction uuid. Returns the transaction or an error.

Parameters

  • uuid String transaction uuid

Examples

alias Recurly.NotFoundError

case Recurly.Transaction.find("ialskdjaldkjsaldkjas") do
  {:ok, transaction} ->
    # Found the transaction
  {:error, %NotFoundError{}} ->
    # 404 transaction was not found
end
path(transaction_code)

Generates the path to an transaction given the transaction code

Parameters

  • transaction_code String transaction code
update(transaction, changeset)

Updates an transaction from a changeset

Parameters

  • transaction transaction resource struct
  • changeset Keyword list changeset representing the updates

Examples

alias Recurly.ValidationError

changes = [
  first_name: "Benjamin",
  last_name: nil
]

case Recurly.transaction.update(transaction, changes) do
  {:ok, transaction} ->
    # the updated transaction
  {:error, %ValidationError{errors: errors}} ->
    # will give you a list of validation errors
end