This is a tiny usability tweak that really bothered me while I was troubleshooting the module shortly after installation. The problem is that the watchdog listings page trims the text at a certain number of characters (not exactly sure how many chars it is) just shy of the error code, and I was having to click to open the details page just simply to get the error code. So i changed the format of the message to make both the error code and the message (if any) returned from the payflow pro transaction response.
From:
watchdog('payflowpro', t('Credit card processing error for !amount with error code !return_code.', array('!amount' => uc_currency_format($amount), '!return_code' => $txn_result_code)));
To:
watchdog('uc_payflowpro', t('Error !return_code: !message for !amount.', array('!message' => (string)$response->Message, '!return_code' => $txn_result_code, '!amount' => uc_currency_format($amount) )));
I wasn't able to test every possible error message case, but this addition didn't seem to blow up for the error messages I was getting.
Also I'm not sure if the choice to use two different $types for watchdog() messages in this single module was intentional or not, but most other messages in the module are sent as watchdog('uc_payflowpro' ...) and in this case it originally was sent as watchdog('payflowpro' ...). So I changed that as well because it seems to me one classification is better in order to:
1) more easily filter messages in the watchdog UI generated from this module (something that's not too much of a problem in d6, but in d5 it is).
2) be consistent with the rest of ubercart modules that use the uc_ prefix for their log messages.
Comments
Comment #1
kwinters commentedCommitted changes:
* Changed the D5 auth / sale error watchdog message to match the suggested version in the issue notes
* In D6, added response message to admin comment created on order as well (was just the code before)
* Combined 'cron' and 'payflow_cron' into just 'payflow_cron'
There are now only 3 watchdog types used. They're divided into cron messages, primary module messages (cart), and recurring system messages which seems like a reasonable distinction.