src/OrangePaymentSlipData.php
public function getCodeLine($fillZeros = true)
    {
        $referenceNumber = $this->getCompleteReferenceNumber(false, $fillZeros);
        $accountNumber = $this->getAccountDigits();

        if ($this->getWithAmount()) {
            $francs = $this->getAmountFrancs();
            $cents = $this->getAmountCents();
            $francs = str_pad($francs, 8, '0', STR_PAD_LEFT);
            $cents = str_pad($cents, 2, '0', STR_PAD_RIGHT);
            $amountPrefix = '01';
            $amountPart = $francs . $cents;
            $amountCheck = $this->modulo10($amountPrefix . $amountPart);
        } else {
            $amountPrefix = '04';
            $amountPart = '';
            $amountCheck = '2';
        }
        if ($fillZeros) {
            $referenceNumberPart = str_pad($referenceNumber, 27, '0', STR_PAD_LEFT);
        } else {
            $referenceNumberPart = $referenceNumber;
        }
        $accountNumberPart = substr($accountNumber, 0, 2) .
            str_pad(substr($accountNumber, 2), 7, '0', STR_PAD_LEFT);

        if ($this->getNotForPayment()) {
            $amountPrefix = 'XX';
            $amountCheck = 'X';
        }

        $codeLine = sprintf(
            '%s%s%s>%s+ %s>',
            $amountPrefix,
            $amountPart,
            $amountCheck,
            $referenceNumberPart,
            $accountNumberPart
        );

        return $codeLine;
    }
public function getCodeLine($fillZeros = true)
    {
        $referenceNumber = $this->getCompleteReferenceNumber(false, $fillZeros);
        $accountNumber = $this->getAccountDigits();

        if ($this->getWithAmount()) {
            $francs = $this->getAmountFrancs();
            $cents = $this->getAmountCents();
            $francs = str_pad($francs, 8, '0', STR_PAD_LEFT);
            $cents = str_pad($cents, 2, '0', STR_PAD_RIGHT);
            $amountPrefix = '01';
            $amountPart = $francs . $cents;
            $amountCheck = $this->modulo10($amountPrefix . $amountPart);
        } else {
            $amountPrefix = '04';
            $amountPart = '';
            $amountCheck = '2';
        }
        if ($fillZeros) {
            $referenceNumberPart = str_pad($referenceNumber, 27, '0', STR_PAD_LEFT);
        } else {
            $referenceNumberPart = $referenceNumber;
        }
        $accountNumberPart = substr($accountNumber, 0, 2) .
            str_pad(substr($accountNumber, 2), 7, '0', STR_PAD_LEFT);

        if ($this->getNotForPayment()) {
            $amountPrefix = 'XX';
            $amountCheck = 'X';
        }

        $codeLine = sprintf(
            '%s%s%s>%s+ %s>',
            $amountPrefix,
            $amountPart,
            $amountCheck,
            $referenceNumberPart,
            $accountNumberPart
        );

        return $codeLine;
    }
public function getCodeLine ( $ fillZeros = true ) { $ referenceNumber = $ this -> getCompleteReferenceNumber ( false , $ fillZeros ) ; $ accountNumber = $ this -> getAccountDigits ( ) ; if ( $ this -> getWithAmount ( ) ) { $ francs = $ this -> getAmountFrancs ( ) ; $ cents = $ this -> getAmountCents ( ) ; $ francs = str_pad ( $ francs , 8 , '0' , STR_PAD_LEFT ) ; $ cents = str_pad ( $ cents , 2 , '0' , STR_PAD_RIGHT ) ; $ amountPrefix = '01' ; $ amountPart = $ francs . $ cents ; $ amountCheck = $ this -> modulo10 ( $ amountPrefix . $ amountPart ) ; } else { $ amountPrefix = '04' ; $ amountPart = '' ; $ amountCheck = '2' ; } if ( $ fillZeros ) { $ referenceNumberPart = str_pad ( $ referenceNumber , 27 , '0' , STR_PAD_LEFT ) ; } else { $ referenceNumberPart = $ referenceNumber ; } $ accountNumberPart = substr ( $ accountNumber , 0 , 2 ) . str_pad ( substr ( $ accountNumber , 2 ) , 7 , '0' , STR_PAD_LEFT ) ; if ( $ this -> getNotForPayment ( ) ) { $ amountPrefix = 'XX' ; $ amountCheck = 'X' ; } $ codeLine = sprintf ( '%s%s%s>%s+ %s>' , $ amountPrefix , $ amountPart , $ amountCheck , $ referenceNumberPart , $ accountNumberPart ) ; return $ codeLine ; }
Get the full code line at the bottom of the ESR

@param bool $fillZeros Whether to fill up the code line with leading zeros.
@return string The full code line.
Get the full code line at the bottom of the ESR