Tax rules and reverse charge (#559)

Tax rules and reverse charge
This commit is contained in:
Raphael Michel
2017-08-23 13:13:16 +03:00
committed by GitHub
parent b9ec5ea83c
commit 56338be13e
82 changed files with 2934 additions and 428 deletions

View File

@@ -53,3 +53,8 @@ def subevent(event):
event.save()
return event.subevents.create(name="Foobar",
date_from=datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
@pytest.fixture
def taxrule(event):
return event.tax_rules.create(name="VAT", rate=19)

View File

@@ -63,6 +63,7 @@ TEST_ITEM_RES = {
"description": None,
"free_price": False,
"tax_rate": "0.00",
"tax_rule": None,
"admission": False,
"position": 0,
"picture": None,

View File

@@ -54,6 +54,7 @@ TEST_ORDERPOSITION_RES = {
"voucher": None,
"tax_rate": "0.00",
"tax_value": "0.00",
"tax_rule": None,
"secret": "z3fsn8jyufm5kpk768q69gkbyr5f4h6w",
"addon_to": None,
"checkins": [],
@@ -74,17 +75,20 @@ TEST_ORDER_RES = {
"payment_fee": "0.00",
"payment_fee_tax_rate": "0.00",
"payment_fee_tax_value": "0.00",
"payment_fee_tax_rule": None,
"total": "23.00",
"comment": "",
"invoice_address": {
"last_modified": "2017-12-01T10:00:00Z",
"is_business": False,
"company": "Sample company",
"name": "",
"street": "",
"zipcode": "",
"city": "",
"country": "NZ",
"vat_id": ""
"vat_id": "",
"vat_id_validated": False
},
"positions": [TEST_ORDERPOSITION_RES],
"downloads": []
@@ -268,11 +272,15 @@ TEST_INVOICE_RES = {
"additional_text": "",
"payment_provider_text": "",
"footer_text": "",
"foreign_currency_display": None,
"foreign_currency_rate": None,
"foreign_currency_rate_date": None,
"lines": [
{
"description": "Budget Ticket",
"gross_value": "23.00",
"tax_value": "0.00",
"tax_name": "",
"tax_rate": "0.00"
}
]

View File

@@ -0,0 +1,28 @@
import pytest
TEST_TAXRULE_RES = {
'name': {'en': 'VAT'},
'rate': '19.00',
'price_includes_tax': True,
'eu_reverse_charge': False,
'home_country': ''
}
@pytest.mark.django_db
def test_rule_list(token_client, organizer, event, taxrule):
res = dict(TEST_TAXRULE_RES)
res["id"] = taxrule.pk
resp = token_client.get('/api/v1/organizers/{}/events/{}/taxrules/'.format(organizer.slug, event.slug))
assert resp.status_code == 200
assert [res] == resp.data['results']
@pytest.mark.django_db
def test_rule_detail(token_client, organizer, event, taxrule):
res = dict(TEST_TAXRULE_RES)
res["id"] = taxrule.pk
resp = token_client.get('/api/v1/organizers/{}/events/{}/taxrules/{}/'.format(organizer.slug, event.slug,
taxrule.pk))
assert resp.status_code == 200
assert res == resp.data