Class: Io::Flow::V0::Models::PaymentRefundForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Returns already captured funds back to the customer. You can refund as many times as you’d like up until the total captured amount has been refunded. Refunds are allowed up to one year after the capture (depending on the payment method) unless a dispute has been raised for a transaction.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PaymentRefundForm

Returns a new instance of PaymentRefundForm.



58547
58548
58549
58550
58551
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58547

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @amount = (x = opts.delete(:amount); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



58545
58546
58547
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58545

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



58545
58546
58547
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58545

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



58557
58558
58559
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58557

def copy(incoming={})
  PaymentRefundForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



58561
58562
58563
58564
58565
58566
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58561

def to_hash
  {
    :amount => amount.to_f.to_s,
    :currency => currency
  }
end

#to_jsonObject



58553
58554
58555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 58553

def to_json
  JSON.dump(to_hash)
end