public async Task MissingPickupDate_ThrowsException()
            {
                InitService();

                var request = _request;

                request.Data.PickupDate = null;
                var response = await _svc.GetSmartSpotQuoteAsync(request);

                AssertHasError(response, "urn:root:PickupDate", "Date is required");
            }
Esempio n. 2
0
        public async Task <IActionResult> QuoteAsync([FromBody] RecaptchaRequest <LoadshopSmartSpotQuoteRequest> request)
        {
            var response = await _svc.GetSmartSpotQuoteAsync(request);

            if (!response.IsSuccess)
            {
                var problemDetails = new ValidationProblemDetails(response.ModelState)
                {
                    Title    = "Send \"In Transit\" Status",
                    Detail   = "One or more errors occurred when trying to retrieve the Smart Spot Quote.  See form for error details",
                    Status   = (int)HttpStatusCode.BadRequest,
                    Instance = $"urn:kbxl:error:{Guid.NewGuid()}"
                };
                return(BadRequest(problemDetails));
            }
            return(Success(response.Data));
        }