class GoCardlessPro::Resources::Refund

Refund objects represent (partial) refunds of a [payment](core-endpoints-payments) back to the [customer](core-endpoints-customers).

GoCardless will notify you via a [webhook](appendix-webhooks) whenever a refund is created, and will update the `amount_refunded` property of the payment.

Attributes

amount[R]
created_at[R]
currency[R]
fx[R]
id[R]
metadata[R]
reference[R]
status[R]

Public Class Methods

new(object, response = nil) click to toggle source

Initialize a refund resource instance @param object [Hash] an object returned from the API

# File lib/gocardless_pro/resources/refund.rb, line 34
def initialize(object, response = nil)
  @object = object

  @amount = object['amount']
  @created_at = object['created_at']
  @currency = object['currency']
  @fx = object['fx']
  @id = object['id']
  @links = object['links']
  @metadata = object['metadata']
  @reference = object['reference']
  @status = object['status']
  @response = response
end

Public Instance Methods

api_response() click to toggle source
# File lib/gocardless_pro/resources/refund.rb, line 49
def api_response
  ApiResponse.new(@response)
end
to_h() click to toggle source

Provides the refund resource as a hash of all its readable attributes

# File lib/gocardless_pro/resources/refund.rb, line 59
def to_h
  @object
end