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 280ee07e
authored
Aug 28, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Penyesuaian LinkAja dimana tahun bisa saja di field msg
1 parent
93329a02
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
5 deletions
CHANGES.txt
iso8583-aggregator.ini
iso8583_web/scripts/views/linkaja/__init__.py
iso8583_web/scripts/web_client_linkaja.py
CHANGES.txt
View file @
280ee07
0.3.2 2020-08-27
----------------
- Penyesuaian linkaja dimana tahun bisa saja di msg.
0.3.1 2020-08-19
----------------
- Bug fixed web service saat ISO8583 offline
...
...
iso8583-aggregator.ini
View file @
280ee07
...
...
@@ -71,5 +71,9 @@ request_bits =
43:AGRATEK-LINKAJA
49:360
59:PAY
60:123
63:214
# Bit 60 diisi sesuai prefix bit 61 (Invoice ID)
bit_60
=
3271:123
3676:142
3275:120
iso8583_web/scripts/views/linkaja/__init__.py
View file @
280ee07
...
...
@@ -160,6 +160,28 @@ class csv_method(object):
return
wrapped
def
profile2name
(
profile
):
msg
=
[
profile
[
'Nama'
]
.
strip
()]
fields
=
[(
'Tagihan'
,
'Pok'
),
(
'Denda'
,
'Den'
),
(
'Discount'
,
'Disk'
)]
for
field
,
label
in
fields
:
s
=
profile
[
field
]
.
strip
()
.
lstrip
(
'0'
)
if
s
:
msg
.
append
(
f
'{label} {s}'
)
fields
=
[
'Nama Kelurahan'
,
'Nama Kecamatan'
,
'Lokasi'
]
for
field
in
fields
:
s
=
profile
[
field
]
.
strip
()
if
s
:
msg
.
append
(
s
)
return
', '
.
join
(
msg
)
def
get_ok_notify
(
data
):
for
key
in
conf
[
'notification_message'
]:
if
data
[
'acc_no'
]
.
find
(
key
)
==
0
:
return
conf
[
'notification_message'
][
key
]
return
''
class
View
(
BaseView
):
def
get_web_job_cls
(
self
):
# Override
return
WebJob
...
...
@@ -229,14 +251,14 @@ class View(BaseView):
web_data
=
get_template_response
(
data
)
if
iso_data
[
39
]
==
'00'
:
web_data
[
'Response Code'
]
=
'00'
web_data
[
'Notification Message'
]
=
get_ok_notify
(
data
)
if
is_inquiry
(
data
):
web_data
[
'Bill Ref'
]
=
str
(
row
.
id
)
if
iso_data
.
get
(
62
):
profile
=
FixLength
(
INVOICE_PROFILE
)
profile
.
set_raw
(
iso_data
[
62
])
iso_log
.
bit_062_data
=
profile
.
to_dict
()
web_data
[
'Biller Name'
]
=
row
.
biller_name
=
\
profile
[
'Nama'
]
.
strip
()
web_data
[
'Biller Name'
]
=
row
.
biller_name
=
profile2name
(
profile
)
web_data
[
'Bill Amount'
]
=
iso_data
[
4
]
.
lstrip
(
'0'
)
if
iso_data
.
get
(
47
):
web_data
[
'Transaction ID'
]
=
row
.
ntp
=
iso_data
[
47
]
# NTP
...
...
@@ -266,7 +288,10 @@ class View(BaseView):
return
web_data
def
get_response
(
self
,
data
):
p
=
dict
(
invoice_id
=
data
[
'acc_no'
])
invoice_id
=
data
[
'acc_no'
]
if
len
(
invoice_id
)
==
18
:
invoice_id
+=
data
[
'msg'
]
p
=
dict
(
invoice_id
=
invoice_id
)
inq
=
pay
=
None
if
not
is_inquiry
(
data
):
p
[
'amount'
]
=
data
[
'amount'
]
...
...
@@ -350,6 +375,17 @@ def init(cfg):
conf
.
update
(
cfg
)
def
str2dict
(
s
):
r
=
dict
()
for
token
in
s
.
split
(
'
\n
'
):
s
=
token
.
strip
()
if
not
s
:
continue
key
,
value
=
s
.
split
(
':'
)
r
[
key
]
=
value
return
r
# Dipanggil forwarder.py
def
pyramid_init
(
config
):
config
.
add_renderer
(
RENDERER
,
'iso8583_web.scripts.views.linkaja.Renderer'
)
...
...
@@ -362,3 +398,4 @@ def pyramid_init(config):
session_factory
=
sessionmaker
(
bind
=
engine
)
conf
[
'db_session'
]
=
scoped_session
(
session_factory
)
register
(
conf
[
'db_session'
])
conf
[
'notification_message'
]
=
str2dict
(
conf
[
'notification_message'
])
iso8583_web/scripts/web_client_linkaja.py
View file @
280ee07
...
...
@@ -71,6 +71,7 @@ def get_option(argv):
parser
.
add_argument
(
'--terminal'
,
default
=
default_terminal
)
parser
.
add_argument
(
'--pwd'
,
default
=
default_pwd
)
parser
.
add_argument
(
'--msisdn'
,
default
=
default_msisdn
)
parser
.
add_argument
(
'--msg'
,
default
=
''
)
return
parser
.
parse_args
(
argv
)
...
...
@@ -199,7 +200,8 @@ class App:
pwd
=
self
.
option
.
pwd
,
msisdn
=
self
.
option
.
msisdn
,
acc_no
=
self
.
option
.
invoice_id
,
trx_date
=
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
))
trx_date
=
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
),
msg
=
self
.
option
.
msg
)
p
[
'trx_type'
]
=
self
.
get_method
()
if
self
.
option
.
payment
or
self
.
option
.
reversal
:
required
(
'amount'
)
...
...
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