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
d2636220
Commit
d2636220
authored
Apr 12, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Erratas
parent
b1b0e0d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
33 deletions
+37
-33
main.py
main.py
+37
-33
No files found.
main.py
View file @
d2636220
...
...
@@ -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
,
p
assword
=
password
,
p
eer_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
,
p
bx
=
account
.
pbx_address
,
p
lan_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
...
...
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