Skip to content

Commit

Permalink
fix: fix learner home URL
Browse files Browse the repository at this point in the history
  • Loading branch information
aht007 committed Sep 19, 2024
1 parent 373b729 commit cfcc4bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/djangoapps/course_modes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def get(self, request, course_id, error=None): # lint-amnesty, pylint: disable=

if verified_mode.sku:
context["use_ecommerce_payment_flow"] = ecommerce_service.is_enabled(request.user)
context["ecommerce_payment_page"] = ecommerce_service.get_add_to_basket_url()
context["ecommerce_payment_page"] = ecommerce_service.payment_page_url()
context["sku"] = verified_mode.sku
context["bulk_sku"] = verified_mode.bulk_sku

Expand Down
10 changes: 8 additions & 2 deletions lms/djangoapps/learner_home/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from datetime import date, timedelta
from urllib.parse import urljoin
from urllib.parse import urlencode, urljoin

from django.conf import settings
from django.urls import reverse
Expand Down Expand Up @@ -132,7 +132,13 @@ def get_upgradeUrl(self, instance):
)

if ecommerce_payment_page and verified_sku:
return f"{ecommerce_payment_page}?sku={verified_sku}"
query_params = {
'sku': verified_sku,
'course_run_key': instance.course_id
}
encoded_params = urlencode(query_params)
upgrade_url = f"{ecommerce_payment_page}?{encoded_params}"
return upgrade_url

def get_resumeUrl(self, instance):
return self.context.get("resume_course_urls", {}).get(instance.course_id)
Expand Down

0 comments on commit cfcc4bf

Please sign in to comment.