Rename contains to get_user_card_details
This commit is contained in:
		
					parent
					
						
							
								abe8c9efa5
							
						
					
				
			
			
				commit
				
					
						63eb7fc0e2
					
				
			
		
					 2 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -312,21 +312,22 @@ class UserCardDetail(AssignPermissionsMixin, models.Model):
 | 
			
		|||
        user_card_detail.save()
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def contains(stripe_customer, card_details):
 | 
			
		||||
    def get_user_card_details(stripe_customer, card_details):
 | 
			
		||||
        """
 | 
			
		||||
        A utility function to check whether a StripeCustomer is already
 | 
			
		||||
        associated with the card having given details
 | 
			
		||||
 | 
			
		||||
        :param stripe_customer:
 | 
			
		||||
        :param card_details:
 | 
			
		||||
        :return:
 | 
			
		||||
        :return: The UserCardDetails object if it exists, False otherwise
 | 
			
		||||
        """
 | 
			
		||||
        try:
 | 
			
		||||
            UserCardDetail.objects.get(
 | 
			
		||||
            ucd = UserCardDetail.objects.get(
 | 
			
		||||
                stripe_customer=stripe_customer,
 | 
			
		||||
                fingerprint=card_details['fingerprint'],
 | 
			
		||||
                exp_month=card_details['exp_month'],
 | 
			
		||||
                exp_year=card_details['exp_year']
 | 
			
		||||
            )
 | 
			
		||||
            return True
 | 
			
		||||
            return ucd
 | 
			
		||||
        except UserCardDetail.DoesNotExist:
 | 
			
		||||
            return False
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue