25
25
import re
26
26
import json
27
27
import uuid
28
+ import logging
28
29
from textwrap import dedent
29
30
from datetime import datetime
30
31
from collections import OrderedDict , defaultdict
38
39
from shoppingcart .processors .helpers import get_processor_config
39
40
from microsite_configuration import microsite
40
41
42
+ log = logging .getLogger (__name__ )
43
+
41
44
42
45
def process_postpay_callback (params ):
43
46
"""
@@ -82,6 +85,7 @@ def process_postpay_callback(params):
82
85
'error_html' : _get_processor_decline_html (params )
83
86
}
84
87
except CCProcessorException as error :
88
+ log .exception ('error processing CyberSource postpay callback' )
85
89
return {
86
90
'success' : False ,
87
91
'order' : None , # due to exception we may not have the order
@@ -449,9 +453,9 @@ def _get_processor_exception_html(exception):
449
453
if isinstance (exception , CCProcessorDataException ):
450
454
return _format_error_html (
451
455
_ (
452
- u"Sorry! Our payment processor sent us back a payment confirmation that had inconsistent data! "
453
- u"We apologize that we cannot verify whether the charge went through and take further action on your order. "
454
- u"The specific error message is: {msg} "
456
+ u"Sorry! Our payment processor sent us back a payment confirmation that had inconsistent data! "
457
+ u"We apologize that we cannot verify whether the charge went through and take further action on your order. "
458
+ u"The specific error message is: {msg} "
455
459
u"Your credit card may possibly have been charged. Contact us with payment-specific questions at {email}."
456
460
).format (
457
461
msg = u'<span class="exception_msg">{msg}</span>' .format (msg = exception .message ),
@@ -461,8 +465,8 @@ def _get_processor_exception_html(exception):
461
465
elif isinstance (exception , CCProcessorWrongAmountException ):
462
466
return _format_error_html (
463
467
_ (
464
- u"Sorry! Due to an error your purchase was charged for a different amount than the order total! "
465
- u"The specific error message is: {msg}. "
468
+ u"Sorry! Due to an error your purchase was charged for a different amount than the order total! "
469
+ u"The specific error message is: {msg}. "
466
470
u"Your credit card has probably been charged. Contact us with payment-specific questions at {email}."
467
471
).format (
468
472
msg = u'<span class="exception_msg">{msg}</span>' .format (msg = exception .message ),
@@ -476,7 +480,7 @@ def _get_processor_exception_html(exception):
476
480
u"unable to validate that the message actually came from the payment processor. "
477
481
u"The specific error message is: {msg}. "
478
482
u"We apologize that we cannot verify whether the charge went through and take further action on your order. "
479
- u"Your credit card may possibly have been charged. Contact us with payment-specific questions at {email}."
483
+ u"Your credit card may possibly have been charged. Contact us with payment-specific questions at {email}."
480
484
).format (
481
485
msg = u'<span class="exception_msg">{msg}</span>' .format (msg = exception .message ),
482
486
email = payment_support_email
@@ -495,15 +499,15 @@ def _get_processor_exception_html(exception):
495
499
else :
496
500
return _format_error_html (
497
501
_ (
498
- u"Sorry! Your payment could not be processed because an unexpected exception occurred. "
502
+ u"Sorry! Your payment could not be processed because an unexpected exception occurred. "
499
503
u"Please contact us at {email} for assistance."
500
504
).format (email = payment_support_email )
501
505
)
502
506
503
507
504
508
def _format_error_html (msg ):
505
509
""" Format an HTML error message """
506
- return '<p class="error_msg">{msg}</p>' .format (msg = msg )
510
+ return u '<p class="error_msg">{msg}</p>' .format (msg = msg )
507
511
508
512
509
513
CARDTYPE_MAP = defaultdict (lambda : "UNKNOWN" )
0 commit comments