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.



10047
10048
10049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10047

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10045
10046
10047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10045

def value
  @value
end

Class Method Details

.ALLObject



10067
10068
10069
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10067

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



10052
10053
10054
10055
10056
10057
10058
10059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10052

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



10097
10098
10099
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10097

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

.cvvObject

Declined due to cvv mismatch



10102
10103
10104
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10102

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

.fraudObject

Declined due to suspected fraud



10107
10108
10109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10107

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



10062
10063
10064
10065
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10062

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



10072
10073
10074
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10072

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

.invalid_expirationObject

Invalid expiration date



10087
10088
10089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10087

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

.invalid_nameObject

Invalid cardholder name



10077
10078
10079
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10077

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

.invalid_numberObject

Invalid payment number



10082
10083
10084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10082

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

.invalid_token_typeObject

Cannot create a permanent card via an unauthorized request



10092
10093
10094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10092

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

.unknownObject

Declined due to another reason (details not known)



10112
10113
10114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10112

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

Instance Method Details

#to_hashObject



10116
10117
10118
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10116

def to_hash
  value
end