Create a DDD Money Value Object, which will validate that the amount is valid for the chosen currency (i.e no more than 21M bitcoins!), arithmetic methods with proper rounding, currency conversion.
Money should extends the existing ValueObject abstract class.
Regarding formatting, we should avoid muddying up our domain model for this. So we will add a MoneyFormatter in the presentation layer, which takes a Money argument and returns a string, such as €5.00 or 5,00€ depending on local standards. We access user language/locale preferences using native i18n API. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n
Create a DDD Money Value Object, which will validate that the amount is valid for the chosen currency (i.e no more than 21M bitcoins!), arithmetic methods with proper rounding, currency conversion. Money should extends the existing ValueObject abstract class.
Regarding formatting, we should avoid muddying up our domain model for this. So we will add a MoneyFormatter in the presentation layer, which takes a Money argument and returns a string, such as €5.00 or 5,00€ depending on local standards. We access user language/locale preferences using native i18n API. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n