File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ module Secretariat
4242 :due_amount ,
4343 :paid_amount ,
4444 :tax_calculation_method ,
45+ :notes ,
4546 :attachments ,
4647 keyword_init : true
4748 ) do
@@ -84,7 +85,7 @@ def taxes
8485 taxes [ line_item . tax_percent ] . base_amount += BigDecimal ( line_item . net_amount ) * line_item . quantity
8586 end
8687 end
87-
88+
8889 if tax_calculation_method == :VERTICAL
8990 taxes . values . map do |tax |
9091 tax . tax_amount = ( tax . base_amount * tax . tax_percent / 100 ) . round ( 2 )
@@ -200,8 +201,13 @@ def to_xml(version: 1, validate: true)
200201 xml . text ( issue_date . strftime ( "%Y%m%d" ) )
201202 end
202203 end
203-
204+ Array ( self . notes ) . each do |note |
205+ xml [ 'ram' ] . IncludedNote do
206+ xml [ 'ram' ] . Content note
207+ end
208+ end
204209 end
210+
205211 transaction = by_version ( version , 'SpecifiedSupplyChainTradeTransaction' , 'SupplyChainTradeTransaction' )
206212 xml [ 'rsm' ] . send ( transaction ) do
207213
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ def make_eu_invoice(tax_category: :REVERSECHARGE)
5252 grand_total_amount : BigDecimal ( '29' ) ,
5353 due_amount : 0 ,
5454 paid_amount : 29 ,
55- payment_due_date : Date . today + 14
55+ payment_due_date : Date . today + 14 ,
56+ notes : "This is a test invoice" ,
5657 )
5758 end
5859
@@ -401,7 +402,7 @@ def test_simple_foreign_invoice_v2_taxexpempt
401402 rescue ValidationError => e
402403 puts e . errors
403404 end
404-
405+
405406 def test_simple_foreign_invoice_v2_untaxed
406407 begin
407408 xml = make_foreign_invoice ( tax_category : :UNTAXEDSERVICE ) . to_xml ( version : 2 )
@@ -561,7 +562,7 @@ def test_de_multiple_taxes_invoice_against_schematron_2
561562 end
562563 assert_equal [ ] , errors
563564 end
564-
565+
565566 def test_negative_de_invoice_against_schematron_1
566567 xml = make_negative_de_invoice . to_xml ( version : 1 )
567568 v = Validator . new ( xml , version : 1 )
You can’t perform that action at this time.
0 commit comments