+ # ... and then pay the invoice
+ $invoice->pay_invoice(chart_id => $bank_transaction->local_bank_account->chart_id,
+ trans_id => $invoice->id,
+ amount => $invoice->open_amount,
+ payment_type => $payment_type,
+ transdate => $bank_transaction->transdate->to_kivitendo);