Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove multi currencies support #1362

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

This document describes changes between each past release.

## 6.2.0 (unreleased)
## 7.0.0 (unreleased)

- Remove the support for multiple currencies, [as discussed](https://github.com/spiral-project/ihatemoney/issues/1232#issuecomment-2081517453) in our bugtracker.
- Add support for python 3.12 (#757)
- Migrate from setup.cfg to pyproject.toml (#1243)
- Update to wtforms 3.1 (#1248)
Expand Down
37 changes: 0 additions & 37 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ A project needs the following arguments:
- `password`: the project password / private code (string)
- `contact_email`: the contact email, used to recover the private code (string)

Optional arguments:

- `default_currency`: the default currency to use for a multi-currency
project, in ISO 4217 format. Bills are converted to this currency
for operations like balance or statistics. Default value: `XXX` (no
currency).

Here is the command:

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

`amount` is expressed in the `original_currency` of the bill, while
`converted_amount` is expressed in the project `default_currency`. Here,
they are the same.

Add a bill with a `POST` query on `/api/projects/<id>/bills`. You need
the following required parameters:

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

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

Returns the id of the created bill :
Expand Down Expand Up @@ -250,23 +233,3 @@ You can get some project stats with a `GET` on
"balance": -10.5
}
]

### Currencies

You can get a list of supported currencies with a `GET` on
`/api/currencies`:

$ curl --basic https://ihatemoney.org/api/currencies
[
"XXX",
"AED",
"AFN",
.
.
.
"ZAR",
"ZMW",
"ZWL"
]


8 changes: 0 additions & 8 deletions ihatemoney/api/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from werkzeug.security import check_password_hash
from wtforms.fields import BooleanField

from ihatemoney.currency_convertor import CurrencyConverter
from ihatemoney.emails import send_creation_email
from ihatemoney.forms import EditProjectForm, MemberForm, ProjectForm, get_billform_for
from ihatemoney.models import Bill, Person, Project, db
Expand Down Expand Up @@ -50,13 +49,6 @@ def wrapper(*args, **kwargs):
return wrapper


class CurrenciesHandler(Resource):
currency_helper = CurrencyConverter()

def get(self):
return self.currency_helper.get_currencies()


class ProjectsHandler(Resource):
def post(self):
form = ProjectForm(meta={"csrf": False})
Expand Down
2 changes: 0 additions & 2 deletions ihatemoney/api/v1/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ihatemoney.api.common import (
BillHandler,
BillsHandler,
CurrenciesHandler,
MemberHandler,
MembersHandler,
ProjectHandler,
Expand All @@ -18,7 +17,6 @@
CORS(api)
restful_api = Api(api)

restful_api.add_resource(CurrenciesHandler, "/currencies")
restful_api.add_resource(ProjectsHandler, "/projects")
restful_api.add_resource(ProjectHandler, "/projects/<string:project_id>")
restful_api.add_resource(TokenHandler, "/projects/<string:project_id>/token")
Expand Down
228 changes: 0 additions & 228 deletions ihatemoney/currency_convertor.py

This file was deleted.

Loading
Loading