public async Task <ActionResult> GetQuote(RequestQuote requestQuote) { try { return(Ok(await _quoteService.GetQuote(requestQuote))); } catch (EmptyQuoteRequestException) { return(BadRequest("Cannot request a quote without specifying any product.")); } catch (BeerNotSoldByWholesalerException ex) { return(BadRequest($"Beer {ex.BeerId} is not sold by the wholesaler.")); } catch (DoubleBeerRequestedException ex) { return(BadRequest($"Beer(s) {string.Join(",", ex.DoubleBeerIds)} specified twice.")); } catch (NotEnoughStockException ex) { return(BadRequest($"Beer {string.Join(",", ex.BeerId)} has not enough stock (current stock: {ex.CurrentStock}).")); } catch (WholesalerNotFoundException) { return(BadRequest($"Wholesaler {requestQuote.WholesalerId} not found")); } }
private void GetRequestQuote() { RequestQuoteRepository rightSectionRepository = new RequestQuoteRepository(); requestQuote = rightSectionRepository.GetRequestQuote(GeneralExtensions.GetQueryStringId()); rptquoteRequest.DataSource = requestQuote.GetQuoteRequest; rptquoteRequest.DataBind(); }
public async Task DenyQuote(int quoteId) { EmbedBuilder eb; if (quoteId == 0) { eb = new EmbedBuilder { Title = "Invalid Syntax / Invalid ID", Description = "**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "denyquote [id]", Color = new Color(210, 47, 33) }; await ReplyAsync("", false, eb.Build()); return; } RequestQuote q = RequestQuote.RequestQuotes.Find(quote => quote.RequestId == quoteId); if (q == null) { eb = new EmbedBuilder { Title = "Unable to find Quote", Description = "Unable to find a request quote with that ID in the database.", Color = new Color(210, 47, 33) }; await ReplyAsync("", false, eb.Build()); return; } RequestQuote.RemoveRequestQuote(quoteId); AdminLog.Log(Context.User.Id, Context.Message.Content, Context.Guild.Id); eb = new EmbedBuilder { Title = "Quote #" + quoteId + " rejected", Author = new EmbedAuthorBuilder { Name = "@" + q.CreatedBy.GetUser().Username, IconUrl = q.CreatedBy.GetUser().GetAvatarUrl() }, Description = q.QuoteText, Footer = new EmbedFooterBuilder { Text = "Rejected by @" + Context.User.Username, IconUrl = Context.User.GetAvatarUrl() } }; await ReplyAsync("", false, eb.Build()); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("", false, eb.Build()); }
private static async Task LoadAllFromDatabase() { Award.Awards = Award.LoadAll(); await new LogMessage(LogSeverity.Info, "Startup", "Loaded " + Award.Awards.Count + " Awards from the Database.").PrintToConsole(); Quote.Quotes = Quote.LoadAll(); await new LogMessage(LogSeverity.Info, "Startup", "Loaded " + Quote.Quotes.Count + " Quotes from the Database.").PrintToConsole(); RequestQuote.RequestQuotes = RequestQuote.LoadAll(); await new LogMessage(LogSeverity.Info, "Startup", "Loaded " + RequestQuote.RequestQuotes.Count + " RequestQuotes from the Database.").PrintToConsole(); }
public async Task TestGetQuoteBeersEmptyShouldThrow() { var breweryContextMoq = new Mock <IBreweryContext>(); QuoteService service = new QuoteService(breweryContextMoq.Object); RequestQuote quote = new RequestQuote() { WholesalerId = 1, Beers = new List <RequestQuoteBeers>() }; await service.GetQuote(quote); }
public void InsertOrUpdate(RequestQuote requestquote) { if (requestquote.RequestQuoteId == default(long)) { // New entity context.RequestQuotes.Add(requestquote); } else { // Existing entity context.Entry(requestquote).State = EntityState.Modified; } }
public ActionResult Edit(RequestQuote requestquote) { if (ModelState.IsValid) { requestquoteRepository.InsertOrUpdate(requestquote); requestquoteRepository.Save(); return(RedirectToAction("Index")); } else { return(View()); } }
public async Task TestGetQuotePriceExactly20ShouldReduce10Percent() { var breweryContextMoq = new Mock <IBreweryContext>(); decimal beerPrice = 0.59M; int beerRequested = 20; breweryContextMoq.Setup(bq => bq.GetWholesaler(1)) .Returns(Task.FromResult(new Wholesaler() { Id = 1, Name = "TestWholeSaler", WholesalerStocks = new List <WholesalerStock>() { new WholesalerStock() { WholesalerId = 1, BeerId = 25, Count = 200, Beer = new Beer() { Id = 25, Name = "TestBeer", AlcoolPercentage = 99.0M, Price = beerPrice } } } })); QuoteService service = new QuoteService(breweryContextMoq.Object); RequestQuote quote = new RequestQuote() { WholesalerId = 1, Beers = new List <RequestQuoteBeers>() { new RequestQuoteBeers() { BeerId = 25, Count = beerRequested }, } }; var resultQuote = await service.GetQuote(quote); Assert.AreEqual(10.62M, resultQuote.Price); }
public async Task TestGetQuoteRequestBeerWholesalerDoesntSellShouldThrow() { var breweryContextMoq = new Mock <IBreweryContext>(); breweryContextMoq.Setup(bq => bq.GetWholesaler(1)) .Returns(Task.FromResult(new Wholesaler() { Id = 1, Name = "TestWholeSaler", WholesalerStocks = new List <WholesalerStock>() { new WholesalerStock() { WholesalerId = 1, BeerId = 25, Count = 200, Beer = new Beer() { Id = 25, Name = "TestBeer", AlcoolPercentage = 99.0M, Price = 0.59M } } } })); QuoteService service = new QuoteService(breweryContextMoq.Object); RequestQuote quote = new RequestQuote() { WholesalerId = 1, Beers = new List <RequestQuoteBeers>() { new RequestQuoteBeers() { BeerId = 25, Count = 10 }, new RequestQuoteBeers() { BeerId = 19, Count = 29 }, } }; await service.GetQuote(quote); }
public async void Should_property_initialize() { var machine = new TestStateMachine(); var instance = new TestState(); var requestQuote = new RequestQuote { Symbol = "MSFT", TicketNumber = "8675309", }; ConsumeContext <RequestQuote> consumeContext = new InternalConsumeContext <RequestQuote>(requestQuote); await machine.RaiseEvent(instance, machine.QuoteRequested, requestQuote, consumeContext); await machine.RaiseEvent(instance, x => x.QuoteRequest.Completed, new Quote { Symbol = requestQuote.Symbol }); }
protected void Page_Load(object sender, EventArgs e) { string requestQuoteKey = "requestQuote"; if (HttpContext.Current.Cache[requestQuoteKey] == null) { RequestQuoteRepository rightSectionRepository = new RequestQuoteRepository(); long requestQuoteId = GeneralExtensions.GetQueryStringId(); if (requestQuoteId == 0) requestQuoteId = 125; requestQuote = rightSectionRepository.GetRequestQuote(requestQuoteId); if (requestQuote != null) HttpContext.Current.Cache.Insert(requestQuoteKey, requestQuote, null, DateTime.Now.AddMinutes("CacheDuration".GetAppKeyDouble()), TimeSpan.Zero); } else { requestQuote = (RequestQuote)HttpContext.Current.Cache[requestQuoteKey]; } rptquoteRequest.DataSource = requestQuote.GetQuoteRequest; rptquoteRequest.DataBind(); }
public async Task RequestToAddQuote([Remainder] string quote = null) { if (Guild.Load(Context.Guild.Id).QuotesEnabled) { int userLevel = User.Load(Context.User.Id).Level; int quoteLevelRequirement = Configuration.Load().QuoteLevelRequirement; if (userLevel < quoteLevelRequirement) { await ReplyAsync(Context.User.Mention + ", you need to be level " + quoteLevelRequirement + "+ to add a quote request."); return; } if (quote == null) { await ReplyAsync("**Syntax:** " + Guild.Load(Context.Guild.Id).Prefix + "requestquote [quote]\n" + "**Alias:** " + Guild.Load(Context.Guild.Id).Prefix + "buyquote [quote]\n```" + "**Information:**\n" + "-----------------------------\n" + "• Your quote will not be added instantly to the list. A staff member must first verify that it is safe to put on the list.\n" + "```"); return; } RequestQuote.AddRequestQuote(quote, Context.User.Id, Context.Guild.Id); await ReplyAsync(Context.User.Mention + ", your quote has been added to the list, and should be verified by a staff member shortly."); await Configuration.Load().LogChannelId.GetTextChannel().SendMessageAsync("**New Quote**\nQuote requested by: **" + Context.User.Mention + "**\nQuote: " + quote); await Guild.Load(Context.Guild.Id).LogChannelID.GetTextChannel().SendMessageAsync("**New Quote**\n" + quote + "\n\n*Do " + Guild.Load(Context.Guild.Id).Prefix + "listrequestquotes to view the ID and other quotes.*"); } else { await ReplyAsync("Quotes are currently disabled. Try again later."); } }
private void SyncViewWithModel() { AddDisposable(_router.GetModelObservable().Observe(model => { using (_entryMonitor.Enter()) { Log.DebugFormat("Model update received. Version: {0}", model.Version); QuoteId = model.Rfq.QuoteId; OrderSummary = model.Inputs.OrderSummary; RfqSummary = model.Rfq.RfqSummary; Notional.Sync(model.Inputs.Notional); CurrencyPair.Sync(model.Inputs.CurrencyPair); Status = model.Rfq.Status; Rate = model.Rfq.Rate; RequestQuote.RaiseCanExecuteChanged(); AcceptQuoteCommand.RaiseCanExecuteChanged(); RejectQuoteCommand.RaiseCanExecuteChanged(); IsRequestQuoteButtonVisible = !model.Rfq.Status.RfqInFlight(); QuotingButtonsVisible = model.Rfq.Status == QuoteStatus.Quoting; } })); }
public async Task Should_property_initialize() { Request <GetQuote, Quote> QuoteRequest = null; Event <RequestQuote> QuoteRequested = null; var machine = AutomatonymousStateMachine <TestState> .New(builder => builder .InstanceState(x => x.CurrentState) .Event("QuoteRequested", out QuoteRequested) .Request(x => x.ServiceAddress = new Uri("loopback://localhost/my_queue"), "QuoteRequest", out QuoteRequest) .Initially() .When(QuoteRequested, b => b .Then(context => Console.WriteLine("Quote requested: {0}", context.Data.Symbol)) .Request(QuoteRequest, context => new GetQuote { Symbol = context.Message.Symbol }) .TransitionTo(QuoteRequest.Pending) ) .During(QuoteRequest.Pending) .When(QuoteRequest.Completed, b => b.Then((context) => Console.WriteLine("Request Completed!"))) .When(QuoteRequest.Faulted, b => b.Then((context) => Console.WriteLine("Request Faulted"))) .When(QuoteRequest.TimeoutExpired, b => b.Then((context) => Console.WriteLine("Request timed out"))) ); var instance = new TestState(); var requestQuote = new RequestQuote { Symbol = "MSFT", TicketNumber = "8675309", }; ConsumeContext <RequestQuote> consumeContext = new InternalConsumeContext <RequestQuote>(requestQuote); await machine.RaiseEvent(instance, QuoteRequested, requestQuote, consumeContext); await machine.RaiseEvent(instance, QuoteRequest.Completed, new Quote { Symbol = requestQuote.Symbol }); }
public async Task TestGetQuoteWholesalerNotFoundShouldThrow() { var breweryContextMoq = new Mock <IBreweryContext>(); breweryContextMoq.Setup(bq => bq.GetWholesaler(1)) .Returns(Task.FromResult <Wholesaler>(null)); QuoteService service = new QuoteService(breweryContextMoq.Object); RequestQuote quote = new RequestQuote() { WholesalerId = 1, Beers = new List <RequestQuoteBeers>() { new RequestQuoteBeers() { BeerId = 1, Count = 10 } } }; await service.GetQuote(quote); }
public async Task TestGetQuotePriceMoreThan20BeersMultipleBeers() { var breweryContextMoq = new Mock <IBreweryContext>(); decimal firstBeerPrice = 0.59M; decimal secondBeerPrice = 0.41M; int firstBeerCountRequest = 199; int secondBeerCountRequest = 56; int firstBeerId = 25; int secondBeerId = 36; breweryContextMoq.Setup(bq => bq.GetWholesaler(1)) .Returns(Task.FromResult(new Wholesaler() { Id = 1, Name = "TestWholeSaler", WholesalerStocks = new List <WholesalerStock>() { new WholesalerStock() { WholesalerId = 1, BeerId = firstBeerId, Count = 200, Beer = new Beer() { Id = firstBeerId, Name = "TestBeer", AlcoolPercentage = 99.0M, Price = firstBeerPrice } }, new WholesalerStock() { WholesalerId = 1, BeerId = secondBeerId, Count = 360, Beer = new Beer() { Id = secondBeerId, Name = "TestBeer2", AlcoolPercentage = 99.0M, Price = secondBeerPrice } }, } })); QuoteService service = new QuoteService(breweryContextMoq.Object); RequestQuote quote = new RequestQuote() { WholesalerId = 1, Beers = new List <RequestQuoteBeers>() { new RequestQuoteBeers() { BeerId = firstBeerId, Count = firstBeerCountRequest }, new RequestQuoteBeers() { BeerId = secondBeerId, Count = secondBeerCountRequest } } }; var resultQuote = await service.GetQuote(quote); Assert.AreEqual(112.30M, resultQuote.Price); }
private static void SetupQuoteRequest(string filePath, ref XmlDocument doc, RequestQuote model) { XmlNode FromCountryCode = doc.SelectSingleNode("//From//CountryCode"); FromCountryCode.InnerText = model.Origin.CountryCode; XmlNode FromPostalcode = doc.SelectSingleNode("//From//Postalcode"); if (FromPostalcode != null) { FromPostalcode.InnerText = model.Origin.Postalcode; } XmlNode FromCity = doc.SelectSingleNode("//From//City"); if (FromCity != null) { FromCity.InnerText = model.Origin.City; } XmlNode paymentCountryCode = doc.SelectSingleNode("//BkgDetails//PaymentCountryCode"); XmlNode date = doc.SelectSingleNode("//BkgDetails//Date"); XmlNode readyTime = doc.SelectSingleNode("//BkgDetails//ReadyTime"); XmlNode readyTimeGMTOffset = doc.SelectSingleNode("//BkgDetails//ReadyTimeGMTOffset"); XmlNode dimensionUnit = doc.SelectSingleNode("//BkgDetails//DimensionUnit"); XmlNode weightUnit = doc.SelectSingleNode("//BkgDetails//WeightUnit"); XmlNode pieceID = doc.SelectSingleNode("//Pieces//Piece//PieceID"); XmlNode height = doc.SelectSingleNode("//Pieces//Piece//Height"); XmlNode depth = doc.SelectSingleNode("//Pieces//Piece//Depth"); XmlNode width = doc.SelectSingleNode("//Pieces//Piece//Width"); XmlNode weight = doc.SelectSingleNode("//Pieces//Piece//Weight"); XmlNode isDutiable = doc.SelectSingleNode("//BkgDetails//IsDutiable"); XmlNode networkTypeCode = doc.SelectSingleNode("//BkgDetails//NetworkTypeCode"); XmlNode declaredCurrency = doc.SelectSingleNode("//Dutiable//DeclaredCurrency"); XmlNode declaredValue = doc.SelectSingleNode("//Dutiable//DeclaredValue"); XmlNode ToCountryCode = doc.SelectSingleNode("//To//CountryCode"); ToCountryCode.InnerText = model.Destination.CountryCode; XmlNode ToPostalcode = doc.SelectSingleNode("//To//Postalcode"); XmlNode ToCity = doc.SelectSingleNode("//To//City"); if (ToPostalcode != null) { ToPostalcode.InnerText = model.Destination.Postalcode; } if (ToCity != null) { ToCity.InnerText = model.Destination.City; } // Set values to elements pull out from above paymentCountryCode.InnerText = model.BkgDetails.PaymentCountryCode; date.InnerText = model.BkgDetails.Date; readyTime.InnerText = model.BkgDetails.ReadyTime; readyTimeGMTOffset.InnerText = model.BkgDetails.ReadyTimeGMTOffset; dimensionUnit.InnerText = model.BkgDetails.DimensionUnit; weightUnit.InnerText = model.BkgDetails.WeightUnit; if (model.BkgDetails.Pieces.Count > 1) { XmlNode Pieces = doc.SelectSingleNode("//Pieces"); foreach (var piece in model.BkgDetails.Pieces.Skip(1)) { XmlNode Piece = doc.CreateNode(XmlNodeType.Element, "Piece", ""); XmlNode PieceID = doc.CreateNode(XmlNodeType.Element, "PieceID", ""); PieceID.InnerText = piece.PieceID.ToString(); XmlNode Height = doc.CreateNode(XmlNodeType.Element, "Height", ""); Height.InnerText = piece.Height.ToString(); XmlNode Depth = doc.CreateNode(XmlNodeType.Element, "Depth", ""); Depth.InnerText = piece.Depth.ToString(); XmlNode Width = doc.CreateNode(XmlNodeType.Element, "Width", ""); Width.InnerText = piece.Width.ToString(); XmlNode Weight = doc.CreateNode(XmlNodeType.Element, "Weight", ""); Weight.InnerText = piece.Weight.ToString(); Piece.AppendChild(PieceID); Piece.AppendChild(Height); Piece.AppendChild(Depth); Piece.AppendChild(Width); Piece.AppendChild(Weight); Pieces.AppendChild(Piece); } } isDutiable.InnerText = model.BkgDetails.IsDutiable; if (networkTypeCode != null) { networkTypeCode.InnerText = model.BkgDetails.NetworkTypeCode; } XmlNode globalProductCode = doc.SelectSingleNode("//BkgDetails//QtdShp//GlobalProductCode"); if (model.BkgDetails.QtdShp != null && globalProductCode != null && model.BkgDetails.QtdShp.GlobalProductCode != null) { globalProductCode.InnerText = model.BkgDetails.QtdShp.GlobalProductCode; } XmlNode localProductCode = doc.SelectSingleNode("//BkgDetails//QtdShp//LocalProductCode"); if (model.BkgDetails.QtdShp != null && localProductCode != null) { XmlNode specialServiceType = doc.SelectSingleNode("//BkgDetails//QtdShp//QtdShpExChrg//SpecialServiceType"); if (specialServiceType != null) { XmlNode localSpecialServiceType = doc.SelectSingleNode("//BkgDetails//QtdShp//QtdShpExChrg//LocalSpecialServiceType"); specialServiceType.InnerText = model.BkgDetails.QtdShp.QtdShpExChrg_SpecialServiceType; localSpecialServiceType.InnerText = model.BkgDetails.QtdShp.QtdShpExChrg_LocalSpecialServiceType; } localProductCode.InnerText = model.BkgDetails.QtdShp.LocalProductCode; } XmlNode insuredValue = doc.SelectSingleNode("//BkgDetails//InsuredValue"); XmlNode insuredCurrency = doc.SelectSingleNode("//BkgDetails//InsuredCurrency"); if (insuredValue != null) { insuredValue.InnerText = model.BkgDetails.InsuredValue; insuredCurrency.InnerText = model.BkgDetails.InsuredCurrency; } declaredCurrency.InnerText = model.Dutiable.DeclaredCurrency; declaredValue.InnerText = model.Dutiable.DeclaredValue.ToString(); doc.Save(filePath); }
public async Task <QuoteResult> GetQuote(RequestQuote requestQuote) { if (requestQuote.Beers == null || requestQuote.Beers.Count == 0 || requestQuote.Beers.Sum(b => b.Count) == 0) { throw new EmptyQuoteRequestException(); } Wholesaler wholesaler = await _breweryContext.GetWholesaler(requestQuote.WholesalerId); if (wholesaler == null) { throw new WholesalerNotFoundException(); } var doubleBeers = requestQuote.Beers .GroupBy(b => b.BeerId) .Where(g => g.Count() > 1) .Select(g => g.Key) .ToList(); if (doubleBeers.Any()) { throw new DoubleBeerRequestedException(doubleBeers); } int totalRequestCountBeer = requestQuote.Beers.Sum(b => b.Count); var discountPercentage = 1.0M; var totalPrice = 0.0M; var requestedBeers = new List <QuoteResultBeer>(); if (totalRequestCountBeer > 20) { discountPercentage = 0.8M; } else if (totalRequestCountBeer > 10) { discountPercentage = 0.9M; } foreach (var requestedBeer in requestQuote.Beers) { var wholeSalerStock = wholesaler.WholesalerStocks.FirstOrDefault(ws => ws.BeerId == requestedBeer.BeerId); if (wholeSalerStock == null) { throw new BeerNotSoldByWholesalerException(requestedBeer.BeerId); } if (wholeSalerStock.Count < requestedBeer.Count) { throw new NotEnoughStockException(requestedBeer.BeerId, wholeSalerStock.Count); } requestedBeers.Add(new QuoteResultBeer() { BeerId = requestedBeer.BeerId, BeerName = wholeSalerStock.Beer.Name, RequestedCount = requestedBeer.Count }); totalPrice += requestedBeer.Count * wholeSalerStock.Beer.Price; } totalPrice = totalPrice * discountPercentage; return(new QuoteResult() { Price = Math.Round(totalPrice, 2), Beers = requestedBeers, WholesalerId = wholesaler.Id, WholesalerName = wholesaler.Name }); }
public async Task <ActionResult <UseCaseResult <JobModel> > > Post([FromBody] RequestQuote request) { return(Ok(await UseCase.Execute(request))); }
public ActionResult _RequestQuote(RequestQuote model) { return(View()); }
static void Main(string[] args) { //DHLApi api = new DHLApi(); string url = ConfigurationManager.AppSettings["DHLWebApi"]; //string xmlFile = "TrackingRequest_SingleAWB_10D.xml"; //string xmlFile = "TrackingRequest_MultipleLP_PieceEnabled_B_1.xml"; //string xmlFile = "Shipment_Global_AP_RegularShpmt_Request.xml"; //string xmlFile = "Request.xml"; //string xmlFile = "BookPickup_GlobalAP_Valid1_Request.xml"; //string xmlFile = "Valid15_Quote_VolWeightHigher_Request.xml"; //string xmlFile = "Valid13_Quote_IMPPricebyReceiver_Request.xml"; string xmlFile = "Valid10_Quote_AP_PriceBreakdownRAS_Request.xml"; //string xmlFile = "Valid11_Quote_EU_PriceBreakdownRAS_Request.xml"; //string xmlFile = "Valid14_Quote_IMPPriceby3rdParty_Request.xml"; //string xmlFile = "Valid17_Quote_EU_NonEU_WithAcctProdInsurance_Request.xml"; //string xmlFile = "Valid18_Quote_BRtoUS_Request.xml"; //string xmlFile = "Valid19_Quote_PEtoEG_Suburb_Request.xml"; //string xmlFile = "Valid20_Quote_BRtoBR_TaxBreakdownPricing_Request.xml"; //string xmlFile = "Valid3_Capability_EU_NonEU_Dutiable_Request.xml"; //string xmlFile = "Valid3_Capability_EU_NonEU_Dutiable_Request.xml"; #if false string filePath = Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath(@"~/DHLShippingXml/"), xmlFile); #else string filePath = Path.Combine(Environment.CurrentDirectory + @"/DHLShippingXml/", xmlFile); #endif // Setup RequestQuote object RequestBase requestQuote = new RequestQuote { RequestType = REQUESTS.CAPABILITY, Origin = new CountryPostalCode() { CountryCode = "BE", Postalcode = "1020", City = "Lima" }, BkgDetails = new BkgDetails() { PaymentCountryCode = "BE", Date = "2017-08-27", ReadyTime = "PT10H22M", ReadyTimeGMTOffset = "+02:00", DimensionUnit = "CM", WeightUnit = "KG", Pieces = new List <Piece>() { new Piece() { PieceID = 1, Height = 30, Depth = 20, Width = 10, Weight = 1.0f, }, new Piece() { PieceID = 2, Height = 60, Depth = 40, Width = 20, Weight = 2.0f, } }, IsDutiable = "Y", NetworkTypeCode = "AL", QtdShp = new QtdShp() { LocalProductCode = "S", QtdShpExChrg_SpecialServiceType = "I", QtdShpExChrg_LocalSpecialServiceType = "II" }, InsuredValue = "400.000", InsuredCurrency = "EUR", }, Destination = new CountryPostalCode() { CountryCode = "US", Postalcode = "86001" }, Dutiable = new Dutiable() { DeclaredCurrency = "EUR", DeclaredValue = "9.0" } }; // Setup RequestTracking object RequestBase requestTracking = new RequestTracking() { RequestType = REQUESTS.TRACKING, LanguageCode = "en", Waybill = "5093841045", //LPNumber = "JD0144549751510007712", LevelOfDetails = "ALL_CHECK_POINTS", PiecesEnabled = "B" }; #if true DHLApi.SetupRequest(filePath, requestQuote); DHLApi.XmlRequest(url, filePath); DHLResponse resp = DHLApi.XmlResponse(DHLApi.ResponseXmlString, REQUESTS.CAPABILITY); #else DHLApi.SetupRequest(filePath, requestTracking); DHLApi.XmlRequest(url, filePath); DHLResponse resp = DHLApi.XmlResponse(DHLApi.ResponseXmlString, REQUESTS.TRACKING); #endif if (resp.RequestType == REQUESTS.TRACKING) { OutputTrackingResponse(resp.Trackings); } else { OutputQuoteResponse(resp.Quote); } }