Beispiel #1
0
        public async Task <FulfillmentResponse> FulfillAsync(FulfillmentRequest fulfillmentRequest, IJobberClient jobberClient)
        {
            var serviceName        = fulfillmentRequest.GetParameter(Constants.Variables.ServiceName);
            var newUnitPrice       = fulfillmentRequest.GetParameterAsDouble(Constants.Variables.Price);
            var modifyQuoteContext = fulfillmentRequest.GetContextParameterAs <ModifyQuoteContext>(
                Constants.Contexts.QuoteDetailsSet, Constants.Variables.ModifyQuoteContext);

            var modifiedQuote = UpdateServicePriceInQuote(modifyQuoteContext.Quote, serviceName, newUnitPrice);

            await jobberClient.UpdateQuoteAsync(modifiedQuote);

            return(FulfillmentResponseBuilder.Create()
                   .Speech("Okay. I've updated the quote for you.")
                   .Build());
        }