Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (tax-integrations): apply zero tax for unknown tax exemption #2517

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/invoice/applied_tax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AppliedTax < ApplicationRecord
validates :amount_cents, numericality: {greater_than_or_equal_to: 0}

TAX_CODES_APPLICABLE_ON_WHOLE_INVOICE = %w[not_collecting juris_not_taxed reverse_charge customer_exempt
transaction_exempt].freeze
transaction_exempt juris_has_no_tax unknown_taxation].freeze

def applied_on_whole_invoice?
TAX_CODES_APPLICABLE_ON_WHOLE_INVOICE.include?(tax_code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Aggregator
module Taxes
module Invoices
class BaseService < Integrations::Aggregator::BaseService
SPECIAL_TAXATION_TYPES = %w[exempt notCollecting productNotTaxed jurisNotTaxed].freeze
SPECIAL_TAXATION_TYPES = %w[exempt notCollecting productNotTaxed jurisNotTaxed jurisHasNoTax].freeze
def initialize(invoice:, fees: nil)
@invoice = invoice
@fees = fees || invoice.fees
Expand Down Expand Up @@ -84,13 +84,20 @@ def tax_breakdown(breakdown)
tax_amount: 0,
type: b['type']
)
else
elsif b['rate']
OpenStruct.new(
name: b['name'],
rate: b['rate'],
tax_amount: b['tax_amount'],
type: b['type']
)
else
OpenStruct.new(
name: humanize_tax_name(b['reason'].presence || b['type'] || 'unknown_taxation'),
rate: '0.00',
tax_amount: 0,
type: b['type'] || 'unknown_taxation'
)
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions config/locales/de/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ de:
tax_name: "%{name} (%{rate}% on %{amount})"
tax_name_only:
customer_exempt: Der Kunde ist von der Umsatzsteuer befreit
juris_has_no_tax: Keine Steuer
juris_not_taxed: Keine Steuer
not_collecting: Keine Steuer
reverse_charge: Reverse-Charge-Verfahren - Steuerschuldnerschaft auf den Kunden übertragen
transaction_exempt: Der Kunde ist von der Umsatzsteuer befreit
unknown_taxation: Unbekannt
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Steuersatz
taxes:
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ en:
tax_name: "%{name} (%{rate}% on %{amount})"
tax_name_only:
customer_exempt: Customer is tax exempt
juris_has_no_tax: No tax
juris_not_taxed: No tax
not_collecting: No tax
reverse_charge: Reverse charge - Tax liability shifted to customer
transaction_exempt: Customer is tax exempt
unknown_taxation: Unknown
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Tax rate
taxes:
Expand Down
2 changes: 2 additions & 0 deletions config/locales/es/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ es:
tax_name: "%{name} (%{rate}% sobre %{amount})"
tax_name_only:
customer_exempt: El cliente está exento de impuestos
juris_has_no_tax: Sin impuesto
juris_not_taxed: Sin impuesto
not_collecting: Sin impuesto
reverse_charge: Inversión del sujeto pasivo - Responsabilidad fiscal trasladada al cliente
transaction_exempt: El cliente está exento de impuestos
unknown_taxation: Desconocido
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Tasas de impuestos
taxes:
Expand Down
2 changes: 2 additions & 0 deletions config/locales/fr/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ fr:
tax_name: "%{name} (%{rate}% sur %{amount})"
tax_name_only:
customer_exempt: Le client est exonéré de taxe
juris_has_no_tax: Taxe non applicable
juris_not_taxed: Taxe non applicable
not_collecting: Pas de taxe
reverse_charge: Autoliquidation - Responsabilité fiscale transférée au client
transaction_exempt: Le client est exonéré de taxe
unknown_taxation: Inconnu
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Taux de taxe
taxes:
Expand Down
2 changes: 2 additions & 0 deletions config/locales/it/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ it:
tax_name: "%{name} (%{rate}% su %{amount})"
tax_name_only:
customer_exempt: Il cliente è esente da tasse
juris_has_no_tax: Nessuna tassa
juris_not_taxed: Nessuna tassa
not_collecting: Nessuna tassa
reverse_charge: Inversione contabile - Responsabilità fiscale trasferita al cliente
transaction_exempt: Il cliente è esente da tasse
unknown_taxation: Sconosciuto
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Aliquota fiscale
taxes:
Expand Down
2 changes: 2 additions & 0 deletions config/locales/nb/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ nb:
tax_name: "%{name} (%{rate}% on %{amount})"
tax_name_only:
customer_exempt: Kunden er fritatt for avgift
juris_has_no_tax: Ingen skatt
juris_not_taxed: Ingen skatt
not_collecting: Ingen skatt
reverse_charge: Omvendt avgiftsplikt - Skatteplikt overført til kunden
transaction_exempt: Kunden er fritatt for avgift
unknown_taxation: Ukjent
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Skattesats
taxes:
Expand Down
2 changes: 2 additions & 0 deletions config/locales/sv/invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ sv:
tax_name: "%{name} (%{rate}% på %{amount})"
tax_name_only:
customer_exempt: Kunden är befriad från moms
juris_has_no_tax: Ingen skatt
juris_not_taxed: Ingen skatt
not_collecting: Ingen skatt
reverse_charge: Omvänd skattskyldighet - Skatteskyldighet överförd till kunden
transaction_exempt: Kunden är befriad från moms
unknown_taxation: Okänd
tax_name_with_details: "%{name} (%{rate}%)"
tax_rate: Momssats
taxes:
Expand Down
2 changes: 2 additions & 0 deletions schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@
[
{received_type: 'notCollecting', expected_name: 'Not collecting'},
{received_type: 'productNotTaxed', expected_name: 'Product not taxed'},
{received_type: 'jurisNotTaxed', expected_name: 'Juris not taxed'}
{received_type: 'jurisNotTaxed', expected_name: 'Juris not taxed'},
{received_type: 'jurisHasNoTax', expected_name: 'Juris has no tax'},
{received_type: 'specialUnknownRule', expected_name: 'Special unknown rule'}
]

special_rules.each do |specific_rule|
Expand Down