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.



7902
7903
7904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7902

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7900
7901
7902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7900

def value
  @value
end

Class Method Details

.ALLObject



7922
7923
7924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7922

def CardErrorCode.ALL
  @@all ||= [CardErrorCode.invalid_address, CardErrorCode.invalid_name, CardErrorCode.invalid_number, CardErrorCode.invalid_expiration, CardErrorCode.invalid_token_type, 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



7907
7908
7909
7910
7911
7912
7913
7914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7907

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



7952
7953
7954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7952

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

.cvvObject

Declined due to cvv mismatch



7957
7958
7959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7957

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

.fraudObject

Declined due to suspected fraud



7962
7963
7964
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7962

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



7917
7918
7919
7920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7917

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



7927
7928
7929
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7927

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

.invalid_expirationObject

Invalid expiration date



7942
7943
7944
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7942

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

.invalid_nameObject

Invalid cardholder name



7932
7933
7934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7932

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

.invalid_numberObject

Invalid payment number



7937
7938
7939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7937

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

.invalid_token_typeObject

Cannot create a permanent card via an unauthorized request



7947
7948
7949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7947

def CardErrorCode.invalid_token_type
  @@_invalid_token_type ||= CardErrorCode.new('invalid_token_type')
end

.unknownObject

Declined due to another reason (details not known)



7967
7968
7969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7967

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

Instance Method Details

#to_hashObject



7971
7972
7973
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7971

def to_hash
  value
end