Using refactored get_vm_price and get_vm_plan_name functions
This commit is contained in:
parent
285d664660
commit
99e5cf5587
3 changed files with 20 additions and 20 deletions
|
@ -12,6 +12,7 @@ from datacenterlight.models import VMTemplate
|
||||||
from datacenterlight.tasks import create_vm_task
|
from datacenterlight.tasks import create_vm_task
|
||||||
from membership.models import StripeCustomer
|
from membership.models import StripeCustomer
|
||||||
from opennebula_api.serializers import VMTemplateSerializer
|
from opennebula_api.serializers import VMTemplateSerializer
|
||||||
|
from utils.hosting_utils import get_vm_price
|
||||||
from utils.models import BillingAddress
|
from utils.models import BillingAddress
|
||||||
from utils.stripe_utils import StripeUtils
|
from utils.stripe_utils import StripeUtils
|
||||||
|
|
||||||
|
@ -94,12 +95,11 @@ class CeleryTaskTestCase(TestCase):
|
||||||
cpu = specs.get('cpu')
|
cpu = specs.get('cpu')
|
||||||
memory = specs.get('memory')
|
memory = specs.get('memory')
|
||||||
disk_size = specs.get('disk_size')
|
disk_size = specs.get('disk_size')
|
||||||
amount_to_be_charged = (cpu * 5) + (memory * 2) + (disk_size * 0.6)
|
amount_to_be_charged = get_vm_price(cpu=cpu, memory=memory,
|
||||||
plan_name = "{cpu} Cores, {memory} GB RAM, {disk_size} GB SSD".format(
|
disk_size=disk_size)
|
||||||
cpu=cpu,
|
plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu,
|
||||||
memory=memory,
|
memory=memory,
|
||||||
disk_size=disk_size)
|
disk_size=disk_size)
|
||||||
|
|
||||||
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
|
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
|
||||||
ram=memory,
|
ram=memory,
|
||||||
ssd=disk_size,
|
ssd=disk_size,
|
||||||
|
|
|
@ -17,6 +17,7 @@ from opennebula_api.models import OpenNebulaManager
|
||||||
from opennebula_api.serializers import VirtualMachineTemplateSerializer, \
|
from opennebula_api.serializers import VirtualMachineTemplateSerializer, \
|
||||||
VMTemplateSerializer
|
VMTemplateSerializer
|
||||||
from utils.forms import BillingAddressForm
|
from utils.forms import BillingAddressForm
|
||||||
|
from utils.hosting_utils import get_vm_price
|
||||||
from utils.mailer import BaseEmail
|
from utils.mailer import BaseEmail
|
||||||
from utils.stripe_utils import StripeUtils
|
from utils.stripe_utils import StripeUtils
|
||||||
from utils.tasks import send_plain_email_task
|
from utils.tasks import send_plain_email_task
|
||||||
|
@ -532,12 +533,11 @@ class OrderConfirmationView(DetailView):
|
||||||
cpu = specs.get('cpu')
|
cpu = specs.get('cpu')
|
||||||
memory = specs.get('memory')
|
memory = specs.get('memory')
|
||||||
disk_size = specs.get('disk_size')
|
disk_size = specs.get('disk_size')
|
||||||
amount_to_be_charged = (cpu * 5) + (memory * 2) + (disk_size * 0.6)
|
amount_to_be_charged = get_vm_price(cpu=cpu, memory=memory,
|
||||||
plan_name = "{cpu} Cores, {memory} GB RAM, {disk_size} GB SSD".format(
|
disk_size=disk_size)
|
||||||
cpu=cpu,
|
plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu,
|
||||||
memory=memory,
|
memory=memory,
|
||||||
disk_size=disk_size)
|
disk_size=disk_size)
|
||||||
|
|
||||||
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
|
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
|
||||||
ram=memory,
|
ram=memory,
|
||||||
ssd=disk_size,
|
ssd=disk_size,
|
||||||
|
|
|
@ -35,6 +35,7 @@ from utils.mailer import BaseEmail
|
||||||
from utils.stripe_utils import StripeUtils
|
from utils.stripe_utils import StripeUtils
|
||||||
from utils.views import PasswordResetViewMixin, PasswordResetConfirmViewMixin, \
|
from utils.views import PasswordResetViewMixin, PasswordResetConfirmViewMixin, \
|
||||||
LoginViewMixin
|
LoginViewMixin
|
||||||
|
from utils.hosting_utils import get_vm_price
|
||||||
from .forms import HostingUserSignupForm, HostingUserLoginForm, \
|
from .forms import HostingUserSignupForm, HostingUserLoginForm, \
|
||||||
UserHostingKeyForm, generate_ssh_key_name
|
UserHostingKeyForm, generate_ssh_key_name
|
||||||
from .mixins import ProcessVMSelectionMixin
|
from .mixins import ProcessVMSelectionMixin
|
||||||
|
@ -724,12 +725,11 @@ class OrdersHostingDetailView(LoginRequiredMixin,
|
||||||
cpu = specs.get('cpu')
|
cpu = specs.get('cpu')
|
||||||
memory = specs.get('memory')
|
memory = specs.get('memory')
|
||||||
disk_size = specs.get('disk_size')
|
disk_size = specs.get('disk_size')
|
||||||
amount_to_be_charged = (cpu * 5) + (memory * 2) + (disk_size * 0.6)
|
amount_to_be_charged = get_vm_price(cpu=cpu, memory=memory,
|
||||||
plan_name = "{cpu} Cores, {memory} GB RAM, {disk_size} GB SSD".format(
|
disk_size=disk_size)
|
||||||
cpu=cpu,
|
plan_name = StripeUtils.get_stripe_plan_name(cpu=cpu,
|
||||||
memory=memory,
|
memory=memory,
|
||||||
disk_size=disk_size)
|
disk_size=disk_size)
|
||||||
|
|
||||||
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
|
stripe_plan_id = StripeUtils.get_stripe_plan_id(cpu=cpu,
|
||||||
ram=memory,
|
ram=memory,
|
||||||
ssd=disk_size,
|
ssd=disk_size,
|
||||||
|
|
Loading…
Reference in a new issue