Clean AuthorizeNetException message

Removes credit card number from exception error message to make sure it
doesn't show up in logs
This commit is contained in:
shlurbee
2012-10-02 11:48:47 -07:00
committed by Keith Mitchell
parent a0d84ad08a
commit 5328df8ec8

View File

@@ -48,7 +48,16 @@ Errors = Storage(TESTMODE = "E00009",
TOO_MANY_SHIP_ADDRESSES = "E00043")
class AuthorizeNetException(Exception):
pass
def __init__(self, msg):
# don't let CC info show up in logs
msg = re.sub("<cardNumber>\d+(\d{4})</cardNumber>",
"<cardNumber>...\g<1></cardNumber>",
msg)
msg = re.sub("<cardCode>\d+</cardCode>",
"<cardCode>omitted</cardCode>",
msg)
super(AuthorizeNetException, self).__init__(msg)
# xml tags whose content shouldn't be escaped