Merge tag '2.10.2' into branch-2.10.3b
Introduce base price for VMs and let admins add stripe_coupon_id
This commit is contained in:
		
				commit
				
					
						580960548e
					
				
			
		
					 12 changed files with 62 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -678,9 +678,9 @@ class OrderConfirmationView(DetailView, FormView):
 | 
			
		|||
                vm_specs["vat_percent"] = vat_percent
 | 
			
		||||
                vm_specs["vat_validation_status"] = request.session["vat_validation_status"] if "vat_validation_status" in request.session else ""
 | 
			
		||||
            vm_specs["vat_country"] = user_vat_country
 | 
			
		||||
            vm_specs["price_with_vat"] = round_up(price * (1 + vm_specs["vat_percent"] * 0.01), 2)
 | 
			
		||||
            vm_specs["price_after_discount"] = round_up(price - discount['amount'], 2)
 | 
			
		||||
            vm_specs["price_after_discount_with_vat"] = round_up((price - discount['amount']) * (1 + vm_specs["vat_percent"] * 0.01), 2)
 | 
			
		||||
            vm_specs["price_with_vat"] = round(price * (1 + vm_specs["vat_percent"] * 0.01), 2)
 | 
			
		||||
            vm_specs["price_after_discount"] = round(price - discount['amount'], 2)
 | 
			
		||||
            vm_specs["price_after_discount_with_vat"] = round((price - discount['amount']) * (1 + vm_specs["vat_percent"] * 0.01), 2)
 | 
			
		||||
            discount["amount_with_vat"] = round(vm_specs["price_with_vat"] - vm_specs["price_after_discount_with_vat"], 2)
 | 
			
		||||
            vm_specs["total_price"] = vm_specs["price_after_discount_with_vat"]
 | 
			
		||||
            vm_specs["discount"] = discount
 | 
			
		||||
| 
						 | 
				
			
			@ -933,11 +933,11 @@ class OrderConfirmationView(DetailView, FormView):
 | 
			
		|||
            subscription_result = stripe_utils.subscribe_customer_to_plan(
 | 
			
		||||
                stripe_api_cus_id,
 | 
			
		||||
                [{"plan": stripe_plan.get('response_object').stripe_plan_id}],
 | 
			
		||||
                coupon='ipv6-discount-8chf' if (
 | 
			
		||||
                    'name' in discount and
 | 
			
		||||
                    discount['name'] is not None and
 | 
			
		||||
                    'ipv6' in discount['name'].lower()
 | 
			
		||||
                ) else "",
 | 
			
		||||
                coupon=(discount['stripe_coupon_id']
 | 
			
		||||
                    if 'name' in discount and
 | 
			
		||||
                       'ipv6' in discount['name'].lower() and
 | 
			
		||||
                       discount['stripe_coupon_id']
 | 
			
		||||
                    else ""),
 | 
			
		||||
                tax_rates=[stripe_tax_rate.tax_rate_id] if stripe_tax_rate else [],
 | 
			
		||||
            )
 | 
			
		||||
            stripe_subscription_obj = subscription_result.get('response_object')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue