-
Notifications
You must be signed in to change notification settings - Fork 562
Description
PayPal payment completed but order not created due to FormatException in Login.cshtml
Smartstore Version: 5.1.0
Describe the bug
A customer completed a PayPal payment successfully (money was debited from their PayPal account), but no corresponding order was created in the Smartstore backend. The order is either missing entirely or was never persisted.
The application log from the same time shows a System.FormatException in Views/Identity/Login.cshtml (line 96), caused by the BooleanConverter failing to parse the string "1" as a valid Boolean value. This exception is thrown during checkbox rendering (GenerateCheckBox) via SmartHtmlGenerator.GenerateInput.
It appears that the FormatException crashes the request that processes the PayPal return/callback, which prevents the OrderProcessingService from finalizing the order.
Steps to reproduce
- Add a product to the cart
- Proceed to checkout and select PayPal as payment method
- Complete payment on PayPal side
- Get redirected back to the shop
- The redirect triggers a request that renders
Login.cshtml, where a checkbox field (likely "Remember me") receives the value"1"instead of"true"inModelState FormatExceptionis thrown → order processing is interrupted- Payment is completed on PayPal's side, but no order exists in Smartstore
Expected behavior
- The
FormatExceptionshould not occur —SmartHtmlGeneratorshould handle non-standard boolean values like"1"and"0"gracefully (this is a known ASP.NET Core issue: dotnet/aspnetcore#55512) - Even if an exception occurs during page rendering, the PayPal order finalization (via webhook or return URL callback) should not be affected by unrelated view rendering errors
- The order should be created and persisted regardless of non-critical UI errors
Stack trace
System.FormatException: 1 is not a valid value for Boolean.
---> System.FormatException: String '1' was not recognized as a valid Boolean.
at System.Boolean.Parse(ReadOnlySpan`1 value)
at System.ComponentModel.BooleanConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.BooleanConverter.ConvertFrom(...)
at Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingHelper.ConvertSimpleType(...)
at Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GetModelStateValue(...)
at Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateInput(...)
at Smartstore.Web.Rendering.SmartHtmlGenerator.GenerateInput(...)
at Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateCheckBox(...)
at Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.GenerateCheckBox(...)
at Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Process(...)
...
at AspNetCore.Views_Identity_Login.<ExecuteAsync>b__32_1()
in Views\Identity\Login.cshtml:line 96
(Full stack trace available upon request.)
Impact
- Customer was charged via PayPal but received no order confirmation
- The order does not appear in the Smartstore admin panel
- This likely affects any checkout flow where the PayPal return coincides with a request that renders a Boolean checkbox from
ModelStatecontaining the value"1"
Suggested fix
- SmartHtmlGenerator: Override
GetModelStateValueor wrap theGenerateCheckBoxcall with a try-catch to handleFormatExceptiongracefully — e.g., treat"1"astrueand"0"asfalse - PayPal module: Ensure that order finalization (capture confirmation / webhook processing) is decoupled from view rendering, so that a rendering error cannot prevent the order from being persisted
Related issues
- dotnet/aspnetcore#55512 — "1 is not a valid value for Boolean" in
GenerateCheckBox - dotnet/aspnetcore#64739 —
GenerateCheckBoxthrows exception for unparseable URL parameters
Environment
- Smartstore version: 5.1.0
- Payment method: PayPal (via Smartstore PayPal module)
- Hosting: IIS (
C:\inetpub\wwwroot\...)