Prot/X payment module silently swallows errors

Create issue
Issue #1118 resolved
Patryk Zawadzki created an issue

Today our customer was testing her new shop when she got a payment processing error saying "Invalid response from payment gateway". She was afraid people could end up being charged twice but the transaction went through without any problems.

I jumped into the code and was surprised to see that the module uses a rather long try/except block that swallows all exceptions it encounters:

The problem in question was a badly configured store e-mail address but as the except clause accepts all exception types, it was silently discarded and turned to meaningless warning (falsely claiming there was anything wrong with the payment gateway).

I propose changing the except clause to only catch KeyError and move the exception handler right under line 171 as errors below that line are related to broken shop configuration rather than the gateway and as such should not be handled here.

Comments (3)

  1. Chris Moffitt repo owner

    Makes sense. If you wouldn't mind putting together a patch, we will take a look at it. Managing payment platforms is challenging because I don't have a working Protx development account. Your input and suggestions are very helpful.

  2. Log in to comment