From 291b08042f538b1e408347ac7049da8093841297 Mon Sep 17 00:00:00 2001 From: Ivo Branco Date: Fri, 12 Apr 2024 12:21:50 +0100 Subject: [PATCH] feat: change field names Change field names to match financial manager --- nau_extensions/financial_manager.py | 10 ++++---- .../tests/test_financial_manager.py | 24 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/nau_extensions/financial_manager.py b/nau_extensions/financial_manager.py index 5626cd8..6dd7b17 100644 --- a/nau_extensions/financial_manager.py +++ b/nau_extensions/financial_manager.py @@ -115,16 +115,16 @@ 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 - amount_exclude_vat = line.quantity * line.unit_price_excl_tax - amount_include_vat = line.quantity * line.unit_price_incl_tax - vat_tax = amount_include_vat - amount_exclude_vat + unit_price_excl_tax = line.quantity * line.unit_price_excl_tax + unit_price_incl_tax = line.quantity * 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, - "amount_exclude_vat": amount_exclude_vat, - "amount_include_vat": amount_include_vat, + "unit_price_excl_tax": unit_price_excl_tax, + "unit_price_incl_tax": unit_price_incl_tax, "organization_code": organization_code, "product_code": product_code, "product_id": course_id, diff --git a/nau_extensions/tests/test_financial_manager.py b/nau_extensions/tests/test_financial_manager.py index 9dc6165..057bb22 100644 --- a/nau_extensions/tests/test_financial_manager.py +++ b/nau_extensions/tests/test_financial_manager.py @@ -98,8 +98,8 @@ def test_financial_manager_sync_data_basic(self): "items": [ # verified { - "amount_exclude_vat": Decimal("10.00"), - "amount_include_vat": Decimal("10.00"), + "unit_price_excl_tax": Decimal("10.00"), + "unit_price_incl_tax": Decimal("10.00"), "description": "Seat in edX Demonstration Course with verified certificate", 'discount_excl_tax': Decimal('0.00'), 'discount_incl_tax': Decimal('0.00'), @@ -111,8 +111,8 @@ def test_financial_manager_sync_data_basic(self): }, # honor { - "amount_exclude_vat": Decimal("0.00"), - "amount_include_vat": Decimal("0.00"), + "unit_price_excl_tax": Decimal("0.00"), + "unit_price_incl_tax": Decimal("0.00"), "description": "Seat in edX Demonstration Course with honor certificate", 'discount_excl_tax': Decimal('0.00'), 'discount_incl_tax': Decimal('0.00'), @@ -200,8 +200,8 @@ def test_financial_manager_sync_data_with_tax_rate(self): "items": [ # verified { - "amount_exclude_vat": Decimal("10.00"), - "amount_include_vat": Decimal("12.99"), + "unit_price_excl_tax": Decimal("10.00"), + "unit_price_incl_tax": Decimal("12.99"), "description": "Seat in edX Demonstration Course with verified certificate", 'discount_excl_tax': Decimal('0.00'), 'discount_incl_tax': Decimal('0.00'), @@ -213,8 +213,8 @@ def test_financial_manager_sync_data_with_tax_rate(self): }, # honor { - "amount_exclude_vat": Decimal("0.00"), - "amount_include_vat": Decimal("0.00"), + "unit_price_excl_tax": Decimal("0.00"), + "unit_price_incl_tax": Decimal("0.00"), "description": "Seat in edX Demonstration Course with honor certificate", 'discount_excl_tax': Decimal('0.00'), 'discount_incl_tax': Decimal('0.00'), @@ -287,8 +287,8 @@ def test_financial_manager_sync_data_without_bbi(self): "items": [ # verified { - "amount_exclude_vat": Decimal("10.00"), - "amount_include_vat": Decimal("10.00"), + "unit_price_excl_tax": Decimal("10.00"), + "unit_price_incl_tax": Decimal("10.00"), "description": "Seat in edX Demonstration Course with verified certificate", "discount_excl_tax": Decimal("0.00"), "discount_incl_tax": Decimal("0.00"), @@ -300,8 +300,8 @@ def test_financial_manager_sync_data_without_bbi(self): }, # honor { - "amount_exclude_vat": Decimal("0.00"), - "amount_include_vat": Decimal("0.00"), + "unit_price_excl_tax": Decimal("0.00"), + "unit_price_incl_tax": Decimal("0.00"), "description": "Seat in edX Demonstration Course with honor certificate", "discount_excl_tax": Decimal("0.00"), "discount_incl_tax": Decimal("0.00"),