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

Instance Method Summary collapse

Methods inherited from AuthorizationForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ MerchantOfRecordAuthorizationForm

Returns a new instance of MerchantOfRecordAuthorizationForm.



13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13003

def initialize(incoming={})
  super(:name => 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

#attributesObject (readonly)

Returns the value of attribute attributes.



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

def attributes
  @attributes
end

#cvvObject (readonly)

Returns the value of attribute cvv.



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

def cvv
  @cvv
end

#ipObject (readonly)

Returns the value of attribute ip.



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

def order_number
  @order_number
end

#tokenObject (readonly)

Returns the value of attribute token.



13001
13002
13003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13001

def token
  @token
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13019
13020
13021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13019

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

#subtype_to_hashObject



13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13023

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

#to_jsonObject



13015
13016
13017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13015

def to_json
  JSON.dump(to_hash)
end