Class: Io::Flow::V0::Models::MerchantOfRecordAuthorizationForm

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

Overview

Creates an authorization for a transaction for which Flow is the merchant of record. In this case, you must provide your order number for a valid Flow order. An authorization is used to check and reserve funds w/ a given payment method. No funds are actually transferred; once you have you an authorization, you can capture up to the amount of the authorization

Instance Attribute Summary collapse

Attributes inherited from AuthorizationForm

#discriminator

Instance Method Summary collapse

Methods inherited from AuthorizationForm

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ MerchantOfRecordAuthorizationForm

Returns a new instance of MerchantOfRecordAuthorizationForm.



16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16289

def initialize(incoming={})
  super(:discriminator => AuthorizationForm::Types::MERCHANT_OF_RECORD_AUTHORIZATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:token, :order_number], 'MerchantOfRecordAuthorizationForm')
  @token = HttpClient::Preconditions.assert_class('token', opts.delete(:token), String)
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @cvv = (x = opts.delete(:cvv); x.nil? ? nil : HttpClient::Preconditions.assert_class('cvv', x, String))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
end

Instance Attribute Details

#attributes ⇒ Object (readonly)

Returns the value of attribute attributes.



16287
16288
16289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16287

def attributes
  @attributes
end

#cvv ⇒ Object (readonly)

Returns the value of attribute cvv.



16287
16288
16289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16287

def cvv
  @cvv
end

#ip ⇒ Object (readonly)

Returns the value of attribute ip.



16287
16288
16289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16287

def ip
  @ip
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



16287
16288
16289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16287

def key
  @key
end

#order_number ⇒ Object (readonly)

Returns the value of attribute order_number.



16287
16288
16289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16287

def order_number
  @order_number
end

#token ⇒ Object (readonly)

Returns the value of attribute token.



16287
16288
16289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16287

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16305
16306
16307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16305

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

#subtype_to_hash ⇒ Object



16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16309

def subtype_to_hash
  {
    :token => token,
    :order_number => order_number,
    :key => key,
    :cvv => cvv,
    :attributes => attributes.nil? ? nil : attributes,
    :ip => ip
  }
end

#to_json ⇒ Object



16301
16302
16303
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16301

def to_json
  JSON.dump(to_hash)
end