public static DateTime ToEetDateTime(DateTimeWithTimeZone dateTimeWithTimeZone)
        {
            var dateTimeUtc = TimeZoneInfo.ConvertTimeToUtc(dateTimeWithTimeZone.DateTime, dateTimeWithTimeZone.TimeZoneInfo);
            var dateTimeCz  = TimeZoneInfo.ConvertTimeFromUtc(dateTimeUtc, TimeZoneInfo.Local);

            return(DateTime.SpecifyKind(new DateTime(dateTimeCz.Ticks - dateTimeCz.Ticks % TimeSpan.TicksPerSecond), DateTimeKind.Local));
        }
Example #2
0
 public Revenue(CurrencyValue gross, DateTimeWithTimeZone accepted = null, CurrencyValue notTaxable = null, TaxRateItem lowerTaxRate = null, TaxRateItem reducedTaxRate = null, TaxRateItem standardTaxRate = null, CurrencyValue travelServices = null, CurrencyValue deposit = null, CurrencyValue usedDeposit = null)
 {
     Accepted        = accepted ?? DateTimeProvider.Now;
     Gross           = gross;
     NotTaxable      = notTaxable;
     LowerTaxRate    = lowerTaxRate;
     ReducedTaxRate  = reducedTaxRate;
     StandardTaxRate = standardTaxRate;
     TravelServices  = travelServices;
     Deposit         = deposit;
     UsedDeposit     = usedDeposit;
 }
Example #3
0
        public SendRevenueResult(Guid id, DateTimeWithTimeZone issued, string securityCode, SendRevenueSuccess success, SendRevenueError error, bool isPlayground, IEnumerable <Fault> warnings)
        {
            if ((success == null) == (error == null))
            {
                throw new ArgumentException("Either error or success has to be non-null.");
            }

            Id           = id;
            IsPlayground = isPlayground;
            Issued       = issued;
            SecurityCode = securityCode;
            Warnings     = warnings ?? Enumerable.Empty <Fault>();
        }
Example #4
0
        internal SendRevenueResult(SendRevenueXmlResponse response)
        {
            var confirmation = response.Item as ResponseSuccess;
            var rejection    = response.Item as ResponseError;

            var date = confirmation != null ? response.Header.Accepted : response.Header.Rejected;

            Id           = String.IsNullOrWhiteSpace(response.Header.MessageUuid) ? (Guid?)null : Guid.Parse(response.Header.MessageUuid);
            Issued       = new DateTimeWithTimeZone(date.ToUniversalTime(), TimeZoneInfo.Utc);
            SecurityCode = response.Header.SecurityCode;
            Success      = confirmation != null ? new SendRevenueSuccess(confirmation.FiscalCode) : null;
            Error        = rejection != null ? new SendRevenueError(new Fault(
                                                                        code: rejection.Code,
                                                                        message: String.Join("\n", rejection.Text)
                                                                        )) : null;
            IsPlayground = confirmation != null ? confirmation.IsPlaygroundSpecified && confirmation.IsPlayground : rejection.IsPlaygroundSpecified && rejection.IsPlayground;
            Warnings     = GetWarnings(response.Warning);
        }