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 712ba00c
authored
Sep 20, 2023
by
taufikyu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update callback ke pemda qris dan va
1 parent
aa74fbc3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
esipkd/views/bjb_qris.py
esipkd/views/bjb_va.py
esipkd/views/bjb_qris.py
View file @
712ba00
...
@@ -503,6 +503,8 @@ def callback(request, data):
...
@@ -503,6 +503,8 @@ def callback(request, data):
try
:
try
:
DBSession
.
add
(
get_va
)
DBSession
.
add
(
get_va
)
DBSession
.
flush
()
DBSession
.
flush
()
if
not
sendrpc
(
request
,
get_va
.
invoice_no
):
return
return
render_to_response
(
'json'
,
return
render_to_response
(
'json'
,
dict
(
response_code
=
'0000'
,
response_message
=
'Success'
))
dict
(
response_code
=
'0000'
,
response_message
=
'Success'
))
except
:
except
:
...
@@ -549,3 +551,29 @@ def calculate_tagihan(values):
...
@@ -549,3 +551,29 @@ def calculate_tagihan(values):
pokok
=
int
(
values
[
'pokok'
])
pokok
=
int
(
values
[
'pokok'
])
denda
=
hitung_bunga
(
pokok
,
values
[
'jatuh_tempo'
])
denda
=
hitung_bunga
(
pokok
,
values
[
'jatuh_tempo'
])
return
pokok
,
denda
return
pokok
,
denda
def
sendrpc
(
request
,
kd_bayar
):
settings
=
get_settings
()
request
=
self
.
req
if
not
'pemdaqris_url'
in
settings
and
not
settings
[
'pemdaqris_url'
]:
log
.
error
(
'pemdaqris_url belum ada di settings'
)
return
url
=
settings
[
'pemdaqris_url'
]
if
request
.
devel
:
verify
=
False
else
:
verify
=
True
try
:
resp
=
requests
.
post
(
url
=
url
,
data
=
dict
(
kd_bayar
=
kd_bayar
),
verify
=
verify
)
datarsp
=
json
.
loads
(
resp
.
content
)
if
not
'result'
in
datarsp
or
datarsp
[
'result'
]
!=
"true"
:
log
.
error
(
'Error : {}'
.
format
(
datarsp
))
return
return
True
except
requests
.
exceptions
.
RequestException
as
err
:
log
.
error
(
'Gagal membuat koneksi, silakan coba lagi beberapa saat'
)
return
esipkd/views/bjb_va.py
View file @
712ba00
...
@@ -586,6 +586,8 @@ def callback(request, data):
...
@@ -586,6 +586,8 @@ def callback(request, data):
try
:
try
:
DBSession
.
add
(
get_va
)
DBSession
.
add
(
get_va
)
DBSession
.
flush
()
DBSession
.
flush
()
if
not
sendrpc
(
request
,
get_va
.
invoice_no
):
return
return
render_to_response
(
'json'
,
return
render_to_response
(
'json'
,
dict
(
response_code
=
'0000'
,
response_message
=
'Success'
))
dict
(
response_code
=
'0000'
,
response_message
=
'Success'
))
except
:
except
:
...
@@ -645,3 +647,29 @@ def calculate_tagihan(values):
...
@@ -645,3 +647,29 @@ def calculate_tagihan(values):
pokok
=
int
(
values
[
'pokok'
])
pokok
=
int
(
values
[
'pokok'
])
denda
=
hitung_bunga
(
pokok
,
values
[
'jatuh_tempo'
])
denda
=
hitung_bunga
(
pokok
,
values
[
'jatuh_tempo'
])
return
pokok
,
denda
return
pokok
,
denda
def
sendrpc
(
request
,
kd_bayar
):
settings
=
get_settings
()
request
=
self
.
req
if
not
'pemdava_url'
in
settings
and
not
settings
[
'pemdava_url'
]:
log
.
error
(
'pemdava_url belum ada di settings'
)
return
url
=
settings
[
'pemdava_url'
]
if
request
.
devel
:
verify
=
False
else
:
verify
=
True
try
:
resp
=
requests
.
post
(
url
=
url
,
data
=
dict
(
kd_bayar
=
kd_bayar
),
verify
=
verify
)
datarsp
=
json
.
loads
(
resp
.
content
)
if
not
'result'
in
datarsp
or
datarsp
[
'result'
]
!=
"true"
:
log
.
error
(
'Error : {}'
.
format
(
datarsp
))
return
return
True
except
requests
.
exceptions
.
RequestException
as
err
:
log
.
error
(
'Gagal membuat koneksi, silakan coba lagi beberapa saat'
)
return
\ No newline at end of file
\ No newline at end of file
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