The handling of decimal numbers from HTTP requests in the FundraisingFrontend is inconsistent:
- donation/new expects English-formatted numbers (using a locale-aware parser) and will default to 0 if the number can't be parsed.
- donation/add expects German-formatted numbers (using a locale-aware parser) and will default to 0 if the number can't be parsed.
- apply-for-membership expects German-formatted numbers (using simple string-replacement of comma to dot) and has no default.
- validate-amount expects an integer (Euro Cents)
- validate-fee can handle both English and German-formated numbers (using simple string-replacement from comma to dot)
My proposal would be to get rid of the existing locale-aware AmountParser and standardize on EuroCents. This will avoid rounding errors. For this solution, the client-side code, both in FundraisingFRontend and in the banners needs to be changed.
Note: This inconsistency has forced us to add workaround code in banners at least 2 times.
When this issue is fixed, check the banner code if the amount is passed on correctly, both to donation/new and to donation/add.
Note: Check for usages of AmountFormatter which will format the amount for rendering it in the template. If the amount is rendered as a string in the template then everything is fine, but if the amount is processed by JavaScript, it needs to re-parse the (German-formatted) amount again.
Note: We don't need to care for backwards compatibility of older banners.
Note: The estimation is made under the assumption that there will only be one skin to be changed.