Class: Io::Flow::V0::Models::CaptureDeclineCode

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

Returns a new instance of CaptureDeclineCode.



12136
12137
12138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12136

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12134
12135
12136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12134

def value
  @value
end

Class Method Details

.ALLObject



12156
12157
12158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12156

def CaptureDeclineCode.ALL
  @@all ||= [CaptureDeclineCode.expired, CaptureDeclineCode.insufficient_funds, CaptureDeclineCode.unknown]
end

.apply(value) ⇒ Object

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



12141
12142
12143
12144
12145
12146
12147
12148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12141

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

.expiredObject

Payment authorization has expired



12161
12162
12163
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12161

def CaptureDeclineCode.expired
  @@_expired ||= CaptureDeclineCode.new('expired')
end

.from_string(value) ⇒ Object

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



12151
12152
12153
12154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12151

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

.insufficient_fundsObject

The amount to capture exceeded the amount authorized and not yet captured



12166
12167
12168
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12166

def CaptureDeclineCode.insufficient_funds
  @@_insufficient_funds ||= CaptureDeclineCode.new('insufficient_funds')
end

.unknownObject

Failed due to another reason (details not known)



12171
12172
12173
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12171

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

Instance Method Details

#to_hashObject



12175
12176
12177
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12175

def to_hash
  value
end