Skip to content

Commit

Permalink
feat: add course_run_key to learner home upgrade url (#35461)
Browse files Browse the repository at this point in the history
* fix: fix learner home URL to have course_run_key
  • Loading branch information
aht007 authored Sep 20, 2024
1 parent cf3673e commit 8f88db2
Showing 1 changed file with 8 additions and 2 deletions.
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': str(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 8f88db2

Please sign in to comment.