Skip to content

Commit ec4957e

Browse files
authored
Merge pull request #39 from konvenit/enable_different_tax_reason_texts
Enable different tax_reason_text per tax
2 parents 8d7f07b + dfb1154 commit ec4957e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/secretariat/invoice.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def errors
5757
@errors
5858
end
5959

60-
def tax_reason_text
61-
tax_reason || TAX_EXEMPTION_REASONS[tax_category]
60+
def tax_reason_text(tax)
61+
tax_reason || TAX_EXEMPTION_REASONS[tax.tax_category || tax_category]
6262
end
6363

6464
def tax_category_code(tax, version: 2)
@@ -283,8 +283,8 @@ def to_xml(version: 1, validate: true)
283283
xml['ram'].ApplicableTradeTax do
284284
Helpers.currency_element(xml, 'ram', 'CalculatedAmount', tax.tax_amount, currency_code, add_currency: version == 1)
285285
xml['ram'].TypeCode 'VAT'
286-
if tax_reason_text.present?
287-
xml['ram'].ExemptionReason tax_reason_text
286+
if tax_reason_text(tax).present?
287+
xml['ram'].ExemptionReason tax_reason_text(tax)
288288
end
289289
Helpers.currency_element(xml, 'ram', 'BasisAmount', tax.base_amount, currency_code, add_currency: version == 1)
290290
xml['ram'].CategoryCode tax_category_code(tax, version: version)

0 commit comments

Comments
 (0)