Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-iso8583
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 f7a845f9
authored
Sep 24, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Bug fixed streamer pos
1 parent
ac93356a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
51 deletions
CHANGES.txt
opensipkd/iso8583/doc.py
opensipkd/iso8583/network/doc.py
opensipkd/iso8583/network/job.py
opensipkd/streamer/pos.py
opensipkd/tcp/connection.py
CHANGES.txt
View file @
f7a845f
0.1.7 2020-09-24
----------------
- Bug fixed streamer pos (untuk PT POS) terkait Python 3
0.1.6 2020-06-24
0.1.6 2020-06-24
----------------
----------------
- Perubahan rumus StanGenerator
- Perubahan rumus StanGenerator
...
...
opensipkd/iso8583/doc.py
View file @
f7a845f
...
@@ -15,13 +15,17 @@ class BaseISO8583(ISO8583):
...
@@ -15,13 +15,17 @@ class BaseISO8583(ISO8583):
value
=
"
%
s"
%
value
value
=
"
%
s"
%
value
if
len
(
value
)
>
self
.
getBitLimit
(
bit
):
if
len
(
value
)
>
self
.
getBitLimit
(
bit
):
value
=
value
[
0
:
self
.
getBitLimit
(
bit
)]
value
=
value
[
0
:
self
.
getBitLimit
(
bit
)]
raise
ValueTooLarge
(
'Error: value up to size! Bit[
%
s] of type
%
s limit size =
%
s'
%
(
raise
ValueTooLarge
(
'Error: value up to size! Bit[
%
s] of type
%
s '
'limit size =
%
s'
%
(
bit
,
self
.
getBitType
(
bit
),
self
.
getBitLimit
(
bit
)))
bit
,
self
.
getBitType
(
bit
),
self
.
getBitLimit
(
bit
)))
data_form
=
self
.
getBitFormat
(
bit
)
data_form
=
self
.
getBitFormat
(
bit
)
if
data_form
==
"A"
:
if
data_form
==
"A"
:
self
.
BITMAP_VALUES
[
bit
]
=
value
.
ljust
(
self
.
getBitLimit
(
bit
))
.
encode
()
self
.
BITMAP_VALUES
[
bit
]
=
value
.
ljust
(
self
.
getBitLimit
(
bit
))
.
\
encode
()
elif
data_form
==
"E"
:
elif
data_form
==
"E"
:
self
.
BITMAP_VALUES
[
bit
]
=
value
.
zfill
(
self
.
getBitLimit
(
bit
))
.
encode
(
'cp1148'
)
self
.
BITMAP_VALUES
[
bit
]
=
value
.
zfill
(
self
.
getBitLimit
(
bit
))
.
\
encode
(
'cp1148'
)
def
redefineBit
(
self
,
bit
,
short_name
,
long_name
,
type_
,
size
,
valueType
):
def
redefineBit
(
self
,
bit
,
short_name
,
long_name
,
type_
,
size
,
valueType
):
if
type_
in
(
'LL'
,
'LLL'
):
if
type_
in
(
'LL'
,
'LLL'
):
...
@@ -33,15 +37,6 @@ class BaseISO8583(ISO8583):
...
@@ -33,15 +37,6 @@ class BaseISO8583(ISO8583):
self
,
bit
,
short_name
,
long_name
,
type_
,
LenForm
,
size
,
self
,
bit
,
short_name
,
long_name
,
type_
,
LenForm
,
size
,
valueType
,
format_
)
valueType
,
format_
)
#def getRawIso(self):
# raw = ISO8583.getRawIso(self)
# if isinstance(raw, bytes):
# raw = raw.decode('utf-8')
# return raw.upper()
#def setIsoContent(self, raw):
# ISO8583.setIsoContent(self, raw.encode('utf-8'))
def
get_bit_definition
(
self
):
def
get_bit_definition
(
self
):
return
{}
return
{}
...
...
opensipkd/iso8583/network/doc.py
View file @
f7a845f
...
@@ -131,13 +131,11 @@ class Doc(BaseISO8583):
...
@@ -131,13 +131,11 @@ class Doc(BaseISO8583):
# Override, please
# Override, please
def
copy_inquiry_bits
(
self
):
def
copy_inquiry_bits
(
self
):
#self.copy([2, 3, 11])
pass
pass
# Override, please
# Override, please
def
copy_payment_bits
(
self
):
def
copy_payment_bits
(
self
):
self
.
copy_inquiry_bits
()
self
.
copy_inquiry_bits
()
#self.copy([4, 48]) # amount, NTB
def
set_transaction_request
(
self
):
def
set_transaction_request
(
self
):
self
.
setMTI
(
'0200'
)
self
.
setMTI
(
'0200'
)
...
...
opensipkd/iso8583/network/job.py
View file @
f7a845f
...
@@ -50,7 +50,7 @@ class Job:
...
@@ -50,7 +50,7 @@ class Job:
iso
=
self
.
create_iso
(
from_iso
=
from_iso
)
iso
=
self
.
create_iso
(
from_iso
=
from_iso
)
try
:
try
:
iso
.
process
()
iso
.
process
()
except
:
except
Exception
:
with
StringIO
()
as
f
:
with
StringIO
()
as
f
:
traceback
.
print_exc
(
file
=
f
)
traceback
.
print_exc
(
file
=
f
)
iso
.
ack_other
(
f
.
getvalue
())
iso
.
ack_other
(
f
.
getvalue
())
...
...
opensipkd/streamer/pos.py
View file @
f7a845f
from
.
import
Streamer
as
BaseStreamer
from
.mitracomm
import
Streamer
as
BaseStreamer
# 2 byte pertama size
# Dalam 1 request bisa saja ada 2 transaksi, bahkan
# bisa saja string transaksi yang belum lengkap
class
Streamer
(
BaseStreamer
):
class
Streamer
(
BaseStreamer
):
def
get_size
(
self
,
raw
):
def
get_size
(
self
,
raw
):
# Override
a
,
b
=
raw
a
,
b
=
raw
a
=
ord
(
a
)
b
=
b
*
256
b
=
ord
(
b
)
*
256
return
b
+
a
return
a
+
b
# Override Stremer.get
def
get
(
self
,
raw
):
if
self
.
size
:
size
=
self
.
size
-
len
(
self
.
raw
)
else
:
raw
=
self
.
raw
+
raw
if
len
(
raw
)
<
2
:
self
.
raw
=
raw
return
size
=
self
.
size
=
self
.
get_size
(
raw
[:
2
])
self
.
raw
=
b
''
raw
=
raw
[
2
:]
self
.
raw
+=
raw
[:
size
]
if
len
(
self
.
raw
)
==
self
.
size
:
raw_iso
=
self
.
raw
self
.
size
=
0
self
.
raw
=
raw
[
size
:]
# Sisa
return
raw_iso
self
.
raw
+=
raw
[
size
:]
# Override Stremer.set
def
set
(
self
,
raw
):
# Override
def
set
(
self
,
raw
):
size
=
len
(
raw
)
size
=
len
(
raw
)
a
=
size
%
256
b
=
size
%
256
b
=
size
/
256
a
=
int
(
size
/
256
)
header
=
bytes
([
a
])
+
bytes
([
b
])
header
=
bytes
([
b
])
+
bytes
([
a
])
return
header
+
raw
return
header
+
raw
opensipkd/tcp/connection.py
View file @
f7a845f
...
@@ -137,8 +137,7 @@ class Connection:
...
@@ -137,8 +137,7 @@ class Connection:
class
ConnectionManager
:
class
ConnectionManager
:
def
__init__
(
self
):
def
__init__
(
self
):
# Kumpulan class Connection
self
.
conns
=
[]
# Kumpulan class Connection
self
.
conns
=
[]
def
count
(
self
,
ip_port
):
def
count
(
self
,
ip_port
):
count
=
0
count
=
0
...
...
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