Class: Io::Flow::V0::Models::PaymentReversalForm

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

Overview

Releases the remaining uncaptured authorization hold from the payment request. The reversal will automatically cancel all funds that have not yet been captured - you cannot issue a partial reversal, but you can partially capture an authorization, then issue a reversal to cancel the remaining balance.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PaymentReversalForm

Returns a new instance of PaymentReversalForm.



59012
59013
59014
59015
59016
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59012

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.



59010
59011
59012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59010

def amount
  @amount
end

#currencyObject (readonly)

Returns the value of attribute currency.



59010
59011
59012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59010

def currency
  @currency
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



59022
59023
59024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59022

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

#to_hashObject



59026
59027
59028
59029
59030
59031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59026

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

#to_jsonObject



59018
59019
59020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59018

def to_json
  JSON.dump(to_hash)
end