Class: Io::Flow::V0::Models::CardErrorCode

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ CardErrorCode

Returns a new instance of CardErrorCode.



6703
6704
6705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6703

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6701
6702
6703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6701

def value
  @value
end

Class Method Details

.ALLObject



6723
6724
6725
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6723

def CardErrorCode.ALL
  @@all ||= [CardErrorCode.invalid_address, CardErrorCode.invalid_name, CardErrorCode.invalid_number, CardErrorCode.invalid_expiration, CardErrorCode.avs, CardErrorCode.cvv, CardErrorCode.fraud, CardErrorCode.unknown]
end

.apply(value) ⇒ Object

Returns the instance of CardErrorCode for this value, creating a new instance for an unknown value



6708
6709
6710
6711
6712
6713
6714
6715
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6708

def CardErrorCode.apply(value)
  if value.instance_of?(CardErrorCode)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || CardErrorCode.new(value))
  end
end

.avsObject

Declined due to avs mismatch



6748
6749
6750
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6748

def CardErrorCode.avs
  @@_avs ||= CardErrorCode.new('avs')
end

.cvvObject

Declined due to cvv mismatch



6753
6754
6755
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6753

def CardErrorCode.cvv
  @@_cvv ||= CardErrorCode.new('cvv')
end

.fraudObject

Declined due to suspected fraud



6758
6759
6760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6758

def CardErrorCode.fraud
  @@_fraud ||= CardErrorCode.new('fraud')
end

.from_string(value) ⇒ Object

Returns the instance of CardErrorCode for this value, or nil if not found



6718
6719
6720
6721
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6718

def CardErrorCode.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  CardErrorCode.ALL.find { |v| v.value == value }
end

.invalid_addressObject

Invalid billing address



6728
6729
6730
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6728

def CardErrorCode.invalid_address
  @@_invalid_address ||= CardErrorCode.new('invalid_address')
end

.invalid_expirationObject

Invalid expiration date



6743
6744
6745
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6743

def CardErrorCode.invalid_expiration
  @@_invalid_expiration ||= CardErrorCode.new('invalid_expiration')
end

.invalid_nameObject

Invalid cardholder name



6733
6734
6735
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6733

def CardErrorCode.invalid_name
  @@_invalid_name ||= CardErrorCode.new('invalid_name')
end

.invalid_numberObject

Invalid payment number



6738
6739
6740
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6738

def CardErrorCode.invalid_number
  @@_invalid_number ||= CardErrorCode.new('invalid_number')
end

.unknownObject

Declined due to another reason (details not known)



6763
6764
6765
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6763

def CardErrorCode.unknown
  @@_unknown ||= CardErrorCode.new('unknown')
end

Instance Method Details

#to_hashObject



6767
6768
6769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6767

def to_hash
  value
end