mitodl / micromasters

Portal for learners and course teams to access MITx Micromasters® programs
https://mm.mit.edu
BSD 3-Clause "New" or "Revised" License
29 stars 17 forks source link

Update has_paid to use edx data #5274

Closed annagav closed 1 year ago

annagav commented 1 year ago

Pre-Flight checklist

What's this PR do?

Since the payments have moved to MITxOnline, we have to switch to rely on edx enrollment data for enrollment status of the course. has_paid is now checking for verified status of the enrollment to mean the user paid.

How should this be manually tested?

make sure the course you are testing with has exams exam_run = ExamRunFactory.create(course=course, authorized=True, scheduling_past=False, scheduling_future=False) enroll your user in a course in 'audit' mode: ./manage.py alter_data set_to_enrolled --username staff --course-title 'Analog Learning 100' --audit

Then manually upgrade their cached enrollment to verified.

from seed_data.lib import *
CachedEnrollmentHandler(user).set_or_create(course_run, verified=True)

Or you could enroll the user in verified and then delete their payment: ./manage.py alter_data set_to_enrolled --username staff --course-title 'Analog Learning 100'

Then check their dashboard api, the course status should be "status": "currently-enrolled", instead of "status": "can-upgrade",

codecov-commenter commented 1 year ago

Codecov Report

Merging #5274 (62c88c3) into master (ab4471d) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #5274   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files         501      501           
  Lines       23291    23294    +3     
  Branches      966      967    +1     
=======================================
+ Hits        21820    21823    +3     
  Misses       1364     1364           
  Partials      107      107           
Impacted Files Coverage Δ
dashboard/utils.py 95.19% <100.00%> (+0.06%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

annagav commented 1 year ago

@arslanashraf7 I agree this is no longer making sense. I think we should remove exam related messages from the dashboard. I'll open a separate issue for that.