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 a8eec3e2
authored
Jul 31, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
advice
1 parent
838b9d62
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
24 deletions
src/agratek/api/merchant/views/merchan.py
src/agratek/api/merchant/views/vendor.py
src/agratek/api/merchant/views/merchan.py
View file @
a8eec3e
...
...
@@ -187,11 +187,11 @@ def purchase(request, data, **kwargs):
r_data
=
[]
log
.
info
(
"
%
s Payment Request:
%
s"
%
(
customer
.
kode
,
data
))
for
dat
in
data
:
if
"inv_no"
not
in
dat
or
"produk"
not
in
dat
or
not
dat
[
"produk"
]:
if
"inv
oice
_no"
not
in
dat
or
"produk"
not
in
dat
or
not
dat
[
"produk"
]:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Parameter tidak lengkap"
else
:
inv_no
=
dat
[
"inv_no"
]
inv_no
=
dat
[
"inv
oice
_no"
]
produk
=
dat
[
"produk"
]
# todo cek apakah invoice sudah ada atau belum
ar_invoice
=
H2hArInvoice
.
query
()
.
filter_by
(
cust_inv_no
=
inv_no
)
.
first
()
...
...
@@ -288,26 +288,42 @@ def advice(request, token, data):
customer
=
Partner
.
query_user
(
user
)
r_data
=
[]
for
dat
in
data
:
cust_inv
=
dat
[
"inv_no"
]
partner_log
=
PartnerLog
.
query
()
.
filter
(
PartnerLog
.
cust_inv
==
cust_inv
)
.
all
()
if
"inv_no"
not
in
dat
:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Parameter tidak lengkap"
else
:
inv_no
=
dat
[
"invoice_no"
]
invoice
=
H2hArInvoice
.
query
()
\
.
filter_by
(
cust_inv_no
=
inv_no
,
customer_id
=
customer
.
id
)
.
first
()
if
not
invoice
:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Invoice
%
s Tidak Ditemukan"
%
inv_no
else
:
qry
=
H2hArInvoiceDet
.
query
()
.
filter_by
(
ar_invoice_id
=
invoice
.
id
)
if
"produk"
in
dat
:
# for p in dat["produk"]:
# prods.append(p["denom"])
# invoice_det = produk.q
pass
# else:
# qry.filter(H2hArInvoiceDet.status!=1)
r_prod
=
[]
for
p
in
partner_log
:
produk
=
PartnerProduk
.
query
()
.
\
filter
(
PartnerProduk
.
partner_id
==
p
.
vendor_id
,
PartnerProduk
.
produk_id
==
p
.
produk_id
)
.
first
()
for
p
in
qry
.
all
():
produk
=
Produk
.
query
()
.
\
filter
(
Produk
.
id
==
p
.
produk_id
)
.
first
()
status
=
p
.
status
==
0
and
'PENDING'
or
p
.
status
==
1
and
'SUCCESS'
\
or
p
.
status
==
2
and
'FAILED
'
status
=
p
.
status
==
-
1
and
'PENDING'
or
p
.
status
==
1
and
'SUCCESS'
\
or
p
.
status
==
-
2
and
'PENDING
'
r_prod
.
append
(
dict
(
denom
=
produk
.
kode
,
id_pel
=
partner_log
[
"id_pel"
],
subtotal
=
partner_log
[
"amt_sell"
]
+
partner_log
[
"discount"
],
discount
=
partner_log
[
"discount"
],
total
=
partner_log
[
"amt_sell"
],
id_pel
=
p
[
"id_pel"
],
subtotal
=
p
[
"amt_sell"
]
+
p
[
"discount"
],
discount
=
p
[
"discount"
],
total
=
p
[
"amt_sell"
],
status
=
status
,
serial_number
=
partner_log
.
serial_number
,
)
serial_number
=
p
.
serial_number
,
)
)
dat
[
"produk"
]
=
r_prod
...
...
src/agratek/api/merchant/views/vendor.py
View file @
a8eec3e
...
...
@@ -75,7 +75,6 @@ class VendorClass(object):
if
self
.
amt_buy
:
self
.
invoice_det
.
amt_buy
=
self
.
amt_buy
if
typ
==
'inquiry'
:
self
.
invoice_det
.
inquiry
=
dict
(
request
=
self
.
request
,
response
=
self
.
response
)
...
...
@@ -123,7 +122,6 @@ class Other(object):
# cust_trx_id = cust_trx_id, row = row,
#
def
get_product
(
self
):
pass
...
...
@@ -194,12 +192,14 @@ def proses_odeo(request):
else
:
order
.
status
=
-
2
order
.
notify
=
dict
(
post
=
data
)
if
"sn"
in
"data"
and
data
[
"sn"
]:
order
.
serial_number
=
data
[
"sn"
]
flush_row
(
order
)
#todo: add to customer notify table
#todo: create cron for notify
#proses jika status 1 notify ada isinya tapi belum ada field result
#todo: create cron torecurring order to other vendor
#jika status = -2 proses vendor yang lain
#
todo: add to customer notify table
#
todo: create cron for notify
#
proses jika status 1 notify ada isinya tapi belum ada field result
#
todo: create cron torecurring order to other vendor
#
jika status = -2 proses vendor yang lain
#
# customer = Partner.query_id(order.customer_id).first()
# if customer and customer.website:
...
...
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