PaymentCheck

Check Bank payments

Returns an object that opens bank payment file and checks it agains data in eKansio.

Example

Check payments in $bankData

$this->get('PaymentCheck')
  ->addData($bankData)
  ->setInvoiceTable('lasku')
  ->setInvoiceReference('viitenumero')
  ->setInvoiceAmount('summa')
  ->setInvoicePaydate('maksupaiva')
  ->setInvoiceDuedate('erapaiva')
  ->checkPayments()
  ->renderResult();

Basic use

Check invoices and render the result:

$this->get('PaymentCheck')
  ->addData($data)
  ->setInvoiceTable('lasku')
  ->setInvoiceReference('viitenumero')
  ->setInvoicePaydate('maksupaiva')
  ->markInvoicesAsPayed()
  ->saveInvoices()
  ->renderResult();

Loop through payments

Optionally, you can loop through payments one by one:

$Payments = $this->get('PaymentCheck')
  ...
  ->addData($data);

foreach ( $Payments as $Payment ){
    if ( $Payment->isInvoice() ){
        $txt .= "There is an Invoice {$Payment->getInvoice()} for {$Payment->getReferenceNumber()};
        $txt .= "Invoice total sum: {$Payment->getInvoice('amount')};
        $txt .= "Viitemaksu currency code: {$Payment->currency_code};
    }
}

Full method list

PaymentCheck

Method  Return value  Description
setInvoiceTable($name) this Set invoice table name.
setInvoiceReference($name) this Set field name for invoice reference number.
setInvoiceAmount($name) this Set field name for invoice amount.
setInvoiceDuedate($name) this Set field name for invoice duedate.
setInvoicePaydate($name) this Set field name for invoice paydate.
addData($string) this Add payments from data.
getPayments() Payment[] Array of found payments.
markInvoicesAsPayed() this Mark invoices payed: ReferenceNumber, amount, paydate is empty.
saveInvoices() this Save changes to Invoices.
renderResult() this Render HTML Table of payments vs. invoices.

Payment

Method  Return value  Description
getInvoice() Sivu Return invoice for current payment. 
getInvoice($field) Kentta Return field of current payments invoice. $field = name of field preference: amount, reference...
isInvoice() bool Return TRUE if invoice with ReferenceNumber is found.
getReferenceNumber() string Reference number.
getAmount() number Payment amount.
getPaydate() string Date of payment YYYY-MM-DD.
getEntrydate() string Date of payment entry YYYY-MM-DD.
getBankAccount() string Payment receiver Bank account.
getPayerName() string Payer name.
getInfo() string Additional info os paymet line: Väärä summa, maksettu myöhässä...
isPayment() bool Return TRUE, if line is a OK payment (type=payment)
isRightAmount() bool Return TRUE, is payment amount is same as Invoice amount.
isOverdue() bool Return TRUE, if payment paydate is later than invoice duedate.
markAsPayed() bool Set invoice paydate from payment paydate.

Payment data (Viitemaksu)

All properties of Viitemaksu -data

Property  Return value  Description
type string Maksurivin tyyppi: payment, canceled
bank_account string 14  Laskuttajan tilinumero 14.
entry_date date  Kirjauspäivä YYYY-MM-DD.
payment_date  date  Maksupäivä YYYY-MM-DD.
filing_id  string 16  Arkistointitunnus AN P.
referencenumber  string 20  referencenumber N P.
name  string 12  Maksajan nimilyhenne AN V.
currency_code  string 1  Rahayksikön koodi 1 = euro.
currency  string 3  Rahayksikkö EUR
name_source_code  string 1  Nimen lähde A,J,K.
name_source  string  Nimen lähde selväkielisenä.
amount  float  Rahamäärä euroina.
payment_type  strig  Maksun tyyppi: Viitemaksu tai Suoraveloitus.
correction_code  int 1  Oikaisutunnus. 0 = Maksu 1 = Maksun peruutus.
correction  string  Oikaisutunnuksen selväkielinen muoto.
transmit_code  string 1  Välitystapa: A,J,K.
transmit  string  Välitystapa selväkielisenä.
message_code  int 1  Palautekoodi (Vain suoraveloitus).
message  string  Palautekoodi selväkielineä.

Transmit codes

Code  Description
A  Asiakkaalta
J  Järjestelmästä
K  Näppäilty toimeksiannon yhteydessä

Name source codes

Code  Description
A Asiakkaalta
J Järjestelmästä
K Näppäilty toimeksiannon yhteydessä

Message codes

Code  Description
0  Maksu onnistunut
1  Tiliä ei löydy
2  Kate ei riitä
3  Ei maksupalvelun tili
4  Maksaja peruuttanut
5  Pankki peruuttanut
6  Peruutus ei kohdistu
7  Valtuutus puuttuu
8  Eräpäivä virheellinen
9  Muotovirhe