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.



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

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7147
7148
7149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7147

def value
  @value
end

Class Method Details

.ALLObject



7169
7170
7171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7169

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



7154
7155
7156
7157
7158
7159
7160
7161
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7154

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



7194
7195
7196
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7194

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

.cvvObject

Declined due to cvv mismatch



7199
7200
7201
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7199

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

.fraudObject

Declined due to suspected fraud



7204
7205
7206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7204

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



7164
7165
7166
7167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7164

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



7174
7175
7176
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7174

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

.invalid_expirationObject

Invalid expiration date



7189
7190
7191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7189

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

.invalid_nameObject

Invalid cardholder name



7179
7180
7181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7179

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

.invalid_numberObject

Invalid payment number



7184
7185
7186
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7184

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

.unknownObject

Declined due to another reason (details not known)



7209
7210
7211
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7209

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

Instance Method Details

#to_hashObject



7213
7214
7215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7213

def to_hash
  value
end