1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

[bug] unable to sync users on stripe if one of them have an invalid email address

This commit is contained in:
Sylvain 2021-06-16 10:33:52 +02:00
parent 17ab75cfa5
commit 2a616125c1
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# Changelog Fab-manager
- Fix a bug: during the upgrade, unable to detect the target when not explicitly specified
- Fix a bug: unable to sync users on stripe if one of them have an invalid email address
## v5.0.4 2021 June 15

View File

@ -11,10 +11,14 @@ class SyncObjectsOnStripeWorker
User.online_payers.each_with_index do |member, index|
logger.debug "#{index} / #{total}"
begin
stp_customer = member.payment_gateway_object.gateway_object.retrieve
stp_customer = member.payment_gateway_object&.gateway_object&.retrieve
StripeWorker.new.create_stripe_customer(member.id) if stp_customer.nil? || stp_customer[:deleted]
rescue Stripe::InvalidRequestError
StripeWorker.new.create_stripe_customer(member.id)
begin
StripeWorker.new.create_stripe_customer(member.id)
rescue Stripe::InvalidRequestError => e
puts "Unable to create the customer #{member.id} do to a Stripe error: #{e}"
end
end
end