protected function getGoodAccountNumber(TaxRuleInterface $rule, float $rate, string $origin)
    {
        foreach ($this->accounts as $account) {
            if ($account->getType() !== AccountingTypes::TYPE_GOOD) {
                continue;
            }

            if ($account->getTaxRule() !== $rule) {
                continue;
            }

            if (is_null($account->getTax())) {
                if ($rate == 0) {
                    return $account->getNumber();
                }

                continue;
            }

            if (0 === bccomp($account->getTax()->getRate(), $rate, 5)) {
                return $account->getNumber();
            }
        }

        throw new LogicException(sprintf(
            "No goods account number configured for tax rule '%s' and tax rate %s (%s)",
            $rule->getName(),
            $rate,
            $origin
        ));
    }