Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
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 4388594a
authored
May 09, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
web-client.py tambah --conf
1 parent
4d7044d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
19 deletions
.gitignore
CHANGES.txt
contrib/web-client.py
iso8583_web/scripts/forwarder.py
.gitignore
View file @
4388594
...
...
@@ -5,3 +5,4 @@ __pycache__
test-*
test.ini
dist
build
CHANGES.txt
View file @
4388594
0.1.6 2020-04-09
----------------
- web-client.py tambah --conf untuk ISO8583 multi.
0.1.5 2020-04-28
----------------
- read_conf.py tidak lagi mewajibkan setiap modul punya init()
...
...
contrib/web-client.py
View file @
4388594
...
...
@@ -7,7 +7,7 @@ from time import (
time
,
)
from
threading
import
Thread
from
optparse
import
Option
Parser
from
argparse
import
Argument
Parser
headers
=
{
'content-type'
:
'application/json'
}
...
...
@@ -71,19 +71,21 @@ help_amount = 'dibutuhkan saat --method payment dan reversal'
help_ntb
=
'dibutuhkan saat --method payment dan reversal'
help_stan
=
'dibutuhkan saat --method payment dan reversal'
help_bit
=
'bit tambahan, contoh: --bit=42:TOKOPEDIA'
parser
=
OptionParser
()
parser
.
add_option
(
''
,
'--url'
,
default
=
default_url
,
help
=
help_url
)
parser
.
add_option
(
''
,
'--host'
,
default
=
default_host
,
help
=
help_host
)
parser
.
add_option
(
'-c'
,
'--count'
,
type
=
'int'
,
default
=
default_count
,
help
=
help_count
)
parser
.
add_option
(
''
,
'--method'
,
default
=
default_method
,
help
=
help_method
)
parser
.
add_option
(
''
,
'--invoice-id'
,
help
=
help_invoice_id
)
parser
.
add_option
(
''
,
'--amount'
,
type
=
int
,
help
=
help_amount
)
parser
.
add_option
(
''
,
'--ntb'
,
help
=
help_ntb
)
parser
.
add_option
(
''
,
'--stan'
,
help
=
help_stan
)
parser
.
add_option
(
''
,
'--bit'
,
help
=
help_bit
)
option
,
args
=
parser
.
parse_args
(
sys
.
argv
[
1
:])
help_conf
=
'konfigurasi tambahan, contoh untuk multi: --conf=pajak:bphtb'
parser
=
ArgumentParser
()
parser
.
add_argument
(
'--url'
,
default
=
default_url
,
help
=
help_url
)
parser
.
add_argument
(
'--host'
,
default
=
default_host
,
help
=
help_host
)
parser
.
add_argument
(
'--count'
,
type
=
int
,
default
=
default_count
,
help
=
help_count
)
parser
.
add_argument
(
'--method'
,
default
=
default_method
,
help
=
help_method
)
parser
.
add_argument
(
'--invoice-id'
,
help
=
help_invoice_id
)
parser
.
add_argument
(
'--amount'
,
type
=
int
,
help
=
help_amount
)
parser
.
add_argument
(
'--ntb'
,
help
=
help_ntb
)
parser
.
add_argument
(
'--stan'
,
help
=
help_stan
)
parser
.
add_argument
(
'--bit'
,
help
=
help_bit
)
parser
.
add_argument
(
'--conf'
,
help
=
help_conf
)
option
=
parser
.
parse_args
(
sys
.
argv
[
1
:])
url
=
option
.
url
count
=
option
.
count
...
...
@@ -93,7 +95,7 @@ if option.method != 'echo':
if
option
.
method
in
(
'payment'
,
'reversal'
):
required
(
'amount'
)
if
option
.
method
==
'payment'
:
required
(
'ntb'
,
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
m
%
s'
))
required
(
'ntb'
,
datetime
.
now
()
.
strftime
(
'
%
y
%
m
%
d
%
H
%
m
%
s'
))
required
(
'stan'
,
datetime
.
now
()
.
strftime
(
'
%
H
%
M
%
S'
))
else
:
required
(
'ntb'
)
...
...
@@ -104,6 +106,12 @@ if option.method != 'echo':
bit
,
value
=
t
.
split
(
':'
)
bits
[
bit
]
=
value
p
[
'bits'
]
=
bits
if
option
.
conf
:
conf
=
dict
()
for
t
in
option
.
conf
.
split
(
','
):
key
,
val
=
t
.
split
(
':'
)
conf
[
key
]
=
val
p
[
'conf'
]
=
conf
data
=
dict
(
method
=
option
.
method
,
params
=
[
p
],
jsonrpc
=
'2.0'
)
for
i
in
range
(
count
):
...
...
iso8583_web/scripts/forwarder.py
View file @
4388594
...
...
@@ -116,9 +116,6 @@ class CommonConnection(Log):
self
.
log_info
(
'Receive {}'
.
format
([
raw
]))
def
log_send
(
self
,
raw
):
if
isinstance
(
raw
,
bytes
):
raw
=
raw
.
decode
(
'utf-8'
)
raw
=
to_str
(
raw
)
self
.
log_info
(
'Send {}'
.
format
([
raw
]))
def
log_close
(
self
,
reason
):
...
...
@@ -626,7 +623,7 @@ def check_job():
raw
=
iso
.
getRawIso
()
with_header
=
connection
.
raw_for_send
(
raw
)
with_headers
.
append
(
with_header
)
raw
=
''
.
join
(
with_headers
)
raw
=
b
''
.
join
(
with_headers
)
connection
.
just_send
(
raw
)
...
...
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