Skip to content
Open
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
8 changes: 4 additions & 4 deletions lib/secretariat/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def errors
@errors
end

def tax_reason_text
tax_reason || TAX_EXEMPTION_REASONS[tax_category]
def tax_reason_text(tax)
tax_reason || TAX_EXEMPTION_REASONS[tax.tax_category || tax_category]
end

def tax_category_code(tax, version: 2)
Expand Down Expand Up @@ -283,8 +283,8 @@ def to_xml(version: 1, validate: true)
xml['ram'].ApplicableTradeTax do
Helpers.currency_element(xml, 'ram', 'CalculatedAmount', tax.tax_amount, currency_code, add_currency: version == 1)
xml['ram'].TypeCode 'VAT'
if tax_reason_text.present?
xml['ram'].ExemptionReason tax_reason_text
if tax_reason_text(tax).present?
xml['ram'].ExemptionReason tax_reason_text(tax)
end
Helpers.currency_element(xml, 'ram', 'BasisAmount', tax.base_amount, currency_code, add_currency: version == 1)
xml['ram'].CategoryCode tax_category_code(tax, version: version)
Expand Down