Sha256: b59188625a4132546acb181a5cef9dda3c859100fa392aa1c058f5b96ce0756e
Contents?: true
Size: 720 Bytes
Versions: 62
Compression:
Stored size: 720 Bytes
Contents
module Workarea class OrderMerge attr_reader :original def initialize(original) @original = original end def merge(other) return unless original.valid? other.items.each do |item| next if original.has_sku?(item.sku) attributes = OrderItemDetails.find!(item.sku, product_id: item.product_id).to_h original.add_item( attributes.merge( product_id: item.product_id, sku: item.sku, quantity: item.quantity, customizations: item.customizations ) ) end other.promo_codes.each do |code| original.add_promo_code(code) end original.save! end end end
Version data entries
62 entries across 62 versions & 1 rubygems