From 2da277929d1eff32911c4809508b1f93fe54f586 Mon Sep 17 00:00:00 2001 From: maurok Date: Wed, 17 May 2017 18:41:47 -0300 Subject: [PATCH] # Checking that no more than one shipping option is selected --- .../PaymentsBot/Controllers/MessagesController.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CSharp/sample-payments/PaymentsBot/Controllers/MessagesController.cs b/CSharp/sample-payments/PaymentsBot/Controllers/MessagesController.cs index 7a317d64b0..fa197f15d4 100644 --- a/CSharp/sample-payments/PaymentsBot/Controllers/MessagesController.cs +++ b/CSharp/sample-payments/PaymentsBot/Controllers/MessagesController.cs @@ -148,11 +148,10 @@ private async Task OnInvoke(IInvokeActivity invoke, IConnectorClient connectorCl } } - // do not require or check default selected option - //if (result.Details.ShippingOptions.Count(option => option.Selected.HasValue && option.Selected.Value) != 1) - //{ - // throw new ArgumentException("Expected exactly zero or one selected shipping option."); - //} + if (result.Details.ShippingOptions.Count(option => option.Selected.HasValue && option.Selected.Value) > 1) + { + throw new ArgumentException("Expected exactly zero or one selected shipping option."); + } // update payment details after shipping changed await this.shippingService.UpdatePaymentDetailsAsync(result.Details, paymentRequestUpdate.ShippingAddress, catalogItem);