Commit 86da9baa by Javier

Balance

parent ec4d457e
<?php
include 'api.php';
// ARGUMENTOS: USUARIO SALDO
if (isset($argv[1]) && isset($argv[2])) {
$result = $magnusBilling->create('refill', [
'id_user' => $magnusBilling->getId('user', 'username', $argv[1]),
'credit' => floatval($argv[2]),
'payment' => 1,
'description' => 'Recarga Saldo'
]);
if ($result['success'] == 1) {
print("[201] OK id=" . $result['rows'][0]['id']);
} else {
print("[409] ERROR Ya existe una cuenta con mismo usuario.");
}
} else {
print("[404] ERROR No se han introducido todos los parámetros necesarios.");
}
import subprocess
from pathlib import Path
mbapi_path = Path('D:\Proyectos\scrapper-portabilidad\magnus-api')
def _add_user_account(phone_number : str, password : str, name : str, surname : str):
result = subprocess.run(['php', Path(mbapi_path, 'create_user.php'), phone_number, password, name, surname])
print(result)
def create_user(phone_number : str, password : str, name : str, surname : str, balance : float = 0.0):
"""Crea a un nuevo usuario en MagnusBilling
"""
_add_user_account(phone_number,password,name,surname)
create_user('856132067', 'test', 'nombre', 'apellido')
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