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 e3a30b5e
authored
Jul 31, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
advice
1 parent
14c3bf27
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
src/agratek/api/merchant/views/merchan.py
src/agratek/api/merchant/views/merchan.py
View file @
e3a30b5
...
@@ -34,11 +34,13 @@ def build_request(typ, vendor_produk, partner_log=None):
...
@@ -34,11 +34,13 @@ def build_request(typ, vendor_produk, partner_log=None):
# dict(data=)
# dict(data=)
return
result
return
result
def
get_vendor_produk
():
def
get_vendor_produk
():
return
PartnerProduk
.
query
()
\
return
PartnerProduk
.
query
()
\
.
join
(
Partner
,
Partner
.
id
==
PartnerProduk
.
partner_id
)
\
.
join
(
Partner
,
Partner
.
id
==
PartnerProduk
.
partner_id
)
\
.
join
(
Produk
,
Produk
.
id
==
PartnerProduk
.
produk_id
)
.
join
(
Produk
,
Produk
.
id
==
PartnerProduk
.
produk_id
)
@jsonrpc_method
(
method
=
'inquiry'
,
endpoint
=
'api-merchant'
)
@jsonrpc_method
(
method
=
'inquiry'
,
endpoint
=
'api-merchant'
)
def
inquiry
(
request
,
data
,
**
kwargs
):
def
inquiry
(
request
,
data
,
**
kwargs
):
"""
"""
...
@@ -240,7 +242,7 @@ def purchase(request, data, **kwargs):
...
@@ -240,7 +242,7 @@ def purchase(request, data, **kwargs):
total
+=
vendor_produk
.
produk
.
harga
total
+=
vendor_produk
.
produk
.
harga
elif
vendor_produk
.
produk
.
harga
>
total
:
elif
vendor_produk
.
produk
.
harga
>
total
:
total
=
vendor_produk
.
produk
.
harga
total
=
vendor_produk
.
produk
.
harga
prod
.
update
(
dict
(
total
=
total
))
prod
.
update
(
dict
(
total
=
total
))
r_prod
.
append
(
prod
)
r_prod
.
append
(
prod
)
...
@@ -285,7 +287,10 @@ def advice(request, data):
...
@@ -285,7 +287,10 @@ def advice(request, data):
i
=
0
i
=
0
is_list
=
type
(
data
)
==
list
is_list
=
type
(
data
)
==
list
data
=
is_list
and
data
or
[
data
]
data
=
is_list
and
data
or
[
data
]
customer
=
Partner
.
query_user
(
user
)
customer
=
Partner
.
query_user
(
user
)
.
first
()
if
not
customer
:
raise
JsonRpcCustomerNotFoundError
r_data
=
[]
r_data
=
[]
for
dat
in
data
:
for
dat
in
data
:
if
"invoice_no"
not
in
dat
:
if
"invoice_no"
not
in
dat
:
...
@@ -293,9 +298,9 @@ def advice(request, data):
...
@@ -293,9 +298,9 @@ def advice(request, data):
dat
[
"message"
]
=
"Parameter tidak lengkap"
dat
[
"message"
]
=
"Parameter tidak lengkap"
else
:
else
:
inv_no
=
dat
[
"invoice_no"
]
inv_no
=
dat
[
"invoice_no"
]
invoice
=
H2hArInvoice
.
query
()
\
invoice
=
H2hArInvoice
.
query
()
\
.
filter_by
(
cust_inv_no
=
inv_no
,
.
filter_by
(
cust_inv_no
=
inv_no
,
customer_id
=
customer
.
id
)
.
first
()
customer_id
=
customer
.
id
)
.
first
()
if
not
invoice
:
if
not
invoice
:
dat
[
"status"
]
=
"FAILED"
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Invoice
%
s Tidak Ditemukan"
%
inv_no
dat
[
"message"
]
=
"Invoice
%
s Tidak Ditemukan"
%
inv_no
...
...
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