Module: Spree::Order::Payments
- Included in:
- Spree::Order
- Defined in:
- app/models/spree/order/payments.rb
Instance Method Summary collapse
- #authorize_payments! ⇒ Object
- #capture_payments! ⇒ Object
-
#process_payments! ⇒ Object
processes any pending payments and must return a boolean as it’s return value is used by the checkout state_machine to determine success or failure of the ‘complete’ event for the order.
- #unprocessed_payments ⇒ Object
Instance Method Details
#authorize_payments! ⇒ Object
26 27 28 |
# File 'app/models/spree/order/payments.rb', line 26 def process_payments_with(:authorize!) end |
#capture_payments! ⇒ Object
30 31 32 |
# File 'app/models/spree/order/payments.rb', line 30 def capture_payments! process_payments_with(:purchase!) end |
#process_payments! ⇒ Object
processes any pending payments and must return a boolean as it’s return value is used by the checkout state_machine to determine success or failure of the ‘complete’ event for the order
Returns:
-
true if all pending payments processed successfully
-
true if a payment failed, ie. raised a GatewayError which gets rescued and converted to TRUE when :allow_checkout_gateway_error is set to true
-
false if a payment failed, ie. raised a GatewayError which gets rescued and converted to FALSE when :allow_checkout_on_gateway_error is set to false
22 23 24 |
# File 'app/models/spree/order/payments.rb', line 22 def process_payments! process_payments_with(:process!) end |
#unprocessed_payments ⇒ Object
34 35 36 |
# File 'app/models/spree/order/payments.rb', line 34 def unprocessed_payments payments.select(&:checkout?) end |