Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Checkout - SavePaymentMethod, remove TryUpdateModelAsync
supportf3504c3ea076
diff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.csindex 2673e6bd8..38d85d6d5 100644--- a/src/Web/Grand.Web/Controllers/CheckoutController.cs+++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs@@ -862,7 +862,7 @@ namespace Grand.Web.Controllers}}- public virtual async Task<IActionResult> SavePaymentMethod(IFormCollection form)+ public virtual async Task<IActionResult> SavePaymentMethod(CheckoutPaymentMethodModel model){try{@@ -871,14 +871,10 @@ namespace Grand.Web.ControllersShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);await CartValidate(cart);- string paymentmethod = form["paymentmethod"];//payment method- if (string.IsNullOrEmpty(paymentmethod))+ if (string.IsNullOrEmpty(model.PaymentMethod))throw new Exception("Selected payment method can't be parsed");- var model = new CheckoutPaymentMethodModel();- await TryUpdateModelAsync(model);-//loyalty pointsif (_loyaltyPointsSettings.Enabled){@@ -909,7 +905,7 @@ namespace Grand.Web.Controllers});}- var paymentMethodInst = _paymentService.LoadPaymentMethodBySystemName(paymentmethod);+ var paymentMethodInst = _paymentService.LoadPaymentMethodBySystemName(model.PaymentMethod);if (paymentMethodInst == null ||!paymentMethodInst.IsPaymentMethodActive(_paymentSettings) ||!paymentMethodInst.IsAuthenticateStore(_workContext.CurrentStore))@@ -917,7 +913,7 @@ namespace Grand.Web.Controllers//saveawait _userFieldService.SaveField(_workContext.CurrentCustomer,- SystemCustomerFieldNames.SelectedPaymentMethod, paymentmethod, _workContext.CurrentStore.Id);+ SystemCustomerFieldNames.SelectedPaymentMethod, model.PaymentMethod, _workContext.CurrentStore.Id);var paymentTransaction = await paymentMethodInst.InitPaymentTransaction();if (paymentTransaction != null)diff --git a/src/Web/Grand.Web/Models/Checkout/CheckoutPaymentMethodModel.cs b/src/Web/Grand.Web/Models/Checkout/CheckoutPaymentMethodModel.csindex 6fc40aadc..ae67a6164 100644--- a/src/Web/Grand.Web/Models/Checkout/CheckoutPaymentMethodModel.cs+++ b/src/Web/Grand.Web/Models/Checkout/CheckoutPaymentMethodModel.cs@@ -16,7 +16,7 @@ namespace Grand.Web.Models.Checkoutpublic string LoyaltyPointsAmount { get; set; }public bool LoyaltyPointsEnoughToPayForOrder { get; set; }public bool UseLoyaltyPoints { get; set; }-+ public string PaymentMethod{ get; set; }#region Nested classespublic partial class PaymentMethodModel : BaseModel