public function isPaid(int $iInvoiceId, bool $bIncludeProcessing = false): bool
    {
        $oInvoice = $this->getById($iInvoiceId);

        if (!empty($oInvoice)) {

            $iPaid = $oInvoice->totals->raw->paid;
            if ($bIncludeProcessing) {
                $iPaid += $oInvoice->totals->raw->processing;
            }

            return $iPaid >= $oInvoice->totals->raw->grand;
        }

        return false;
    }