Class: Decidim::Budgets::Checkout
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Budgets::Checkout
- Defined in:
- app/commands/decidim/budgets/checkout.rb
Overview
A command with all the business to checkout.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(order, feature) ⇒ Checkout
constructor
Public: Initializes the command.
Constructor Details
#initialize(order, feature) ⇒ Checkout
Public: Initializes the command.
order - The current order for the user. feature - The current feature.
10 11 12 13 |
# File 'app/commands/decidim/budgets/checkout.rb', line 10 def initialize(order, feature) @order = order @feature = feature end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the there is an error.
Returns nothing.
21 22 23 24 25 |
# File 'app/commands/decidim/budgets/checkout.rb', line 21 def call return broadcast(:invalid) unless @order&.can_checkout? checkout! broadcast(:ok, @order) end |