implement credit card listing

This commit is contained in:
Nico Schottelius 2020-12-28 23:35:34 +01:00
commit e225bf1cc0
12 changed files with 183 additions and 63 deletions

View file

@ -4,9 +4,24 @@ from .models import *
from .selectors import *
from .tasks import *
@transaction.atomic
def create_wireguard_vpn(owner, public_key, network_mask):
# Check if the user has a membership.
#------------------------------------
# If yes, user is eligible for API access and 2 VPNs
# If user already has 2 VPNs, we deduct from the credit
# If deduction is higher than the allowed credit, we fail
#
# Check if the user has suitable balance
# Create order
#
return create_wireguard_vpn_tech(owner, public_key, network_mask)
@transaction.atomic
def create_wireguard_vpn_tech(owner, public_key, network_mask):
pool = get_suitable_pools(network_mask)[0]
count = pool.wireguardvpn_set.count()