Class: Stall::Checkout::PaymentCheckoutStep
- Defined in:
- lib/stall/checkout/payment_checkout_step.rb
Instance Attribute Summary
Attributes inherited from Step
Instance Method Summary collapse
-
#allow_inactive_carts? ⇒ Boolean
When we access this step after a payment to validate the step, the cart is “inactive”, so we force processing the cart.
-
#process ⇒ Object
Determine wether the customer’s payment has been validated or not.
Methods inherited from Step
#identifier, #initialize, #inject, #is?, #prepare, #save, #skip?, #valid?
Constructor Details
This class inherits a constructor from Stall::Checkout::Step
Instance Method Details
#allow_inactive_carts? ⇒ Boolean
When we access this step after a payment to validate the step, the cart is “inactive”, so we force processing the cart.
25 26 27 |
# File 'lib/stall/checkout/payment_checkout_step.rb', line 25 def allow_inactive_carts? !!params[:succeeded] end |
#process ⇒ Object
Determine wether the customer’s payment has been validated or not.
By default, the payment processing occurs in the background and, for some of the payment gateways, can be run asynchronously. In this case, the gateway should redirect here with the ‘:succeeded` param in the URL.
If the payment processing occurs synchronously, the gateway overrides the #synchronous_payment_notification? method, using the cart payment state to determine this parameter.
14 15 16 17 18 19 20 |
# File 'lib/stall/checkout/payment_checkout_step.rb', line 14 def process if gateway.synchronous_payment_notification? cart.paid? elsif params[:succeeded] true end end |