Use refactored get_all_cards_list function
This commit is contained in:
		
					parent
					
						
							
								bf91bf3822
							
						
					
				
			
			
				commit
				
					
						8351b1bf8b
					
				
			
		
					 1 changed files with 4 additions and 15 deletions
				
			
		|  | @ -659,25 +659,14 @@ class PaymentVMView(LoginRequiredMixin, FormView): | ||||||
| 
 | 
 | ||||||
|     def get_context_data(self, **kwargs): |     def get_context_data(self, **kwargs): | ||||||
|         context = super(PaymentVMView, self).get_context_data(**kwargs) |         context = super(PaymentVMView, self).get_context_data(**kwargs) | ||||||
|         # Get user |  | ||||||
|         user = self.request.user |         user = self.request.user | ||||||
| 
 |         cards_list = UserCardDetail.get_all_cards_list( | ||||||
|         # Get user last order |             stripe_customer= user.stripecustomer | ||||||
|         last_hosting_order = HostingOrder.objects.filter( |         ) | ||||||
|             customer__user=user).last() |  | ||||||
| 
 |  | ||||||
|         # If user has already an hosting order, get the credit card data from |  | ||||||
|         # it |  | ||||||
|         if last_hosting_order: |  | ||||||
|             credit_card_data = last_hosting_order.get_cc_data() |  | ||||||
|             context.update({ |  | ||||||
|                 'credit_card_data': credit_card_data if credit_card_data else None, |  | ||||||
|             }) |  | ||||||
| 
 |  | ||||||
|         context.update({ |         context.update({ | ||||||
|  |             'cards_list': cards_list, | ||||||
|             'stripe_key': settings.STRIPE_API_PUBLIC_KEY |             'stripe_key': settings.STRIPE_API_PUBLIC_KEY | ||||||
|         }) |         }) | ||||||
| 
 |  | ||||||
|         return context |         return context | ||||||
| 
 | 
 | ||||||
|     def get(self, request, *args, **kwargs): |     def get(self, request, *args, **kwargs): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue