Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a5c9d0b0
Commit
a5c9d0b0
authored
May 06, 2015
by
jsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add custom PayPal payment button and js tests for buttons.
XCOM-270
parent
2817ce14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
lms/static/js/spec/verify_student/make_payment_step_view_spec.js
+28
-1
lms/static/js/verify_student/views/make_payment_step_view.js
+2
-0
No files found.
lms/static/js/spec/verify_student/make_payment_step_view_spec.js
View file @
a5c9d0b0
...
...
@@ -57,7 +57,7 @@ define([
};
var
expectPaymentDisabledBecauseInactive
=
function
()
{
var
payButton
=
$
(
'.payment
_
button'
);
var
payButton
=
$
(
'.payment
-
button'
);
// Payment button should be hidden
expect
(
payButton
.
length
).
toEqual
(
0
);
...
...
@@ -98,6 +98,19 @@ define([
expect
(
form
.
attr
(
'action'
)).
toEqual
(
'http://payment-page-url/'
);
};
var
checkPaymentButtons
=
function
(
requests
,
buttons
)
{
var
$el
=
$
(
'.payment-button'
);
expect
(
$el
.
length
).
toEqual
(
_
.
size
(
buttons
));
_
.
each
(
buttons
,
function
(
expectedText
,
expectedId
)
{
var
buttonEl
=
$
(
'#'
+
expectedId
);
expect
(
buttonEl
.
length
).
toEqual
(
1
);
expect
(
buttonEl
[
0
]
).
toHaveClass
(
'payment-button'
);
expect
(
buttonEl
[
0
].
text
).
toEqual
(
expectedText
);
buttonEl
[
0
].
click
();
expect
(
requests
[
requests
.
length
-
1
].
requestBody
.
split
(
'&'
)).
toContain
(
'processor='
+
expectedId
);
});
};
beforeEach
(
function
()
{
window
.
analytics
=
jasmine
.
createSpyObj
(
'analytics'
,
[
'track'
,
'page'
,
'trackLink'
]);
...
...
@@ -120,6 +133,20 @@ define([
expectPaymentSubmitted
(
view
,
{
foo
:
'bar'
}
);
});
it
(
'provides working payment buttons for a single processor'
,
function
()
{
createView
({
processors
:
[
'cybersource'
]});
checkPaymentButtons
(
AjaxHelpers
.
requests
(
this
),
{
cybersource
:
"Pay with Credit Card"
});
});
it
(
'provides working payment buttons for multiple processors'
,
function
()
{
createView
({
processors
:
[
'cybersource'
,
'paypal'
,
'other'
]});
checkPaymentButtons
(
AjaxHelpers
.
requests
(
this
),
{
cybersource
:
"Pay with Credit Card"
,
paypal
:
"Pay with PayPal"
,
other
:
"Pay with other"
});
});
it
(
'by default minimum price is selected if no suggested prices are given'
,
function
()
{
var
view
=
createView
(),
requests
=
AjaxHelpers
.
requests
(
this
);
...
...
lms/static/js/verify_student/views/make_payment_step_view.js
View file @
a5c9d0b0
...
...
@@ -46,6 +46,8 @@ var edx = edx || {};
_getPaymentButtonText
:
function
(
processorName
)
{
if
(
processorName
.
toLowerCase
().
substr
(
0
,
11
)
==
'cybersource'
)
{
return
gettext
(
'Pay with Credit Card'
);
}
else
if
(
processorName
.
toLowerCase
()
==
'paypal'
)
{
return
gettext
(
'Pay with PayPal'
);
}
else
{
// 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")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment