Class: Yookassa::Entities::Payment
- Defined in:
- lib/yookassa/entities/payment.rb
Overview
Payment entity with status helpers and confirmation URL access.
All attributes from the API response (id, status, amount, description, etc.) are accessible as methods via the inherited Base dynamic dispatch.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#canceled? ⇒ Boolean
trueif the payment was canceled. -
#confirmation_url ⇒ String?
Returns the confirmation URL for redirect-based payment flows.
-
#pending? ⇒ Boolean
trueif the payment is awaiting user action. -
#succeeded? ⇒ Boolean
trueif the payment completed successfully. -
#waiting_for_capture? ⇒ Boolean
trueif the payment is authorized and awaiting capture.
Methods inherited from Base
#[], #initialize, #respond_to_missing?, #to_h
Constructor Details
This class inherits a constructor from Yookassa::Entities::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Yookassa::Entities::Base
Instance Method Details
#canceled? ⇒ Boolean
Returns true if the payment was canceled.
32 33 34 |
# File 'lib/yookassa/entities/payment.rb', line 32 def canceled? status == "canceled" end |
#confirmation_url ⇒ String?
Returns the confirmation URL for redirect-based payment flows.
15 16 17 18 19 |
# File 'lib/yookassa/entities/payment.rb', line 15 def confirmation_url return nil unless attributes["confirmation"] attributes.dig("confirmation", "confirmation_url") end |
#pending? ⇒ Boolean
Returns true if the payment is awaiting user action.
27 28 29 |
# File 'lib/yookassa/entities/payment.rb', line 27 def pending? status == "pending" end |
#succeeded? ⇒ Boolean
Returns true if the payment completed successfully.
22 23 24 |
# File 'lib/yookassa/entities/payment.rb', line 22 def succeeded? status == "succeeded" end |
#waiting_for_capture? ⇒ Boolean
Returns true if the payment is authorized and awaiting capture.
37 38 39 |
# File 'lib/yookassa/entities/payment.rb', line 37 def waiting_for_capture? status == "waiting_for_capture" end |