Commit 4cab2441 by Javier

Se agrega Postpago y se corrije error en número al recargar

parent 782a1b01
......@@ -14,7 +14,7 @@ if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]) && isset($argv[4]) &&
'password' => $argv[2] . strval(rand(100, 999)),
'active' => '1',
'firstname' => str_replace("\"", "", strtoupper($argv[3])),
'lastname' => strtoupper($argv[4]),
'lastname' => str_replace("\"", "", strtoupper($argv[4])),
'callingcard_pin' => strval(rand(1000, 9999)),
'id_group' => 3,
'id_plan' => $argv[5],
......
......@@ -17,8 +17,8 @@ DB_CREDENTIALS = {
'host': re.match(r'.*http://([0-9\.]+).*', values['MAGNUS_HOST'], flags=re.DOTALL).group(1),
'user': values['DB_USER'],
'password': values['DB_PASSWORD'],
'port' : 3306,
'database' : 'mbilling'
'port': 3306,
'database': 'mbilling'
}
......@@ -129,7 +129,13 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
password = password if password else ''.join(
(name.split(' ')[0].lower(), str(randint(100, 999))))
_create_user(phone_number, password, name, surname, plan_id, offer_id)
# Eliminamos Espacios entre Elementos
phone_number = phone_number.strip()
name = name.strip()
surname = surname.strip()
# Lanzamos las Acciones del API
_create_user(phone_number.strip(), password, name, surname, plan_id, offer_id)
_create_sip(phone_number, password, pbx)
_create_did(phone_number)
......@@ -139,8 +145,7 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
"UPDATE mbilling.pkg_user SET typepaid=1, creditlimit=30 WHERE username=?",
(phone_number,)
)
cursor.fetchone()
cnx.commit()
return password
......@@ -162,7 +167,7 @@ def add_balance(phone_number: str, quantity: float, tax: float = 0.21, descript
result = subprocess.check_output(
['php', pathlib.Path(mbapi_path, 'add_balance.php'),
phone_number, quantity, f'\"{description}\"']
phone_number.strip(), quantity, f'\"{description}\"']
)
if not re.match(succesful, result.decode('utf-8')):
......@@ -192,6 +197,6 @@ def get_user(phone_number: str) -> dict:
(phone_number,)
)
query = cursor.fetchone()
cnx.commit()
return dict(zip(headers, query)) if query else None
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