1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

handle sync old coupons on stripe

This commit is contained in:
Sylvain 2021-06-21 10:50:37 +02:00
parent 427ba1a74b
commit e8c5c49bd0

View File

@ -29,7 +29,11 @@ class SyncObjectsOnStripeWorker
logger.debug "#{index} / #{total}" logger.debug "#{index} / #{total}"
Stripe::Coupon.retrieve(coupon.code, api_key: Setting.get('stripe_secret_key')) Stripe::Coupon.retrieve(coupon.code, api_key: Setting.get('stripe_secret_key'))
rescue Stripe::InvalidRequestError rescue Stripe::InvalidRequestError
begin
Stripe::Service.new.create_coupon(coupon.id) Stripe::Service.new.create_coupon(coupon.id)
rescue Stripe::InvalidRequestError => e
logger.warn "Unable to create coupon #{coupon.code} on stripe: #{e}"
end
end end
w = StripeWorker.new w = StripeWorker.new