From f1f1aec9456a634ef368a92c3a931de036baf45a Mon Sep 17 00:00:00 2001 From: Vincent Pochet Date: Thu, 12 Sep 2024 16:00:15 +0200 Subject: [PATCH] fix(invoice): avoid failure on error not related to taxes --- app/services/invoices/subscription_service.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/services/invoices/subscription_service.rb b/app/services/invoices/subscription_service.rb index b7a99e62ec42..8efe9ff07e48 100644 --- a/app/services/invoices/subscription_service.rb +++ b/app/services/invoices/subscription_service.rb @@ -139,7 +139,10 @@ def flag_lifetime_usage_for_refresh end def tax_error?(fee_result) - !fee_result.success? && fee_result&.error&.code == 'tax_error' + return false if fee_result.success? + return false unless fee_result.error.is_a?(BaseService::ServiceFailure) + + fee_result&.error&.code == 'tax_error' end end end