Class: Io::Flow::V0::Models::AuthorizationResult
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AuthorizationResult
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Contains the result of the authorization. If an immediate response is not available, the state will be ‘pending’ - this usually indicates fraud review requires additional time / verification (or a potential network issue with the issuing bank).
Instance Attribute Summary collapse
-
#avs ⇒ Object
readonly
Returns the value of attribute avs.
-
#cvv ⇒ Object
readonly
Returns the value of attribute cvv.
-
#decline_code ⇒ Object
readonly
Returns the value of attribute decline_code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AuthorizationResult
constructor
A new instance of AuthorizationResult.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AuthorizationResult
Returns a new instance of AuthorizationResult.
10650 10651 10652 10653 10654 10655 10656 10657 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10650 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:status], 'AuthorizationResult') @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::AuthorizationStatus) ? x : ::Io::Flow::V0::Models::AuthorizationStatus.apply(x)) @decline_code = (x = opts.delete(:decline_code); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationDeclineCode) ? x : ::Io::Flow::V0::Models::AuthorizationDeclineCode.apply(x))) @avs = (x = opts.delete(:avs); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Avs) ? x : ::Io::Flow::V0::Models::Avs.new(x))) @cvv = (x = opts.delete(:cvv); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Cvv) ? x : ::Io::Flow::V0::Models::Cvv.new(x))) end |
Instance Attribute Details
#avs ⇒ Object (readonly)
Returns the value of attribute avs.
10648 10649 10650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10648 def avs @avs end |
#cvv ⇒ Object (readonly)
Returns the value of attribute cvv.
10648 10649 10650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10648 def cvv @cvv end |
#decline_code ⇒ Object (readonly)
Returns the value of attribute decline_code.
10648 10649 10650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10648 def decline_code @decline_code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10648 10649 10650 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10648 def status @status end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
10663 10664 10665 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10663 def copy(incoming={}) AuthorizationResult.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
10667 10668 10669 10670 10671 10672 10673 10674 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10667 def to_hash { :status => status.value, :decline_code => decline_code.nil? ? nil : decline_code.value, :avs => avs.nil? ? nil : avs.to_hash, :cvv => cvv.nil? ? nil : cvv.to_hash } end |
#to_json ⇒ Object
10659 10660 10661 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10659 def to_json JSON.dump(to_hash) end |