Fix getting cc details from payment_methods
This commit is contained in:
		
					parent
					
						
							
								2f98294eab
							
						
					
				
			
			
				commit
				
					
						13f5f576b5
					
				
			
		
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -169,6 +169,10 @@ class HostingOrder(AssignPermissionsMixin, models.Model):
 | 
			
		|||
 | 
			
		||||
    def set_stripe_charge(self, stripe_charge):
 | 
			
		||||
        self.stripe_charge_id = stripe_charge.id
 | 
			
		||||
        if stripe_charge.source is None:
 | 
			
		||||
            self.last4 = stripe_charge.payment_method_details.card.last4
 | 
			
		||||
            self.cc_brand = stripe_charge.payment_method_details.card.brand
 | 
			
		||||
        else:
 | 
			
		||||
            self.last4 = stripe_charge.source.last4
 | 
			
		||||
            self.cc_brand = stripe_charge.source.brand
 | 
			
		||||
        self.save()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue