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 captured funds has been refunded. Note when creating a refund you can specify either an authorization id or a capture id (or both as long as they match).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundForm

Returns a new instance of RefundForm.



15276
15277
15278
15279
15280
15281
15282
15283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15276

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



15274
15275
15276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15274

def amount
  @amount
end

#authorization_idObject (readonly)

Returns the value of attribute authorization_id.



15274
15275
15276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15274

def authorization_id
  @authorization_id
end

#capture_idObject (readonly)

Returns the value of attribute capture_id.



15274
15275
15276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15274

def capture_id
  @capture_id
end

#currencyObject (readonly)

Returns the value of attribute currency.



15274
15275
15276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15274

def currency
  @currency
end

#keyObject (readonly)

Returns the value of attribute key.



15274
15275
15276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15274

def key
  @key
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15289
15290
15291
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15289

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

#to_hashObject



15293
15294
15295
15296
15297
15298
15299
15300
15301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15293

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

#to_jsonObject



15285
15286
15287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15285

def to_json
  JSON.dump(to_hash)
end