Skip to content

Commit f32b08b

Browse files
feat: add new param in url (#36458)
Add new param in ecommerce url to calculate program price based on course keys SONIC-918
1 parent 646c2ac commit f32b08b

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

  • openedx/core/djangoapps/programs

openedx/core/djangoapps/programs/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
701701
is_learner_eligible_for_one_click_purchase = self.data["is_program_eligible_for_one_click_purchase"]
702702
bundle_uuid = self.data.get("uuid")
703703
skus = []
704+
course_keys = []
704705
bundle_variant = "full"
705706

706707
if is_learner_eligible_for_one_click_purchase: # lint-amnesty, pylint: disable=too-many-nested-blocks
@@ -719,6 +720,7 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
719720
# we are assuming that, for any given course, there is at most one paid entitlement available.
720721
if entitlement["mode"] in applicable_seat_types:
721722
skus.append(entitlement["sku"])
723+
course_keys.append(course.get("key"))
722724
entitlement_product = True
723725
break
724726
if not entitlement_product:
@@ -728,6 +730,7 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
728730
for seat in published_course_runs[0]["seats"]:
729731
if seat["type"] in applicable_seat_types and seat["sku"]:
730732
skus.append(seat["sku"])
733+
course_keys.append(course.get("key"))
731734
break
732735
else:
733736
# If a course in the program has more than 1 published course run
@@ -744,14 +747,14 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
744747
if is_anonymous or ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER.is_enabled():
745748
# The bundle uuid is necessary to see the program's discounted price
746749
if bundle_uuid:
747-
params = dict(sku=skus, is_anonymous=True, bundle=bundle_uuid)
750+
params = dict(sku=skus, is_anonymous=True, bundle=bundle_uuid, course_key=course_keys)
748751
else:
749-
params = dict(sku=skus, is_anonymous=True)
752+
params = dict(sku=skus, is_anonymous=True, course_key=course_keys)
750753
else:
751754
if bundle_uuid:
752-
params = dict(sku=skus, username=self.user.username, bundle=bundle_uuid)
755+
params = dict(sku=skus, username=self.user.username, bundle=bundle_uuid, course_key=course_keys)
753756
else:
754-
params = dict(sku=skus, username=self.user.username)
757+
params = dict(sku=skus, username=self.user.username, course_key=course_keys)
755758

756759
response = get_program_price_info(self.user, params)
757760
response.raise_for_status()

0 commit comments

Comments
 (0)