Class: SolidusSubscriptions::Checkout
- Inherits:
-
Object
- Object
- SolidusSubscriptions::Checkout
- Defined in:
- lib/solidus_subscriptions/checkout.rb
Instance Attribute Summary collapse
-
#installment ⇒ Object
readonly
Returns the value of attribute installment.
Instance Method Summary collapse
-
#initialize(installment) ⇒ Checkout
constructor
A new instance of Checkout.
- #process ⇒ Object
Constructor Details
#initialize(installment) ⇒ Checkout
Returns a new instance of Checkout.
7 8 9 |
# File 'lib/solidus_subscriptions/checkout.rb', line 7 def initialize(installment) @installment = installment end |
Instance Attribute Details
#installment ⇒ Object (readonly)
Returns the value of attribute installment.
5 6 7 |
# File 'lib/solidus_subscriptions/checkout.rb', line 5 def installment @installment end |
Instance Method Details
#process ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/solidus_subscriptions/checkout.rb', line 11 def process order = create_order begin populate_order(order) finalize_order(order) SolidusSubscriptions.configuration.success_dispatcher_class.new(installment, order).dispatch rescue StateMachines::InvalidTransition if order.payments.any?(&:failed?) SolidusSubscriptions.configuration.payment_failed_dispatcher_class.new(installment, order).dispatch else SolidusSubscriptions.configuration.failure_dispatcher_class.new(installment, order).dispatch end rescue ::Spree::Order::InsufficientStock SolidusSubscriptions.configuration.out_of_stock_dispatcher_class.new(installment, order).dispatch end order end |