Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
iso8583
/
bjb-samsat-banten
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9b371100
authored
Apr 05, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
aagusti
1 parent
298b9bad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
42 deletions
opensipkd/iso8583/bjb/samsat/banten/test_info.py
setup.py
opensipkd/iso8583/bjb/samsat/banten/test_info.py
View file @
9b37110
...
...
@@ -9,14 +9,10 @@ from iso8583_web.read_conf import read_conf, name_conf, ip_conf
from
.doc
import
Doc
from
.job
import
Job
def
main
(
argv
=
sys
.
argv
):
# Blok Utama #
##############
global
conf
conf_file
=
os
.
path
.
join
(
'conf'
,
'forwarder.py'
)
host_name
=
'bjb'
def
get_option
(
argv
):
bank_id
=
'110'
log_dir
=
'logs'
method
=
'get_
tagihan
'
method
=
'get_
kd_bayar
'
host
=
'bjb'
no_rangka
=
""
no_ktp
=
""
...
...
@@ -24,6 +20,7 @@ def main(argv=sys.argv):
amount
=
0
pars
=
OptionParser
()
pars
.
add_option
(
'-p'
,
'--no-pol'
)
pars
.
add_option
(
'-b'
,
'--bank-id'
,
default
=
bank_id
,
help
=
'diisi 3 digit kode bank'
)
pars
.
add_option
(
'-r'
,
'--no-rangka'
,
default
=
no_rangka
,
help
=
'diisi 5 digit no rangka'
)
pars
.
add_option
(
'-k'
,
'--no-ktp'
,
default
=
no_ktp
,
help
=
'diisi dengan no identitas'
)
pars
.
add_option
(
'-a'
,
'--amount'
,
default
=
amount
,
help
=
'diisi nilai pembayaran'
)
...
...
@@ -32,69 +29,111 @@ def main(argv=sys.argv):
pars
.
add_option
(
'-i'
,
'--invoice'
,
default
=
no_invoice
,
help
=
'no tagihan'
)
pars
.
add_option
(
'-m'
,
'--method'
,
default
=
method
,
help
=
'default '
+
method
)
option
,
remain
=
pars
.
parse_args
(
argv
[
1
:])
return
option
conf_file
=
os
.
path
.
realpath
(
option
.
conf_file
)
# print(conf_file)
conf
=
imp
.
load_source
(
'conf'
,
conf_file
)
method
=
option
.
method
host
=
option
.
host
no_pol
=
option
.
no_pol
no_rangka
=
option
.
no_rangka
no_ktp
=
option
.
no_ktp
no_invoice
=
option
.
invoice
amount
=
option
.
amount
from
iso8583_web.read_conf
import
(
read_conf
,
get_str
,
name_conf
)
class
TestInfo
(
object
):
def
__init__
(
self
,
argv
,
conf
):
option
=
get_option
(
argv
)
if
not
option
:
return
self
.
host
=
option
.
host
self
.
method
=
option
.
method
self
.
kd_bank
=
option
.
bank_id
self
.
no_pol
=
option
.
no_pol
self
.
no_rangka
=
option
.
no_rangka
self
.
no_ktp
=
option
.
no_ktp
self
.
no_invoice
=
option
.
invoice
self
.
amount
=
option
.
amount
self
.
kd_channel
=
'6010'
self
.
conf
=
name_conf
[
self
.
host
]
self
.
kd_biller
=
'00000'
self
.
kd_produk
=
'5'
read_conf
(
conf_file
)
_host
=
conf
.
host
job
=
Job
(
conf
=
ip_conf
[
''
])
rpc
=
_host
[
host
][
'samsat_banten'
]
def
run
(
self
):
kd_bank
=
'110'
,
kd_biller
=
'0000'
kd_produk
=
'5'
kini
=
datetime
.
now
()
tgl_transaksi
=
kini
.
strftime
(
"
%
Y
%
m
%
d"
)
jam_transaksi
=
kini
.
strftime
(
"
%
H
%
M
%
S"
)
message
=
dict
(
kd_bank
=
conf
.
host
[
host
][
'id'
]
,
kd_biller
=
rpc
[
'kd_biller'
]
,
kd_channel
=
'6010'
,
kd_produk
=
rpc
[
'kd_produk'
]
,
message
=
dict
(
kd_bank
=
self
.
kd_bank
,
kd_biller
=
self
.
kd_biller
,
kd_channel
=
self
.
kd_channel
,
kd_produk
=
self
.
kd_produk
,
)
if
method
==
'get_tagihan'
:
message
.
update
(
dict
(
no_polisi
=
no_pol
))
elif
method
==
'get_kd_bayar'
:
if
self
.
method
==
'get_tagihan'
:
message
.
update
(
dict
(
no_polisi
=
self
.
no_pol
))
elif
self
.
method
==
'get_kd_bayar'
:
message
.
update
(
dict
(
no_polisi
=
no_pol
,
no_identitas
=
no_ktp
,
no_rangka
=
no_rangka
dict
(
no_polisi
=
self
.
no_pol
,
no_identitas
=
self
.
no_ktp
,
no_rangka
=
self
.
no_rangka
)
)
elif
method
==
'inquiry'
:
elif
self
.
method
==
'inquiry'
:
message
.
update
(
dict
(
invoice_no
=
no_invoice
invoice_no
=
self
.
no_invoice
)
)
elif
method
==
'payment'
:
elif
self
.
method
==
'payment'
:
message
.
update
(
dict
(
invoice_no
=
no_invoice
,
invoice_no
=
self
.
no_invoice
,
ntb
=
'12345BHJJJK'
,
amount
=
int
(
amount
),
amount
=
int
(
self
.
amount
),
tgl_transaksi
=
tgl_transaksi
,
jam_transaksi
=
jam_transaksi
,
)
)
elif
method
==
'reversal'
:
elif
self
.
method
==
'reversal'
:
message
.
update
(
dict
(
invoice_no
=
no_invoice
,
invoice_no
=
self
.
no_invoice
,
ntb
=
'12345BHJJJK'
,
amount
=
int
(
amount
),
amount
=
int
(
self
.
amount
),
tgl_transaksi
=
tgl_transaksi
,
jam_transaksi
=
jam_transaksi
,
ntp
=
'1993797040'
)
)
doc
=
Doc
(
conf
=
self
.
conf
)
rows
=
doc
.
send_rpc
(
self
.
method
,
message
)
# rpc = conf.rpc
rows
=
send_rpc
(
rpc
[
'user'
],
rpc
[
'key'
],
rpc
[
'url'
],
method
,
message
)
# print(rpc['user'], rpc['key'], rpc['url'], method, message)
from
iso8583_web.read_conf
import
(
read_conf
,
get_str
,
name_conf
)
import
logging
from
pyramid.paster
import
setup_logging
from
iso8583_web.scripts.forwarder
import
logs
try
:
from
configparser
import
(
ConfigParser
,
NoOptionError
,
)
except
ImportError
:
from
ConfigParser
import
(
ConfigParser
,
NoOptionError
,
)
def
main
(
argv
=
sys
.
argv
):
option
=
get_option
(
argv
)
conf_file
=
os
.
path
.
realpath
(
option
.
conf_file
)
read_conf
(
conf_file
)
setup_logging
(
conf_file
)
log
=
logging
.
getLogger
(
__file__
)
logs
.
append
(
log
)
conf
=
ConfigParser
()
conf
.
read
(
conf_file
)
localization
=
get_str
(
conf
,
'main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
locale
.
setlocale
(
locale
.
LC_ALL
,
localization
)
test
=
TestInfo
(
argv
,
conf
)
test
.
run
()
setup.py
View file @
9b37110
...
...
@@ -36,6 +36,8 @@ setup(
entry_points
=
{
'console_scripts'
:
[
'initialize_bjb_samsat_db = opensipkd.iso8583.bjb.samsat.scripts.initialize_db:main'
,
'test-info-samsat-banten = opensipkd.iso8583.bjb.samsat.banten.test_info:main'
,
]
}
)
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