diff --git a/CHANGELOG.md b/CHANGELOG.md index f0242576e..a011bc328 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fix a bug: unable to book a free event - Fix a bug: can't see the dates for the next booked training session, when the user is reserving a machine without the appropriate training - Fix a bug: invalid link to the user's manual +- Fix a bug: unable to sync coupons on stripe ## v5.0.4 2021 June 15 diff --git a/app/workers/sync_objects_on_stripe_worker.rb b/app/workers/sync_objects_on_stripe_worker.rb index 4add9fbef..859c7285d 100644 --- a/app/workers/sync_objects_on_stripe_worker.rb +++ b/app/workers/sync_objects_on_stripe_worker.rb @@ -26,9 +26,9 @@ class SyncObjectsOnStripeWorker total = Coupon.all.count Coupon.all.each_with_index do |coupon, index| logger.debug "#{index} / #{total}" - Stripe::Coupon.retrieve(c.code, api_key: Setting.get('stripe_secret_key')) + Stripe::Coupon.retrieve(coupon.code, api_key: Setting.get('stripe_secret_key')) rescue Stripe::InvalidRequestError - Stripe::Service.create_coupon(c.id) + Stripe::Service.create_coupon(coupon.id) end w = StripeWorker.new