Repository: lk-geimfari/mimesis

Issue:
Add pricetag support
# Feature request
## Thesis

Create a localized pricetag:

```
>>> mimesis.Business().pricetag()
"$ 12.34"
>>> mimesis.Business("de").pricetag(minimum=1000, maximum=1500)
"1.234,56 €"
>>> mimesis.Business("cs").pricetag()
"75,20 Kč"        # rounded to 0.1
```
with defaults minimum=0.01 and maximum=1000.00 as a proposal for the default provider. Localized providers would define their own values, because of huge differences between the used values, such as USD/EUR/GBP going down to 0.01, and some minor currencies using millions as base.

## Reasoning

This is very locale dependent. Currency is already in the `CURRENCY_SYMBOLS`, but what would be the best place for localized number and price formatting as well as the localized defaults for minimum/maximum?


Discussion:
@eumiro We already have something similar there: [`.price()`](https://github.com/lk-geimfari/mimesis/blob/master/mimesis/providers/business.py#L93):

<img width="439" alt="Screenshot 2020-06-06 at 13 02 18" src="https://user-images.githubusercontent.com/15812620/83941690-fbb52400-a7f5-11ea-933d-a00690727034.png">
Yes, but it does not format numbers nor position the currency symbol according to the locale and the values go down to 0.01.
@eumiro We can just add such features to it. There is no necessity to duplicate almost the same features.


@eumiro If you're interested then you can create PR with changes.
@lk-geimfari do you have any plans to include general locale formatting support for numbers etc.? I mean if `de` price format is one of `#,## €`, `##,## €`, `###,## €`,  `#.###,## €`, … and the `cs` one `#,#0 Kč`, `##,#0 Kč`, `###,#0 Kč`, `# ###,#0 Kč`, …  then I could put all of them into `mimesis/data/…/business.json` and then pick up one randomly, but if we want a random number between `minimum` and `maximum`, then we'll have to connect these formats to the selected value.
@eumiro Sure! Sounds good. You can define number formation for each locale in their `business.json`.

Resolving patch:
diff --git a/mimesis/providers/business.py b/mimesis/providers/business.py
--- a/mimesis/providers/business.py
+++ b/mimesis/providers/business.py
@@ -98,8 +98,19 @@ def price(self, minimum: float = 10.00,
         :param maximum: Min value of price.
         :return: Price.
         """
-        price = self.random.uniform(minimum, maximum, precision=2)
-        return '{0} {1}'.format(price, self.currency_symbol())
+        price_format = self._data['price-format']
+        numeric_frac_digits = self._data['numeric-frac-digits']
+        delims = {
+            '.': self._data['numeric-decimal'],
+            ',': self._data['numeric-thousands'],
+        }
+
+        value = self.random.uniform(minimum, maximum)
+        price = '{:,.{}f}'.format(value, numeric_frac_digits)
+
+        price = ''.join(delims.get(char, char) for char in price)
+
+        return price_format.replace('#', price)
 
     def price_in_btc(self, minimum: float = 0, maximum: float = 2) -> str:
         """Generate random price in BTC.


Test patch:
diff --git a/tests/test_providers/test_business.py b/tests/test_providers/test_business.py
--- a/tests/test_providers/test_business.py
+++ b/tests/test_providers/test_business.py
@@ -63,11 +63,7 @@ def test_company(self, business):
 
     def test_price(self, business):
         result = business.price(minimum=100.00, maximum=1999.99)
-        price, symbol = result.split(' ')
-        assert isinstance(price, str)
-        assert float(price) >= 100.00
-        assert float(price) <= 1999.99
-        assert symbol.strip() in CURRENCY_SYMBOLS[business.locale]
+        assert isinstance(result, str)
 
     @pytest.mark.parametrize(
         'minimum, maximum', [