Merge pull request #552 from pcoder/bug/3993/dg_new_user_membership_payment
Set cardholder_name field for UserBillingAddressForm
This commit is contained in:
		
				commit
				
					
						ed6e39d955
					
				
			
		
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -376,6 +376,10 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): | ||||||
|                 return render(request, self.template_name, context) |                 return render(request, self.template_name, context) | ||||||
| 
 | 
 | ||||||
|             charge = charge_response.get('response_object') |             charge = charge_response.get('response_object') | ||||||
|  |             if 'source' in charge: | ||||||
|  |                 cardholder_name = charge['source']['name'] | ||||||
|  |             else: | ||||||
|  |                 cardholder_name = customer.user.name | ||||||
| 
 | 
 | ||||||
|             # Create Billing Address |             # Create Billing Address | ||||||
|             billing_address = form.save() |             billing_address = form.save() | ||||||
|  | @ -383,7 +387,8 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView): | ||||||
|             # Create Billing Address for User if he does not have one |             # Create Billing Address for User if he does not have one | ||||||
|             if not customer.user.billing_addresses.count(): |             if not customer.user.billing_addresses.count(): | ||||||
|                 data.update({ |                 data.update({ | ||||||
|                     'user': customer.user.id |                     'user': customer.user.id, | ||||||
|  |                     'cardholder_name': cardholder_name | ||||||
|                 }) |                 }) | ||||||
|                 billing_address_user_form = UserBillingAddressForm(data) |                 billing_address_user_form = UserBillingAddressForm(data) | ||||||
|                 billing_address_user_form.is_valid() |                 billing_address_user_form.is_valid() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue