Commit 567f2172 by Kevin Falcone

Merge pull request #9800 from edx/hotfix-2015-09-17

Hotfix 2015 09 17
parents 7ee03f33 394c2906
...@@ -126,6 +126,16 @@ class CourseMode(models.Model): ...@@ -126,6 +126,16 @@ class CourseMode(models.Model):
self.currency = self.currency.lower() self.currency = self.currency.lower()
super(CourseMode, self).save(force_insert, force_update, using) super(CourseMode, self).save(force_insert, force_update, using)
@property
def slug(self):
"""
Returns mode_slug
NOTE (CCB): This is a silly hack needed because all of the class methods use tuples
with a property named slug instead of mode_slug.
"""
return self.mode_slug
@classmethod @classmethod
def all_modes_for_courses(cls, course_id_list): def all_modes_for_courses(cls, course_id_list):
"""Find all modes for a list of course IDs, including expired modes. """Find all modes for a list of course IDs, including expired modes.
......
...@@ -766,13 +766,22 @@ def create_order(request): ...@@ -766,13 +766,22 @@ def create_order(request):
return HttpResponseBadRequest(_("Selected price is not valid number.")) return HttpResponseBadRequest(_("Selected price is not valid number."))
current_mode = None current_mode = None
paid_modes = CourseMode.paid_modes_for_course(course_id) sku = request.POST.get('sku', None)
# Check if there are more than 1 paid(mode with min_price>0 e.g verified/professional/no-id-professional) modes
# for course exist then choose the first one if sku:
if paid_modes: try:
if len(paid_modes) > 1: current_mode = CourseMode.objects.get(sku=sku)
log.warn(u"Multiple paid course modes found for course '%s' for create order request", course_id) except CourseMode.DoesNotExist:
current_mode = paid_modes[0] log.exception(u'Failed to find CourseMode with SKU [%s].', sku)
if not current_mode:
# Check if there are more than 1 paid(mode with min_price>0 e.g verified/professional/no-id-professional) modes
# for course exist then choose the first one
paid_modes = CourseMode.paid_modes_for_course(course_id)
if paid_modes:
if len(paid_modes) > 1:
log.warn(u"Multiple paid course modes found for course '%s' for create order request", course_id)
current_mode = paid_modes[0]
# Make sure this course has a paid mode # Make sure this course has a paid mode
if not current_mode: if not current_mode:
......
...@@ -66,7 +66,8 @@ define([ ...@@ -66,7 +66,8 @@ define([
var params = { var params = {
contribution: kwargs.amount || "", contribution: kwargs.amount || "",
course_id: kwargs.courseId || "", course_id: kwargs.courseId || "",
processor: kwargs.processor || "" processor: kwargs.processor || "",
sku: kwargs.sku || ""
}; };
// Click the "go to payment" button // Click the "go to payment" button
......
...@@ -55,6 +55,7 @@ var edx = edx || {}; ...@@ -55,6 +55,7 @@ var edx = edx || {};
), ),
upgrade: el.data('msg-key') === 'upgrade', upgrade: el.data('msg-key') === 'upgrade',
minPrice: el.data('course-mode-min-price'), minPrice: el.data('course-mode-min-price'),
sku: el.data('course-mode-sku'),
contributionAmount: el.data('contribution-amount'), contributionAmount: el.data('contribution-amount'),
suggestedPrices: _.filter( suggestedPrices: _.filter(
(el.data('course-mode-suggested-prices').toString()).split(","), (el.data('course-mode-suggested-prices').toString()).split(","),
......
...@@ -17,6 +17,7 @@ var edx = edx || {}; ...@@ -17,6 +17,7 @@ var edx = edx || {};
isActive: true, isActive: true,
suggestedPrices: [], suggestedPrices: [],
minPrice: 0, minPrice: 0,
sku: '',
currency: 'usd', currency: 'usd',
upgrade: false, upgrade: false,
verificationDeadline: '', verificationDeadline: '',
...@@ -133,7 +134,8 @@ var edx = edx || {}; ...@@ -133,7 +134,8 @@ var edx = edx || {};
postData = { postData = {
'processor': event.target.id, 'processor': event.target.id,
'contribution': paymentAmount, 'contribution': paymentAmount,
'course_id': this.stepData.courseKey 'course_id': this.stepData.courseKey,
'sku': this.templateContext().sku
}; };
// Disable the payment button to prevent multiple submissions // Disable the payment button to prevent multiple submissions
......
...@@ -263,7 +263,8 @@ ...@@ -263,7 +263,8 @@
@include text-align(center); @include text-align(center);
.provider-logo img { .provider-logo img {
width: 100px; max-width: 160px;
margin-bottom: $baseline * 0.5;
} }
.complete-order { .complete-order {
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
<% if ( isActive ) { %> <% if ( isActive ) { %>
<div class="payment-buttons nav-wizard is-ready center"> <div class="payment-buttons nav-wizard is-ready center">
<input type="hidden" name="contribution" value="<%- minPrice %>" /> <input type="hidden" name="contribution" value="<%- minPrice %>" />
<input type="hidden" name="sku" value="<%- sku %>" />
<div class="purchase"> <div class="purchase">
<p class="product-info"><span class="product-name"></span> <%- gettext( "price" ) %>: <span class="price">$<%- minPrice %> USD</span></p> <p class="product-info"><span class="product-name"></span> <%- gettext( "price" ) %>: <span class="price">$<%- minPrice %> USD</span></p>
</div> </div>
......
...@@ -62,6 +62,7 @@ from verify_student.views import PayAndVerifyView ...@@ -62,6 +62,7 @@ from verify_student.views import PayAndVerifyView
data-course-mode-name='${course_mode.name}' data-course-mode-name='${course_mode.name}'
data-course-mode-slug='${course_mode.slug}' data-course-mode-slug='${course_mode.slug}'
data-course-mode-min-price='${course_mode.min_price}' data-course-mode-min-price='${course_mode.min_price}'
data-course-mode-sku='${course_mode.sku or ''}'
data-course-mode-suggested-prices='${course_mode.suggested_prices}' data-course-mode-suggested-prices='${course_mode.suggested_prices}'
data-course-mode-currency='${course_mode.currency}' data-course-mode-currency='${course_mode.currency}'
data-contribution-amount='${contribution_amount}' data-contribution-amount='${contribution_amount}'
......
...@@ -58,7 +58,7 @@ git+https://github.com/edx/ecommerce-api-client.git@1.1.0#egg=ecommerce-api-clie ...@@ -58,7 +58,7 @@ git+https://github.com/edx/ecommerce-api-client.git@1.1.0#egg=ecommerce-api-clie
-e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client -e git+https://github.com/edx/edx-user-state-client.git@30c0ad4b9f57f8d48d6943eb585ec8a9205f4469#egg=edx-user-state-client
-e git+https://github.com/edx/edx-organizations.git@release-2015-08-31#egg=edx-organizations -e git+https://github.com/edx/edx-organizations.git@release-2015-08-31#egg=edx-organizations
git+https://github.com/edx/edx-proctoring.git@0.9.6#egg=edx-proctoring==0.9.6 git+https://github.com/edx/edx-proctoring.git@0.9.6b#egg=edx-proctoring==0.9.6b
# Third Party XBlocks # Third Party XBlocks
-e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga -e git+https://github.com/mitodl/edx-sga@172a90fd2738f8142c10478356b2d9ed3e55334a#egg=edx-sga
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment