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.



11177
11178
11179
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11177

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11175
11176
11177
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11175

def value
  @value
end

Class Method Details

.ALLObject



11197
11198
11199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11197

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



11182
11183
11184
11185
11186
11187
11188
11189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11182

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



11227
11228
11229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11227

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

.cvvObject

Declined due to cvv mismatch



11232
11233
11234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11232

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

.fraudObject

Declined due to suspected fraud



11237
11238
11239
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11237

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



11192
11193
11194
11195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11192

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



11202
11203
11204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11202

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

.invalid_expirationObject

Invalid expiration date



11217
11218
11219
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11217

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

.invalid_nameObject

Invalid cardholder name



11207
11208
11209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11207

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

.invalid_numberObject

Invalid payment number



11212
11213
11214
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11212

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

.invalid_token_typeObject

Cannot create a permanent card via an unauthorized request



11222
11223
11224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11222

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

.unknownObject

Declined due to another reason (details not known)



11242
11243
11244
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11242

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

Instance Method Details

#to_hashObject



11246
11247
11248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11246

def to_hash
  value
end