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: 3 additions & 1 deletion lib/secretariat/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions test/invoice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down