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.



7089
7090
7091
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7089

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7087
7088
7089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7087

def value
  @value
end

Class Method Details

.ALLObject



7109
7110
7111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7109

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



7094
7095
7096
7097
7098
7099
7100
7101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7094

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



7134
7135
7136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7134

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

.cvvObject

Declined due to cvv mismatch



7139
7140
7141
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7139

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

.fraudObject

Declined due to suspected fraud



7144
7145
7146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7144

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



7104
7105
7106
7107
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7104

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



7114
7115
7116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7114

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

.invalid_expirationObject

Invalid expiration date



7129
7130
7131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7129

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

.invalid_nameObject

Invalid cardholder name



7119
7120
7121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7119

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

.invalid_numberObject

Invalid payment number



7124
7125
7126
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7124

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

.unknownObject

Declined due to another reason (details not known)



7149
7150
7151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7149

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

Instance Method Details

#to_hashObject



7153
7154
7155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7153

def to_hash
  value
end