Manual merge of ungleich/master into opennebula-integration
This commit is contained in:
		
					parent
					
						
							
								d10285e23d
							
						
					
				
			
			
				commit
				
					
						d537fcb118
					
				
			
		
					 227 changed files with 25686 additions and 482 deletions
				
			
		|  | @ -59,11 +59,23 @@ class StripeUtils(object): | |||
|         self.stripe = stripe | ||||
| 
 | ||||
|     def update_customer_token(self, customer, token): | ||||
|         # customer = stripe.Customer.retrieve(id) | ||||
| 
 | ||||
|         customer.source = token | ||||
|         customer.save() | ||||
| 
 | ||||
|     @handleStripeError | ||||
|     def update_customer_card(self, customer_id, token): | ||||
|         customer = stripe.Customer.retrieve(customer_id) | ||||
|         current_card_token = customer.default_source | ||||
|         customer.sources.retrieve(current_card_token).delete() | ||||
|         customer.source = token | ||||
|         customer.save() | ||||
|         credit_card_raw_data = customer.sources.data.pop() | ||||
|         new_card_data = { | ||||
|             'last4': credit_card_raw_data.last4, | ||||
|             'brand': credit_card_raw_data.brand | ||||
|         } | ||||
|         return new_card_data | ||||
| 
 | ||||
|     def check_customer(self, id, user, token): | ||||
|         customers = self.stripe.Customer.all() | ||||
|         if not customers.get('data'): | ||||
|  | @ -77,6 +89,12 @@ class StripeUtils(object): | |||
|                 user.stripecustomer.save() | ||||
|         return customer | ||||
| 
 | ||||
|     @handleStripeError | ||||
|     def get_customer(self, id): | ||||
|         customer = stripe.Customer.retrieve(id) | ||||
|         # data = customer.get('response_object') | ||||
|         return customer | ||||
| 
 | ||||
|     @handleStripeError | ||||
|     def create_customer(self, token, email): | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue