Пример #1
0
        public override IFiscalPrinter Connect(IChannel channel, IDictionary <string, string>?options = null)
        {
            var fiscalPrinter = new BgTremolZfpFiscalPrinter(channel, options);

            var(rawDeviceInfo, _) = fiscalPrinter.GetRawDeviceInfo();
            fiscalPrinter.Info    = ParseDeviceInfo(rawDeviceInfo);
            return(fiscalPrinter);
        }
        public override IFiscalPrinter Connect(IChannel channel, bool autoDetect = true, IDictionary <string, string>?options = null)
        {
            var fiscalPrinter = new BgTremolZfpFiscalPrinter(channel, options);

            var(rawDeviceInfo, _)                      = fiscalPrinter.GetRawDeviceInfo();
            fiscalPrinter.Info                         = ParseDeviceInfo(rawDeviceInfo, autoDetect);
            var(TaxIdentificationNumber, _)            = fiscalPrinter.GetTaxIdentificationNumber();
            fiscalPrinter.Info.TaxIdentificationNumber = TaxIdentificationNumber;
            return(fiscalPrinter);
        }
Пример #3
0
        public override IFiscalPrinter Connect(IChannel channel, bool autoDetect = true, IDictionary <string, string>?options = null)
        {
            var fiscalPrinter         = new BgTremolZfpFiscalPrinter(channel, options);
            var rawDeviceInfoCacheKey = $"zfp.{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);
            var(TaxIdentificationNumber, _)            = fiscalPrinter.GetTaxIdentificationNumber();
            fiscalPrinter.Info.TaxIdentificationNumber = TaxIdentificationNumber;
            fiscalPrinter.Info.SupportedPaymentTypes   = fiscalPrinter.GetSupportedPaymentTypes();
            return(fiscalPrinter);
        }