From 01712b93b484b131a0882a4e41fd9e61d47644c6 Mon Sep 17 00:00:00 2001 From: Valentin Lazar Date: Wed, 17 Dec 2025 16:08:13 +0200 Subject: [PATCH] Add BT-21 field --- lib/secretariat/invoice.rb | 4 +++- test/invoice_test.rb | 15 +++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/secretariat/invoice.rb b/lib/secretariat/invoice.rb index 8a8f42a..94826e3 100644 --- a/lib/secretariat/invoice.rb +++ b/lib/secretariat/invoice.rb @@ -51,7 +51,8 @@ module Secretariat :attachments, :direct_debit_mandate_reference_id, # BT-89 :direct_debit_creditor_id, # BT-90 - :direct_debit_iban, # BT-91 + :direct_debit_iban, # BT-91, + :subject_code, # BT-21 keyword_init: true ) do @@ -220,6 +221,7 @@ def to_xml(version: 1, validate: true) Array(self.notes).each do |note| xml['ram'].IncludedNote do xml['ram'].Content note + xml['ram'].SubjectCode subject_code if subject_code end end end diff --git a/test/invoice_test.rb b/test/invoice_test.rb index 666b1f5..f6e1923 100644 --- a/test/invoice_test.rb +++ b/test/invoice_test.rb @@ -56,6 +56,7 @@ def make_eu_invoice(tax_category: :REVERSECHARGE, ship_to: nil) paid_amount: 29, payment_due_date: Date.today + 14, notes: "This is a test invoice", + subject_code: 'REG' # BT-21 ) end @@ -111,6 +112,7 @@ def make_eu_invoice_with_line_item_billing_period(tax_category: :REVERSECHARGE) paid_amount: 29, payment_due_date: Date.today + 14, notes: "This is a test invoice", + subject_code: 'REG' # BT-21 ) end @@ -169,6 +171,7 @@ def make_eu_invoice_with_sepa_direct_debit(tax_category: :REVERSECHARGE) direct_debit_mandate_reference_id: "MANDATE REFERENCE", # BT-89 direct_debit_creditor_id: "DE98ZZZ09999999999", # BT-90 direct_debit_iban: "DE02120300000000202051", # BT-91 + subject_code: 'REG' # BT-21 ) end @@ -218,7 +221,8 @@ def make_foreign_invoice(tax_category: :TAXEXEMPT) grand_total_amount: BigDecimal('29'), due_amount: 0, paid_amount: 29, - payment_due_date: Date.today + 14 + payment_due_date: Date.today + 14, + subject_code: 'REG' # BT-21 ) end @@ -275,7 +279,8 @@ def make_eu_invoice_with_attachment due_amount: 0, paid_amount: 29, payment_due_date: Date.today + 14, - attachments: [attachment] + attachments: [attachment], + subject_code: 'REG' # BT-21 ) end @@ -333,7 +338,8 @@ def make_de_invoice grand_total_amount: BigDecimal('23.80'), due_amount: 0, paid_amount: BigDecimal('23.80'), - payment_due_date: Date.today + 14 + payment_due_date: Date.today + 14, + subject_code: 'REG' # BT-21 ) end @@ -413,7 +419,8 @@ def make_de_invoice_with_multiple_tax_rates grand_total_amount: BigDecimal('55.28'), due_amount: 0, paid_amount: BigDecimal('55.28'), - payment_due_date: Date.today + 14 + payment_due_date: Date.today + 14, + subject_code: 'REG' # BT-21 ) end