Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running any type of payment for my account #60

Closed
jlengrand opened this issue Nov 4, 2022 · 6 comments · Fixed by #61
Closed

Error when running any type of payment for my account #60

jlengrand opened this issue Nov 4, 2022 · 6 comments · Fixed by #61

Comments

@jlengrand
Copy link
Contributor

When trying to use my account, I'm getting the following error whatever method of payment I'm using:

'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
2022-11-04 13:54:05,659 - INFO - Running on http://localhost:8080
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
request_data:
{'countryCode': 'NL', 'currency': 'EUR', 'locale': 'en_NL', 'city': 'Amsterdam', 'postalCode': '1011DJ', 'street': 'Simon Carmiggeltstraat', 'houseNumberOrName': '6 - 50', 'blockedPaymentMethods': []}
/paymentMethods request:
{'reference': 'Reference 7b0ec906-5af2-4b9d-a793-a94b284ff3d5', 'countryCode': 'NL', 'shopperReference': 'UniqueReference', 'channel': 'Web', 'merchantAccount': 'LengrandECOM', 'blockedPaymentMethods': []}
/paymentMethods response:
{"paymentMethods": [{"issuers": [{"id": "1121", "name": "Test Issuer"}, {"id": "1154", "name": "Test Issuer 5"}, {"id": "1153", "name": "Test Issuer 4"}, {"id": "1152", "name": "Test Issuer 3"}, {"id": "1163", "name": "Ideal bridge test issuer"}, {"id": "1151", "name": "Test Issuer 2"}, {"id": "1162", "name": "Test Issuer Cancelled"}, {"id": "1161", "name": "Test Issuer Pending"}, {"id": "1160", "name": "Test Issuer Refused"}, {"id": "1159", "name": "Test Issuer 10"}, {"id": "1158", "name": "Test Issuer 9"}, {"id": "1157", "name": "Test Issuer 8"}, {"id": "1156", "name": "Test Issuer 7"}, {"id": "1155", "name": "Test Issuer 6"}], "name": "iDEAL", "type": "ideal"}, {"brands": ["mc", "visa", "amex", "diners", "jcb"], "name": "Credit Card", "type": "scheme"}, {"name": "Pay later with Klarna.", "type": "klarna"}, {"name": "Paysafecard", "type": "paysafecard"}, {"name": "Pay over time with Klarna.", "type": "klarna_account"}, {"name": "Pay now with Klarna.", "type": "klarna_paynow"}]}
Traceback (most recent call last):
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/venv/lib/python3.9/site-packages/flask/app.py", line 2548, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/venv/lib/python3.9/site-packages/flask/app.py", line 2528, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/venv/lib/python3.9/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/venv/lib/python3.9/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/venv/lib/python3.9/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/venv/lib/python3.9/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/app/app.py", line 42, in initiate_payment
    return adyen_payments(request, locale_data)
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/app/main/payments.py", line 106, in adyen_payments
    sanatizeRequest(payments_request)
  File "/Users/julienlengrand-lambert/Developer/adyen/checkoutCreate/app/main/payments.py", line 143, in sanatizeRequest
    del payments_request['stateOrProvince']
KeyError: 'stateOrProvince'

Trying to dig into the issue

@anamotaadyen
Copy link
Collaborator

This should be fixed already in #49
Do you have the latest version?

@jlengrand
Copy link
Contributor Author

jlengrand commented Nov 4, 2022 via email

@jlengrand
Copy link
Contributor Author

well actually I believe that issue is the origin of the problem

    del payments_request['stateOrProvince']

leads to a KeyError :).

@anamotaadyen
Copy link
Collaborator

anamotaadyen commented Nov 4, 2022

Correct, I see the issue, this is needed for US, but I think we need to now add the field by default to then sanitise, for other countries

@jlengrand
Copy link
Contributor Author

Here is a potential fix to avoid KeyErrors :

#61

@jlengrand
Copy link
Contributor Author

(with some typo fixes as a bonus 😊)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants