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 fbfac186
authored
Jul 22, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
odeo
1 parent
377ad8ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
17 deletions
src/agratek/api/merchant/views/odeoo.py → src/agratek/api/merchant/views/odeo.py
src/agratek/api/merchant/views/vendor.py
src/agratek/api/merchant/views/odeo
o
.py
→
src/agratek/api/merchant/views/odeo.py
View file @
fbfac18
...
@@ -13,25 +13,41 @@ from .vendor import VendorClass
...
@@ -13,25 +13,41 @@ from .vendor import VendorClass
class
Vendor
(
VendorClass
):
class
Vendor
(
VendorClass
):
def
__init__
(
self
,
product_kd
,
cid
):
def
__init__
(
self
,
vendor_produk
,
bill_no
,
customer_id
=
None
,
VendorClass
.
__init__
(
self
,
product_kd
,
cid
)
cust_trx_id
=
None
,
row
=
None
):
VendorClass
.
__init__
(
self
,
vendor_produk
,
bill_no
,
customer_id
,
cust_trx_id
,
row
)
settings
=
get_settings
()
settings
=
get_settings
()
self
.
mid
=
'odeoo_cid'
in
settings
and
settings
[
'odeo_cid'
]
or
None
self
.
mid
=
'odeo_mid'
in
settings
and
settings
[
'odeo_mid'
]
or
None
self
.
key
=
'odeoo_key'
in
settings
and
settings
[
'odeoo_key'
]
or
None
self
.
key
=
'odeo_key'
in
settings
and
settings
[
'odeo_key'
]
or
None
self
.
url
=
'odeoo_url'
in
settings
and
settings
[
'odeoo_url'
]
or
None
self
.
url
=
'odeo_url'
in
settings
and
settings
[
'odeo_url'
]
or
None
self
.
cid
=
cid
key
=
":"
.
join
([
self
.
mid
,
self
.
key
])
.
encode
()
key
=
":"
.
join
([
self
.
cid
,
self
.
key
])
self
.
auth
=
base64
.
b64encode
(
key
)
self
.
auth
=
base64
.
b64encode
(
key
)
qry
=
PartnerProduk
.
query
()
\
.
join
(
Partner
,
Partner
.
id
==
PartnerProduk
.
partner_id
)
\
.
join
(
Produk
,
Produk
.
id
==
PartnerProduk
.
produk_id
)
\
.
filter
(
Produk
.
kode
==
product_kd
,
Partner
.
kode
==
"odeoo"
)
row
=
qry
.
first
()
self
.
product_kd
=
row
and
row
.
kode
or
None
def
inquiry
(
self
):
def
inquiry
(
self
):
pass
if
not
self
.
v_produk_kd
or
not
self
.
bill_no
:
return
params
=
dict
(
data
=
dict
(
denom
=
self
.
v_produk_kd
,
number
=
self
.
bill_no
)
)
with
requests
.
session
():
headers
=
{
'Authorization'
:
'Bearer {key}'
.
format
(
key
=
self
.
key
)}
data
=
json
.
dumps
(
params
)
resp
=
requests
.
post
(
url
=
self
.
url
,
data
=
data
,
verify
=
False
,
headers
=
headers
)
if
resp
.
ok
:
print
(
resp
.
text
)
content
=
resp
.
json
()
#json.dumps(resp.text)
else
:
raise
JsonRpcError
(
code
=
resp
.
status_code
,
message
=
resp
.
text
)
return
content
return
def
payment
(
self
):
def
payment
(
self
):
# request = Request('https://api.odeo.co.id/v1/affiliate/prepaid/purchase', data=values, headers=headers)
# request = Request('https://api.odeo.co.id/v1/affiliate/prepaid/purchase', data=values, headers=headers)
...
...
src/agratek/api/merchant/views/vendor.py
View file @
fbfac18
...
@@ -407,6 +407,9 @@ def vendor_test(request):
...
@@ -407,6 +407,9 @@ def vendor_test(request):
params
=
dict
(
controls
)
params
=
dict
(
controls
)
params
[
"status"
]
=
"SUCCESS"
params
[
"status"
]
=
"SUCCESS"
result
=
dict
(
root
=
params
)
result
=
dict
(
root
=
params
)
result
=
xmltodict
.
unparse
(
result
)
elif
vendor
==
"odeoo"
:
params
=
json
.
loads
(
request
.
text
)
xml
=
xmltodict
.
unparse
(
result
)
result
=
request
.
text
return
xml
return
result
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