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 aab18d42
authored
Mar 17, 2020
by
yasir
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update notify
1 parent
181b1140
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
18 deletions
src/agratek/api/merchant/views/notify_vendor.py
src/agratek/api/merchant/views/odeo/__init__.py
src/agratek/api/merchant/views/odeo/dummy.py
src/agratek/api/merchant/views/odeo/notify.py
src/agratek/api/merchant/views/vendor.py
src/agratek/api/merchant/views/notify_vendor.py
View file @
aab18d4
...
...
@@ -33,6 +33,7 @@ def update_harga(p, k, v):
def
purchase_notify
(
order
):
print
(
'purchase_notify >>'
)
# Callback to merchant
if
hasattr
(
order
,
"customer_id"
):
customer
=
order
.
customer
...
...
@@ -41,6 +42,9 @@ def purchase_notify(order):
invoice
=
order
.
h2h_ar_invoice
customer
=
invoice
.
customer
print
(
'purchase_notify customer.website >>'
)
print
(
customer
.
website
)
if
customer
and
customer
.
website
:
url
=
customer
.
website
users
=
customer
.
users
...
...
@@ -69,6 +73,8 @@ def purchase_notify(order):
dat
.
update
(
produk
=
produk
)
data
.
append
(
dat
)
log
.
info
(
"Notify Save:
%
s"
%
(
data
))
print
(
'purchase_notify order.notify >>'
)
print
(
order
.
notify
)
order
.
notify
[
"result"
]
=
data
flush_row
(
order
)
js
=
get_jsonrpc
(
method
=
"notify"
,
params
=
dict
(
data
=
data
))
...
...
src/agratek/api/merchant/views/odeo/__init__.py
View file @
aab18d4
...
...
@@ -62,22 +62,19 @@ class Vendor(VendorClass):
self
.
save_log
(
"inquiry"
)
# try:
# lolable = Lolable(self.vendor_produk, self.invoice_det)
# # resp = lolable.stupeed(json.dumps(params))
# resp = lolable.inquat(json.dumps(params))
# resp = requests.get(url, params=params, verify=False,
# headers=self.get_headers())
# print('resp_inquat >>')
# print(resp_dummy)
# # resp = requests.get(url, params=params, verify=False,
# # headers=self.get_headers())
# print('respon inquiry beneran >>')
# print(resp.text)
# except Exception as e:
# log.info(e)
# print('error lolable >>')
# print(e)
# return
lolable
=
Lolable
(
self
.
vendor_produk
,
self
.
invoice_det
)
resp
=
lolable
.
inquat
(
json
.
dumps
(
params
))
...
...
@@ -180,15 +177,20 @@ class Vendor(VendorClass):
parsd
=
self
.
get_price
()
url
=
self
.
get_url
(
"/prepaid/purchase"
)
try
:
#
try:
# resp = requests.post(url, data=json.dumps(params), verify=False,
# headers=self.get_headers(), timeout=timeout)
# print('response purchase beneran >>')
# print(resp.text)
# except Exception as e:
# print(e)
# resp = None
lolable
=
Lolable
(
self
.
vendor_produk
,
self
.
invoice_det
)
resp
=
lolable
.
stupeed
(
json
.
dumps
(
params
))
except
Exception
as
e
:
print
(
e
)
resp
=
None
print
(
'response purchase >>'
)
print
(
resp
.
text
)
if
resp
is
None
or
not
resp
.
text
:
return
self
.
set_pending
(
parsd
,
typ
=
"payment"
)
...
...
@@ -226,7 +228,7 @@ class Vendor(VendorClass):
self
.
serial_number
=
'serial_number'
in
data
and
data
[
"serial_number"
]
\
or
self
.
serial_number
kirim_notify
(
self
.
invoice_det
.
h2h_ar_invoice
.
cust_inv_no
)
#
kirim_notify(self.invoice_det.h2h_ar_invoice.cust_inv_no)
return
self
.
set_success
(
parsd
,
typ
=
"payment"
)
elif
resp
.
status_code
==
400
:
...
...
src/agratek/api/merchant/views/odeo/dummy.py
View file @
aab18d4
import
json
import
datetime
from
opensipkd.pasar.models
import
PartnerProduk
,
H2hArInvoiceDet
from
opensipkd.pasar.models
import
PartnerProduk
,
H2hArInvoiceDet
,
flush_row
from
agratek.api.merchant.views.notify_vendor
import
purchase_notify
from
opensipkd.base
import
get_settings
import
hashlib
...
...
@@ -24,6 +24,7 @@ class Lolable(object):
elif
type
(
inst_class
)
.
__name__
==
'H2hArInvoiceDet'
:
self
.
pl_idpel
=
self
.
inst_class
.
id_pel
self
.
pl_invoice_no
=
self
.
inst_class
.
h2h_ar_invoice
.
cust_inv_no
self
.
vendor_produk
=
vendor_produk
...
...
@@ -57,11 +58,15 @@ class Lolable(object):
dumb_dict
[
'message'
]
=
''
dumb_data
=
{}
dumb_data
[
'order_id'
]
=
1
if
self
.
pl_invoice_no
:
dumb_data
[
'order_id'
]
=
self
.
pl_invoice_no
else
:
dumb_data
[
'order_id'
]
=
self
.
pl_idpel
dumb_data
[
'message'
]
=
''
if
self
.
kategori
==
'e-pulsa'
:
dumb_data
[
'price'
]
=
(
self
.
get_price_epulsa
(
denom
)
*
1000
)
dumb_data
[
'serial_number'
]
=
'9090909'
else
:
if
denom
[:
3
]
==
'PLN'
and
denom
!=
"PLNPASCA"
:
bayar
=
denom
.
replace
(
'PLN'
,
''
)
...
...
@@ -72,7 +77,7 @@ class Lolable(object):
dumb_data
[
'price'
]
=
150000
dumb_data
[
'name'
]
=
'Suriyah Sidkisari'
dumb_data
[
'serial_number'
]
=
'
0
9090909'
dumb_data
[
'serial_number'
]
=
'9090909'
dumb_data
[
'status'
]
=
'SUCCESS'
dumb_data
.
update
(
merch_request_dict
[
'data'
])
...
...
@@ -81,7 +86,16 @@ class Lolable(object):
self
.
text
=
json
.
dumps
(
dumb_dict
)
# self.kirim_notify()
print
(
'stupeed inst_class >>'
)
print
(
type
(
self
.
inst_class
)
.
__name__
)
self
.
inst_class
.
status
=
1
self
.
inst_class
.
notify
=
dict
(
postdata
=
kirim_notify
(
dumb_data
[
'order_id'
]))
flush_row
(
self
.
inst_class
)
purchase_notify
(
self
.
inst_class
)
return
self
# {
...
...
@@ -388,7 +402,8 @@ def kirim_notify(order_id):
print
(
website
)
print
(
'dict_notify >>'
)
print
(
dict_notify
)
requests
.
post
(
website
,
data
=
json
.
dumps
(
dict_notify
),
timeout
=
30
)
return
dict_notify
# requests.post(website, data=json.dumps(dict_notify), timeout=30)
# requests.post(fake_web, data=json.dumps(dict_notify), timeout=30)
# except Exception as e:
# print('error notify >>')
...
...
src/agratek/api/merchant/views/odeo/notify.py
View file @
aab18d4
...
...
@@ -11,6 +11,7 @@ log = logging.getLogger(__name__)
def
proses
(
data
):
print
(
'masuk odeo notify >>'
)
settings
=
get_settings
()
mid
=
'odeo_mid'
in
settings
and
settings
[
"odeo_mid"
]
or
None
key
=
'odeo_key'
in
settings
and
settings
[
"odeo_key"
]
or
None
...
...
@@ -42,11 +43,22 @@ def proses(data):
signature
))
log
.
info
(
"local
%
s, vendor
%
s"
%
(
signature
,
data
[
"signature"
]))
return
dict
(
error
=
"Signature Different"
)
print
(
'odeo notify partner.id >>'
)
print
(
partner
.
id
)
print
(
'odeo notify order_id >>'
)
print
(
order_id
)
order
=
H2hArInvoiceDet
.
query
()
\
.
filter
(
H2hArInvoiceDet
.
vendor_id
==
partner
.
id
,
H2hArInvoiceDet
.
vend_inv_no
==
str
(
order_id
))
.
first
()
print
(
'purchase_notify data >>'
)
print
(
data
)
print
(
'purchase_notify order >>'
)
print
(
order
)
if
order
:
print
(
order
.
h2h_ar_invoice
.
cust_inv_no
)
if
status
==
"COMPLETED"
:
order
.
status
=
1
else
:
...
...
src/agratek/api/merchant/views/vendor.py
View file @
aab18d4
...
...
@@ -27,6 +27,8 @@ class VendorClass(object):
"""
self
.
settings
=
get_settings
()
self
.
vendor_produk
=
vendor_produk
print
(
'create vendor >>'
)
print
(
invoice_det
)
self
.
invoice_det
=
invoice_det
self
.
v_produk_kd
=
vendor_produk
.
kode
self
.
kategori
=
vendor_produk
.
produk
.
kategori
.
kode
...
...
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