<?php

declare(strict_types=1);

namespace External\HannahBundle\Daktela;

class HannahDaktelaUpdater extends \KupShop\DaktelaBundle\Utils\DaktelaUpdater
{
    protected function getContactParams($orderResult, $contact, $account = '')
    {
        $params = parent::getContactParams($orderResult, $contact);

        $contactTitle = $params['firstname'].' '.$params['lastname'];
        if (!empty($orderResult['invoice_firm'])) {
            $contactTitle = $orderResult['invoice_firm'].', '.$contactTitle;
        }

        if (!empty($orderResult['contactEmail'])) {
            $contactTitle .= ' <'.$orderResult['contactEmail'].'>';
        }

        $params['title'] = $contactTitle;

        return $params;
    }
}
