PinElixir.Refund

Responsible for refunding of charges and retreiving refund details

Summary

Functions

Retreives all refunds

Given a charge token, retreives associated refund(s)

Requests a full refund given a charge_token

Requests a partial refund given a charge_token

Functions

get()

Retreives all refunds

Returns a tuple

{:ok,
 %{pagination: %{count: 9, current: 1, next: nil, pages: 1, per_page: 25,
     previous: nil},
   refunds: [%{amount: 100, charge: "ch_lENRObt9AvXvuUszuq5FBA",
      created_at: "2015-11-15T08:50:55Z", currency: "AUD", error_message: nil,
      status_message: "Pending", success: nil,
      token: "rf_djFwf03PLpp4G7cGEr_5mg"},
    %{amount: 500, charge: "ch_NCoA7oBzrycXEPBTEUWNdQ",
      created_at: "2015-11-15T08:49:46Z", currency: "AUD", error_message: nil,
      status_message: "Pending", success: nil,
      token: "rf_HWV4-cB6UNlh_Tdc5ZaC8g"}]
    }
  }

OR

{:error, error_map}
get(charge_token)

Given a charge token, retreives associated refund(s)

Returns a tuple

{:ok,
 %{pagination: %{count: 1, current: 1, next: nil, pages: 1, per_page: 25,
     previous: nil},
   refunds: [%{amount: 100, charge: "ch_lENRObt9AvXvuUszuq5FBA",
      created_at: "2015-11-15T08:50:55Z", currency: "AUD", error_message: nil,
      status_message: "Pending", success: nil,
      token: "rf_djFwf03PLpp4G7cGEr_5mg"}]}}

OR

{:error, error_map}
request(charge_token)

Requests a full refund given a charge_token

Returns a tuple

{:ok,
 %{amount: 500, charge: "ch_NCoA7oBzrycXEPBTEUWNdQ",
   created_at: "2015-11-15T08:49:46Z", currency: "AUD", error_message: nil,
   status_message: "Pending", success: nil, token: "rf_HWV4-cB6UNlh_Tdc5ZaC8g"}}

OR

{:error, error_map}
request(charge_token, partial_amount)

Requests a partial refund given a charge_token

Returns a tuple

{:ok,
 %{amount: 100, charge: "ch_lENRObt9AvXvuUszuq5FBA",
   created_at: "2015-11-15T08:50:55Z", currency: "AUD", error_message: nil,
   status_message: "Pending", success: nil, token: "rf_djFwf03PLpp4G7cGEr_5mg"}}

OR

{:error, error_map}