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
82d50450
Commit
82d50450
authored
Mar 31, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Función para cambiar método de pago
parent
ef5ce199
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
functions.py
mbilling/functions.py
+11
-7
No files found.
mbilling/functions.py
View file @
82d50450
...
@@ -108,6 +108,16 @@ def _create_did(phone_number: str):
...
@@ -108,6 +108,16 @@ def _create_did(phone_number: str):
if
not
re
.
match
(
succesful
,
result
.
decode
(
'utf-8'
)):
if
not
re
.
match
(
succesful
,
result
.
decode
(
'utf-8'
)):
raise
MagnusCommandError
(
result
.
decode
(
'utf-8'
))
raise
MagnusCommandError
(
result
.
decode
(
'utf-8'
))
def
_update_payment
(
phone_number
:
str
,
postpay
:
bool
=
False
,
credit
:
float
=
0.0
):
with
mariadb
.
connect
(
**
DB_CREDENTIALS
)
as
cnx
:
with
cnx
.
cursor
()
as
cursor
:
cursor
.
execute
(
"UPDATE mbilling.pkg_user SET typepaid=?, creditlimit=? WHERE username=?"
,
(
postpay
,
credit
if
postpay
else
0
,
phone_number
)
)
cnx
.
commit
()
def
create_user
(
phone_number
:
str
,
name
:
str
,
surname
:
str
,
password
:
str
=
None
,
pbx
:
str
=
None
,
plan_id
:
int
=
1
,
offer_id
:
int
=
0
)
->
str
:
def
create_user
(
phone_number
:
str
,
name
:
str
,
surname
:
str
,
password
:
str
=
None
,
pbx
:
str
=
None
,
plan_id
:
int
=
1
,
offer_id
:
int
=
0
)
->
str
:
"""Genera un nuevo usuario en Magnus Billing con una cuenta SIP, un DID para llamadas nacionales
\
"""Genera un nuevo usuario en Magnus Billing con una cuenta SIP, un DID para llamadas nacionales
\
...
@@ -138,14 +148,8 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
...
@@ -138,14 +148,8 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
_create_user
(
phone_number
.
strip
(),
password
,
name
,
surname
,
plan_id
,
offer_id
)
_create_user
(
phone_number
.
strip
(),
password
,
name
,
surname
,
plan_id
,
offer_id
)
_create_sip
(
phone_number
,
password
,
pbx
)
_create_sip
(
phone_number
,
password
,
pbx
)
_create_did
(
phone_number
)
_create_did
(
phone_number
)
_update_payment
(
phone_number
,
offer_id
!=
0
,
30.00
)
with
mariadb
.
connect
(
**
DB_CREDENTIALS
)
as
cnx
:
with
cnx
.
cursor
()
as
cursor
:
cursor
.
execute
(
"UPDATE mbilling.pkg_user SET typepaid=1, creditlimit=30 WHERE username=?"
,
(
phone_number
,)
)
cnx
.
commit
()
return
password
return
password
...
...
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