Commit d2636220 by Javier

Erratas

parent b1b0e0d7
......@@ -213,43 +213,47 @@ def create_account(account: Account = Depends()):
"""
plan_id, offer_id = encode_rate(account.rate)
# Generación de la Cuenta
try:
password = mbilling.functions.create_user(
phone_number=account.number,
name=account.name,
surname=account.surname,
pbx=account.pbx_address,
plan_id=plan_id,
offer_id=offer_id
)
if not mbilling.functions.get_user(account.number):
plan_id, offer_id = encode_rate(account.rate)
if not account.pbx_address:
response = ConnectionData(
account=account.number, password=password)
else:
response = ConnectionData(
account=account.number,
password=password,
peer_details=f'type = friend username = {account.number} host = 192.168.2.84 nat = force_rport, comedia qualify = yes insecure = invite, port',
user_details='type = friend host = 192.168.2.84 nat = force_rport, comedia qualify = yes insecure = invite, port'
# Generación de la Cuenta
try:
password = mbilling.functions.create_user(
phone_number=account.number,
name=account.name,
surname=account.surname,
pbx=account.pbx_address,
plan_id=plan_id,
offer_id=offer_id
)
# Recarga Inicial de Cuenta
if account.initial_balance > 0.0:
mbilling.functions.add_balance(
account.number, account.initial_balance, description=Refill.INICIAL)
if not account.pbx_address:
response = ConnectionData(
account=account.number, password=password)
else:
response = ConnectionData(
account=account.number,
password=password,
peer_details=f'type = friend username = {account.number} host = 192.168.2.84 nat = force_rport, comedia qualify = yes insecure = invite, port',
user_details='type = friend host = 192.168.2.84 nat = force_rport, comedia qualify = yes insecure = invite, port'
)
# Recarga Inicial de Cuenta
if account.initial_balance > 0.0:
mbilling.functions.add_balance(
account.number, account.initial_balance, description=Refill.INICIAL)
except mbilling.functions.MagnusCommandError as e:
response = JSONResponse(
content={
'error': 'Se ha producido un error en Magnus durante la ejecución del comando.',
'description': str(e),
},
status_code=400
)
except mbilling.functions.MagnusCommandError as e:
response = JSONResponse(
content={
'error': 'Se ha producido un error en Magnus durante la ejecución del comando.',
'description': str(e),
},
status_code=400
)
else:
response = JSONResponse(content={'error' : 'El número ya está registrado en MagnusBilling'}, status_code=409)
return response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment