public override IFiscalPrinter Connect(
            IChannel channel,
            ServiceOptions serviceOptions,
            bool autoDetect = true,
            IDictionary <string, string>?options = null)
        {
            var fiscalPrinter         = new BgIncotexIslFiscalPrinter(channel, serviceOptions, options);
            var rawDeviceInfoCacheKey = $"isl.{channel.Descriptor}";
            var rawDeviceInfo         = Cache.Get(rawDeviceInfoCacheKey);

            if (rawDeviceInfo == null)
            {
                (rawDeviceInfo, _) = fiscalPrinter.GetRawDeviceInfo();
                Cache.Store(rawDeviceInfoCacheKey, rawDeviceInfo, TimeSpan.FromSeconds(30));
            }
            // Probing
            ParseDeviceInfo(rawDeviceInfo, autoDetect);
            // If there is no InvalidDeviceInfoException get the device info and constants
            var(rawDeviceConstants, _)                         = fiscalPrinter.GetRawDeviceConstants();
            fiscalPrinter.Info                                 = ParseDeviceInfo(rawDeviceInfo, autoDetect, rawDeviceConstants);
            var(TaxIdentificationNumber, _)                    = fiscalPrinter.GetTaxIdentificationNumber();
            fiscalPrinter.Info.TaxIdentificationNumber         = TaxIdentificationNumber;
            fiscalPrinter.Info.SupportedPaymentTypes           = fiscalPrinter.GetSupportedPaymentTypes();
            fiscalPrinter.Info.SupportsSubTotalAmountModifiers = true;
            serviceOptions.ReconfigurePrinterConstants(fiscalPrinter.Info);
            return(fiscalPrinter);
        }
Example #2
0
        public override IFiscalPrinter Connect(IChannel channel, bool autoDetect = true, IDictionary <string, string>?options = null)
        {
            var fiscalPrinter = new BgIncotexIslFiscalPrinter(channel, options);

            var(rawDeviceInfo, _) = fiscalPrinter.GetRawDeviceInfo();
            // Probing
            ParseDeviceInfo(rawDeviceInfo, autoDetect);
            // If there is no InvalidDeviceInfoException get the device info and constants
            var(rawDeviceConstants, _)                 = fiscalPrinter.GetRawDeviceConstants();
            fiscalPrinter.Info                         = ParseDeviceInfo(rawDeviceInfo, autoDetect, rawDeviceConstants);
            var(TaxIdentificationNumber, _)            = fiscalPrinter.GetTaxIdentificationNumber();
            fiscalPrinter.Info.TaxIdentificationNumber = TaxIdentificationNumber;
            return(fiscalPrinter);
        }