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 1c41c941
authored
Sep 09, 2019
by
Tatang
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
notif
1 parent
219c39ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
21 deletions
src/agratek/api/merchant/views/api_payment.py
src/agratek/api/merchant/views/np/__init__.py
src/agratek/api/merchant/views/api_payment.py
View file @
1c41c94
...
...
@@ -215,6 +215,7 @@ def form_result(request, values):
form
.
render
(
values
)
return
dict
(
form
=
form
,
params
=
dict
(
scripts
=
""
))
class
ViewData
(
BaseView
):
@view_config
(
route_name
=
'api-merchant-payment'
,
renderer
=
'templates/form-clean.pt'
)
...
...
@@ -269,10 +270,11 @@ class ViewData(BaseView):
message
=
"Parameter Expected"
)
return
form_result
(
request
,
values
)
@view_config
(
route_name
=
'api-vendor-callback'
,
renderer
=
"templates/form-clean.pt"
)
def
api_vendor_callback
(
request
):
data
=
request
.
POST
and
dict
(
request
.
POST
.
items
())
or
dict
(
request
.
GET
.
items
())
print
(
data
)
#
print(data)
vendor_nm
=
request
.
matchdict
[
'name'
]
modul
=
'.callback'
pckgs
=
'agratek.api.merchant.views.{}'
.
format
(
vendor_nm
)
...
...
@@ -280,11 +282,11 @@ def api_vendor_callback(request):
typ
=
'proses'
log
.
info
(
"Pckgs: {} Modul:{} typ {}"
.
format
(
pckgs
,
modul
,
typ
))
cls
=
hasattr
(
moduls
,
typ
)
and
getattr
(
moduls
,
typ
)
or
None
print
(
dir
(
cls
))
#
print(dir(cls))
if
cls
:
result
=
cls
(
data
)
if
result
:
return
dict
(
form
=
result
[
"form"
])
qs
=
get_qs
(
data
)
qs
=
get_qs
(
data
)
return
HTTPFound
(
location
=
request
.
route_url
(
"api-merchant-register-callback"
,
_query
=
qs
))
return
dict
(
form
=
"<h1>ERROR</h1>"
)
\ No newline at end of file
# return dict(form="<h1>ERROR</h1>")
src/agratek/api/merchant/views/np/__init__.py
View file @
1c41c94
...
...
@@ -520,6 +520,7 @@ class Vendor(VendorClass): # VendorClass
signature
=
sha256
(
"{mid}{vend_inv_no}{amount}{key}"
\
.
format
(
mid
=
self
.
mid
,
key
=
self
.
key
,
amount
=
str
(
amount
),
vend_inv_no
=
vend_inv_no
))
# print('>>>>', signature)
if
merchant_token
!=
signature
:
return
...
...
@@ -534,35 +535,57 @@ class Vendor(VendorClass): # VendorClass
flush_row
(
self
.
invoice_det
)
self
.
response
=
data
self
.
result
=
get_result
(
self
.
response
,
self
.
pay_method
)
self
.
save_log
(
"notify"
)
return
self
.
result
def
get_result
(
response
,
pay_method
):
status
=
"status"
in
response
and
response
[
'status'
]
and
int
(
response
[
"status"
])
+
1
or
1
try
:
code
=
int
(
response
[
"resultCd"
])
except
:
code
=
0
try
:
message
=
response
[
"resultMsg"
]
except
:
message
=
''
result
=
dict
(
code
=
int
(
response
[
"resultCd"
]),
message
=
response
[
"resultMsg"
],
# cancel_amt=response["cancelAmt"],
# deposit_date=response["depositDt"],
# deposit_time=response["depositTm"],
code
=
code
,
message
=
message
,
# cancel_amt="cancelAmt" in response and int(response["cancelAmt"]) or 0,
# deposit_date="depositDt" in response and response["depositDt"] or "",
# deposit_time="depositTm" in response and response["depositTm"] or "",
# tx_id=response[''], # <=
invoice_no
=
"referenceNo"
in
response
and
response
[
"referenceNo"
]
or
""
,
amount
=
"amt"
in
response
and
int
(
response
[
"amt"
])
or
0
,
match_cl
=
"matchCl"
in
response
and
int
(
response
[
"matchCl"
])
or
0
,
status
=
status
,
trans_date
=
"transDt"
in
response
and
response
[
"transDt"
]
or
""
,
trans_time
=
"transTm"
in
response
and
response
[
"transTm"
]
or
""
,
currency
=
"currency"
in
response
and
response
[
"currency"
]
or
""
,
description
=
"goodsNm"
in
response
and
response
[
"goodsNm"
]
or
""
,
customer_nm
=
"billingNm"
in
response
and
response
[
"billingNm"
]
or
""
,
)
if
pay_method
==
"01"
:
result
.
update
(
dict
(
c
c
=
dict
(
c
redit_card
=
dict
(
auth_no
=
response
[
"authNo"
],
issue_bank
=
response
[
"issuBankCd"
],
issue_bank_nm
=
'issuBankNm'
in
response
and
response
[
"issuBankNm"
]
or
""
,
acqu_bank
=
response
[
"acquBankCd"
],
acqu_bank_nm
=
'acquBankNm'
in
response
and
response
[
"acquBankNm"
]
or
""
,
acqu_status
=
'acquStatus'
in
response
and
response
[
"acquStatus"
]
or
""
,
card_no
=
response
[
"cardNo"
]
,
card_exp
=
response
[
"cardExpYymm"
]
,
instmnt_mon
=
response
[
"instmntMon"
]
,
instmnt_tpe
=
response
[
"instmntType"
]
,
preauth_token
=
response
[
"preauthToken"
]
,
recurring_token
=
response
[
"recurringToken"
]
,
cc_trans_type
=
response
[
"ccTransType"
]
,
card_no
=
'cardNo'
in
response
and
response
[
"cardNo"
]
or
""
,
card_exp
=
'cardExpYymm'
in
response
and
response
[
"cardExpYymm"
]
or
""
,
instmnt_mon
=
'instmntMon'
in
response
and
response
[
"instmntMon"
]
or
""
,
instmnt_tpe
=
'instmntType'
in
response
and
response
[
"instmntType"
]
or
""
,
preauth_token
=
'preauthToken'
in
response
and
response
[
"preauthToken"
]
or
""
,
recurring_token
=
'recurringToken'
in
response
and
response
[
"recurringToken"
]
or
""
,
cc_trans_type
=
'ccTransType'
in
response
and
response
[
"ccTransType"
]
or
""
,
vat
=
"vat"
in
response
and
int
(
response
[
"vat"
])
or
0
,
fee
=
"fee"
in
response
and
int
(
response
[
"fee"
])
or
0
,
no_tax_amt
=
"notaxAmt"
in
response
and
int
(
response
[
"notaxAmt"
])
or
0
,
...
...
@@ -605,7 +628,9 @@ def get_result(response, pay_method):
va
=
dict
(
vaacct_no
=
response
[
"vacctNo"
],
valid_date
=
response
[
"vacctValidDt"
],
valid_time
=
response
[
"vacctValidTm"
]
valid_time
=
response
[
"vacctValidTm"
],
deposit_date
=
"depositDt"
in
response
and
response
[
"depositDt"
]
or
""
,
deposit_time
=
"depositTm"
in
response
and
response
[
"depositTm"
]
or
""
,
)
))
else
:
...
...
@@ -625,16 +650,18 @@ def get_result(response, pay_method):
valid_date
=
"payValidDt"
in
response
and
response
[
"payValidDt"
]
or
""
,
valid_time
=
"payValidTm"
in
response
and
response
[
"payValidTm"
]
or
""
,
m_ref_no
=
"mRefNo"
in
response
and
response
[
"mRefNo"
]
or
""
,
receipt_code
=
"receiptCode"
in
response
and
response
[
"receiptCode"
]
or
""
receipt_code
=
"receiptCode"
in
response
and
response
[
"receiptCode"
]
or
""
,
deposit_date
=
"depositDt"
in
response
and
response
[
"depositDt"
]
or
""
,
deposit_time
=
"depositTm"
in
response
and
response
[
"depositTm"
]
or
""
,
)
if
pay_method
==
"03"
:
result
.
update
({
"cvs"
:
other
})
elif
pay_method
==
"04"
:
result
.
update
({
"cp"
:
other
})
elif
pay_method
==
"05"
:
result
.
update
({
"w
l
"
:
other
})
result
.
update
({
"w
allet
"
:
other
})
else
:
result
.
update
({
"
pl
"
:
other
})
result
.
update
({
"
loan
"
:
other
})
return
result
...
...
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