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

cybersource requires undocummented attrs #323

Open
Jskarie opened this issue Aug 5, 2022 · 1 comment
Open

cybersource requires undocummented attrs #323

Jskarie opened this issue Aug 5, 2022 · 1 comment

Comments

@Jskarie
Copy link
Contributor

Jskarie commented Aug 5, 2022

The cybersource interface requires the following data, but it's not in the documentation.
I think 1. i should be added to the documentation for cybersource
2. I think the error capture needs to use AttributeError instead of KeyError
payment.attrs.fingerprint_session_id = cart_id
payment.attrs.merchant_defined_data = {}

  1. I think this is an error, the code looks to be trying to capture the error, but it captures KeyError when the error it throws is AttributeError.
try:
            fingerprint_id = payment.attrs.fingerprint_session_id
        except KeyError:
            pass

Same with merchant_defined_data

        try:
            merchant_defined_data = payment.attrs.merchant_defined_data
        except KeyError:

here is where it throws the error in payments/models.py

        def __getattr__(self, item):

            data = json.loads(self._payment.extra_data or "{}")

            try:

                return data[item]

            except KeyError as e:

                raise AttributeError(*e.args)

To recreate the error, simply edit the test to remove either field. The error will show up.

@WhyNotHugo
Copy link
Member

The cybersource interface requires the following data, but it's not in the documentation.

What data? I think you're missing something here.

Regarding the rest, can you send a PR?

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

No branches or pull requests

2 participants