Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
scrapper-portabilidad
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Javier
scrapper-portabilidad
Commits
86da9baa
Commit
86da9baa
authored
Feb 04, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Balance
parent
ec4d457e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
add_balance.php
magnus-api/add_balance.php
+24
-0
test.py
notebook/test.py
+20
-0
No files found.
magnus-api/add_balance.php
0 → 100644
View file @
86da9baa
<?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."
);
}
notebook/test.py
0 → 100644
View file @
86da9baa
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'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment