Class: Io::Flow::V0::Models::AuthorizationResult

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AuthorizationResult

Returns a new instance of AuthorizationResult.



23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23507

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))
  @action = (x = opts.delete(:action); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationResultAction) ? x : ::Io::Flow::V0::Models::AuthorizationResultAction.from_json(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)))
  @three_d_secure = (x = opts.delete(:three_d_secure); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ThreeDSecure) ? x : ::Io::Flow::V0::Models::ThreeDSecure.new(x)))
  @description = (x = opts.delete(:description); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationResultDescription) ? x : ::Io::Flow::V0::Models::AuthorizationResultDescription.new(x)))
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def action
  @action
end

#avsObject (readonly)

Returns the value of attribute avs.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def avs
  @avs
end

#cvvObject (readonly)

Returns the value of attribute cvv.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def cvv
  @cvv
end

#decline_codeObject (readonly)

Returns the value of attribute decline_code.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def decline_code
  @decline_code
end

#descriptionObject (readonly)

Returns the value of attribute description.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def description
  @description
end

#statusObject (readonly)

Returns the value of attribute status.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def status
  @status
end

#three_d_secureObject (readonly)

Returns the value of attribute three_d_secure.



23505
23506
23507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23505

def three_d_secure
  @three_d_secure
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23523
23524
23525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23523

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

#to_hashObject



23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23527

def to_hash
  {
    :status => status.value,
    :action => action.nil? ? nil : action.to_hash,
    :decline_code => decline_code.nil? ? nil : decline_code.value,
    :avs => avs.nil? ? nil : avs.to_hash,
    :cvv => cvv.nil? ? nil : cvv.to_hash,
    :three_d_secure => three_d_secure.nil? ? nil : three_d_secure.to_hash,
    :description => description.nil? ? nil : description.to_hash
  }
end

#to_jsonObject



23519
23520
23521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23519

def to_json
  JSON.dump(to_hash)
end