Check if DG subscription created was under trial; if not show error
This commit is contained in:
		
					parent
					
						
							
								f5170cce5f
							
						
					
				
			
			
				commit
				
					
						3ed6119dc9
					
				
			
		
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -398,10 +398,18 @@ class MembershipPaymentView(LoginRequiredMixin, IsNotMemberMixin, FormView):
 | 
			
		|||
            stripe_subscription_obj = subscription_result.get(
 | 
			
		||||
                'response_object'
 | 
			
		||||
            )
 | 
			
		||||
            # Check if the subscription was approved and is active
 | 
			
		||||
            # Check if call to create subscription was ok
 | 
			
		||||
            if (stripe_subscription_obj is None or
 | 
			
		||||
                    stripe_subscription_obj.status != 'active'):
 | 
			
		||||
                pass
 | 
			
		||||
                    (
 | 
			
		||||
                        stripe_subscription_obj.status != 'active' and
 | 
			
		||||
                        stripe_subscription_obj.status != 'trialing'
 | 
			
		||||
                    )
 | 
			
		||||
                ):
 | 
			
		||||
                context.update({
 | 
			
		||||
                    'paymentError': subscription_result.get('error'),
 | 
			
		||||
                    'form': form
 | 
			
		||||
                })
 | 
			
		||||
                return render(request, self.template_name, context)
 | 
			
		||||
 | 
			
		||||
            charge = charge_response.get('response_object')
 | 
			
		||||
            if 'source' in charge:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue