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 6a9c70e9
authored
Jul 24, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
pars odeo
1 parent
9795dd6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
src/agratek/api/merchant/views/odeo.py
src/agratek/api/merchant/views/vendor.py
src/agratek/api/merchant/views/odeo.py
View file @
6a9c70e
...
...
@@ -68,6 +68,7 @@ class Vendor(VendorClass):
except
:
content
=
resp
.
text
self
.
status
=
1
if
resp
.
ok
:
result
=
content
else
:
...
...
@@ -96,7 +97,9 @@ class Vendor(VendorClass):
if
resp
.
ok
:
result
=
content
self
.
status
=
1
else
:
self
.
status
=
-
1
result
=
dict
(
code
=
resp
.
status_code
,
message
=
resp
.
text
)
...
...
@@ -130,27 +133,38 @@ class Vendor(VendorClass):
content
=
resp
.
text
if
resp
.
ok
:
self
.
status
=
1
# sukses
result
=
json
.
loads
(
content
)
else
:
self
.
status
=
-
1
result
=
dict
(
code
=
resp
.
status_code
,
message
=
resp
.
text
)
data
=
'data'
in
result
and
result
[
'data'
]
or
None
if
data
:
self
.
vend_trx
=
'order_id'
in
data
and
data
[
'order_id'
]
\
or
self
.
vend_trx
self
.
response
=
content
parsd
=
self
.
pars_data
(
result
)
self
.
save_log
(
'advice'
)
return
self
.
pars_data
(
result
)
return
parsd
def
pars_data
(
self
,
data
):
def
pars_data
(
self
,
params
):
result
=
{}
result
[
"trx_id"
]
=
self
.
partner_log_id
result
[
"bill_no"
]
=
self
.
bill_no
result
[
"cust_trx"
]
=
self
.
cust_trx
data
=
"data"
in
data
and
data
[
"data"
]
or
None
data
=
'data'
in
params
and
params
[
'data'
]
or
None
if
not
data
:
return
result
if
data
:
self
.
vend_trx
=
'order_id'
in
data
and
data
[
'order_id'
]
\
or
self
.
partner_log_id
if
"rc"
in
data
:
if
data
[
"rc"
]
==
"13"
:
self
.
status
=
-
1
elif
data
[
"rc"
]
==
"68"
:
self
.
status
=
0
#pending
elif
data
[
"rc"
]
==
"67"
:
self
.
status
=
-
2
# Gagal Karena Pernah Transaksi
if
"order_id"
in
data
:
result
[
"vend_trx"
]
=
data
[
"order_id"
]
or
self
.
partner_log_id
...
...
src/agratek/api/merchant/views/vendor.py
View file @
6a9c70e
...
...
@@ -352,6 +352,7 @@ class VendorClass(object):
self
.
partner_log_id
=
row
and
row
.
id
or
None
self
.
v_produk_kd
=
vendor_produk
.
kode
self
.
kategori
=
vendor_produk
.
produk
.
kategori
.
nama
self
.
status
=
0
def
save_log
(
self
,
typ
):
# if not self.partner_log:
...
...
@@ -362,6 +363,7 @@ class VendorClass(object):
row
.
customer_id
=
self
.
customer_id
row
.
cust_trx
=
self
.
cust_trx
row
.
vend_trx
=
self
.
vend_trx
row
.
status
=
self
.
status
if
typ
==
'inquiry'
:
row
.
inquiry
=
dict
(
request
=
self
.
request
,
response
=
self
.
response
)
...
...
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