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.



10178
10179
10180
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10178

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10176
10177
10178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10176

def value
  @value
end

Class Method Details

.ALLObject



10198
10199
10200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10198

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



10183
10184
10185
10186
10187
10188
10189
10190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10183

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



10228
10229
10230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10228

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

.cvvObject

Declined due to cvv mismatch



10233
10234
10235
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10233

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

.fraudObject

Declined due to suspected fraud



10238
10239
10240
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10238

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



10193
10194
10195
10196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10193

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



10203
10204
10205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10203

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

.invalid_expirationObject

Invalid expiration date



10218
10219
10220
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10218

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

.invalid_nameObject

Invalid cardholder name



10208
10209
10210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10208

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

.invalid_numberObject

Invalid payment number



10213
10214
10215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10213

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

.invalid_token_typeObject

Cannot create a permanent card via an unauthorized request



10223
10224
10225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10223

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

.unknownObject

Declined due to another reason (details not known)



10243
10244
10245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10243

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

Instance Method Details

#to_hashObject



10247
10248
10249
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10247

def to_hash
  value
end