Class: Io::Flow::V0::Models::RefundForm

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

Overview

Refund actually transfers funds. You can refund as many times as you’d like up until the total amount of the capture has been refunded.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundForm

Returns a new instance of RefundForm.



12699
12700
12701
12702
12703
12704
12705
12706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12699

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:capture_id], 'RefundForm')
  @capture_id = HttpClient::Preconditions.assert_class('capture_id', opts.delete(:capture_id), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @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.



12697
12698
12699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12697

def amount
  @amount
end

#capture_idObject (readonly)

Returns the value of attribute capture_id.



12697
12698
12699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12697

def capture_id
  @capture_id
end

#currencyObject (readonly)

Returns the value of attribute currency.



12697
12698
12699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12697

def currency
  @currency
end

#keyObject (readonly)

Returns the value of attribute key.



12697
12698
12699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12697

def key
  @key
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12712
12713
12714
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12712

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

#to_hashObject



12716
12717
12718
12719
12720
12721
12722
12723
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12716

def to_hash
  {
    :capture_id => capture_id,
    :key => key,
    :amount => amount,
    :currency => currency
  }
end

#to_jsonObject



12708
12709
12710
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12708

def to_json
  JSON.dump(to_hash)
end