Skip to content

Commit

Permalink
feat(financial manager): no longer send excl vat tax fields
Browse files Browse the repository at this point in the history
On financial manager integration, no longer send the exclude vat tax fields.

related to: fccn/nau-technical#215
  • Loading branch information
igobranco committed Jul 26, 2024
1 parent db0ed51 commit e5f99ef
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 88 deletions.
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ edit the `ecommerce/settings/private.py` file add change to::
)
LOGO_URL = "https://lms.nau.edu.pt/static/nau-basic/images/nau_azul.svg"

# Configure tax as 23% used in Portugal
NAU_EXTENSION_TAX_RATE = "0.298701299" # = 0.23/0.77

NAU_FINANCIAL_MANAGER = {
"edx": {
"url": "http://financial-manager.local.nau.fccn.pt:8000/api/billing/transaction-complete/",
Expand Down
6 changes: 0 additions & 6 deletions nau_extensions/financial_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ def sync_request_data(bti: BasketTransactionIntegration) -> dict:
"country_code": country_code,
"vat_identification_number": vat_identification_number,
"vat_identification_country": vat_identification_country,
"total_amount_exclude_vat": order.total_excl_tax,
"total_amount_include_vat": order.total_incl_tax,
"total_discount_incl_tax": order.total_discount_incl_tax,
"total_discount_excl_tax": order.total_discount_excl_tax,
"currency": order.currency,
"payment_type": _get_payment_type(order),
"items": _convert_order_lines(order),
Expand Down Expand Up @@ -119,15 +117,11 @@ def _convert_order_lines(order):
course_key = CourseKey.from_string(course.id) if course else None
organization_code = course_key.org if course else None
product_code = course_key.course if course else None
unit_price_excl_tax = line.unit_price_excl_tax
unit_price_incl_tax = line.unit_price_incl_tax
vat_tax = unit_price_incl_tax - unit_price_excl_tax
result.append(
{
"description": line.title,
"quantity": line.quantity,
"vat_tax": vat_tax,
"unit_price_excl_vat": unit_price_excl_tax,
"unit_price_incl_vat": unit_price_incl_tax,
"organization_code": organization_code,
"product_code": product_code,
Expand Down
22 changes: 0 additions & 22 deletions nau_extensions/strategy.py

This file was deleted.

29 changes: 2 additions & 27 deletions nau_extensions/tests/test_financial_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,13 @@ def test_financial_manager_sync_data_basic(self):
"country_code": "PT",
"vat_identification_number": "123456789",
"vat_identification_country": "PT",
"total_amount_exclude_vat": Decimal("30.00"),
"total_amount_include_vat": Decimal("30.00"),
"total_discount_excl_tax": Decimal('0.00'),
"total_discount_incl_tax": Decimal('0.00'),
"currency": "EUR",
"payment_type": None,
"items": [
# verified
{
"unit_price_excl_vat": Decimal("10.00"),
"unit_price_incl_vat": Decimal("10.00"),
"description": "Seat in edX Demonstration Course with verified certificate",
'discount_excl_tax': Decimal('0.00'),
Expand All @@ -109,11 +106,9 @@ def test_financial_manager_sync_data_basic(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 3,
"vat_tax": Decimal("0.00"),
},
# honor
{
"unit_price_excl_vat": Decimal("0.00"),
"unit_price_incl_vat": Decimal("0.00"),
"description": "Seat in edX Demonstration Course with honor certificate",
'discount_excl_tax': Decimal('0.00'),
Expand All @@ -122,7 +117,6 @@ def test_financial_manager_sync_data_basic(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 2,
"vat_tax": Decimal("0.00"),
},
],
},
Expand Down Expand Up @@ -192,16 +186,13 @@ def test_financial_manager_sync_data_with_quantity(self):
"country_code": "PT",
"vat_identification_number": "123456789",
"vat_identification_country": "PT",
"total_amount_exclude_vat": Decimal("10.00"),
"total_amount_include_vat": Decimal("10.00"),
"total_discount_excl_tax": Decimal('0.00'),
"total_discount_incl_tax": Decimal('0.00'),
"currency": "EUR",
"payment_type": None,
"items": [
# verified
{
"unit_price_excl_vat": Decimal("10.00"),
"unit_price_incl_vat": Decimal("10.00"),
"description": "Seat in edX Demonstration Course with verified certificate",
'discount_excl_tax': Decimal('0.00'),
Expand All @@ -210,11 +201,9 @@ def test_financial_manager_sync_data_with_quantity(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 1,
"vat_tax": Decimal("0.00"),
},
# honor
{
"unit_price_excl_vat": Decimal("0.00"),
"unit_price_incl_vat": Decimal("0.00"),
"description": "Seat in edX Demonstration Course with honor certificate",
'discount_excl_tax': Decimal('0.00'),
Expand All @@ -223,14 +212,12 @@ def test_financial_manager_sync_data_with_quantity(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 1,
"vat_tax": Decimal("0.00"),
},
],
},
)

@override_settings(
NAU_EXTENSION_TAX_RATE="0.298701299", # = 0.23/0.77,
OSCAR_DEFAULT_CURRENCY="EUR"
)
def test_financial_manager_sync_data_with_tax_rate(self):
Expand Down Expand Up @@ -294,29 +281,24 @@ def test_financial_manager_sync_data_with_tax_rate(self):
"country_code": "PT",
"vat_identification_number": "123456789",
"vat_identification_country": "PT",
"total_amount_exclude_vat": Decimal("10.00"),
"total_amount_include_vat": Decimal("12.99"),
"total_discount_excl_tax": Decimal('0.00'),
"total_amount_include_vat": Decimal("10.00"),
"total_discount_incl_tax": Decimal('0.00'),
"currency": "EUR",
"payment_type": None,
"items": [
# verified
{
"unit_price_excl_vat": Decimal("10.00"),
"unit_price_incl_vat": Decimal("12.99"),
"unit_price_incl_vat": Decimal("10.00"),
"description": "Seat in edX Demonstration Course with verified certificate",
'discount_excl_tax': Decimal('0.00'),
'discount_incl_tax': Decimal('0.00'),
"organization_code": "edX",
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 1,
"vat_tax": Decimal("2.99"),
},
# honor
{
"unit_price_excl_vat": Decimal("0.00"),
"unit_price_incl_vat": Decimal("0.00"),
"description": "Seat in edX Demonstration Course with honor certificate",
'discount_excl_tax': Decimal('0.00'),
Expand All @@ -325,7 +307,6 @@ def test_financial_manager_sync_data_with_tax_rate(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 1,
"vat_tax": Decimal("0.00"),
},
],
},
Expand Down Expand Up @@ -381,16 +362,13 @@ def test_financial_manager_sync_data_without_bbi(self):
"country_code": None,
"vat_identification_number": None,
"vat_identification_country": None,
"total_amount_exclude_vat": Decimal("10.00"),
"total_amount_include_vat": Decimal("10.00"),
"total_discount_excl_tax": Decimal("0.00"),
"total_discount_incl_tax": Decimal("0.00"),
"currency": "EUR",
"payment_type": None,
"items": [
# verified
{
"unit_price_excl_vat": Decimal("10.00"),
"unit_price_incl_vat": Decimal("10.00"),
"description": "Seat in edX Demonstration Course with verified certificate",
"discount_excl_tax": Decimal("0.00"),
Expand All @@ -399,11 +377,9 @@ def test_financial_manager_sync_data_without_bbi(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 1,
"vat_tax": Decimal("0.00"),
},
# honor
{
"unit_price_excl_vat": Decimal("0.00"),
"unit_price_incl_vat": Decimal("0.00"),
"description": "Seat in edX Demonstration Course with honor certificate",
"discount_excl_tax": Decimal("0.00"),
Expand All @@ -412,7 +388,6 @@ def test_financial_manager_sync_data_without_bbi(self):
"product_code": "DemoX",
"product_id": "course-v1:edX+DemoX+Demo_Course",
"quantity": 1,
"vat_tax": Decimal("0.00"),
},
],
},
Expand Down
30 changes: 0 additions & 30 deletions nau_extensions/tests/test_vat.py

This file was deleted.

0 comments on commit e5f99ef

Please sign in to comment.