pretix / pretix-mollie

Mollie payments for pretix
Other
3 stars 9 forks source link

Mollie Internal Server Error #5

Open gleichaberanders opened 5 years ago

gleichaberanders commented 5 years ago

Hey together,

i just implemented the Mollie plugin in our pretix system. Mollie says the payment is okay, but pretix is unable to get this information. First step: we just select sofort via mollie, we authorize the test payment:

Bildschirmfoto 2019-03-18 um 21 36 01

After that we just get this information / internal server error:

Bildschirmfoto 2019-03-18 um 21 48 40

(URL: https://url.shop/eventname/veranstaltung/mollie/return/HR9AQ/e2c32a748445edd56a5f081daebf84e566b25cac/34/)

If we check Mollie, it says the payment is okay, but there is an web hook error:

Bildschirmfoto 2019-03-18 um 21 38 27

If we check the pretix backend, we are not able to see that the order is payed:

Bildschirmfoto 2019-03-18 um 21 39 38 Bildschirmfoto 2019-03-18 um 21 39 33
raphaelm commented 5 years ago

Can you check pretix.log for the actual error message, please?

gleichaberanders commented 5 years ago

Its just in the test system, if we switch it to live - it works :)

lesander commented 4 years ago

Hi there @raphaelm, first of all: thanks for your plugin.

I've encountered the same problem @gleichaberanders has encountered. In test mode, using Mollie test keys, I too receive a 500 error.

pretix.log:

ERROR 2019-10-04 18:41:40,180 django.request log Internal Server Error: /syntax/test-event/mollie/webhook/1/
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pretix_mollie/views.py", line 150, in handle_payment
    resp.raise_for_status()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.mollie.com/v2/payments/tr_K7qgaWBnQp?testmode=true

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/pretix/src/pretix/presale/utils.py", line 158, in wrap
    response = func(request=request, *args, **kwargs)
  File "/pretix/src/pretix/presale/utils.py", line 158, in wrap
    response = func(request=request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pretix_mollie/views.py", line 287, in post
    handle_payment(self.payment, request.POST.get('id'))
  File "/usr/local/lib/python3.6/site-packages/pretix_mollie/views.py", line 206, in handle_payment
    raise PaymentException(_('We had trouble communicating with Mollie. Please try again and get in touch '
pretix.base.payment.PaymentException: We had trouble communicating with Mollie. Please try again and get in touch with us if this problem persists.
lesander commented 4 years ago

Note: I’m not sure if I used Mollie’s OAuth or API key. Will check later this evening.

lesander commented 4 years ago

This seems to occur for both OAuth and API key implementations. For further debugging we'd need to print Mollie's detail and field strings in the json response body.

https://docs.mollie.com/guides/handling-errors -> CTRL + F -> "422"