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
92622f12
Commit
92622f12
authored
Dec 31, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6373 from edx/improve-i18n-receipt-page
Improve i18n on shoppingcart
parents
20c356bd
08e90d2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
71 deletions
+105
-71
lms/djangoapps/shoppingcart/models.py
+7
-2
lms/djangoapps/shoppingcart/processors/CyberSource.py
+63
-50
lms/templates/shoppingcart/receipt.html
+35
-19
No files found.
lms/djangoapps/shoppingcart/models.py
View file @
92622f12
...
...
@@ -1019,8 +1019,13 @@ class PaidCourseRegistration(OrderItem):
Generates instructions when the user has purchased a PaidCourseRegistration.
Basically tells the user to visit the dashboard to see their new classes
"""
notification
=
(
_
(
'Please visit your <a href="{dashboard_link}">dashboard</a> to see your new course.'
)
.
format
(
dashboard_link
=
reverse
(
'dashboard'
)))
notification
=
_
(
u"Please visit your {link_start}dashboard{link_end} "
u"to see your new course."
)
.
format
(
link_start
=
u'<a href="{url}">'
.
format
(
url
=
reverse
(
'dashboard'
)),
link_end
=
u'</a>'
,
)
return
self
.
pk_with_subclass
,
set
([
notification
])
...
...
lms/djangoapps/shoppingcart/processors/CyberSource.py
View file @
92622f12
...
...
@@ -241,23 +241,22 @@ def get_processor_decline_html(params):
# see if we have an override in the microsites
payment_support_email
=
microsite
.
get_value
(
'payment_support_email'
,
settings
.
PAYMENT_SUPPORT_EMAIL
)
msg
=
dedent
(
_
(
"""
<p class="error_msg">
Sorry! Our payment processor did not accept your payment.
The decision they returned was <span class="decision">{decision}</span>,
and the reason was <span class="reason">{reason_code}:{reason_msg}</span>.
You were not charged. Please try a different form of payment.
Contact us with payment-related questions at {email}.
</p>
"""
))
return
msg
.
format
(
decision
=
params
[
'decision'
],
reason_code
=
params
[
'reasonCode'
],
reason_msg
=
REASONCODE_MAP
[
params
[
'reasonCode'
]],
email
=
payment_support_email
)
msg
=
_
(
"Sorry! Our payment processor did not accept your payment. "
"The decision they returned was {decision_text}, "
"and the reason was {reason_text}. "
"You were not charged. "
"Please try a different form of payment. "
"Contact us with payment-related questions at {email}."
)
formatted
=
msg
.
format
(
decision_text
=
'<span class="decision">{}</span>'
.
format
(
params
[
'decision'
]),
reason_text
=
'<span class="reason">{code}:{msg}</span>'
.
format
(
code
=
params
[
'reasonCode'
],
msg
=
REASONCODE_MAP
[
params
[
'reasonCode'
]],
),
email
=
payment_support_email
,
)
return
'<p class="error_msg">{}</p>'
.
format
(
formatted
)
def
get_processor_exception_html
(
exception
):
...
...
@@ -266,41 +265,55 @@ def get_processor_exception_html(exception):
# see if we have an override in the microsites
payment_support_email
=
microsite
.
get_value
(
'payment_support_email'
,
settings
.
PAYMENT_SUPPORT_EMAIL
)
if
isinstance
(
exception
,
CCProcessorDataException
):
msg
=
dedent
(
_
(
"""
<p class="error_msg">
Sorry! Our payment processor sent us back a payment confirmation that had inconsistent data!
We apologize that we cannot verify whether the charge went through and take further action on your order.
The specific error message is: <span class="exception_msg">{msg}</span>.
Your credit card may possibly have been charged. Contact us with payment-specific questions at {email}.
</p>
"""
.
format
(
msg
=
exception
.
message
,
email
=
payment_support_email
)
))
return
msg
msg
=
_
(
"Sorry! Our payment processor sent us back a payment confirmation "
"that had inconsistent data!"
"We apologize that we cannot verify whether the charge went through "
"and take further action on your order."
"The specific error message is: {error_message}. "
"Your credit card may possibly have been charged. "
"Contact us with payment-specific questions at {email}."
)
formatted
=
msg
.
format
(
error_message
=
'<span class="exception_msg">{msg}</span>'
.
format
(
msg
=
exception
.
message
,
),
email
=
payment_support_email
,
)
return
'<p class="error_msg">{}</p>'
.
format
(
formatted
)
elif
isinstance
(
exception
,
CCProcessorWrongAmountException
):
msg
=
dedent
(
_
(
"""
<p class="error_msg">
Sorry! Due to an error your purchase was charged for a different amount than the order total!
The specific error message is: <span class="exception_msg">{msg}</span>.
Your credit card has probably been charged. Contact us with payment-specific questions at {email}.
</p>
"""
.
format
(
msg
=
exception
.
message
,
email
=
payment_support_email
)
))
return
msg
msg
=
_
(
"Sorry! Due to an error your purchase was charged for "
"a different amount than the order total! "
"The specific error message is: {error_message}. "
"Your credit card has probably been charged. "
"Contact us with payment-specific questions at {email}."
)
formatted
=
msg
.
format
(
error_message
=
'<span class="exception_msg">{msg}</span>'
.
format
(
msg
=
exception
.
message
,
),
email
=
payment_support_email
,
)
return
'<p class="error_msg">{}</p>'
.
format
(
formatted
)
elif
isinstance
(
exception
,
CCProcessorSignatureException
):
msg
=
dedent
(
_
(
"""
<p class="error_msg">
Sorry! Our payment processor sent us back a corrupted message regarding your charge, so we are
unable to validate that the message actually came from the payment processor.
The specific error message is: <span class="exception_msg">{msg}</span>.
We apologize that we cannot verify whether the charge went through and take further action on your order.
Your credit card may possibly have been charged. Contact us with payment-specific questions at {email}.
</p>
"""
.
format
(
msg
=
exception
.
message
,
email
=
payment_support_email
)
))
return
msg
msg
=
_
(
"Sorry! Our payment processor sent us back a corrupted message "
"regarding your charge, so we are unable to validate that "
"the message actually came from the payment processor. "
"The specific error message is: {error_message}. "
"We apologize that we cannot verify whether the charge went through "
"and take further action on your order. "
"Your credit card may possibly have been charged. "
"Contact us with payment-specific questions at {email}."
)
formatted
=
msg
.
format
(
error_message
=
'<span class="exception_msg">{msg}</span>'
.
format
(
msg
=
exception
.
message
,
),
email
=
payment_support_email
,
)
return
'<p class="error_msg">{}</p>'
.
format
(
formatted
)
# fallthrough case, which basically never happens
return
'<p class="error_msg">EXCEPTION!</p>'
...
...
lms/templates/shoppingcart/receipt.html
View file @
92622f12
<
%
inherit
file=
"shopping_cart_flow.html"
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
from
django
.
utils
.
translation
import
ungettext
from
django
.
core
.
urlresolvers
import
reverse
from
courseware
.
courses
import
course_image_url
,
get_course_about_section
,
get_course_by_id
%
>
...
...
@@ -20,7 +21,7 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
<div
class=
"message-left"
>
<
%
courses_url =
reverse('courses')
%
>
% if receipt_has_donation_item:
<b>
${_("Thank you for your
P
urchase!")}
</b>
<b>
${_("Thank you for your
p
urchase!")}
</b>
% for inst in instructions:
${inst}
% endfor
...
...
@@ -29,18 +30,33 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
## we will show the button View Dashboard
<
%
dashboard_url =
reverse('dashboard')
%
>
<a
href=
"${dashboard_url}"
class=
"blue pull-right"
>
${_("View Dashboard")}
<i
class=
"icon-caret-right"
></i></a>
<span
class=
"mt-7"
>
${_("You have successfully been enrolled for
<b>
{appended_course_names}
</b>
. The following receipt has been emailed to"
"
<strong>
{appended_recipient_emails}
</strong></span>
").format(appended_course_names=appended_course_names, appended_recipient_emails=appended_recipient_emails)}
<span
class=
"mt-7"
>
${_(u"You have successfully been enrolled for {course_names}. "
u"The following receipt has been emailed to {receipient_emails}").format(
course_names=u"
<b>
{course_names}
</b>
".format(
course_names=appended_course_names
),
receipient_emails=u"
<strong>
{receipient_emails}
</strong>
".format(
receipient_emails=appended_recipient_emails
),
)}
</span>
% elif order_type == 'business':
% if total_registration_codes > 1 :
<
%
code_plural_form =
'codes'
%
>
% else:
<
%
code_plural_form =
'code'
%
>
% endif
${_("You have successfully purchased
<b>
{total_registration_codes} course registration codes
</b>
"
"for
<b>
{appended_course_names}.
</b>
"
"The following receipt has been emailed to
<strong>
{appended_recipient_emails}
</strong>
"
).format(total_registration_codes=total_registration_codes, appended_course_names=appended_course_names, appended_recipient_emails=appended_recipient_emails)}
${ungettext(
"You have successfully purchased
<b>
{number} course registration code
</b>
for {course_names}.",
"You have successfully purchased
<b>
{number} course registration codes
</b>
for {course_names}.",
total_registration_codes
).format(
number=total_registration_codes,
course_names=u"
<b>
{course_names}
</b>
".format(
course_names=appended_course_names
)
)}
${_("The following receipt has been emailed to {receipient_emails}").format(
receipient_emails=u"
<strong>
{receipient_emails}
</strong>
".format(
receipient_emails=appended_recipient_emails,
)
)}
% endif
</div>
...
...
@@ -93,7 +109,7 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
<b>
${_('Company Name')}:
</b>
<label>
% if order.company_name:
${
_("{company_name}").format(company_name=order.company_name)
}
${
order.company_name
}
% else:
N/A
% endif
...
...
@@ -105,7 +121,7 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
<b>
${_('Purchase Order Number')}:
</b>
<label>
% if order.customer_reference_number:
${
_("{customer_reference_number}").format(customer_reference_number=order.customer_reference_number)
}
${
order.customer_reference_number
}
% else:
N/A
% endif
...
...
@@ -117,7 +133,7 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
<b>
${_('Company Contact Name')}:
</b>
<label>
% if order.company_contact_name:
${
_("{company_contact_name}").format(company_contact_name=order.company_contact_name)
}
${
order.company_contact_name
}
% else:
N/A
% endif
...
...
@@ -129,7 +145,7 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
<b>
${_('Company Contact Email')}:
</b>
<label>
% if order.company_contact_email:
${
order.company_contact_email
}
${
order.company_contact_email
}
% else:
N/A
% endif
...
...
@@ -141,7 +157,7 @@ from courseware.courses import course_image_url, get_course_about_section, get_c
<b>
${_('Recipient Name')}:
</b>
<label>
% if order.recipient_name:
${
_("{recipient_name}").format(recipient_name=order.recipient_name)
}
${
order.recipient_name
}
% else:
N/A
% endif
...
...
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