Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Kunto
/
backoffice
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 5ea334cd
authored
Jul 22, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
vsi_pln_post
1 parent
ec4e3f1b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
81 deletions
log.txt
src/agratek/api/merchant/views/vendor.py
src/agratek/api/merchant/views/vsi.py
src/agratek/api/merchant/views/vsi_pln_post.py
log.txt
View file @
5ea334c
22 July 2019Test Install
20 JanuaryChange Project Structure
+opensipkd
+--api
+--views
+--models
+--reports
+--tools
+--statics
+--scripts
15-Nov Pemindahan Departemen dan Partner dari Core ke opensipkd
5-november-2018
Penambahan fungsi request._host
src/agratek/api/merchant/views/vendor.py
View file @
5ea334c
...
...
@@ -107,6 +107,12 @@ class AddSchema(colander.Schema):
oid
=
"trx_id"
,
# widget=widget.HiddenWidget()
)
ref_no
=
colander
.
SchemaNode
(
colander
.
Integer
(),
title
=
'REF. NO'
,
missing
=
colander
.
drop
,
oid
=
"ref_no"
,
# widget=widget.HiddenWidget()
)
result
=
colander
.
SchemaNode
(
colander
.
String
(),
title
=
'Result'
,
...
...
@@ -214,6 +220,7 @@ $(document).ready(function(){
$(".tanggal").datepicker({format:"dd-mm-yyyy"});
$(".tanggal").attr("readonly", true);
$("#trx_id").attr("readonly", true);
$("#ref_no").attr("readonly", true);
$("#result").attr("readonly", true);
...
...
@@ -224,6 +231,7 @@ form_params_view = dict(scripts="""
$(document).ready(function(){
$("#nip_penerima, #nopel").attr("readonly", true);
$("#trx_id").attr("readonly", true);
$("#ref_no").attr("readonly", true);
$("#result").attr("readonly", true);
});
"""
)
...
...
@@ -259,8 +267,8 @@ class ViewHome(BaseView):
return
dict
(
form
=
form
,
params
=
form_params_edit
)
values
=
dict
(
c
.
items
())
if
'trx_id'
not
in
values
or
not
values
[
'trx_id'
]:
values
[
'trx_id'
]
=
get_random_number
(
10
)
#
if 'trx_id' not in values or not values['trx_id']:
#
values['trx_id'] = get_random_number(10)
result
=
[]
if
'inquiry'
in
request
.
POST
:
result
=
build_request
(
'inquiry'
,
values
)
...
...
@@ -279,9 +287,10 @@ class ViewHome(BaseView):
if
result
and
'error'
in
result
:
session
.
flash
(
result
[
'error'
],
'error'
)
if
result
:
else
:
values
[
'result'
]
=
json
.
dumps
(
result
,
indent
=
4
)
values
[
'ref_no'
]
=
'ref_no'
in
result
and
result
[
"ref_no"
]
or
None
values
[
'trx_id'
]
=
'trx_id'
in
result
and
result
[
'trx_id'
]
or
None
form
.
render
(
values
)
return
dict
(
form
=
form
,
params
=
form_params_view
)
...
...
@@ -380,6 +389,8 @@ def api_vendor_notify(request):
# from pyramid_xmlrpc import XMLRPCView, xmlrpc_response
import
logging
log
=
logging
.
getLogger
(
__name__
)
@view_config
(
route_name
=
'api-vendor-test'
,
renderer
=
"string"
)
def
vendor_test
(
request
):
...
...
@@ -387,65 +398,11 @@ def vendor_test(request):
vendor
=
request
.
matchdict
[
'vendor'
]
result
=
dict
(
a
=
1
)
request
.
response
.
content_type
=
"text / xml"
if
vendor
==
'vsi'
:
cid
=
params
[
'cid'
]
dt
=
params
[
'dt'
]
hc
=
params
[
'hc'
]
modul
=
params
[
'modul'
]
command
=
params
[
'command'
]
trxid
=
params
[
'trxid'
]
resp
=
params
[
'resp'
]
if
modul
==
"ISI"
:
tujuan
=
params
[
'tujuan'
]
voucherid
=
params
[
'voucherid'
]
if
command
==
"INQ"
:
result
=
dict
(
root
=
dict
(
status
=
"SUCCESS"
,
rc
=
"0000"
,
rcm
=
"0000"
,
text
=
"[0] Cek Tagihan Sukses ke: 628523123789 "
,
refnum
=
"DB3DC0A2539419F8C50000000000000"
,
voucherid
=
voucherid
,
destnum
=
tujuan
,
nominal
=
5000
))
elif
command
==
"PAY"
:
result
=
dict
(
root
=
dict
(
status
=
"SUCCESS"
,
rc
=
"0000"
,
rcm
=
"0000"
,
text
=
"[0] Cek Tagihan Sukses ke: 628523123789 "
,
refnum
=
"DB3DC0A2539419F8C50000000000000"
,
voucherid
=
voucherid
,
destnum
=
tujuan
,
nominal
=
5000
))
elif
command
==
"ADV"
:
pass
elif
modul
==
"pln"
:
tujuan
=
params
[
'idpel'
]
voucherid
=
params
[
'voucherid'
]
if
command
==
"INQ"
:
result
=
dict
(
root
=
dict
(
status
=
"SUCCESS"
,
rc
=
"0000"
,
rcm
=
"0000"
,
text
=
"[0] Cek Tagihan Sukses ke: 628523123789 "
,
refnum
=
"DB3DC0A2539419F8C50000000000000"
,
destnum
=
tujuan
,
nominal
=
5000
))
elif
command
==
"PAY"
:
result
=
dict
(
root
=
dict
(
status
=
"SUCCESS"
,
rc
=
"0000"
,
rcm
=
"0000"
,
text
=
"[0] Cek Tagihan Sukses ke: 628523123789 "
,
refnum
=
"DB3DC0A2539419F8C50000000000000"
,
destnum
=
tujuan
,
nominal
=
5000
))
elif
command
==
"ADV"
:
pass
if
vendor
==
"vsi"
:
controls
=
request
.
GET
.
items
()
params
=
dict
(
controls
)
params
[
"status"
]
=
"SUCCESS"
result
=
dict
(
root
=
params
)
xml
=
xmltodict
.
unparse
(
result
)
return
xml
src/agratek/api/merchant/views/vsi.py
View file @
5ea334c
...
...
@@ -37,7 +37,7 @@ class Vendor(VendorClass):
return
self
.
auth
def
get_params
(
self
,
cmd
,
msn
=
None
,
idpel
=
None
,
modul
=
None
):
tanggal
=
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
%
M
%
S'
)
tanggal
=
datetime
.
now
()
.
strftime
(
'
%
Y
%
m
%
d
%
H
%
M
%
S'
)
params
=
dict
(
cid
=
self
.
mid
,
dt
=
tanggal
,
...
...
src/agratek/api/merchant/views/vsi_pln_post.py
View file @
5ea334c
...
...
@@ -85,7 +85,9 @@ class Vendor(VendorClass):
if
result
.
ok
:
data
=
xmltodict
.
parse
(
result
.
text
)[
"root"
]
else
:
data
=
dict
(
error
=
result
.
status_code
)
data
=
dict
(
error
=
result
.
text
,
code
=
result
.
status_code
)
self
.
response
=
data
self
.
save_log
(
'inquiry'
,
row
)
if
"status"
in
data
and
data
[
"status"
]
and
data
[
"status"
]
==
"SUCCESS"
:
...
...
@@ -102,6 +104,7 @@ class Vendor(VendorClass):
"tarif"
:
"tarif"
in
data
and
data
[
"tarif"
]
or
""
,
}
elif
"status"
in
data
and
data
[
"status"
]
and
data
[
"status"
]
==
"ERROR"
:
#todo: apakah data akan dimapping errornya?
data
=
dict
(
error
=
data
[
"rcm"
],
code
=
data
[
"rc"
])
...
...
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