Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

1. lépés9012028684
műveletjel x x x x x
szorzószám 2 2 2 2 2
           
EREDMÉNY 0 4 4 12 8
           
2. lépés9+0+1+4+0+4+8+1+2+8+8
ÖSSZESEN=45         
3. lépés          
EREDMÉNY50-45=5       

ELLENŐRZŐ SZÁMJEGY: 5

 

forrás: https://www.posta.hu/static/internet/download/PUSZ_16_4_melleklet_20150901.pdf

CDV kód ellenőrzése példa

Code Block
languagephp
titleCDV kód ellenőrzése
linenumberstrue
public function isCdvCorrect()
{
    return $this->calculateCdv() == $this->cdv;
}

public function calculateCdv()
{
    $sum = 0;
    $j = 1;
    $valueAsString = (string) $this->value;
    for ($i = $this->getValueLength() - 1; $i > -1; $i--)
    {
        if ($j % 2 != 0)
        {
            $result = $valueAsString[$i] * 2;
        }
        else
        {
            $result = $valueAsString[$i];
        }

        foreach(str_split($result) as $digit)
        {
            $sum += $digit;
        }

        $j++;
    }
    return $sum % 10;
}

 

 

...

Példa

Code Block
languagexml
themeConfluence
linenumberstrue
<payerIdentifier>
    <value>123</value>
    <cdv>2</cdv>
</payerIdentifier>

...