mitodl / mitxonline

BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

upgrade button in open edX production #953

Closed pdpinch closed 2 years ago

pdpinch commented 2 years ago

Steps to Reproduce

  1. Enroll as auditor in https://courses.mitxonline.mit.edu/learn/course/course-v1:MITxT+JPAL102x+3T2022/home
  2. Click the upgrade button on the course home page

Expected Behavior

Actual Behavior

arslanashraf7 commented 2 years ago

While looking around this I didn't find any specific settings/feature flag to disable the upgrade of a button but there are other simpler ways that we can use as mentioned below:

  1. If we don't have Verified course mode or the deadline of the Verified course mode is in the past the upgrade button will hide automatically from the frontend.

If possible, we'd like to hide the upgrade button, until we turn on the ecommerce system early next month

The upgrade button displays, even though we're not ready to start taking payments through mitxonline

Possible Solutions:

  1. So if we are not ready to take payments for a course we should not have Verified course mode set up for that in edX or we should set the upgrade_deadline in the past if that is feasible.
  2. If we can't delete the Verified course mode, it might be a case where we want two services e.g. Micromasters & MITxOnline to use the same edX instance where Micromasters needs Verified mode and MITxOnline doesn't. In this case even if there was a setting in edX that might not have been useful. In this case we might have to hide the upgrade button intentionally from our MITxOnline fork of https://github.com/mitodl/frontend-app-learning.

When the learner clicks the button, it should take them to the mitxonline checkout page, with the correct course in their basket

It will start working when we setup our external-checkout-plugin in production as mentioned in https://github.com/mitodl/hq/discussions/227#discussioncomment-3517802

pdpinch commented 2 years ago

Unfortunately, the verified course mode is a requirement because the course team needs to do some authoring with cohorts -- they want to start working on the exam which should only be seen by learners in the verified mode.

I'll try setting the date into the past.

pdpinch commented 2 years ago

Ok, setting the start date in the past hides the button, but I've been reminded that we also want the upgrade date to display in the course Important Dates.

@mitodl/devops Can we set MARKETING_SITE_CHECKOUT_URL to https://micromasters.mit.edu/dashboard/ only for the mitoxonline production open edX?

https://github.com/mitodl/ol-infrastructure/blob/8863a97df92b0ee777e975be9e8343f50620567b/src/bilder/images/edxapp/templates/edxapp/mitxonline/common_values.yml.tmpl#L340

pdpinch commented 2 years ago

@arslanashraf7 devops tried setting MARKETING_SITE_CHECKOUT_URL to https://micromasters.mit.edu/dashboard/ in production, but it didn't seem to work. They're not sure if it's set in the right place to be included in the Learning MFE build. Can you take a look?

arslanashraf7 commented 2 years ago

@arslanashraf7 devops tried setting MARKETING_SITE_CHECKOUT_URL to https://micromasters.mit.edu/dashboard/ in production, but it didn't seem to work. They're not sure if it's set in the right place to be included in the Learning MFE build. Can you take a look?

Taking a look, Will keep you posted

arslanashraf7 commented 2 years ago

MARKETING_SITE_CHECKOUT_URL key is not part of edX setting it was added to support our own plugin.

So i was looking at it and below are the possible solutions:

If external checkout plugin is configured on production:

  1. We need to check the ecommerce configuration(admin/commerce/commerceconfiguration) - I suppose the value for Basket checkout page is set to dashboard in which case, to redirect this to external checkout plugin we need to set /checkout-external/ as value for Basket checkout page. After setting this, it should redirect the user to MARKETING_SITE_CHECKOUT_URL with a query param course_id e.g. https://micromasters.mit.edu/dashboard/?course_id=course-v1%3AMIT%2BMIT_RR_1%2BR1.

If external checkout plugin is not configured on production:

  1. We need to set the value for ECOMMERCE_PUBLIC_URL_ROOT instead of MARKETING_SITE_CHECKOUT_URL and the value would be https://micromasters.mit.edu without the dashboard. It would be appended from the ecommerce configuration value set through Django Admin which is already dashboard i think.

FYI, @pdpinch @blarghmatey

arslanashraf7 commented 2 years ago

Follow up on my above comment:

@blarghmatey Just wanted to confirm something, This line means that the ol-openedx-external-checkout plugin is installed in production too, Could you please confirm?

If the answer to the above is YES, We will need to do the following (I don't have production access to do the below):

  1. Visit admin/commerce/commerceconfiguration in production and add a configuration with value of Basket checkout page=/checkout-external/.
  2. Visit the verified course mode for the course and make sure that it has a unique SKU value set

With the above changes, @blarghmatey 's This PR should start working and it should start taking the user to Micromasters with links that would look like https://micromasters.mit.edu/dashboard/?course_id=<course_id>.

FYI, @pdpinch

blarghmatey commented 2 years ago

Thanks for those details @arslanashraf7, you are correct that the ol-openedx-external-checkout plugin is installed with the line that you linked.

@pdpinch let me know if you want me to do any of that admin setup, otherwise I'll assume that you're going to take it from here.

pdpinch commented 2 years ago

We fixed this today. The ol-infrastructure code will need to be updated again when we switch from micromasters to mitxonline for payment.