Cleaned up some unused code
This commit is contained in:
		
					parent
					
						
							
								08c5485352
							
						
					
				
			
			
				commit
				
					
						bba82e95d1
					
				
			
		
					 1 changed files with 5 additions and 6 deletions
				
			
		|  | @ -137,17 +137,18 @@ class StripeUtils(object): | ||||||
|     @handleStripeError |     @handleStripeError | ||||||
|     def get_or_create_plan(self, amount, name, stripe_plan_id): |     def get_or_create_plan(self, amount, name, stripe_plan_id): | ||||||
|         """ |         """ | ||||||
|         This function checks if a StripePlan with the given id already exists. If it exists then the function returns |         This function checks if a StripePlan with the given stripe_plan_id already exists. If it exists then the | ||||||
|         this object otherwise it creates a new StripePlan and returns the new object. |         function returns this object otherwise it creates a new StripePlan and returns the new object. | ||||||
| 
 | 
 | ||||||
|         :param amount: The amount in CHF |         :param amount: The amount in CHF | ||||||
|         :param name: The name of the Stripe plan to be created. |         :param name: The name of the Stripe plan to be created. | ||||||
|         :param stripe_plan_id: The id of the Stripe plan to be created. Use get_stripe_plan_id_string function to obtain the name of the plan to be created |         :param stripe_plan_id: The id of the Stripe plan to be created. Use get_stripe_plan_id_string function to obtain | ||||||
|  |                                the name of the plan to be created | ||||||
|         :return: The StripePlan object if it exists or if can create a Plan object with Stripe, None otherwise |         :return: The StripePlan object if it exists or if can create a Plan object with Stripe, None otherwise | ||||||
|         """ |         """ | ||||||
|         _amount = float(amount) |         _amount = float(amount) | ||||||
|         amount = int(_amount * 100)  # stripe amount unit, in cents |         amount = int(_amount * 100)  # stripe amount unit, in cents | ||||||
| 
 |         stripe_plan_db_obj = None | ||||||
|         try: |         try: | ||||||
|             stripe_plan_db_obj = StripePlan.objects.get(stripe_plan_id=stripe_plan_id) |             stripe_plan_db_obj = StripePlan.objects.get(stripe_plan_id=stripe_plan_id) | ||||||
|         except StripePlan.DoesNotExist: |         except StripePlan.DoesNotExist: | ||||||
|  | @ -160,8 +161,6 @@ class StripeUtils(object): | ||||||
|                     id=stripe_plan_id) |                     id=stripe_plan_id) | ||||||
|                 if not stripe_plan.get('response_object') and not stripe_plan.get('error'): |                 if not stripe_plan.get('response_object') and not stripe_plan.get('error'): | ||||||
|                     stripe_plan_db_obj = StripePlan.objects.create(stripe_plan_id=stripe_plan_id) |                     stripe_plan_db_obj = StripePlan.objects.create(stripe_plan_id=stripe_plan_id) | ||||||
|                 else: |  | ||||||
|                     stripe_plan_db_obj = None |  | ||||||
|             except stripe.error.InvalidRequestError as e: |             except stripe.error.InvalidRequestError as e: | ||||||
|                 if self.PLAN_ALREADY_EXISTS in str(e): |                 if self.PLAN_ALREADY_EXISTS in str(e): | ||||||
|                     logger.debug(self.PLAN_EXISTS_ERROR_MSG.format(stripe_plan_id)) |                     logger.debug(self.PLAN_EXISTS_ERROR_MSG.format(stripe_plan_id)) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue