Skip to content

Commit

Permalink
feat: change field names
Browse files Browse the repository at this point in the history
Change field names to match financial manager
  • Loading branch information
igobranco committed Apr 12, 2024
1 parent 0869cda commit 291b080
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions nau_extensions/financial_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 12 additions & 12 deletions nau_extensions/tests/test_financial_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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'),
Expand Down Expand Up @@ -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'),
Expand All @@ -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'),
Expand Down Expand Up @@ -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"),
Expand All @@ -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"),
Expand Down

0 comments on commit 291b080

Please sign in to comment.