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 65ae8425
authored
Sep 16, 2019
by
Solo Group
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
advice
1 parent
a2a25d8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
1 deletions
src/agratek/api/merchant/views/api_merchant.py
src/agratek/api/merchant/views/np/__init__.py
src/agratek/api/merchant/views/api_merchant.py
View file @
65ae842
...
@@ -389,6 +389,89 @@ def advice(request, data):
...
@@ -389,6 +389,89 @@ def advice(request, data):
i
+=
1
i
+=
1
data
=
is_list
and
r_data
or
r_data
[
0
]
data
=
is_list
and
r_data
or
r_data
[
0
]
return
data
return
data
def
cancel_tx
(
dat
):
tx_id
=
dat
[
"tx_id"
]
inv_no
=
dat
[
"invoice_no"
]
inv
=
PartnerPay
.
query_txid
(
tx_id
)
.
filter_by
(
cust_inv_no
=
inv_no
)
.
first
()
if
not
inv
:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Data Tagihan {} tidak ditemukan"
.
format
(
inv_no
)
return
dat
payment
=
inv
.
payment
[
"response"
]
if
not
payment
:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Data Pembayaran {} tidak ditemukan"
.
format
(
inv_no
)
return
dat
vend_produk
=
PartnerProduk
.
query
()
.
filter_by
(
produk_id
=
inv
.
produk_id
,
partner_id
=
inv
.
vendor_id
)
.
first
()
if
not
vend_produk
:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Data Produk tidak ditemukan"
.
format
(
inv_no
)
return
dat
vendor_nm
=
vend_produk
.
modules
modul
=
'.cancel_tx'
pckgs
=
'agratek.api.merchant.views.{}'
.
format
(
vendor_nm
)
moduls
=
import_module
(
modul
,
pckgs
)
typ
=
'proses'
cls
=
hasattr
(
moduls
,
typ
)
and
getattr
(
moduls
,
typ
)
or
None
if
cls
:
order
=
cls
(
inv
,
vend_produk
)
return
order
return
dict
()
@jsonrpc_method
(
method
=
'cancel'
,
endpoint
=
'api-merchant'
)
def
advice
(
request
,
data
):
"""
Digunakan untuk mendapatkan daftar produk
:param request:
:param data:
{
denom: string,
id_pel:string
inv_no: string optional
}
:param token:
user_token
:return:
{
product_nm:string,
denom: string,
id_pel:string
inv_no: string optional
denom:string,
harga:integer,
admin:integer,
discount:integer,
total:integer,
status:success/pending/failed
"""
user
=
auth_from_rpc
(
request
)
i
=
0
is_list
=
type
(
data
)
==
list
data
=
is_list
and
data
or
[
data
]
customer
=
Partner
.
query_user
(
user
)
.
first
()
if
not
customer
:
raise
JsonRpcCustomerNotFoundError
r_data
=
[]
for
dat
in
data
:
if
"invoice_no"
not
in
dat
and
"tx_id"
not
in
dat
and
"cancel_type"
not
in
dat
:
dat
[
"status"
]
=
"FAILED"
dat
[
"message"
]
=
"Parameter tidak lengkap"
dat
.
update
(
cancel_tx
(
dat
))
r_data
.
append
(
dat
)
i
+=
1
data
=
is_list
and
r_data
or
r_data
[
0
]
return
data
#
#
# @jsonrpc_method(method='payment', endpoint='api-merchant')
# @jsonrpc_method(method='payment', endpoint='api-merchant')
# def payment(request, token, data):
# def payment(request, token, data):
...
...
src/agratek/api/merchant/views/np/__init__.py
View file @
65ae842
...
@@ -649,7 +649,7 @@ def get_result(response, pay_method):
...
@@ -649,7 +649,7 @@ def get_result(response, pay_method):
if
pay_method
==
"01"
:
if
pay_method
==
"01"
:
result
.
update
(
dict
(
result
.
update
(
dict
(
credit_card
=
dict
(
credit_card
=
dict
(
auth_no
=
response
[
"authNo"
]
,
auth_no
=
"authNo"
in
response
and
response
[
"authNo"
]
or
""
,
issue_bank
=
response
[
"issuBankCd"
],
issue_bank
=
response
[
"issuBankCd"
],
issue_bank_nm
=
'issuBankNm'
in
response
and
response
[
"issuBankNm"
]
or
""
,
issue_bank_nm
=
'issuBankNm'
in
response
and
response
[
"issuBankNm"
]
or
""
,
acqu_bank
=
response
[
"acquBankCd"
],
acqu_bank
=
response
[
"acquBankCd"
],
...
...
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