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); }
public override IFiscalPrinter Connect( IChannel channel, ServiceOptions serviceOptions, bool autoDetect = true, IDictionary <string, string>?options = null) { var fiscalPrinter = new BgIslIcpFiscalPrinter(channel, serviceOptions, 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(); fiscalPrinter.Info.SupportsSubTotalAmountModifiers = false; serviceOptions.ReconfigurePrinterConstants(fiscalPrinter.Info); return(fiscalPrinter); }