Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions openedx/core/djangoapps/programs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
is_learner_eligible_for_one_click_purchase = self.data["is_program_eligible_for_one_click_purchase"]
bundle_uuid = self.data.get("uuid")
skus = []
course_keys = []
bundle_variant = "full"

if is_learner_eligible_for_one_click_purchase: # lint-amnesty, pylint: disable=too-many-nested-blocks
Expand All @@ -719,6 +720,7 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
# we are assuming that, for any given course, there is at most one paid entitlement available.
if entitlement["mode"] in applicable_seat_types:
skus.append(entitlement["sku"])
course_keys.append(course.get("key"))
entitlement_product = True
break
if not entitlement_product:
Expand All @@ -728,6 +730,7 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
for seat in published_course_runs[0]["seats"]:
if seat["type"] in applicable_seat_types and seat["sku"]:
skus.append(seat["sku"])
course_keys.append(course.get("key"))
break
else:
# If a course in the program has more than 1 published course run
Expand All @@ -744,14 +747,14 @@ def _collect_one_click_purchase_eligibility_data(self): # lint-amnesty, pylint:
if is_anonymous or ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER.is_enabled():
# The bundle uuid is necessary to see the program's discounted price
if bundle_uuid:
params = dict(sku=skus, is_anonymous=True, bundle=bundle_uuid)
params = dict(sku=skus, is_anonymous=True, bundle=bundle_uuid, course_key=course_keys)
else:
params = dict(sku=skus, is_anonymous=True)
params = dict(sku=skus, is_anonymous=True, course_key=course_keys)
else:
if bundle_uuid:
params = dict(sku=skus, username=self.user.username, bundle=bundle_uuid)
params = dict(sku=skus, username=self.user.username, bundle=bundle_uuid, course_key=course_keys)
else:
params = dict(sku=skus, username=self.user.username)
params = dict(sku=skus, username=self.user.username, course_key=course_keys)

response = get_program_price_info(self.user, params)
response.raise_for_status()
Expand Down
Loading