Added CustomUser model reload code
This commit is contained in:
		
					parent
					
						
							
								5caa79f199
							
						
					
				
			
			
				commit
				
					
						d4e7eb9511
					
				
			
		
					 1 changed files with 1 additions and 3 deletions
				
			
		|  | @ -176,16 +176,14 @@ class StripeCustomer(models.Model): | ||||||
|             return stripe_customer |             return stripe_customer | ||||||
| 
 | 
 | ||||||
|         except StripeCustomer.DoesNotExist: |         except StripeCustomer.DoesNotExist: | ||||||
|  |             CustomUser.refresh_from_db() | ||||||
|             user = CustomUser.objects.get(email=email) |             user = CustomUser.objects.get(email=email) | ||||||
| 
 |  | ||||||
|             stripe_utils = StripeUtils() |             stripe_utils = StripeUtils() | ||||||
|             stripe_data = stripe_utils.create_customer(token, email) |             stripe_data = stripe_utils.create_customer(token, email) | ||||||
|             if stripe_data.get('response_object'): |             if stripe_data.get('response_object'): | ||||||
|                 stripe_cus_id = stripe_data.get('response_object').get('id') |                 stripe_cus_id = stripe_data.get('response_object').get('id') | ||||||
| 
 |  | ||||||
|                 stripe_customer = StripeCustomer.objects.\ |                 stripe_customer = StripeCustomer.objects.\ | ||||||
|                     create(user=user, stripe_id=stripe_cus_id) |                     create(user=user, stripe_id=stripe_cus_id) | ||||||
| 
 |  | ||||||
|                 return stripe_customer |                 return stripe_customer | ||||||
|             else: |             else: | ||||||
|                 return None |                 return None | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue