django-payments icon indicating copy to clipboard operation
django-payments copied to clipboard

cybersource requires undocummented attrs

Open Jskarie opened this issue 3 years ago • 1 comments

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.

Jskarie avatar Aug 05 '22 16:08 Jskarie

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?

WhyNotHugo avatar Aug 05 '22 17:08 WhyNotHugo