Module: Spree::Order::Payments

Included in:
Spree::Order
Defined in:
app/models/spree/order/payments.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) authorize_payments!



24
25
26
# File 'app/models/spree/order/payments.rb', line 24

def authorize_payments!
  process_payments_with(:authorize!)
end

- (Object) capture_payments!



28
29
30
# File 'app/models/spree/order/payments.rb', line 28

def capture_payments!
  process_payments_with(:purchase!)
end

- (Object) process_payments!

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



20
21
22
# File 'app/models/spree/order/payments.rb', line 20

def process_payments!
  process_payments_with(:process!)
end

- (Object) unprocessed_payments



32
33
34
# File 'app/models/spree/order/payments.rb', line 32

def unprocessed_payments
  payments.select(&:checkout?)
end