Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Taufik Yulianto
/
esipkd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3571b142
authored
Feb 26, 2024
by
taufikyu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update rpc callback to pemda
1 parent
75b1cc6e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
18 deletions
esipkd/models/bjb_qris.py
esipkd/models/bjb_va.py
esipkd/models/rpc.py
esipkd/views/bjb_qris.py
esipkd/views/bjb_va.py
esipkd/views/rpc.py
esipkd/models/bjb_qris.py
View file @
3571b14
...
...
@@ -67,7 +67,7 @@ class BJBQRIS(KodeModel, Base):
## 10 = PDL
## 30 = WEBR
## 90 = PERIZINAN
description
=
Column
(
String
(
128
)
)
description
=
Column
(
Text
)
customer_name
=
Column
(
String
(
64
))
customer_email
=
Column
(
String
(
128
))
customer_phone
=
Column
(
String
(
32
))
...
...
esipkd/models/bjb_va.py
View file @
3571b14
...
...
@@ -68,7 +68,7 @@ class BJBVA(KodeModel, Base):
## 10 = PDL
## 30 = WEBR
## 90 = PERIZINAN
description
=
Column
(
String
(
128
)
)
description
=
Column
(
Text
)
customer_name
=
Column
(
String
(
64
))
customer_email
=
Column
(
String
(
128
))
customer_phone
=
Column
(
String
(
32
))
...
...
esipkd/models/rpc.py
View file @
3571b14
...
...
@@ -289,9 +289,17 @@ def custom_error(code, message):
raise
cls
def
get_mandatory
(
data
,
values
):
for
value
in
values
:
if
not
value
in
data
or
data
[
value
]
==
''
or
data
[
value
]
==
None
:
raise
JsonRpcInvalidDataError
(
message
=
"{} Not Found"
.
format
(
value
))
if
isinstance
(
values
,
list
):
for
value
in
values
:
if
not
value
in
data
or
data
[
value
]
==
''
or
data
[
value
]
==
None
:
raise
JsonRpcInvalidDataError
(
message
=
"{} Not Found"
.
format
(
value
))
elif
isinstance
(
values
,
dict
):
for
k
,
v
in
values
.
items
():
if
v
:
if
len
(
str
(
data
[
k
]))
>
v
:
raise
JsonRpcInvalidDataError
(
message
=
"{} error, max character {}"
.
format
(
k
,
v
)
)
def
get_seconds
():
begin_unix_time
=
datetime
(
1970
,
1
,
1
)
...
...
esipkd/views/bjb_qris.py
View file @
3571b14
...
...
@@ -485,7 +485,7 @@ def callback(request, data):
sleep
(
1
)
auth_from_rpc
(
request
)
log
.
error
(
'
REQUEST
BJBQRIS'
)
log
.
error
(
'
CALLBACK
BJBQRIS'
)
log
.
error
(
data
)
get_va
=
BJBQRIS
.
query
()
.
filter
(
BJBQRIS
.
va_number
==
data
[
'va_number'
],
...
...
@@ -575,7 +575,7 @@ def calculate_tagihan(values):
def
sendrpc
(
request
,
kd_bayar
):
settings
=
get_settings
()
request
=
self
.
req
headers
=
{
'Content-Type'
:
'application/json'
}
if
not
'pemdaqris_url'
in
settings
and
not
settings
[
'pemdaqris_url'
]:
log
.
error
(
'pemdaqris_url belum ada di settings'
)
return
...
...
@@ -588,11 +588,9 @@ def sendrpc(request, kd_bayar):
try
:
resp
=
requests
.
post
(
url
=
url
,
data
=
dict
(
kd_bayar
=
kd_bayar
),
headers
=
headers
,
verify
=
verify
)
datarsp
=
json
.
loads
(
resp
.
content
)
if
not
'result'
in
datarsp
or
datarsp
[
'result'
]
!=
"true"
:
log
.
error
(
'Error : {}'
.
format
(
datarsp
))
return
log
.
info
(
'Response RPC CALLBACK PEMDA : {}'
.
format
(
resp
.
content
))
return
True
except
requests
.
exceptions
.
RequestException
as
err
:
log
.
error
(
'Gagal membuat koneksi, silakan coba lagi beberapa saat'
)
...
...
esipkd/views/bjb_va.py
View file @
3571b14
...
...
@@ -568,7 +568,7 @@ def callback(request, data):
sleep
(
1
)
auth_from_rpc
(
request
)
log
.
error
(
'
REQUEST
BJBVA'
)
log
.
error
(
'
CALLBACK
BJBVA'
)
log
.
error
(
data
)
get_va
=
BJBVA
.
query
()
.
filter
(
BJBVA
.
va_number
==
data
[
'va_number'
],
...
...
@@ -670,7 +670,7 @@ def calculate_tagihan(values):
def
sendrpc
(
request
,
kd_bayar
):
settings
=
get_settings
()
request
=
self
.
req
headers
=
{
'Content-Type'
:
'application/json'
}
if
not
'pemdava_url'
in
settings
and
not
settings
[
'pemdava_url'
]:
log
.
error
(
'pemdava_url belum ada di settings'
)
return
...
...
@@ -682,12 +682,10 @@ def sendrpc(request, kd_bayar):
verify
=
True
try
:
resp
=
requests
.
post
(
url
=
url
,
data
=
dict
(
kd_bayar
=
kd_bayar
),
data
=
dict
(
kd_bayar
=
kd_bayar
),
headers
=
headers
,
verify
=
verify
)
datarsp
=
json
.
loads
(
resp
.
content
)
if
not
'result'
in
datarsp
or
datarsp
[
'result'
]
!=
"true"
:
log
.
error
(
'Error : {}'
.
format
(
datarsp
))
return
log
.
info
(
'Response RPC CALLBACK PEMDA : {}'
.
format
(
resp
.
content
))
return
True
except
requests
.
exceptions
.
RequestException
as
err
:
log
.
error
(
'Gagal membuat koneksi, silakan coba lagi beberapa saat'
)
...
...
esipkd/views/rpc.py
View file @
3571b14
...
...
@@ -289,6 +289,15 @@ def create_qris(request, data):
sleep
(
1
)
auth_from_rpc
(
request
)
get_mandatory
(
data
,
[
'kd_bayar'
,
'unit_kode'
])
params
=
dict
(
product_code
=
2
,
invoice_no
=
16
,
description
=
''
,
customer_name
=
64
,
customer_email
=
128
,
customer_phone
=
32
,
)
get_mandatory
(
data
,
params
)
log
.
error
(
'CREATE QRIS BJBQRIS'
)
log
.
error
(
data
)
...
...
@@ -383,6 +392,15 @@ def create_va(request, data):
sleep
(
1
)
auth_from_rpc
(
request
)
get_mandatory
(
data
,
[
'kd_bayar'
,
'unit_kode'
])
params
=
dict
(
product_code
=
2
,
invoice_no
=
16
,
description
=
''
,
customer_name
=
64
,
customer_email
=
128
,
customer_phone
=
32
,
)
get_mandatory
(
data
,
params
)
log
.
error
(
'CREATE VA BJBVA'
)
log
.
error
(
data
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment