Skip to content
Open
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
4 changes: 2 additions & 2 deletions lib/secretariat/line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def to_xml(xml, line_item_index, version: 2, validate: true)
xml['udt'].Indicator 'false'
end
Helpers.currency_element(xml, 'ram', 'ActualAmount', discount_amount, currency_code, add_currency: version == 1)
xml['ram'].Reason discount_reason
xml['ram'].Reason discount_reason if discount_reason
end
end
if version == 1 && discount_amount
Expand All @@ -182,7 +182,7 @@ def to_xml(xml, line_item_index, version: 2, validate: true)
xml['udt'].Indicator 'false'
end
Helpers.currency_element(xml, 'ram', 'ActualAmount', discount_amount, currency_code, add_currency: version == 1)
xml['ram'].Reason discount_reason
xml['ram'].Reason discount_reason if discount_reason
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/secretariat/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
=end

module Secretariat
VERSION = "3.8.1"
VERSION = "3.8.2"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this change. Incrementing version numbers happens during the release process.

end
2 changes: 2 additions & 0 deletions test/invoice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ def test_simple_eu_invoice_v2
assert_match(/<ram:ExemptionReason>Reverse Charge<\/ram:ExemptionReason>/, xml)
assert_match(/<ram:RateApplicablePercent>/, xml)
assert_match(%r{<ram:BuyerTradeParty>\s*<ram:ID>Kunde 4711</ram:ID>}, xml)
assert_equal xml.include?('<ram:Reason>'), false
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer refute xml.include?('<ram:Reason>') or even a refute_match` here.


v = Validator.new(xml, version: 2)
errors = v.validate_against_schema
Expand Down Expand Up @@ -790,6 +791,7 @@ def test_invoice_object_extensions

assert_match(/<ram:PaymentReference>#{invoice.payment_reference}<\/ram:PaymentReference>/, xml)
assert_match(%r{<ram:DefinedTradeContact>\s*<ram:PersonName>Max Mustermann</ram:PersonName>\s*</ram:DefinedTradeContact>}, xml)
assert_match(/<ram:Reason>/, xml)
end

def test_invoice_with_quantity_causing_sub_cent_amounts
Expand Down