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.



7365
7366
7367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7365

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7363
7364
7365
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7363

def value
  @value
end

Class Method Details

.ALLObject



7385
7386
7387
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7385

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



7370
7371
7372
7373
7374
7375
7376
7377
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7370

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



7410
7411
7412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7410

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

.cvvObject

Declined due to cvv mismatch



7415
7416
7417
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7415

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

.fraudObject

Declined due to suspected fraud



7420
7421
7422
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7420

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



7380
7381
7382
7383
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7380

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



7390
7391
7392
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7390

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

.invalid_expirationObject

Invalid expiration date



7405
7406
7407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7405

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

.invalid_nameObject

Invalid cardholder name



7395
7396
7397
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7395

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

.invalid_numberObject

Invalid payment number



7400
7401
7402
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7400

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

.unknownObject

Declined due to another reason (details not known)



7425
7426
7427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7425

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

Instance Method Details

#to_hashObject



7429
7430
7431
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7429

def to_hash
  value
end