gocardless v1.0.3 Gocardless.Behaviour.Refund behaviour

Link to this section Summary

Callbacks

Creates a new Refund

Gets a Refund based on their ID in GoCardless

Lists Refunds from GoCardless

Updates a Refund metadata based on their ID in GoCardless. Only the metadata parameter is allowed

Link to this section Callbacks

Link to this callback create_refund(map)
create_refund(map) :: tuple

Creates a new Refund

Examples

iex> params = %{
  refunds: %{
    amount: 100,
    total_amount_confirmation: 100,
    reference: "partial refund",
    links: %{
      payment: "PM000999999998"
    }
  }
}
iex> Gocardless.Client.create_refund(params)
{:ok,
 %{"refunds" => %{"amount" => 100, "created_at" => "2017-06-27T10:00:26.248Z",
     "currency" => "GBP", "id" => "RF000999999998",
     "links" => %{"payment" => "PM000999999998"}, "metadata" => %{},
     "reference" => "partial refund"}}}
Link to this callback get_refund(arg0)
get_refund(String.t) :: tuple

Gets a Refund based on their ID in GoCardless

Examples

iex> Gocardless.Client.get_refund("RF000999999998")
{:ok,
 %{"refunds" => %{"amount" => 100, "created_at" => "2017-06-27T10:00:26.248Z",
     "currency" => "GBP", "id" => "RF000999999998",
     "links" => %{"payment" => "PM000999999998"}, "metadata" => %{},
     "reference" => "partial refund"}}}
Link to this callback list_refunds(map)
list_refunds(map) :: tuple

Lists Refunds from GoCardless

Examples

iex> Gocardless.Client.list_refunds
{:ok,
 %{"meta" => %{"cursors" => %{"after" => nil, "before" => nil}, "limit" => 50},
   "refunds" => [%{"amount" => 100, "created_at" => "2017-06-27T10:00:26.248Z",
      "currency" => "GBP", "id" => "RF000999999998",
      "links" => %{"payment" => "PM000999999998"}, "metadata" => %{},
      "reference" => "partial refund"}]}}
Link to this callback update_refund(arg0, map)
update_refund(String.t, map) :: tuple

Updates a Refund metadata based on their ID in GoCardless. Only the metadata parameter is allowed.

Examples

iex> params = %{
  refunds: %{
    metadata: %{
      db_id: "1234"
    }
  }
}
iex> Gocardless.Client.update_refund("RF000999999998", params)
{:ok,
 %{"refunds" => %{"amount" => 100, "created_at" => "2017-06-27T10:00:26.248Z",
     "currency" => "GBP", "id" => "RF000999999998",
     "links" => %{"payment" => "PM000999999998"},
     "metadata" => %{"db_id" => "1234"}, "reference" => "partial refund"}}}