num-num / ubl-invoice

A modern object-oriented PHP library to create valid UBL and Peppol BIS files
MIT License
81 stars 70 forks source link

Multiple PaymentMeans #52

Open internaut19 opened 1 year ago

internaut19 commented 1 year ago

Hello!

I am trying to find a way to put multiple payment means in an invoice but I can get it to work. What I am doing wrong?

$supplier_bank_details = (new \NumNum\UBL\FinancialInstitutionBranch())
->setID('Bank Name 1');

$supplier_iban_details = (new \NumNum\UBL\PayeeFinancialAccount())
->setID('IBAN1')
->setFinancialInstitutionBranch($supplier_bank_details);

$supplier_bank_details2 = (new \NumNum\UBL\FinancialInstitutionBranch())
->setID('Bank Name 2');

$supplier_iban_details2 = (new \NumNum\UBL\PayeeFinancialAccount())
->setID('IBAN2')
->setFinancialInstitutionBranch($supplier_bank_details2);

.....

$supplier_payment_means = (new \NumNum\UBL\PaymentMeans())
->setPaymentMeansCode(21)
->setPayeeFinancialAccount($supplier_iban_details);

$supplier_payment_means2 = (new \NumNum\UBL\PaymentMeans())
->setPaymentMeansCode(21)
->setPayeeFinancialAccount($supplier_iban_details2);
.....

$invoice = (new \NumNum\UBL\Invoice())
.....
->setAccountingCustomerParty($clientCompany)
->setPaymentMeans($supplier_payment_means)
->setPaymentMeans($supplier_payment_means2)
->setTaxTotal($taxTotal)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setInvoiceLines($invoiceLines);