Skip to content
Merged
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
12 changes: 10 additions & 2 deletions lib/secretariat/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ module Secretariat
:payment_terms_text,
:payment_due_date,
:payment_iban,
:payment_bic,
:payment_payee_account_name,
:tax_category,
:tax_percent,
:tax_amount,
Expand Down Expand Up @@ -263,9 +265,15 @@ def to_xml(version: 1, validate: true)
xml['ram'].SpecifiedTradeSettlementPaymentMeans do
xml['ram'].TypeCode payment_code
xml['ram'].Information payment_text
if payment_iban
if payment_iban || payment_payee_account_name
xml['ram'].PayeePartyCreditorFinancialAccount do
xml['ram'].IBANID payment_iban
xml['ram'].IBANID payment_iban if payment_iban
xml['ram'].AccountName payment_payee_account_name if payment_payee_account_name
end
end
if payment_bic
xml['ram'].PayeeSpecifiedCreditorFinancialInstitution do
xml['ram'].BICID payment_bic
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions test/invoice_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ def make_negative_de_invoice
payment_reference: 'INV 123123123',
payment_iban: 'DE02120300000000202051',
payment_terms_text: "Wir zahlen die Gutschrift unmittelbar aus",
payment_bic: 'BYLADEM1001',
payment_payee_account_name: 'Depfu inc',
tax_category: :STANDARDRATE,
tax_amount: BigDecimal('-38'),
basis_amount: BigDecimal('-200'),
Expand Down