Class: Io::Flow::V0::Models::AuthorizationStatus

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

Returns a new instance of AuthorizationStatus.



8233
8234
8235
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8233

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8231
8232
8233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8231

def value
  @value
end

Class Method Details

.ALLObject



8253
8254
8255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8253

def AuthorizationStatus.ALL
  @@all ||= [AuthorizationStatus.pending, AuthorizationStatus.expired, AuthorizationStatus.authorized, AuthorizationStatus.review, AuthorizationStatus.declined, AuthorizationStatus.reversed]
end

.apply(value) ⇒ Object

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



8238
8239
8240
8241
8242
8243
8244
8245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8238

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

.authorizedObject

Authorization was successful



8271
8272
8273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8271

def AuthorizationStatus.authorized
  @@_authorized ||= AuthorizationStatus.new('authorized')
end

.declinedObject

Indicates the authorization has been declined by the issuing bank. See the authorization decline code for more details as to the reason for decline.



8284
8285
8286
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8284

def AuthorizationStatus.declined
  @@_declined ||= AuthorizationStatus.new('declined')
end

.expiredObject

Authorization has expired.



8266
8267
8268
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8266

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

.from_string(value) ⇒ Object

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



8248
8249
8250
8251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8248

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

.pendingObject

If an immediate response is not available, the state will be ‘pending’. For example, online payment methods like AliPay or PayPal will have a status of ‘pending’ until the user completes the payment. Pending authorizations expire if the user does not complete the payment in a timely fashion.



8261
8262
8263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8261

def AuthorizationStatus.pending
  @@_pending ||= AuthorizationStatus.new('pending')
end

.reversedObject

Indicates the authorization has been fully reversed. You can fully reverse an authorization up until the moment you capture funds; once you have captured funds you must create refunds.



8291
8292
8293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8291

def AuthorizationStatus.reversed
  @@_reversed ||= AuthorizationStatus.new('reversed')
end

.reviewObject

If an immediate response is not available, the state will be ‘review’ - this usually indicates fraud review requires additional time / verification (or a potential network issue with the issuing bank)



8278
8279
8280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8278

def AuthorizationStatus.review
  @@_review ||= AuthorizationStatus.new('review')
end

Instance Method Details

#to_hashObject



8295
8296
8297
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8295

def to_hash
  value
end