Class: Io::Flow::V0::Models::PaymentErrorCode

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) ⇒ PaymentErrorCode

Returns a new instance of PaymentErrorCode.



10156
10157
10158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10156

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10154
10155
10156
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10154

def value
  @value
end

Class Method Details

.ALLObject



10176
10177
10178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10176

def PaymentErrorCode.ALL
  @@all ||= [PaymentErrorCode.duplicate, PaymentErrorCode.invalid_amount, PaymentErrorCode.invalid_currency, PaymentErrorCode.invalid_method, PaymentErrorCode.invalid_order, PaymentErrorCode.invalid_customer, PaymentErrorCode.invalid_destination, PaymentErrorCode.unknown]
end

.apply(value) ⇒ Object

Returns the instance of PaymentErrorCode for this value, creating a new instance for an unknown value



10161
10162
10163
10164
10165
10166
10167
10168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10161

def PaymentErrorCode.apply(value)
  if value.instance_of?(PaymentErrorCode)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || PaymentErrorCode.new(value))
  end
end

.duplicateObject



10180
10181
10182
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10180

def PaymentErrorCode.duplicate
  @@_duplicate ||= PaymentErrorCode.new('duplicate')
end

.from_string(value) ⇒ Object

Returns the instance of PaymentErrorCode for this value, or nil if not found



10171
10172
10173
10174
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10171

def PaymentErrorCode.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  PaymentErrorCode.ALL.find { |v| v.value == value }
end

.invalid_amountObject

Amount is not valid (e.g. for merchant of record payments, the amount specified must match the order). This typically is handled by refreshing the order amount and reconfirming with the user as something has changed.



10187
10188
10189
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10187

def PaymentErrorCode.invalid_amount
  @@_invalid_amount ||= PaymentErrorCode.new('invalid_amount')
end

.invalid_currencyObject

Currency is either not known or invalid (e.g. for merchant of record payments, the currency specified must match the order).



10193
10194
10195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10193

def PaymentErrorCode.invalid_currency
  @@_invalid_currency ||= PaymentErrorCode.new('invalid_currency')
end

.invalid_customerObject

Customer information is invalid (e.g. email specified but not a valid email)



10208
10209
10210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10208

def PaymentErrorCode.invalid_customer
  @@_invalid_customer ||= PaymentErrorCode.new('invalid_customer')
end

.invalid_destinationObject

Destination/shipping address is not valid



10213
10214
10215
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10213

def PaymentErrorCode.invalid_destination
  @@_invalid_destination ||= PaymentErrorCode.new('invalid_destination')
end

.invalid_methodObject

Invalid payment method



10198
10199
10200
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10198

def PaymentErrorCode.invalid_method
  @@_invalid_method ||= PaymentErrorCode.new('invalid_method')
end

.invalid_orderObject

The specified order number was not found



10203
10204
10205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10203

def PaymentErrorCode.invalid_order
  @@_invalid_order ||= PaymentErrorCode.new('invalid_order')
end

.unknownObject

Failed due to another reason (details not known)



10218
10219
10220
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10218

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

Instance Method Details

#to_hashObject



10222
10223
10224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10222

def to_hash
  value
end