diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/ContosoFlowers.BotAssets.csproj b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/ContosoFlowers.BotAssets.csproj index 875c678e78..a963f14f04 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/ContosoFlowers.BotAssets.csproj +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/ContosoFlowers.BotAssets.csproj @@ -39,24 +39,24 @@ ..\packages\Chronic.Signed.0.3.2\lib\net40\Chronic.dll True - - ..\packages\Microsoft.Bot.Builder.3.5.3\lib\net46\Microsoft.Bot.Builder.dll + + ..\packages\Microsoft.Bot.Builder.3.8.0\lib\net46\Microsoft.Bot.Builder.dll True - - ..\packages\Microsoft.Bot.Builder.3.5.3\lib\net46\Microsoft.Bot.Builder.Autofac.dll + + ..\packages\Microsoft.Bot.Builder.3.8.0\lib\net46\Microsoft.Bot.Builder.Autofac.dll True - - ..\packages\Microsoft.Bot.Builder.Location.1.1.0\lib\net46\Microsoft.Bot.Builder.Location.dll + + ..\packages\Microsoft.Bot.Builder.Location.2.0.0\lib\net46\Microsoft.Bot.Builder.Location.dll True - - ..\packages\Microsoft.Bot.Builder.3.5.3\lib\net46\Microsoft.Bot.Connector.dll + + ..\packages\Microsoft.Bot.Builder.3.8.0\lib\net46\Microsoft.Bot.Connector.dll True - - ..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.3.308261200\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll + + ..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.4.403061554\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll True @@ -69,8 +69,8 @@ - - ..\packages\System.IdentityModel.Tokens.Jwt.4.0.3.308261200\lib\net45\System.IdentityModel.Tokens.Jwt.dll + + ..\packages\System.IdentityModel.Tokens.Jwt.4.0.4.403061554\lib\net45\System.IdentityModel.Tokens.Jwt.dll True diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/Dialogs/CancelablePromptChoice.cs b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/Dialogs/CancelablePromptChoice.cs index 9a083419f6..8b90651903 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/Dialogs/CancelablePromptChoice.cs +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/Dialogs/CancelablePromptChoice.cs @@ -52,7 +52,7 @@ protected override bool TryParse(IMessageActivity message, out T result) return base.TryParse(message, out result); } - protected override IMessageActivity MakePrompt(IDialogContext context, string prompt, IReadOnlyList options = null, IReadOnlyList descriptions = null) + protected override IMessageActivity MakePrompt(IDialogContext context, string prompt, IReadOnlyList options = null, IReadOnlyList descriptions = null, string speak = null) { prompt += Environment.NewLine + (this.promptOptions.CancelPrompt ?? this.promptOptions.DefaultCancelPrompt); return base.MakePrompt(context, prompt, options); diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/app.config b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/app.config index 58c3c3f6a2..782d507f56 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/app.config +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/app.config @@ -12,11 +12,11 @@ - + - + diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/packages.config b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/packages.config index 06b3666413..c74d5526c1 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/packages.config +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers.BotAssets/packages.config @@ -4,10 +4,10 @@ - - - + + + - + \ No newline at end of file diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers/ContosoFlowers.csproj b/CSharp/demo-ContosoFlowers/ContosoFlowers/ContosoFlowers.csproj index 7bcd10d25a..8b1ab64e76 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers/ContosoFlowers.csproj +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers/ContosoFlowers.csproj @@ -63,25 +63,25 @@ ..\packages\Chronic.Signed.0.3.2\lib\net40\Chronic.dll True - - ..\packages\Microsoft.Bot.Builder.3.5.3\lib\net46\Microsoft.Bot.Builder.dll + + ..\packages\Microsoft.Bot.Builder.3.8.0\lib\net46\Microsoft.Bot.Builder.dll True - - ..\packages\Microsoft.Bot.Builder.3.5.3\lib\net46\Microsoft.Bot.Builder.Autofac.dll + + ..\packages\Microsoft.Bot.Builder.3.8.0\lib\net46\Microsoft.Bot.Builder.Autofac.dll True - - ..\packages\Microsoft.Bot.Builder.Location.1.1.0\lib\net46\Microsoft.Bot.Builder.Location.dll + + ..\packages\Microsoft.Bot.Builder.Location.2.0.0\lib\net46\Microsoft.Bot.Builder.Location.dll True - - ..\packages\Microsoft.Bot.Builder.3.5.3\lib\net46\Microsoft.Bot.Connector.dll + + ..\packages\Microsoft.Bot.Builder.3.8.0\lib\net46\Microsoft.Bot.Connector.dll True - - ..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.3.308261200\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll + + ..\packages\Microsoft.IdentityModel.Protocol.Extensions.1.0.4.403061554\lib\net45\Microsoft.IdentityModel.Protocol.Extensions.dll True @@ -101,8 +101,8 @@ True - - ..\packages\System.IdentityModel.Tokens.Jwt.4.0.3.308261200\lib\net45\System.IdentityModel.Tokens.Jwt.dll + + ..\packages\System.IdentityModel.Tokens.Jwt.4.0.4.403061554\lib\net45\System.IdentityModel.Tokens.Jwt.dll True @@ -199,7 +199,9 @@ - + + Designer + diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers/Controllers/CheckOutController.cs b/CSharp/demo-ContosoFlowers/ContosoFlowers/Controllers/CheckOutController.cs index ff39a6582b..9d39378c00 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers/Controllers/CheckOutController.cs +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers/Controllers/CheckOutController.cs @@ -3,6 +3,7 @@ using System; using System.Threading.Tasks; using System.Web.Mvc; + using Microsoft.Bot.Builder.ConnectorEx; using Microsoft.Bot.Builder.Dialogs; using Services; using Services.Models; @@ -43,15 +44,25 @@ public ActionResult Index(string state, string orderId) [Route("")] [HttpPost] - public async Task Index(string state, string orderId, PaymentDetails paymentDetails) + public async Task Index( + string botId, + string channelId, + string conversationId, + string serviceUrl, + string userId, + string orderId, + PaymentDetails paymentDetails) + { this.ordersService.ConfirmOrder(orderId, paymentDetails); - // Send Receipt - var resumptionCookie = ResumptionCookie.GZipDeserialize(state); - var message = resumptionCookie.GetMessage(); + var address = new Address(botId, channelId, userId, conversationId, serviceUrl); + var conversationReference = address.ToConversationReference(); + var message = conversationReference.GetPostToBotMessage(); + message.Text = orderId; - await Conversation.ResumeAsync(resumptionCookie, message); + + await Conversation.ResumeAsync(conversationReference, message); return this.RedirectToAction("Completed", new { orderId = orderId }); } diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers/Dialogs/RootDialog.cs b/CSharp/demo-ContosoFlowers/ContosoFlowers/Dialogs/RootDialog.cs index e51cb70c58..5026dd543d 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers/Dialogs/RootDialog.cs +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers/Dialogs/RootDialog.cs @@ -8,6 +8,7 @@ using AutoMapper; using BotAssets.Dialogs; using BotAssets.Extensions; + using Microsoft.Bot.Builder.ConnectorEx; using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Builder.FormFlow; using Microsoft.Bot.Builder.Location; @@ -25,7 +26,7 @@ public class RootDialog : IDialog private readonly IOrdersService ordersService; private Models.Order order; - private ResumptionCookie resumptionCookie; + private ConversationReference conversationReference; public RootDialog(string checkoutUriFormat, IContosoFlowersDialogFactory dialogFactory, IOrdersService ordersService) { @@ -43,9 +44,9 @@ public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitabl { var message = await result; - if (this.resumptionCookie == null) + if (this.conversationReference == null) { - this.resumptionCookie = new ResumptionCookie(message); + this.conversationReference = message.ToConversationReference(); } await this.WelcomeMessageAsync(context); @@ -271,15 +272,19 @@ private async Task PaymentSelectionAsync(IDialogContext context) private string BuildCheckoutUrl(string orderID) { - var encodedCookie = this.resumptionCookie.GZipSerialize(); var uriBuilder = new UriBuilder(this.checkoutUriFormat); - var query = HttpUtility.ParseQueryString(uriBuilder.Query); - query["state"] = encodedCookie; + var query = HttpUtility.ParseQueryString(uriBuilder.Query); query["orderID"] = orderID; + query["botId"] = this.conversationReference.Bot.Id; + query["channelId"] = this.conversationReference.ChannelId; + query["conversationId"] = this.conversationReference.Conversation.Id; + query["serviceUrl"] = this.conversationReference.ServiceUrl; + query["userId"] = this.conversationReference.User.Id; uriBuilder.Query = query.ToString(); var checkoutUrl = uriBuilder.Uri.ToString(); + return checkoutUrl; } diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers/Views/CheckOut/Index.cshtml b/CSharp/demo-ContosoFlowers/ContosoFlowers/Views/CheckOut/Index.cshtml index 49e8f1b05e..ffff250750 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers/Views/CheckOut/Index.cshtml +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers/Views/CheckOut/Index.cshtml @@ -31,8 +31,12 @@

+ @Html.Hidden("botId", Request.QueryString.Get("botId")) + @Html.Hidden("channelId", Request.QueryString.Get("channelId")) + @Html.Hidden("conversationId", Request.QueryString.Get("conversationId")) + @Html.Hidden("serviceUrl", Request.QueryString.Get("serviceUrl")) + @Html.Hidden("userId", Request.QueryString.Get("userId")) @Html.Hidden("orderId", Model.OrderID) - @Html.Hidden("state", (string)ViewBag.State)

diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers/Web.config b/CSharp/demo-ContosoFlowers/ContosoFlowers/Web.config index a5a99ef046..744b2798ae 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers/Web.config +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers/Web.config @@ -78,11 +78,11 @@ - + - + diff --git a/CSharp/demo-ContosoFlowers/ContosoFlowers/packages.config b/CSharp/demo-ContosoFlowers/ContosoFlowers/packages.config index 44974745cd..814910bf56 100644 --- a/CSharp/demo-ContosoFlowers/ContosoFlowers/packages.config +++ b/CSharp/demo-ContosoFlowers/ContosoFlowers/packages.config @@ -12,13 +12,13 @@ - - - + + + - + \ No newline at end of file