From 788838ba68bc26980301856c31cb1b965317c0b8 Mon Sep 17 00:00:00 2001 From: James Skarie Date: Fri, 5 Aug 2022 15:28:03 -0500 Subject: [PATCH] Bugfix for Cybersource. Wrong exception was except Bugfix and added documentation about a feature Optional parameters payment.attrs.fingerprint_session_id payment.attrs.merchant_defined_data were essentially required otherwise an error was thrown. Was caused by the wrong exception being captured --- docs/backends.rst | 6 ++++++ payments/cybersource/__init__.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/backends.rst b/docs/backends.rst index 465edc4f5..a2dd65e84 100644 --- a/docs/backends.rst +++ b/docs/backends.rst @@ -110,6 +110,12 @@ accomplished by passing your data to the :class:`Payment` instance:: >>> payment.attrs.merchant_defined_data = {'01': 'foo', '02': 'bar'} +Fingerprinting:: + +Cybersource allows you to pass a fingerprint data to help identify fraud + + >>> payment.attrs.fingerprint_session_id + Dotpay ------ diff --git a/payments/cybersource/__init__.py b/payments/cybersource/__init__.py index c8dae1573..8f773ed5e 100644 --- a/payments/cybersource/__init__.py +++ b/payments/cybersource/__init__.py @@ -280,7 +280,7 @@ def _get_params_for_new_payment(self, payment): } try: fingerprint_id = payment.attrs.fingerprint_session_id - except KeyError: + except AttributeError: pass else: params["deviceFingerprintID"] = fingerprint_id @@ -446,7 +446,7 @@ def _prepare_items(self, payment): def _prepare_merchant_defined_data(self, payment): try: merchant_defined_data = payment.attrs.merchant_defined_data - except KeyError: + except AttributeError: return else: data = self.client.factory.create("data:MerchantDefinedData")