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



7236
7237
7238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7236

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7234
7235
7236
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7234

def value
  @value
end

Class Method Details

.ALLObject



7256
7257
7258
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7256

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

.apply(value) ⇒ Object

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



7241
7242
7243
7244
7245
7246
7247
7248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7241

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



7274
7275
7276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7274

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.



7287
7288
7289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7287

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

.expiredObject

Authorization has expired.



7269
7270
7271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7269

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



7251
7252
7253
7254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7251

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.



7264
7265
7266
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7264

def AuthorizationStatus.pending
  @@_pending ||= AuthorizationStatus.new('pending')
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)



7281
7282
7283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7281

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

.voidedObject

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



7294
7295
7296
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7294

def AuthorizationStatus.voided
  @@_voided ||= AuthorizationStatus.new('voided')
end

Instance Method Details

#to_hashObject



7298
7299
7300
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7298

def to_hash
  value
end