Sha256: 823613cfd6049233647f85e8dc076ced491f91d4f08f795fa5b60082a410e3a7

Contents?: true

Size: 616 Bytes

Versions: 26

Compression:

Stored size: 616 Bytes

Contents

module Spree
  module Shipments
    module Helper
      def add_or_update_line_item(order:, variant:, quantity:, shipment:)
        result = add_item_service.call(order: order, variant: variant, quantity: quantity, options: { shipment: shipment })

        if result.success?
          success(shipment.reload)
        else
          failure(result.value, result.error)
        end
      end

      def add_item_service
        Spree::Dependencies.cart_add_item_service.constantize
      end

      def remove_item_service
        Spree::Dependencies.cart_remove_item_service.constantize
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/services/spree/shipments/helper.rb
spree_core-4.10.0 app/services/spree/shipments/helper.rb
spree_core-4.9.0 app/services/spree/shipments/helper.rb
spree_core-4.8.3 app/services/spree/shipments/helper.rb
spree_core-4.8.2 app/services/spree/shipments/helper.rb
spree_core-4.7.3 app/services/spree/shipments/helper.rb
spree_core-4.6.6 app/services/spree/shipments/helper.rb
spree_core-4.5.5 app/services/spree/shipments/helper.rb
spree_core-4.4.1 app/services/spree/shipments/helper.rb
spree_core-4.5.4 app/services/spree/shipments/helper.rb
spree_core-4.6.5 app/services/spree/shipments/helper.rb
spree_core-4.7.2 app/services/spree/shipments/helper.rb
spree_core-4.7.1 app/services/spree/shipments/helper.rb
spree_core-4.6.4 app/services/spree/shipments/helper.rb
spree_core-4.7.0 app/services/spree/shipments/helper.rb
spree_core-4.6.3 app/services/spree/shipments/helper.rb
spree_core-4.6.2 app/services/spree/shipments/helper.rb
spree_core-4.6.1 app/services/spree/shipments/helper.rb
spree_core-4.6.0 app/services/spree/shipments/helper.rb
spree_core-4.5.3 app/services/spree/shipments/helper.rb