Class: Io::Flow::V0::Models::VirtualCardCapture

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

Overview

Payment has been captured for the virtual credit card

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ VirtualCardCapture

Returns a new instance of VirtualCardCapture.



55257
55258
55259
55260
55261
55262
55263
55264
55265
55266
55267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55257

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :issuer, :virtual_card, :authorization, :amount, :currency, :created_at], 'VirtualCardCapture')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @issuer = (x = opts.delete(:issuer); x.is_a?(::Io::Flow::V0::Models::IssuerV1) ? x : ::Io::Flow::V0::Models::IssuerV1.new(x))
  @virtual_card = (x = opts.delete(:virtual_card); x.is_a?(::Io::Flow::V0::Models::VirtualCardReference) ? x : ::Io::Flow::V0::Models::VirtualCardReference.new(x))
  @authorization = (x = opts.delete(:authorization); x.is_a?(::Io::Flow::V0::Models::AuthorizationReference) ? x : ::Io::Flow::V0::Models::AuthorizationReference.new(x))
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def amount
  @amount
end

#authorizationObject (readonly)

Returns the value of attribute authorization.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def authorization
  @authorization
end

#created_atObject (readonly)

Returns the value of attribute created_at.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def id
  @id
end

#issuerObject (readonly)

Returns the value of attribute issuer.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def issuer
  @issuer
end

#virtual_cardObject (readonly)

Returns the value of attribute virtual_card.



55255
55256
55257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55255

def virtual_card
  @virtual_card
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



55273
55274
55275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55273

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

#to_hashObject



55277
55278
55279
55280
55281
55282
55283
55284
55285
55286
55287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55277

def to_hash
  {
    :id => id,
    :issuer => issuer.to_hash,
    :virtual_card => virtual_card.to_hash,
    :authorization => authorization.to_hash,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :created_at => created_at
  }
end

#to_jsonObject



55269
55270
55271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55269

def to_json
  JSON.dump(to_hash)
end