Class: Io::Flow::V0::Models::PaymentStatus

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

Returns a new instance of PaymentStatus.



22678
22679
22680
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22678

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



22676
22677
22678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22676

def value
  @value
end

Class Method Details

.ALLObject



22698
22699
22700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22698

def PaymentStatus.ALL
  @@all ||= [PaymentStatus.requires_payment_method, PaymentStatus.requires_action, PaymentStatus.processing, PaymentStatus.cancelled, PaymentStatus.expired, PaymentStatus.authorized, PaymentStatus.reversed, PaymentStatus.captured, PaymentStatus.refunded, PaymentStatus.in_dispute, PaymentStatus.charged_back]
end

.apply(value) ⇒ Object

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



22683
22684
22685
22686
22687
22688
22689
22690
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22683

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

.authorizedObject

A hold has been placed on the consumer’s payment method for the amount of the payment request. The funds have not yet been withdrawn - they must be captured separately. The full balance of the payment request must be captured in order to update the status to ‘captured`. Any outstanding balance that is not captured will eventually be reversed. If an order is found to be fraudulent, the payment request can be cancelled and the status will change to `reversed`.



22745
22746
22747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22745

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

.cancelledObject

The payment request was cancelled before any transaction was authorized. The consumer will not be charged for any transactions that were in progress.



22729
22730
22731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22729

def PaymentStatus.cancelled
  @@_cancelled ||= PaymentStatus.new('cancelled')
end

.capturedObject

The entire balance of the payment request has been captured. The funds have been withdrawn from the consumer and will be transferred to the merchant. With some payment methods, this occurs automatically after authorization without taking steps to capture. Any funds captured can be returned to the customer by refunding them. The consumer can issue a dispute for any captured funds.



22761
22762
22763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22761

def PaymentStatus.captured
  @@_captured ||= PaymentStatus.new('captured')
end

.charged_backObject

The payment provider has decided that the merchant breached terms of service will claim back all captured funds for the consumer.



22781
22782
22783
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22781

def PaymentStatus.charged_back
  @@_charged_back ||= PaymentStatus.new('charged_back')
end

.expiredObject

The payment request expired due to inactivity before any transaction was authorized.



22735
22736
22737
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22735

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

.from_string(value) ⇒ Object

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



22693
22694
22695
22696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22693

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

.in_disputeObject

The consumer has placed a dispute with their payment provider to reclaim any captured funds due to breach of service with the merchant. The status of the payment request will update to ‘charged_back` or `dispute_won` after the payment provider makes a decision.



22775
22776
22777
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22775

def PaymentStatus.in_dispute
  @@_in_dispute ||= PaymentStatus.new('in_dispute')
end

.processingObject

The payment attempt is processing. Eventually it will update with the results of the transaction. Sometimes, this may take hours or days to finish processing - if that is the case, the consumer can have their order reserved provisionally until the payment is processed.



22723
22724
22725
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22723

def PaymentStatus.processing
  @@_processing ||= PaymentStatus.new('processing')
end

.refundedObject

The entire balance of the payment request has been refunded back to the consumer. No further actions can be taken with this payment request.



22767
22768
22769
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22767

def PaymentStatus.refunded
  @@_refunded ||= PaymentStatus.new('refunded')
end

.requires_actionObject

In order to process a payment for a given payment method, an action needs to be rendered on the consumer’s device so that they can interact with the payment provider or authenticate themselves. If the action is not completed, the action will expire and the payment request will change to ‘requires_payment_method`.



22715
22716
22717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22715

def PaymentStatus.requires_action
  @@_requires_action ||= PaymentStatus.new('requires_action')
end

.requires_payment_methodObject

The initial state of payment request if no ‘payment_method_data` is provided, if an authorization couldn’t be completed, or if the payment request details are changed beyond certain thesholds (e.g. currency changed). If a payment method is not added, this payment request will change to ‘expired`.



22706
22707
22708
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22706

def PaymentStatus.requires_payment_method
  @@_requires_payment_method ||= PaymentStatus.new('requires_payment_method')
end

.reversedObject

The entire balance of the payment request was reversed without being captured. The consumer has not had any funds withdrawn and any authorization hold has been removed.



22752
22753
22754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22752

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

Instance Method Details

#to_hashObject



22785
22786
22787
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22785

def to_hash
  value
end