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 ce14575c
authored
Sep 19, 2023
by
taufikyu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaiki rpc, qris, va
1 parent
67f9d846
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
esipkd/models/bjb_qris.py
esipkd/models/bjb_va.py
esipkd/views/rpc.py
esipkd/models/bjb_qris.py
View file @
ce14575
...
...
@@ -153,13 +153,15 @@ class BJBQRIS(KodeModel, Base):
def
send_rpc
(
parameter
,
method
,
data
):
headers
=
json_rpc_header
(
parameter
[
'bjbqris_user'
],
parameter
[
'bjbqris_key'
])
params
=
get_jsonrpc
(
method
,
dict
(
data
=
data
))
log
.
error
(
"REQ TO QRIS"
)
log
.
error
(
json
.
dumps
(
params
))
try
:
resp
=
requests
.
post
(
url
=
parameter
[
'bjbqris_url'
],
data
=
json
.
dumps
(
params
),
headers
=
headers
)
try
:
datava
=
json
.
loads
(
resp
.
content
)
log
.
error
(
"RESPONSE FROM
VA
"
)
log
.
error
(
"RESPONSE FROM
QRIS
"
)
log
.
error
(
resp
.
text
)
if
'error'
in
datava
:
log
.
error
(
resp
.
content
)
...
...
esipkd/models/bjb_va.py
View file @
ce14575
...
...
@@ -210,6 +210,8 @@ class BJBVA(KodeModel, Base):
def
send_rpc
(
parameter
,
method
,
data
):
headers
=
json_rpc_header
(
parameter
[
'bjbva_user'
],
parameter
[
'bjbva_key'
])
params
=
get_jsonrpc
(
method
,
dict
(
data
=
data
))
log
.
error
(
"REQ TO VA"
)
log
.
error
(
json
.
dumps
(
params
))
try
:
resp
=
requests
.
post
(
url
=
parameter
[
'bjbva_url'
],
data
=
json
.
dumps
(
params
),
...
...
esipkd/views/rpc.py
View file @
ce14575
...
...
@@ -22,6 +22,7 @@ from .bjb_qris import (BJBQRIS, cekqris, calculate_tagihan, rpc_params as rpc_qr
from
.bjb_va
import
(
BJBVA
,
cekva
,
calculate_tagihan
,
rpc_params
as
rpc_va
)
import
logging
log
=
logging
.
getLogger
(
'RPC ESIPKD'
)
from
time
import
sleep
###########################################################################
...
...
@@ -284,6 +285,7 @@ def create_qris(request, data):
:return:
-
"""
sleep
(
0.75
)
auth_from_rpc
(
request
)
get_mandatory
(
data
,
[
'kd_bayar'
,
'unit_kode'
])
...
...
@@ -328,9 +330,9 @@ def create_qris(request, data):
pokok
,
denda
=
calculate_tagihan
(
dict
(
pokok
=
row
.
jumlah
,
jatuh_tempo
=
row
.
jatuh_tempo
))
if
row
.
jatuh_tempo
<
date
.
today
():
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
date
.
today
(),
time
(
23
,
5
9
,
59
)))
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
date
.
today
(),
time
(
23
,
5
5
,
00
)))
else
:
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
row
.
jatuh_tempo
,
time
(
23
,
5
9
,
59
)))
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
row
.
jatuh_tempo
,
time
(
23
,
5
5
,
00
)))
expired_date
=
jatuh_tempo
dt_qris
=
dict
(
client_type
=
"3"
,
...
...
@@ -366,6 +368,7 @@ def create_va(request, data):
:return:
-
"""
sleep
(
0.75
)
auth_from_rpc
(
request
)
get_mandatory
(
data
,
[
'kd_bayar'
,
'unit_kode'
])
...
...
@@ -410,9 +413,9 @@ def create_va(request, data):
pokok
,
denda
=
calculate_tagihan
(
dict
(
pokok
=
row
.
jumlah
,
jatuh_tempo
=
row
.
jatuh_tempo
))
if
row
.
jatuh_tempo
<
date
.
today
():
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
date
.
today
(),
time
(
23
,
5
9
,
59
)))
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
date
.
today
(),
time
(
23
,
5
5
,
00
)))
else
:
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
row
.
jatuh_tempo
,
time
(
23
,
5
9
,
59
)))
jatuh_tempo
=
ymdhms
(
datetime
.
combine
(
row
.
jatuh_tempo
,
time
(
23
,
5
5
,
00
)))
expired_date
=
jatuh_tempo
dt_va
=
dict
(
client_type
=
"3"
,
...
...
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