Sha256: 76aabb7a4340a18889b270463fff83f4dc963ee5ede78991202b03a1f3fdce00
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
# frozen_string_literal: true module Decidim module Lausanne module Budgets # A command with all the business to add remove line items from orders class RemoveLineItem < Decidim::Lausanne::Budgets::Command # Public: Initializes the command. # # order - The current order for the user # project - The the project to remove from the order def initialize(order, project) @order = order @project = project end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the there is an error. # # Returns nothing. def call return broadcast(:invalid) if @order.checked_out? remove_line_item broadcast(:ok, @order) end private attr_reader :project def remove_line_item @order.projects.destroy(project) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-lausanne-budgets-0.1.0 | app/commands/decidim/lausanne/budgets/remove_line_item.rb |