Skip to content

Commit

Permalink
fix(invoice): avoid failure on error not related to taxes (#2576)
Browse files Browse the repository at this point in the history
## Description

This PR is fixing a regression recently introduced by the external tax
management feature. A test was added to handle `tax_error` and was
testing a specific error code on a service failure, but not all
`BaseService::FailedResult` are responding to the `error` method
  • Loading branch information
vincent-pochet authored Sep 12, 2024
1 parent 1a2fc2a commit 967255e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/services/invoices/subscription_service.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 967255e

Please sign in to comment.