From 79a37c1b3282396d288c6475f127d127533f4d1e 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 b7a99e62ec4..d972b3e051a 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