$deliveries способы доставки: [название, «Значение НДС» * (`ofd_nds`, пусто — системная ставка)] * * @return array нераспознанные ставки: `системная ставка PHPShop (товары): 23` */ public static function find( bool $fiscalization, bool $vatEnabled, VatSetting $goodsVat, VatSetting $deliveryVat, string $systemPercent, array $deliveries ): array { if (!$fiscalization || !$vatEnabled) { return []; } $warnings = []; if ($goodsVat->getFixed() === null && Vat::tryFromPercent($systemPercent) === null) { $warnings[] = 'системная ставка PHPShop (товары): ' . self::shown($systemPercent); } if ($deliveryVat->getFixed() === null) { foreach ($deliveries as [$name, $percent]) { $percent = (trim($percent) !== '') ? $percent : $systemPercent; if (Vat::tryFromPercent($percent) === null) { $warnings[] = 'доставка «' . $name . '»: ' . self::shown($percent); } } } return $warnings; } /** * Значение для сообщения: пустое — словом, иначе как ввёл мерчант. */ public static function shown(string $percent): string { $percent = trim($percent); return ($percent === '') ? 'не задана' : $percent . '%'; } }