private CreditNoteRecountPostModel CreateRecountPostModel() { var model = new CreditNoteRecountPostModel { CurrencyId = _creditNotePostModel.CurrencyId, DateOfTaxing = DateTime.Today.SetKindUtc(), DiscountPercentage = 0, ExchangeRate = 1, ExchangeRateAmount = 1, PaymentOptionId = 1, Items = new List <CreditNoteItemRecountPostModel> { new CreditNoteItemRecountPostModel { Amount = 2, Id = 5, Name = "item", PriceType = PriceType.WithoutVat, UnitPrice = 100, VatRateType = VatRateType.Basic, DiscountPercentage = 10 } } }; return(model); }
private static void ComparePostAndGetRecountModels(CreditNoteRecountPostModel postModel, CreditNoteRecountGetModel getModel) { Assert.AreEqual(postModel.CurrencyId, getModel.CurrencyId); Assert.AreEqual(postModel.DiscountPercentage, getModel.DiscountPercentage); Assert.AreEqual(postModel.ExchangeRate, getModel.ExchangeRate); Assert.AreEqual(postModel.ExchangeRateAmount, getModel.ExchangeRateAmount); Assert.AreEqual(0, getModel.Prices.TotalPaid); Assert.AreEqual(0, getModel.Prices.TotalPaidHc); Assert.AreEqual(37.8m, getModel.Prices.TotalVat); Assert.AreEqual(37.8m, getModel.Prices.TotalVatHc); Assert.AreEqual(180.2m, getModel.Prices.TotalWithoutVat); Assert.AreEqual(180.2m, getModel.Prices.TotalWithoutVatHc); Assert.AreEqual(218m, getModel.Prices.TotalWithVat); Assert.AreEqual(218m, getModel.Prices.TotalWithVatHc); Assert.AreEqual(-24.2m, getModel.Prices.TotalDiscountAmount); Assert.AreEqual(242m, getModel.Prices.TotalWithoutDiscount); Assert.GreaterOrEqual(getModel.Items.Count, 1); ComparePostAndGetRecountItemModels(postModel.Items.First(), getModel.Items.First(i => i.ItemType == IssuedInvoiceItemType.ItemTypeNormal)); Assert.AreEqual(2, getModel.Prices.VatRateSummary.Count); CheckRecountVatRateSummary(getModel.Prices.VatRateSummary.First()); }
/// <inheritdoc /> public ApiResult <CreditNoteRecountGetModel> Recount(CreditNoteRecountPostModel model) { var resource = $"{ResourceUrl}/Recount"; return(Post <CreditNoteRecountPostModel, CreditNoteRecountGetModel>(resource, model)); }
/// <inheritdoc/> public Task <ApiResult <CreditNoteRecountGetModel> > RecountAsync(CreditNoteRecountPostModel model, CancellationToken cancellationToken = default) { var resource = $"{ResourceUrl}/Recount"; return(PostAsync <CreditNoteRecountPostModel, CreditNoteRecountGetModel>(resource, model, cancellationToken)); }