Skip to content

Commit cd64bee

Browse files
committed
Remove multi currencies support
For more information about the rationale, this was [discussed](#1232 (comment)) in our bugtracker.
1 parent 4f9cad8 commit cd64bee

26 files changed

+85
-1337
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
This document describes changes between each past release.
44

5-
## 6.2.0 (unreleased)
5+
## 7.0.0 (unreleased)
66

7+
- Remove the support for multiple currencies, [as discussed](https://github.com/spiral-project/ihatemoney/issues/1232#issuecomment-2081517453) in our bugtracker.
78
- Add support for python 3.12 (#757)
89
- Migrate from setup.cfg to pyproject.toml (#1243)
910
- Update to wtforms 3.1 (#1248)

docs/api.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@ A project needs the following arguments:
7171
- `password`: the project password / private code (string)
7272
- `contact_email`: the contact email, used to recover the private code (string)
7373

74-
Optional arguments:
75-
76-
- `default_currency`: the default currency to use for a multi-currency
77-
project, in ISO 4217 format. Bills are converted to this currency
78-
for operations like balance or statistics. Default value: `XXX` (no
79-
currency).
80-
8174
Here is the command:
8275

8376
$ curl -X POST https://ihatemoney.org/api/projects \
@@ -97,7 +90,6 @@ Getting information about the project:
9790
"id": "demo",
9891
"name": "demonstration",
9992
"contact_email": "demo@notmyidea.org",
100-
"default_currency": "XXX",
10193
"members": [{"id": 11515, "name": "f", "weight": 1.0, "activated": true, "balance": 0},
10294
{"id": 11531, "name": "g", "weight": 1.0, "activated": true, "balance": 0},
10395
{"id": 11532, "name": "peter", "weight": 1.0, "activated": true, "balance": 5.0},
@@ -181,14 +173,8 @@ Or get a specific bill by ID:
181173
"creation_date": "2021-01-13",
182174
"what": "Raclette du nouvel an",
183175
"external_link": "",
184-
"original_currency": "XXX",
185-
"converted_amount": 100
186176
}
187177

188-
`amount` is expressed in the `original_currency` of the bill, while
189-
`converted_amount` is expressed in the project `default_currency`. Here,
190-
they are the same.
191-
192178
Add a bill with a `POST` query on `/api/projects/<id>/bills`. You need
193179
the following required parameters:
194180

@@ -203,9 +189,6 @@ And optional parameters:
203189

204190
- `date`: the date of the bill (`yyyy-mm-dd` format). Defaults to
205191
current date if not provided.
206-
- `original_currency`: the currency in which `amount` has been paid
207-
(ISO 4217 code). Only makes sense for a project with currencies.
208-
Defaults to the project `default_currency`.
209192
- `external_link`: an optional URL associated with the bill.
210193

211194
Returns the id of the created bill :
@@ -250,23 +233,3 @@ You can get some project stats with a `GET` on
250233
"balance": -10.5
251234
}
252235
]
253-
254-
### Currencies
255-
256-
You can get a list of supported currencies with a `GET` on
257-
`/api/currencies`:
258-
259-
$ curl --basic https://ihatemoney.org/api/currencies
260-
[
261-
"XXX",
262-
"AED",
263-
"AFN",
264-
.
265-
.
266-
.
267-
"ZAR",
268-
"ZMW",
269-
"ZWL"
270-
]
271-
272-

ihatemoney/api/common.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from werkzeug.security import check_password_hash
66
from wtforms.fields import BooleanField
77

8-
from ihatemoney.currency_convertor import CurrencyConverter
98
from ihatemoney.emails import send_creation_email
109
from ihatemoney.forms import EditProjectForm, MemberForm, ProjectForm, get_billform_for
1110
from ihatemoney.models import Bill, Person, Project, db
@@ -50,13 +49,6 @@ def wrapper(*args, **kwargs):
5049
return wrapper
5150

5251

53-
class CurrenciesHandler(Resource):
54-
currency_helper = CurrencyConverter()
55-
56-
def get(self):
57-
return self.currency_helper.get_currencies()
58-
59-
6052
class ProjectsHandler(Resource):
6153
def post(self):
6254
form = ProjectForm(meta={"csrf": False})

ihatemoney/api/v1/resources.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from ihatemoney.api.common import (
66
BillHandler,
77
BillsHandler,
8-
CurrenciesHandler,
98
MemberHandler,
109
MembersHandler,
1110
ProjectHandler,
@@ -18,7 +17,6 @@
1817
CORS(api)
1918
restful_api = Api(api)
2019

21-
restful_api.add_resource(CurrenciesHandler, "/currencies")
2220
restful_api.add_resource(ProjectsHandler, "/projects")
2321
restful_api.add_resource(ProjectHandler, "/projects/<string:project_id>")
2422
restful_api.add_resource(TokenHandler, "/projects/<string:project_id>/token")

ihatemoney/currency_convertor.py

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)