I'm submitting a ... (check one with "x")
Current behavior:
Following is the heroku log for making a request to Orders API with payment-mode:paypal
2017-08-17T11:24:19.730791+00:00 app[web.1]: Exception on /v1/orders [POST]
2017-08-17T11:24:19.730793+00:00 app[web.1]: Traceback (most recent call last):
2017-08-17T11:24:19.730794+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
2017-08-17T11:24:19.730794+00:00 app[web.1]: response = self.full_dispatch_request()
2017-08-17T11:24:19.730795+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
2017-08-17T11:24:19.730796+00:00 app[web.1]: rv = self.handle_user_exception(e)
2017-08-17T11:24:19.730797+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
2017-08-17T11:24:19.730800+00:00 app[web.1]: return cors_after_request(app.make_response(f(*args, **kwargs)))
2017-08-17T11:24:19.730801+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
2017-08-17T11:24:19.730802+00:00 app[web.1]: reraise(exc_type, exc_value, tb)
2017-08-17T11:24:19.730803+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
2017-08-17T11:24:19.730804+00:00 app[web.1]: rv = self.dispatch_request()
2017-08-17T11:24:19.730804+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
2017-08-17T11:24:19.730805+00:00 app[web.1]: return self.view_functions[rule.endpoint](**req.view_args)
2017-08-17T11:24:19.730806+00:00 app[web.1]: File "/app/app/api/helpers/permissions.py", line 43, in decorator
2017-08-17T11:24:19.730806+00:00 app[web.1]: return fn(*args, **kwargs)
2017-08-17T11:24:19.730807+00:00 app[web.1]: File "/app/.heroku/src/flask-rest-jsonapi/flask_rest_jsonapi/decorators.py", line 32, in wrapper
2017-08-17T11:24:19.730808+00:00 app[web.1]: return func(*args, **kwargs)
2017-08-17T11:24:19.730809+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/flask/views.py", line 84, in view
2017-08-17T11:24:19.730809+00:00 app[web.1]: return self.dispatch_request(*args, **kwargs)
2017-08-17T11:24:19.730810+00:00 app[web.1]: File "/app/.heroku/src/flask-rest-jsonapi/flask_rest_jsonapi/resource.py", line 68, in dispatch_request
2017-08-17T11:24:19.730811+00:00 app[web.1]: response = method(*args, **kwargs)
2017-08-17T11:24:19.730812+00:00 app[web.1]: File "/app/.heroku/src/flask-rest-jsonapi/flask_rest_jsonapi/decorators.py", line 56, in wrapper
2017-08-17T11:24:19.730812+00:00 app[web.1]: return func(*args, **kwargs)
2017-08-17T11:24:19.730813+00:00 app[web.1]: File "/app/.heroku/src/flask-rest-jsonapi/flask_rest_jsonapi/resource.py", line 206, in post
2017-08-17T11:24:19.730813+00:00 app[web.1]: result = schema.dump(obj).data
2017-08-17T11:24:19.730814+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/marshmallow/schema.py", line 525, in dump
2017-08-17T11:24:19.730815+00:00 app[web.1]: original_data=obj)
2017-08-17T11:24:19.730815+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/marshmallow/schema.py", line 842, in _invoke_dump_processors
2017-08-17T11:24:19.730816+00:00 app[web.1]: data=data, many=many, original_data=original_data)
2017-08-17T11:24:19.730817+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/marshmallow/schema.py", line 955, in _invoke_processors
2017-08-17T11:24:19.730817+00:00 app[web.1]: data = utils.if_none(processor(data), data)
2017-08-17T11:24:19.730818+00:00 app[web.1]: File "/app/app/api/schema/orders.py", line 27, in generate_payment_url
2017-08-17T11:24:19.730819+00:00 app[web.1]: data['payment_url'] = PayPalPaymentsManager.get_checkout_url(order)
2017-08-17T11:24:19.730820+00:00 app[web.1]: File "/app/app/api/helpers/payment.py", line 190, in get_checkout_url
2017-08-17T11:24:19.730820+00:00 app[web.1]: token = dict(urlparse.parse_qsl(response.text))['TOKEN']
2017-08-17T11:24:19.730821+00:00 app[web.1]: KeyError: 'TOKEN'
Expected behavior:
Instead of giving 500, show proper error message and error handling in case of server side error. Else fix the problem.
@SaptakS Did that fix it? If not I am not exactly sure what the problem is :sweat_smile:
@poush Can you work on this issue?
@magdalenesuo Sure, I will first test it on my paypal sandbox and try to reproduce it.
Tried with different scenarios, couldn't reproduce it. If this is still causing any error on Heroku deploy then this could be due to invalid credentials of PayPal in the settings.