Skip to content

Commit

Permalink
Fix product webhooks after Order refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
huoxito committed Dec 17, 2014
1 parent f0bb30e commit 365f7f4
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 640 deletions.
4 changes: 2 additions & 2 deletions lib/SF_services/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ def setup_pricebook_entry(standard_id, product_id, price)
def upsert!(attributes = {})
product_id = attributes["Id"]

standard_id = standard_pricebook.first["Id"]
standard_id = standard_pricebook["Id"]
price = attributes.delete "DefaultPrice"

if product_id
update! attributes.merge Id: product_id
update! attributes
else
product_id = create! attributes
end
Expand Down
6 changes: 5 additions & 1 deletion lib/integrations/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def initialize(config, object)

def upsert!(item = nil)
item ||= product_params
item.merge Id: product_id if product_id = find_id_by_code(product_code)

if product_id = find_id_by_code(item['ProductCode'])
item.merge! "Id" => product_id
end

product_service.upsert! item
end

Expand Down
244 changes: 0 additions & 244 deletions spec/cassettes/requests/add_product.yml

This file was deleted.

Loading

0 comments on commit 365f7f4

Please sign in to comment.