Sha256: 3d85d4fcd370894501d0b7608e8ca65dca4b684d6bf1d494b34b2751b5904427
Contents?: true
Size: 707 Bytes
Versions: 62
Compression:
Stored size: 707 Bytes
Contents
module Workarea class PricingOverrideParams attr_reader :params, :user def initialize(params, user = nil) @params = params.with_indifferent_access @user = user end def to_h flip_adjustment_values set_created_by params end def flip_adjustment_values if params[:subtotal_adjustment].present? params[:subtotal_adjustment] = params[:subtotal_adjustment].to_f * -1 end if params[:shipping_adjustment].present? params[:shipping_adjustment] = params[:shipping_adjustment].to_f * -1 end end def set_created_by return unless user.present? params.merge!(created_by_id: user.id) end end end
Version data entries
62 entries across 62 versions & 1 rubygems