public override IFiscalPrinter Connect(IChannel channel, bool autoDetect = true, IDictionary <string, string>?options = null)
        {
            var fiscalPrinter = new BgIslIcpFiscalPrinter(channel, options);

            var(rawDeviceInfo, _) = fiscalPrinter.GetRawDeviceInfo();
            fiscalPrinter.Info    = ParseDeviceInfo(rawDeviceInfo, autoDetect);
            return(fiscalPrinter);
        }
예제 #2
0
        public override IFiscalPrinter Connect(IChannel channel, bool autoDetect = true, IDictionary <string, string>?options = null)
        {
            var fiscalPrinter         = new BgIslIcpFiscalPrinter(channel, options);
            var rawDeviceInfoCacheKey = $"icp.{channel.Descriptor}";
            var rawDeviceInfo         = Cache.Get(rawDeviceInfoCacheKey);

            if (rawDeviceInfo == null)
            {
                (rawDeviceInfo, _) = fiscalPrinter.GetRawDeviceInfo();
                Cache.Store(rawDeviceInfoCacheKey, rawDeviceInfo, TimeSpan.FromSeconds(30));
            }
            fiscalPrinter.Info = ParseDeviceInfo(rawDeviceInfo, autoDetect);
            fiscalPrinter.Info.SupportedPaymentTypes = fiscalPrinter.GetSupportedPaymentTypes();
            return(fiscalPrinter);
        }