Skip to content

Commit 58c4b13

Browse files
authored
Merge pull request #44 from valii2334/add_bt-21
Add BT-21 field
2 parents 7fdf322 + 01712b9 commit 58c4b13

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lib/secretariat/invoice.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ module Secretariat
5151
:attachments,
5252
:direct_debit_mandate_reference_id, # BT-89
5353
:direct_debit_creditor_id, # BT-90
54-
:direct_debit_iban, # BT-91
54+
:direct_debit_iban, # BT-91,
55+
:subject_code, # BT-21
5556
keyword_init: true
5657
) do
5758

@@ -220,6 +221,7 @@ def to_xml(version: 1, validate: true)
220221
Array(self.notes).each do |note|
221222
xml['ram'].IncludedNote do
222223
xml['ram'].Content note
224+
xml['ram'].SubjectCode subject_code if subject_code
223225
end
224226
end
225227
end

test/invoice_test.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def make_eu_invoice(tax_category: :REVERSECHARGE, ship_to: nil)
5656
paid_amount: 29,
5757
payment_due_date: Date.today + 14,
5858
notes: "This is a test invoice",
59+
subject_code: 'REG' # BT-21
5960
)
6061
end
6162

@@ -111,6 +112,7 @@ def make_eu_invoice_with_line_item_billing_period(tax_category: :REVERSECHARGE)
111112
paid_amount: 29,
112113
payment_due_date: Date.today + 14,
113114
notes: "This is a test invoice",
115+
subject_code: 'REG' # BT-21
114116
)
115117
end
116118

@@ -169,6 +171,7 @@ def make_eu_invoice_with_sepa_direct_debit(tax_category: :REVERSECHARGE)
169171
direct_debit_mandate_reference_id: "MANDATE REFERENCE", # BT-89
170172
direct_debit_creditor_id: "DE98ZZZ09999999999", # BT-90
171173
direct_debit_iban: "DE02120300000000202051", # BT-91
174+
subject_code: 'REG' # BT-21
172175

173176
)
174177
end
@@ -218,7 +221,8 @@ def make_foreign_invoice(tax_category: :TAXEXEMPT)
218221
grand_total_amount: BigDecimal('29'),
219222
due_amount: 0,
220223
paid_amount: 29,
221-
payment_due_date: Date.today + 14
224+
payment_due_date: Date.today + 14,
225+
subject_code: 'REG' # BT-21
222226
)
223227
end
224228

@@ -275,7 +279,8 @@ def make_eu_invoice_with_attachment
275279
due_amount: 0,
276280
paid_amount: 29,
277281
payment_due_date: Date.today + 14,
278-
attachments: [attachment]
282+
attachments: [attachment],
283+
subject_code: 'REG' # BT-21
279284
)
280285
end
281286

@@ -333,7 +338,8 @@ def make_de_invoice
333338
grand_total_amount: BigDecimal('23.80'),
334339
due_amount: 0,
335340
paid_amount: BigDecimal('23.80'),
336-
payment_due_date: Date.today + 14
341+
payment_due_date: Date.today + 14,
342+
subject_code: 'REG' # BT-21
337343
)
338344
end
339345

@@ -413,7 +419,8 @@ def make_de_invoice_with_multiple_tax_rates
413419
grand_total_amount: BigDecimal('55.28'),
414420
due_amount: 0,
415421
paid_amount: BigDecimal('55.28'),
416-
payment_due_date: Date.today + 14
422+
payment_due_date: Date.today + 14,
423+
subject_code: 'REG' # BT-21
417424
)
418425
end
419426

0 commit comments

Comments
 (0)