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.



6151
6152
6153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6151

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6149
6150
6151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6149

def value
  @value
end

Class Method Details

.ALLObject



6171
6172
6173
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6171

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



6156
6157
6158
6159
6160
6161
6162
6163
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6156

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



6196
6197
6198
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6196

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

.cvvObject

Declined due to cvv mismatch



6201
6202
6203
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6201

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

.fraudObject

Declined due to suspected fraud



6206
6207
6208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6206

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



6166
6167
6168
6169
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6166

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



6176
6177
6178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6176

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

.invalid_expirationObject

Invalid expiration date



6191
6192
6193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6191

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

.invalid_nameObject

Invalid cardholder name



6181
6182
6183
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6181

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

.invalid_numberObject

Invalid payment number



6186
6187
6188
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6186

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

.unknownObject

Declined due to another reason (details not known)



6211
6212
6213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6211

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

Instance Method Details

#to_hashObject



6215
6216
6217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6215

def to_hash
  value
end