Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
iso8583
/
iso8583-web
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 e638f9f0
authored
Apr 18, 2019
by
root
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://git.opensipkd.com:8088/iso8583/iso8583-web
2 parents
0161e1d3
daa43e10
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
27 deletions
contrib/iso8583.init
iso8583_web/read_conf.py
iso8583_web/scripts/forwarder.py
iso8583_web/scripts/test_inquiry.py
iso8583_web/scripts/test_payment.py
iso8583_web/scripts/test_reversal.py
contrib/iso8583.init
0 → 100755
View file @
e638f9f
#!/bin/sh
### BEGIN INIT INFO
# Provides: iso8583-bjb-bphtb
# Required-Start: cron
# Required-Stop: cron
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ISO 8583 Forwarder BJB BPHTB
# Description: BJB BPHTB ISO 8583 Forwarder
### END INIT INFO
BIN
=
"/home/bphtb/bin/start"
PID
=
"/home/bphtb/tmp/iso8583-bphtb.pid"
DESC
=
"ISO8583 Forwarder BPHTB BJB"
USER
=
"bphtb"
GROUP
=
"bphtb"
CONF
=
"/home/bphtb/bjb-bphtb/production.ini"
# /home/samsat-banten/iso8583-web/env/bin/iso8583 \
# /home/samsat-banten/iso8583-web/iso8583.ini \
# $@
. /lib/lsb/init-functions
killtree
()
{
local
_pid
=
$1
local
_sig
=
${
2
-TERM
}
for
_child
in
$(
ps -o pid --no-headers --ppid
${
_pid
})
;
do
killtree
${
_child
}
${
_sig
}
done
kill
-
${
_sig
}
${
_pid
}
}
case
$1
in
start
)
log_begin_msg
"Starting
$DESC
"
[
-z
`
cat
$PID
2>/dev/null
`
]
&&
\
/sbin/start-stop-daemon --start --chuid
"
$USER
:
$GROUP
"
--background
\
--make-pidfile
$PID
--pidfile
$PID
--exec
$BIN
||
true
log_end_msg
$?
;;
stop
)
log_begin_msg
"Stopping
$DESC
PID
$(
cat
$PID
)
"
[
-z
`
cat
$PID
2>/dev/null
`
]
||
\
while
test
-d /proc/
$(
cat
$PID
)
;
do
killtree
$(
cat
$PID
)
15
sleep 0.5
done
[
-z
`
cat
$PID
2>/dev/null
`
]
||
rm
$PID
log_end_msg
$?
;;
status
)
status_of_proc -p
$PID
""
$DESC
&&
exit
0
||
exit
$?
;;
restart
)
$0
stop
sleep 3
$0
start
;;
*
)
echo
"Usage:
$0
{start|stop|restart|status}"
esac
exit
0
iso8583_web/read_conf.py
View file @
e638f9f
...
...
@@ -115,6 +115,7 @@ def read_conf(conf_file):
cfg
[
'module'
]
=
get_str
(
conf
,
section
,
'module'
,
'opensipkd.iso8583.network'
)
cfg
[
'module_obj'
]
=
get_module_object
(
cfg
[
'module'
])
cfg
[
'module_conf'
]
=
modules
cfg
[
'ip'
]
=
conf
.
get
(
section
,
'ip'
)
cfg
[
'port'
]
=
conf
.
getint
(
section
,
'port'
)
cfg
[
'listen'
]
=
get_boolean
(
conf
,
section
,
'listen'
,
True
)
...
...
@@ -130,3 +131,5 @@ def read_conf(conf_file):
allowed_ips
.
append
(
ip
)
# print(cfg)
ip_conf
[
ip_port
]
=
name_conf
[
name
]
=
dict
(
cfg
)
return
conf
iso8583_web/scripts/forwarder.py
View file @
e638f9f
...
...
@@ -612,21 +612,12 @@ except ImportError:
NoOptionError
,
)
def
get_db
(
conf_file
):
conf
=
ConfigParser
()
conf
.
read
(
conf_file
)
if
'main'
not
in
conf
.
sections
():
def
get_db
(
conf
):
if
'app:main'
not
in
conf
.
sections
():
return
#settings = conf.sections()
#print settings, settings['main']
#if 'sqlalchemy.url' not in settings:
# log_message('SQL URL Not Foune')
# return
pool_size
=
get_int
(
conf
,
'main'
,
'pool_size'
,
5
)
max_overflow
=
get_int
(
conf
,
'main'
,
'max_overflow'
,
10
)
url
=
get_str
(
conf
,
'main'
,
'sqlalchemy.url'
,
None
)
pool_size
=
get_int
(
conf
,
'app:main'
,
'pool_size'
,
5
)
max_overflow
=
get_int
(
conf
,
'app:main'
,
'max_overflow'
,
10
)
url
=
get_str
(
conf
,
'app:main'
,
'sqlalchemy.url'
,
None
)
if
not
url
:
return
...
...
@@ -636,15 +627,22 @@ def get_db(conf_file):
DBSession
.
configure
(
bind
=
engine
)
Base
.
metadata
.
bind
=
engine
# session_factory = session_factory_from_settings(settings)
modules
=
get_str
(
conf
,
'app:main'
,
'modules'
,
None
)
if
modules
:
from
importlib
import
import_module
for
module
in
modules
.
split
(
','
):
m
=
import_module
(
'.'
,
module
)
cfg
=
dict
(
conf
.
items
(
'module'
))
m
.
main
(
None
,
**
cfg
)
def
main
(
argv
=
sys
.
argv
):
if
len
(
argv
)
!=
2
:
usage
(
argv
)
config_uri
=
argv
[
1
]
setup_logging
(
config_uri
)
read_conf
(
config_uri
)
get_db
(
config_uri
)
conf
=
read_conf
(
config_uri
)
get_db
(
conf
)
log
=
logging
.
getLogger
(
__file__
)
logs
.
append
(
log
)
running
.
append
(
True
)
...
...
iso8583_web/scripts/test_inquiry.py
View file @
e638f9f
...
...
@@ -8,7 +8,7 @@ from pyramid.paster import setup_logging
# import importlib
# import imp
# from .iso8583_forwarder import conf
from
.forwarder
import
logs
from
.forwarder
import
logs
,
get_db
try
:
from
configparser
import
(
ConfigParser
,
...
...
@@ -34,10 +34,11 @@ def main(argv=sys.argv):
pars
.
add_option
(
'-i'
,
'--invoice-id'
)
pars
.
add_option
(
'-b'
,
'--bank-id'
,
default
=
'001'
,
help
=
'default Bank Indonesia'
)
option
,
remain
=
pars
.
parse_args
(
argv
[
1
:])
conf_file
=
os
.
path
.
realpath
(
option
.
conf_file
)
conf_file
=
os
.
path
.
realpath
(
option
.
conf_file
)
conf
=
read_conf
(
conf_file
)
get_db
(
conf
)
read_conf
(
conf_file
)
setup_logging
(
conf_file
)
log
=
logging
.
getLogger
(
__file__
)
logs
.
append
(
log
)
...
...
@@ -45,7 +46,7 @@ def main(argv=sys.argv):
conf
=
ConfigParser
()
conf
.
read
(
conf_file
)
localization
=
get_str
(
conf
,
'main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
localization
=
get_str
(
conf
,
'
app:
main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
locale
.
setlocale
(
locale
.
LC_ALL
,
localization
)
module_name
=
'main'
...
...
iso8583_web/scripts/test_payment.py
View file @
e638f9f
...
...
@@ -48,8 +48,8 @@ def main(argv=sys.argv):
conf_file
=
os
.
path
.
realpath
(
option
.
conf_file
)
read_conf
(
conf_file
)
get_db
(
conf
_file
)
conf
=
read_conf
(
conf_file
)
get_db
(
conf
)
setup_logging
(
conf_file
)
log
=
logging
.
getLogger
(
__file__
)
logs
.
append
(
log
)
...
...
@@ -57,7 +57,7 @@ def main(argv=sys.argv):
conf
=
ConfigParser
()
conf
.
read
(
conf_file
)
localization
=
get_str
(
conf
,
'main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
localization
=
get_str
(
conf
,
'
app:
main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
locale
.
setlocale
(
locale
.
LC_ALL
,
localization
)
module_name
=
'main'
...
...
iso8583_web/scripts/test_reversal.py
View file @
e638f9f
...
...
@@ -55,13 +55,14 @@ def main(argv=sys.argv):
pars
.
add_option
(
'-o'
,
'--host'
,
default
=
host_name
,
help
=
'default '
+
host_name
)
pars
.
add_option
(
'-i'
,
'--invoice-id'
)
pars
.
add_option
(
'-b'
,
'--bank-id'
,
default
=
'001'
,
help
=
'default Bank Indonesia'
)
pars
.
add_option
(
''
,
'--query'
,
action
=
'store_true'
)
option
,
remain
=
pars
.
parse_args
(
argv
[
1
:])
conf_file
=
os
.
path
.
realpath
(
option
.
conf_file
)
read_conf
(
conf_file
)
get_db
(
conf
_file
)
conf
=
read_conf
(
conf_file
)
get_db
(
conf
)
setup_logging
(
conf_file
)
log
=
logging
.
getLogger
(
__file__
)
logs
.
append
(
log
)
...
...
@@ -69,7 +70,7 @@ def main(argv=sys.argv):
conf
=
ConfigParser
()
conf
.
read
(
conf_file
)
localization
=
get_str
(
conf
,
'main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
localization
=
get_str
(
conf
,
'
app:
main'
,
'localization'
,
default
=
'id_ID.UTF-8'
)
locale
.
setlocale
(
locale
.
LC_ALL
,
localization
)
module_name
=
'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