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 219c39ba
authored
Sep 09, 2019
by
Tatang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
notify
1 parent
2423a245
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
4 deletions
src/agratek/api/merchant/views/merchant_payment.py
src/agratek/api/merchant/views/notify_vendor.py
src/agratek/api/merchant/views/np/__init__.py
src/agratek/api/merchant/views/np/notify.py
src/agratek/api/merchant/views/vendor.py
src/agratek/api/merchant/views/merchant_payment.py
View file @
219c39b
...
@@ -429,7 +429,7 @@ class CCardPayment(colander.Schema):
...
@@ -429,7 +429,7 @@ class CCardPayment(colander.Schema):
callback_url
=
colander
.
SchemaNode
(
callback_url
=
colander
.
SchemaNode
(
colander
.
String
(),
colander
.
String
(),
default
=
"{}/api/merchant/register/callback"
.
format
(
"https://server"
),
#
default="{}/api/merchant/register/callback".format("https://server"),
widget
=
widget
.
TextInputWidget
(
max_len
=
255
)
widget
=
widget
.
TextInputWidget
(
max_len
=
255
)
)
)
...
...
src/agratek/api/merchant/views/notify_vendor.py
View file @
219c39b
...
@@ -104,7 +104,12 @@ def proses_np(data):
...
@@ -104,7 +104,12 @@ def proses_np(data):
@view_config
(
route_name
=
'api-vendor-notify'
,
renderer
=
'json'
)
@view_config
(
route_name
=
'api-vendor-notify'
,
renderer
=
'json'
)
def
api_vendor_notify
(
request
):
def
api_vendor_notify
(
request
):
vendor_nm
=
request
.
matchdict
[
'name'
]
vendor_nm
=
request
.
matchdict
[
'name'
]
try
:
data
=
json
.
loads
(
request
.
text
)
data
=
json
.
loads
(
request
.
text
)
except
:
data
=
request
.
POST
and
dict
(
request
.
POST
.
items
())
or
dict
(
request
.
GET
.
items
())
modul
=
'.notify'
modul
=
'.notify'
pckgs
=
'agratek.api.merchant.views.{}'
.
format
(
vendor_nm
)
pckgs
=
'agratek.api.merchant.views.{}'
.
format
(
vendor_nm
)
moduls
=
import_module
(
modul
,
pckgs
)
moduls
=
import_module
(
modul
,
pckgs
)
...
...
src/agratek/api/merchant/views/np/__init__.py
View file @
219c39b
...
@@ -461,7 +461,7 @@ class Vendor(VendorClass): # VendorClass
...
@@ -461,7 +461,7 @@ class Vendor(VendorClass): # VendorClass
self
.
response
=
data
self
.
response
=
data
log
.
info
(
"Payment Result: {}"
.
format
(
data
))
log
.
info
(
"Payment Result: {}"
.
format
(
data
))
self
.
result
=
get_result
(
self
.
response
,
self
.
pay_method
)
self
.
result
=
get_result
(
self
.
response
,
self
.
pay_method
)
self
.
save_log
(
"payment"
)
script
=
"""
script
=
"""
function submit_form(){
function submit_form(){
$("form[name='callback']").submit();
$("form[name='callback']").submit();
...
@@ -473,6 +473,11 @@ class Vendor(VendorClass): # VendorClass
...
@@ -473,6 +473,11 @@ class Vendor(VendorClass): # VendorClass
# /api/merchant/payment
# /api/merchant/payment
f
=
""
f
=
""
result
=
self
.
result
result
=
self
.
result
self
.
request
=
'request'
in
self
.
invoice_det
.
payment
and
\
self
.
invoice_det
.
payment
[
'request'
]
or
""
self
.
save_log
(
"payment"
)
for
r
in
result
:
for
r
in
result
:
if
r
and
type
(
result
[
r
])
==
dict
:
if
r
and
type
(
result
[
r
])
==
dict
:
rs
=
result
[
r
]
rs
=
result
[
r
]
...
@@ -518,6 +523,16 @@ class Vendor(VendorClass): # VendorClass
...
@@ -518,6 +523,16 @@ class Vendor(VendorClass): # VendorClass
if
merchant_token
!=
signature
:
if
merchant_token
!=
signature
:
return
return
status
=
int
(
data
[
'status'
])
if
status
==
0
:
# pembayaran sukses
self
.
invoice_det
.
status
=
1
flush_row
(
self
.
invoice_det
)
elif
status
==
1
:
# pembayaran gagal / reversal
self
.
invoice_det
.
status
=
2
flush_row
(
self
.
invoice_det
)
self
.
response
=
data
self
.
response
=
data
self
.
result
=
get_result
(
self
.
response
,
self
.
pay_method
)
self
.
result
=
get_result
(
self
.
response
,
self
.
pay_method
)
self
.
save_log
(
"notify"
)
self
.
save_log
(
"notify"
)
...
...
src/agratek/api/merchant/views/np/notify.py
View file @
219c39b
...
@@ -10,10 +10,19 @@ def proses(data):
...
@@ -10,10 +10,19 @@ def proses(data):
vend_inv_no
=
data
[
"tXid"
]
vend_inv_no
=
data
[
"tXid"
]
cus_inv_no
=
data
[
"referenceNo"
]
cus_inv_no
=
data
[
"referenceNo"
]
invoice_det
=
PartnerPay
.
query_vend_inv_no
(
vend_inv_no
)
\
invoice_det
=
PartnerPay
.
query_vend_inv_no
(
vend_inv_no
)
\
.
filter
(
cust_inv_no
=
cus_inv_no
)
.
filter_by
(
cust_inv_no
=
cus_inv_no
)
\
.
first
()
# by tatang
if
not
invoice_det
:
return
vendor_produk
=
PartnerProduk
.
query
()
\
vendor_produk
=
PartnerProduk
.
query
()
\
.
filter_by
(
partner_id
=
invoice_det
.
vendor_id
,
.
filter_by
(
partner_id
=
invoice_det
.
vendor_id
,
produk_id
=
invoice_det
.
produk_id
)
produk_id
=
invoice_det
.
produk_id
)
\
.
first
()
# by tatang
if
not
vendor_produk
:
return
vendor
=
Vendor
(
vendor_produk
,
invoice_det
)
vendor
=
Vendor
(
vendor_produk
,
invoice_det
)
vendor
.
notify
(
data
)
vendor
.
notify
(
data
)
...
...
src/agratek/api/merchant/views/vendor.py
View file @
219c39b
...
@@ -167,6 +167,11 @@ class VendorClass(object):
...
@@ -167,6 +167,11 @@ class VendorClass(object):
self
.
invoice_det
.
info
=
dict
(
request
=
self
.
request
,
self
.
invoice_det
.
info
=
dict
(
request
=
self
.
request
,
response
=
self
.
response
,
response
=
self
.
response
,
result
=
self
.
result
)
result
=
self
.
result
)
elif
typ
==
'notify'
:
# by tatang
self
.
invoice_det
.
notify
=
dict
(
request
=
self
.
request
,
response
=
self
.
response
,
result
=
self
.
result
)
flush_row
(
self
.
invoice_det
)
flush_row
(
self
.
invoice_det
)
...
...
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