Class: Io::Flow::V0::Models::CardAuthorizationForm
- Inherits:
-
AuthorizationForm
- Object
- AuthorizationForm
- Io::Flow::V0::Models::CardAuthorizationForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Similar to a merchant of record authorization form, but it allows card information to be included rather than tokenizing first. If the amount is $0, then
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#card ⇒ Object
readonly
Returns the value of attribute card.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#cvv ⇒ Object
readonly
Returns the value of attribute cvv.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
Attributes inherited from AuthorizationForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ CardAuthorizationForm
constructor
A new instance of CardAuthorizationForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from AuthorizationForm
Constructor Details
#initialize(incoming = {}) ⇒ CardAuthorizationForm
Returns a new instance of CardAuthorizationForm.
15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15052 def initialize(incoming={}) super(:discriminator => AuthorizationForm::Types::CARD_AUTHORIZATION_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:card], 'CardAuthorizationForm') @card = (x = opts.delete(:card); x.is_a?(::Io::Flow::V0::Models::CardAuthorizationData) ? x : ::Io::Flow::V0::Models::CardAuthorizationData.from_json(x)) @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', 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)) @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)) = (x = opts.delete(:options); x.nil? ? nil : HttpClient::Preconditions.assert_class('options', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AuthorizationOption) ? x : ::Io::Flow::V0::Models::AuthorizationOption.apply(x)) }) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def attributes @attributes end |
#card ⇒ Object (readonly)
Returns the value of attribute card.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def card @card end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def currency @currency end |
#cvv ⇒ Object (readonly)
Returns the value of attribute cvv.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def cvv @cvv end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def ip @ip end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
15050 15051 15052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15050 def order_number @order_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
15071 15072 15073 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15071 def copy(incoming={}) CardAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15075 def subtype_to_hash { :card => card.to_hash, :order_number => order_number, :amount => amount, :currency => currency, :key => key, :cvv => cvv, :attributes => attributes.nil? ? nil : attributes, :ip => ip, :options => .nil? ? nil : .map { |o| o.value } } end |
#to_json ⇒ Object
15067 15068 15069 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15067 def to_json JSON.dump(to_hash) end |