Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor verification required setting for professional courses in the receipt view #12470

Merged
merged 1 commit into from Oct 25, 2016

Conversation

jbzdak
Copy link
Contributor

@jbzdak jbzdak commented May 16, 2016

Background

When creating a profesional course in CAT (/courses view ecommerce) administrator is given option to either enable or disable "Verification" feature for that course. This setting is honored on the LMS /dashboard view, however it is not honored on the /receipt view.

Only LMS is affected by this change.

Sandbox URL: http://pr12470.sandbox.opencraft.com/

Partner information: 3rd party-hosted open edX instance

Reviewers

Testing instructions

On sandbox

Login as a {{verified@example.com}} user and see following two receipts:

On Devstack
Prepare the enviorment:

  1. Install devstack using recent master
  2. Setup a payment processor, paypal seems to be the easier one to set up. See setting-up PayPal for some hints
  3. Create two new courses in Studio, name one of them "Professional with Verification Required" and another one "Professional no verification".
  4. Start e-commerce and go to localhost:8002/courses, and add two courses, first one with Verification second one without it.

Reproduce the issue:

  1. Register to the platform with a new user, and buy for both courses.
  2. Observe that on Receipt for both courses you are asked to confirm your identity.

selection_001

Verify the fix:

  1. Check out this branch.
  2. Go to the receipt pages for both courses, and observe that course with enabled verification still
    asks user to verify:
    selection_002
  3. However for course with verification disabled user can go straight to the dashboard
    selection_003

Setting up PayPal

To configure paypal add section from this gist to ecommerce/settings/private.py. And client_id and client_secret.

I also had problems releated to PayPal forcing TLS 1.2 for all urls (including Sandbox), if you'll get errors citing: 'sslv3 alert handshake failure', you'll need to update lib-ssl-*, openssl-* (and probably *curl*) in your devstack.


Settings

SANDBOX_ENABLE_ECOMMERCE: True

@openedx-webhooks
Copy link

Thanks for the pull request, @jbzdak! It looks like you're a member of a company that does contract work for edX. If you're doing this work as part of a paid contract with edX, you should talk to edX about who will review this pull request. If this work is not part of a paid contract with edX, then you should ensure that there is an OSPR issue to track this work in JIRA, so that we don't lose track of your pull request.

To automatically create an OSPR issue for this pull request, just visit this link: https://openedx-webhooks.herokuapp.com/github/process_pr?repo=edx%2Fedx-platform&number=12470

@jbzdak jbzdak changed the title Honor verification required setting for professional courses Honor verification required setting for professional courses in the receipt view May 16, 2016
@mtyaka
Copy link
Contributor

mtyaka commented May 31, 2016

👍

@openedx-webhooks
Copy link

Thanks for the pull request, @jbzdak! I've created OSPR-1273 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams.

Feel free to add as much of the following information to the ticket:

  • supporting documentation
  • edx-code email threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here.

@e-kolpakov e-kolpakov force-pushed the jbzdak/hide-verification branch 3 times, most recently from d70043c to 2958839 Compare August 30, 2016 14:54
@shaunagm
Copy link
Contributor

@edx/ecommerce Does this need a second thumb?

(Also, sincere apologies @jbzdak for letting this sit without action for so long)

@e-kolpakov
Copy link
Contributor

e-kolpakov commented Sep 29, 2016

@shaunagm FYI, I've taken over this PR from @jbzdak and will be addressing your (and others') comments, so it would be helpful if you tagged me and not @jbzdak.

@shaunagm
Copy link
Contributor

Will do, @e-kolpakov

@e-kolpakov
Copy link
Contributor

@shaunagm Does this silence means "everything is right" or "we haven't looked at it yet"? :)

@rlucioni
Copy link
Contributor

@e-kolpakov it means we haven't had a chance to look at it. Review of this PR is in our sprint, which ends next Monday. We'll take a look at it before then.

@clintonb
Copy link
Contributor

clintonb commented Oct 3, 2016

@mjfrey has the receipt page been moved to edx/ecommerce? If not, when will that happen and what ticket is tracking the work?

@clintonb
Copy link
Contributor

clintonb commented Oct 5, 2016

The decision has been made to not merge this. The receipt page is moving to edx/ecommerce, where this issue will be addressed.

@clintonb clintonb closed this Oct 5, 2016
@shaunagm
Copy link
Contributor

Moving discussion from email to the relevant PR. It seems like there are two major options - making this fix as part of the refactoring/move to edx/ecommerce, and making this fix afterwards. What's your preference for how to proceed?

@clintonb @nedbat @antoviaque

(What's Deen's github handle? I want to tag them too.)

@clintonb
Copy link
Contributor

Considering the uncertainty around when the receipt page will be moved, I'm inclined to merge this and move forward. 

@antoviaque
Copy link
Contributor

antoviaque commented Oct 21, 2016

@clintonb That would be great - this way there is something in place to address it in the meantime. Thank you!

I'm reopening this PR then - let me know if there is anything else we need to do.

@antoviaque antoviaque reopened this Oct 21, 2016
Copy link
Contributor

@clintonb clintonb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks goods good aside from the string vs. boolean questions.

var requests, view, orderUrlFormat,
actualRequestInThemedSite = requestInThemedSite;
if (typeof actualRequestInThemedSite === 'undefined') {
actualRequestInThemedSite = 'False';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a string instead of an actual boolean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clintonb Most likely it would work with actualRequestInThemedSite (and corresponding parameters up the call chain) being a proper boolean, but this is closer to how LMS actually operates: it renders a python boolean into a HTML tag. When it happens, booleans are stred, and their python string representation is "True" and "False` (i.e. titlecase).

I would suggest keeping it as now for two reasons:

  • As I've said, it is closer to how LMS actually works
  • We maintain a fork with this exact commit applied - it would be nice to not introduce the code drift.

},

renderReceipt: function(data) {
var templateHtml = $('#receipt-tpl').html(),
self = this,
context = {
platformName: this.$el.data('platform-name'),
verified: this.$el.data('verified').toLowerCase() === 'true',
is_request_in_themed_site: this.$el.data('is-request-in-themed-site').toLowerCase() === 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question regarding string versus boolean.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clintonb Better ask @mattdrayer about this, but as far as I can tell, this.$el.data('is-request-in-themed-site') returns a string (just like other jQuery.data "getter" calls). Than, if what was stored in attribute was boolean there's a quirk:

  • When it is stored (either via data-something attribute in HTML or via jQuery.data call) it is serialized. Booleans serialize as "true" or "false"
  • When it is extracted by jQuery.data, it returns string, "true" or "false.
  • The thing is string "false" is still a trueish value if passed directly to JS bool function.

So, a check using === "true" is necessary.

@antoviaque
Copy link
Contributor

@clintonb Thank you for the review! We'll schedule time from @e-kolpakov this week so he can look into your comments.

@clintonb clintonb merged commit 5f6ddf4 into openedx:master Oct 25, 2016
@bradenmacdonald
Copy link
Contributor

Thanks for merging, @clintonb !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engineering review open-source-contribution PR author is not from Axim or 2U
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants