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 ab930151
authored
Sep 14, 2020
by
vm.dev
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Update from VM Dev
1 parent
65a70ae2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
iso8583_web/scripts/views/sambat/__init__.py
iso8583_web/scripts/views/sambat/structure.py
iso8583_web/scripts/views/sambat/__init__.py
View file @
ab93015
...
@@ -159,7 +159,7 @@ class View(BaseView):
...
@@ -159,7 +159,7 @@ class View(BaseView):
# conn = self.get_connection()
# conn = self.get_connection()
method
=
get_method
(
data
)
method
=
get_method
(
data
)
# iso_func = getattr(conn.job, method)
# iso_func = getattr(conn.job, method)
iso_req
=
Transaksi
(
p
,
method
,
inq
,
pay
)
iso_req
=
Transaksi
(
p
,
method
,
inq
,
pay
,
conf
)
row
=
self
.
before_send_iso
(
data
,
inq
,
pay
,
iso_req
)
row
=
self
.
before_send_iso
(
data
,
inq
,
pay
,
iso_req
)
iso_req
.
send
()
iso_req
.
send
()
if
type
(
iso_req
.
response
)
!=
dict
:
if
type
(
iso_req
.
response
)
!=
dict
:
...
...
iso8583_web/scripts/views/sambat/structure.py
View file @
ab93015
# import colander
# import colander
# from opensipkd.string.row import Row
# from opensipkd.string.row import Row
# from .exceptions import InternalError
# from .exceptions import InternalError
import
json
from
iso8583_web.scripts.logger
import
(
from
iso8583_web.scripts.logger
import
(
log_web_info
,
log_web_info
,
log_web_debug
)
log_web_debug
)
...
@@ -70,20 +71,29 @@ PAY_REQ = \
...
@@ -70,20 +71,29 @@ PAY_REQ = \
}
}
def
send_data
(
json_data
):
def
send_data
(
json_data
,
conf
):
settings
=
get_settings
()
#
settings = get_settings()
pload
=
{
'username'
:
'olivia'
,
'password'
:
'123'
}
#
pload = {'username': 'olivia', 'password': '123'}
bjb_sam
bat_url
=
"bjb_sambat_url"
in
settings
and
settings
[
"bjb_sambat
_url"
]
or
\
bjb_sam
_url
=
"bjb_sam_url"
in
conf
and
conf
[
"bjb_sam
_url"
]
or
\
"http://localhost:7001/bjb/sambat/test"
"http://localhost:7001/bjb/sambat/test"
data
=
json_data
data
=
json_data
# todo butuh server buat testing json sementara pake static response
# todo butuh server buat testing json sementara pake static response
if
json_data
[
"processingCode"
]
==
'321000'
:
if
json_data
[
"processingCode"
]
==
'321000'
:
return
INQ_RESP
bjb_sam_url
+=
"/inquiryPaymentRest"
# return INQ_RESP
elif
json_data
[
"processingCode"
]
==
'521000'
:
elif
json_data
[
"processingCode"
]
==
'521000'
:
return
PAY_RESP
bjb_sam_url
+=
"/paymentRest"
# return PAY_RESP
r
=
requests
.
post
(
bjb_sambat_url
,
data
=
data
)
#data=json.dumps(data)
log_web_info
(
data
)
r
=
requests
.
post
(
bjb_sam_url
,
json
=
data
)
if
r
:
log_web_info
(
r
.
text
)
#log_web_info(r.code)
log_web_info
(
r
.
json
)
if
r
.
text
:
if
r
.
text
:
try
:
try
:
return
r
.
json
()
return
r
.
json
()
...
@@ -94,8 +104,9 @@ def send_data(json_data):
...
@@ -94,8 +104,9 @@ def send_data(json_data):
class
Transaksi
(
object
):
class
Transaksi
(
object
):
def
__init__
(
self
,
p
,
method
,
inq
,
pay
):
def
__init__
(
self
,
p
,
method
,
inq
,
pay
,
conf
):
self
.
settings
=
get_settings
()
self
.
settings
=
get_settings
()
self
.
conf
=
conf
self
.
response
=
None
self
.
response
=
None
if
method
==
"reversal"
:
# data Payment ada (berarti reversal)
if
method
==
"reversal"
:
# data Payment ada (berarti reversal)
self
.
mti
=
"0400"
self
.
mti
=
"0400"
...
@@ -121,22 +132,23 @@ class Transaksi(object):
...
@@ -121,22 +132,23 @@ class Transaksi(object):
else
:
else
:
self
.
mti
=
"0200"
self
.
mti
=
"0200"
self
.
data
=
INQ_REQ
.
copy
()
self
.
data
=
INQ_REQ
.
copy
()
self
.
data
[
"caCode"
]
=
"ca_code"
in
self
.
settings
and
self
.
settings
[
"ca_code"
]
or
"1234"
#self.data["systemTraceAuditNumber"] = "880977"
self
.
data
[
"caCode"
]
=
"ca_code"
in
conf
and
conf
[
"ca_code"
]
or
"123456"
self
.
data
[
"processingCode"
]
=
"321000"
self
.
data
[
"processingCode"
]
=
"321000"
self
.
data
[
"billInformation"
][
"bills"
][
0
][
"info"
]
=
p
[
"invoice_id"
]
self
.
data
[
"billInformation"
][
"bills"
][
0
][
"info"
]
=
p
[
"invoice_id"
]
self
.
set_local_time
()
self
.
set_local_time
()
def
set_local_time
(
self
):
def
set_local_time
(
self
):
time
=
datetime
.
now
()
time
=
datetime
.
now
()
self
.
data
[
"timeLocalTransaction"
]
=
time
.
strftime
(
"
%
H
Hmiss
"
)
self
.
data
[
"timeLocalTransaction"
]
=
time
.
strftime
(
"
%
H
%
M
%
S
"
)
self
.
data
[
"localTransactionDate"
]
=
time
.
strftime
(
"
%
MMDD
"
)
self
.
data
[
"localTransactionDate"
]
=
time
.
strftime
(
"
%
m
%
d
"
)
self
.
data
[
"transmissionDateTime"
]
=
time
.
strftime
(
"
%
MMDDHHmiss
"
)
self
.
data
[
"transmissionDateTime"
]
=
time
.
strftime
(
"
%
m
%
d
%
H
%
M
%
S
"
)
def
get_stan
(
self
):
def
get_stan
(
self
):
return
self
.
data
[
"systemTraceAuditNumber"
]
return
self
.
data
[
"systemTraceAuditNumber"
]
def
send
(
self
):
def
send
(
self
):
self
.
response
=
send_data
(
self
.
data
)
self
.
response
=
send_data
(
self
.
data
,
self
.
conf
)
self
.
mti
=
self
.
mti
==
"0200"
and
"0210"
or
"0410"
self
.
mti
=
self
.
mti
==
"0200"
and
"0210"
or
"0410"
INVOICE_PROFILE
=
[
INVOICE_PROFILE
=
[
...
...
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