Class: Workarea::Checkout::Steps::Payment
- Defined in:
- app/models/workarea/checkout/steps/payment.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#complete? ⇒ Boolean
Whether this checkout step is finished.
-
#update(params = {}) ⇒ Boolean
Update the payment step of checkout (does not place the order).
Methods inherited from Base
Constructor Details
This class inherits a constructor from Workarea::Checkout::Steps::Base
Instance Method Details
#complete? ⇒ Boolean
Whether this checkout step is finished. Requires:
-
order to be purchasable
-
payment purchasable for order total_price
36 37 38 |
# File 'app/models/workarea/checkout/steps/payment.rb', line 36 def complete? order.purchasable? && payment.purchasable?(order.total_price) end |
#update(params = {}) ⇒ Boolean
Update the payment step of checkout (does not place the order). Clears the previous credit card because we may not need one anymore and we shouldn’t keep one if we don’t need it.
Processes the payment params to determine whether it’s a saved card or new card.
18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/workarea/checkout/steps/payment.rb', line 18 def update(params = {}) return false unless payment.address.present? set_payment_profile set_credit_card(params) update_order_pricing update_payment_tenders persist_update end |