Commit 03490908 by Renzo Lucioni

Merge pull request #8456 from edx/renzo/payment-button-ui

Payment button UI modifications
parents 2374685d d6c04604
...@@ -103,11 +103,15 @@ define([ ...@@ -103,11 +103,15 @@ define([
expect($el.length).toEqual(_.size(buttons)); expect($el.length).toEqual(_.size(buttons));
_.each(buttons, function( expectedText, expectedId ) { _.each(buttons, function( expectedText, expectedId ) {
var buttonEl = $( '#' + expectedId ); var buttonEl = $( '#' + expectedId );
buttonEl.removeAttr('disabled'); buttonEl.removeAttr('disabled');
expect( buttonEl.length ).toEqual( 1 ); expect( buttonEl.length ).toEqual( 1 );
expect( buttonEl[0] ).toHaveClass( 'payment-button' ); expect( buttonEl[0] ).toHaveClass( 'payment-button' );
expect( buttonEl[0] ).toHaveText( expectedText ); expect( buttonEl[0] ).toHaveText( expectedText );
buttonEl[0].click(); buttonEl[0].click();
expect( buttonEl[0] ).toHaveClass( 'is-selected' );
expectPaymentButtonEnabled( false );
expect(requests[requests.length - 1].requestBody.split('&')).toContain('processor=' + expectedId); expect(requests[requests.length - 1].requestBody.split('&')).toContain('processor=' + expectedId);
}); });
}; };
...@@ -136,15 +140,15 @@ define([ ...@@ -136,15 +140,15 @@ define([
it( 'provides working payment buttons for a single processor', function() { it( 'provides working payment buttons for a single processor', function() {
createView({processors: ['cybersource']}); createView({processors: ['cybersource']});
checkPaymentButtons( AjaxHelpers.requests(this), {cybersource: "Pay with Credit Card"}); checkPaymentButtons( AjaxHelpers.requests(this), {cybersource: "Checkout"});
}); });
it( 'provides working payment buttons for multiple processors', function() { it( 'provides working payment buttons for multiple processors', function() {
createView({processors: ['cybersource', 'paypal', 'other']}); createView({processors: ['cybersource', 'paypal', 'other']});
checkPaymentButtons( AjaxHelpers.requests(this), { checkPaymentButtons( AjaxHelpers.requests(this), {
cybersource: "Pay with Credit Card", cybersource: "Checkout",
paypal: "Pay with PayPal", paypal: "Checkout with PayPal",
other: "Pay with other" other: "Checkout with other"
}); });
}); });
......
...@@ -45,13 +45,13 @@ var edx = edx || {}; ...@@ -45,13 +45,13 @@ var edx = edx || {};
_getPaymentButtonText: function(processorName) { _getPaymentButtonText: function(processorName) {
if (processorName.toLowerCase().substr(0, 11)=='cybersource') { if (processorName.toLowerCase().substr(0, 11)=='cybersource') {
return gettext('Pay with Credit Card'); return gettext('Checkout');
} else if (processorName.toLowerCase()=='paypal') { } else if (processorName.toLowerCase()=='paypal') {
return gettext('Pay with PayPal'); return gettext('Checkout with PayPal');
} else { } else {
// This is mainly for testing as no other processors are supported right now. // This is mainly for testing as no other processors are supported right now.
// Translators: 'processor' is the name of a third-party payment processing vendor (example: "PayPal") // Translators: 'processor' is the name of a third-party payment processing vendor (example: "PayPal")
return interpolate_text(gettext('Pay with {processor}'), {processor: processorName}); return interpolate_text(gettext('Checkout with {processor}'), {processor: processorName});
} }
}, },
...@@ -134,6 +134,8 @@ var edx = edx || {}; ...@@ -134,6 +134,8 @@ var edx = edx || {};
// Disable the payment button to prevent multiple submissions // Disable the payment button to prevent multiple submissions
this.setPaymentEnabled( false ); this.setPaymentEnabled( false );
$( event.target ).toggleClass( 'is-selected' );
// Create the order for the amount // Create the order for the amount
$.ajax({ $.ajax({
url: '/verify_student/create_order/', url: '/verify_student/create_order/',
...@@ -194,6 +196,8 @@ var edx = edx || {}; ...@@ -194,6 +196,8 @@ var edx = edx || {};
// Re-enable the button so the user can re-try // Re-enable the button so the user can re-try
this.setPaymentEnabled( true ); this.setPaymentEnabled( true );
$( '.payment-button' ).toggleClass( 'is-selected', false );
}, },
getPaymentAmount: function() { getPaymentAmount: function() {
......
...@@ -67,6 +67,10 @@ ...@@ -67,6 +67,10 @@
.payment-button { .payment-button {
float: right; float: right;
@include margin-left( ($baseline/2) ); @include margin-left( ($baseline/2) );
&.is-selected {
background: $m-blue-d3 !important;
}
} }
} }
......
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