Skip to content

Commit

Permalink
Sd 966 manual upsert (#106)
Browse files Browse the repository at this point in the history
* manually do an upsert

* SD-966 update travis.yml

Co-authored-by: Jordan Moncharmont <[email protected]>
  • Loading branch information
KacperMekarski and jormon authored Oct 16, 2020
1 parent a8f8422 commit ec776f0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/jobs/spree_mailchimp_ecommerce/upsert_order_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
module SpreeMailchimpEcommerce
class UpsertOrderJob < ApplicationJob
def perform(mailchimp_order)
gibbon_store.orders(mailchimp_order["id"]).upsert(body: mailchimp_order)
gibbon_store.orders(mailchimp_order["id"]).update(body: mailchimp_order)
rescue Gibbon::MailChimpError => e
if e.status_code == 404
gibbon_store.orders(mailchimp_order["id"]).create(body: mailchimp_order)
else
# re-raise
raise
end
end
end
end

0 comments on commit ec776f0

Please sign in to comment.