public function getBalance(VendorInterface $vendor)
    {
        $this->resetRestClient();

        $this->restClient->getConfig()->setPath(
            'request.options/headers/php-auth-user',
            $this->login
        );

        $this->restClient->getConfig()->setPath(
            'request.options/headers/php-auth-pw',
            $this->password
        );

        if (!is_null($vendor->getHiPayId())) {
            $this->restClient->getConfig()->setPath(
                'request.options/headers/php-auth-subaccount-id',
                $vendor->getHiPayId()
            );
        } elseif (!is_null($vendor->getLogin())) {
            $this->restClient->getConfig()->setPath(
                'request.options/headers/php-auth-subaccount-login',
                $vendor->getLogin()
            );
        }

        $command = $this->restClient->getCommand(
            'GetBalance',
            array()
        );

        try {
            $result = $this->executeRest($command);
        } catch (ClientErrorResponseException $e) {
            /** retro compatible if old account */
            if ($e->getResponse()->getStatusCode() == '401') {
                /** retry with email in php-auth-subaccount-login */
                $this->restClient->getConfig()->setPath(
                    'request.options/headers/php-auth-subaccount-login',
                    strtolower($vendor->getEmail())
                );
                $command = $this->restClient->getCommand(
                    'GetBalance',
                    array()
                );
                $result = $this->executeRest($command);
            }
        }
        return $result['balances'][0]['balance'];
    }