From 8d42ca3200217d5c49c3d0e9ac3f2e2dd6616c3a Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 7 Jul 2018 01:08:45 +0200 Subject: [PATCH] Remove token parameter from stripe_utils.get_card_details and add additional paramters to uniquely identify a card --- datacenterlight/tests.py | 3 +-- utils/stripe_utils.py | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/datacenterlight/tests.py b/datacenterlight/tests.py index d6cd6adf..c755cc6f 100644 --- a/datacenterlight/tests.py +++ b/datacenterlight/tests.py @@ -86,8 +86,7 @@ class CeleryTaskTestCase(TestCase): token=self.token ) card_details = self.stripe_utils.get_card_details( - stripe_customer.stripe_id, - self.token + stripe_customer.stripe_id ) card_details_dict = card_details.get('error') self.assertEquals(card_details_dict, None) diff --git a/utils/stripe_utils.py b/utils/stripe_utils.py index e4b9b02e..2045df8e 100644 --- a/utils/stripe_utils.py +++ b/utils/stripe_utils.py @@ -109,12 +109,16 @@ class StripeUtils(object): return new_card_data @handleStripeError - def get_card_details(self, customer_id, token): + def get_card_details(self, customer_id): customer = stripe.Customer.retrieve(customer_id) credit_card_raw_data = customer.sources.data.pop() card_details = { 'last4': credit_card_raw_data.last4, - 'brand': credit_card_raw_data.brand + 'brand': credit_card_raw_data.brand, + 'exp_month': credit_card_raw_data.exp_month, + 'exp_year': credit_card_raw_data.exp_year, + 'fingerprint': credit_card_raw_data.fingerprint, + 'card_id': credit_card_raw_data.id } return card_details