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.



8552
8553
8554
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8552

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8550
8551
8552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8550

def value
  @value
end

Class Method Details

.ALLObject



8572
8573
8574
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8572

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



8557
8558
8559
8560
8561
8562
8563
8564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8557

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



8602
8603
8604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8602

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

.cvvObject

Declined due to cvv mismatch



8607
8608
8609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8607

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

.fraudObject

Declined due to suspected fraud



8612
8613
8614
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8612

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



8567
8568
8569
8570
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8567

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



8577
8578
8579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8577

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

.invalid_expirationObject

Invalid expiration date



8592
8593
8594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8592

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

.invalid_nameObject

Invalid cardholder name



8582
8583
8584
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8582

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

.invalid_numberObject

Invalid payment number



8587
8588
8589
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8587

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

.invalid_token_typeObject

Cannot create a permanent card via an unauthorized request



8597
8598
8599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8597

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

.unknownObject

Declined due to another reason (details not known)



8617
8618
8619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8617

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

Instance Method Details

#to_hashObject



8621
8622
8623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8621

def to_hash
  value
end