-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Checkout on Otto #11503
Checkout on Otto #11503
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ | |
|
||
from ratelimitbackend.exceptions import RateLimitException | ||
|
||
|
||
from social.apps.django_app import utils as social_utils | ||
from social.backends import oauth as social_oauth | ||
from social.exceptions import AuthException, AuthAlreadyAssociated | ||
|
@@ -55,6 +54,7 @@ | |
create_comments_service_user, PasswordHistory, UserSignupSource, | ||
DashboardConfiguration, LinkedInAddToProfileConfiguration, ManualEnrollmentAudit, ALLOWEDTOENROLL_TO_ENROLLED) | ||
from student.forms import AccountCreationForm, PasswordResetFormNoActive, get_registration_extension_form | ||
from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error | ||
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=import-error | ||
from certificates.models import CertificateStatuses, certificate_status_for_student | ||
from certificates.api import ( # pylint: disable=import-error | ||
|
@@ -502,6 +502,7 @@ def complete_course_mode_info(course_id, enrollment, modes=None): | |
# if verified is an option. | ||
if CourseMode.VERIFIED in modes and enrollment.mode in CourseMode.UPSELL_TO_VERIFIED_MODES: | ||
mode_info['show_upsell'] = True | ||
mode_info['verified_sku'] = modes['verified'].sku | ||
# if there is an expiration date, find out how long from now it is | ||
if modes['verified'].expiration_datetime: | ||
today = datetime.datetime.now(UTC).date() | ||
|
@@ -737,6 +738,13 @@ def dashboard(request): | |
'xseries_credentials': xseries_credentials, | ||
} | ||
|
||
ecommerce_service = EcommerceService() | ||
if ecommerce_service.is_enabled(): | ||
context.update({ | ||
'use_ecommerce_payment_flow': True, | ||
'ecommerce_payment_page': ecommerce_service.payment_page_url(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like here :) |
||
}) | ||
|
||
return render_to_response('dashboard.html', context) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
""" Admin site bindings for commerce app. """ | ||
|
||
from django.contrib import admin | ||
|
||
from commerce.models import CommerceConfiguration | ||
from config_models.admin import ConfigurationModelAdmin | ||
|
||
admin.site.register(CommerceConfiguration, ConfigurationModelAdmin) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extend this and update the list view to display the current values. Our current list views are not useful. Bonus points if you can update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please be more specific which values should be displayed in the admin panel. This is what I currently see: http://i.imgur.com/exUJHyr.png There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, you're all set. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
from django.conf import settings | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('commerce', '0001_data__add_ecommerce_service_user'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CommerceConfiguration', | ||
fields=[ | ||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||
('change_date', models.DateTimeField(auto_now_add=True, verbose_name='Change date')), | ||
('enabled', models.BooleanField(default=False, verbose_name='Enabled')), | ||
('checkout_on_ecommerce_service', models.BooleanField(default=False, help_text='Use the checkout page hosted by the E-Commerce service.')), | ||
('single_course_checkout_page', models.CharField(default=b'/basket/single-item/', help_text='Path to single course checkout page hosted by the E-Commerce service.', max_length=255)), | ||
('changed_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, editable=False, to=settings.AUTH_USER_MODEL, null=True, verbose_name='Changed by')), | ||
], | ||
options={ | ||
'ordering': ('-change_date',), | ||
'abstract': False, | ||
}, | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
""" | ||
This file is intentionally empty. Django 1.6 and below require a models.py file for all apps. | ||
Commerce-related models. | ||
""" | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from config_models.models import ConfigurationModel | ||
|
||
|
||
class CommerceConfiguration(ConfigurationModel): | ||
""" Commerce configuration """ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know I've asked about this before, but I just want to ask again if this is the right location/time to add a foreign key back to the Site. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if so, maybe the name of this model should be SiteCommerceConfiguration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is not my code, I'd like to include @clintonb to weigh in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may have initially wrote this code as a prototype; but, if you are submitting the PR @vkaracic, it's your code. That being said, yes, this would be the place to add multi-tenancy support. That should be tested extensively (obviously). |
||
checkout_on_ecommerce_service = models.BooleanField( | ||
default=False, | ||
help_text=_('Use the checkout page hosted by the E-Commerce service.') | ||
) | ||
|
||
single_course_checkout_page = models.CharField( | ||
max_length=255, | ||
default='/basket/single-item/', | ||
help_text=_('Path to single course checkout page hosted by the E-Commerce service.') | ||
) | ||
|
||
def __unicode__(self): | ||
return "Commerce configuration" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
unicode(course_key)
.