Commit f89c092d by Owo Sugiana

Bug fixed penggunaan pyramid_linkaja

1 parent caa7ba2d
...@@ -221,7 +221,7 @@ class RequestHandler(BaseRequestHandler, CommonConnection): ...@@ -221,7 +221,7 @@ class RequestHandler(BaseRequestHandler, CommonConnection):
def run(self): def run(self):
try: try:
BaseRequestHandler.run(self) BaseRequestHandler.run(self)
except: except Exception:
self.log_unknown() self.log_unknown()
...@@ -287,7 +287,7 @@ class Client(BaseClient, CommonConnection): ...@@ -287,7 +287,7 @@ class Client(BaseClient, CommonConnection):
def run(self): def run(self):
try: try:
BaseClient.run(self) BaseClient.run(self)
except: except Exception:
self.log_unknown() self.log_unknown()
...@@ -337,7 +337,7 @@ class Parser(Log): ...@@ -337,7 +337,7 @@ class Parser(Log):
self.log_decode(from_iso) self.log_decode(from_iso)
try: try:
iso = self.connection.job.process(from_iso) iso = self.connection.job.process(from_iso)
except: except Exception:
self.log_unknown() self.log_unknown()
self.running = False self.running = False
return return
...@@ -349,7 +349,7 @@ class Parser(Log): ...@@ -349,7 +349,7 @@ class Parser(Log):
if for_host: if for_host:
try: try:
self.send_iso_for_host(iso) self.send_iso_for_host(iso)
except: except Exception:
self.log_unknown() self.log_unknown()
else: else:
self.send(iso) self.send(iso)
...@@ -376,7 +376,7 @@ class Parser(Log): ...@@ -376,7 +376,7 @@ class Parser(Log):
try: try:
iso.continue_response(from_iso) iso.continue_response(from_iso)
ok = True ok = True
except: except Exception:
self.log_unknown() self.log_unknown()
ok = False ok = False
if ok: if ok:
......
...@@ -24,7 +24,7 @@ from iso8583_web.scripts.logger import ( ...@@ -24,7 +24,7 @@ from iso8583_web.scripts.logger import (
log_web_info, log_web_info,
log_web_error, log_web_error,
) )
from .. import ( from . import (
WebJob as BaseWebJob, WebJob as BaseWebJob,
View as BaseView, View as BaseView,
) )
...@@ -42,15 +42,20 @@ from pyramid_linkaja.exceptions import ( ...@@ -42,15 +42,20 @@ from pyramid_linkaja.exceptions import (
PaymentNotFound, PaymentNotFound,
LinkError, LinkError,
) )
from pyramid_linkaja.response import ( from pyramid_linkaja.responses import (
InquiryResponse, InquiryResponse,
PaymentResponse, PaymentResponse,
get_trx_date, get_trx_date,
is_inquiry,
is_payment,
is_reversal,
) )
from pyramid_linkaja.decorator import csv_method
from pyramid_linkaja.structure import RENDERER
from pyramid_linkaja.form import get_form
ROUTE = 'linkaja' ROUTE = 'linkaja'
RENDERER = 'csv'
conf = dict() conf = dict()
...@@ -178,7 +183,8 @@ class View(BaseView): ...@@ -178,7 +183,8 @@ class View(BaseView):
profile = FixLength(INVOICE_PROFILE) profile = FixLength(INVOICE_PROFILE)
profile.set_raw(iso_data[62]) profile.set_raw(iso_data[62])
iso_log.bit_062_data = profile.to_dict() iso_log.bit_062_data = profile.to_dict()
web_data['Biller Name'] = row.biller_name = profile2name(profile) web_data['Biller Name'] = row.biller_name = \
profile2name(profile)
web_data['Bill Amount'] = iso_data[4].lstrip('0') web_data['Bill Amount'] = iso_data[4].lstrip('0')
if iso_data.get(47): if iso_data.get(47):
web_data['Transaction ID'] = row.ntp = iso_data[47] # NTP web_data['Transaction ID'] = row.ntp = iso_data[47] # NTP
...@@ -283,7 +289,7 @@ def view_exception(exc, request): ...@@ -283,7 +289,7 @@ def view_exception(exc, request):
r['Response Code'] = exc.code r['Response Code'] = exc.code
r['Notification Message'] = exc.message r['Notification Message'] = exc.message
prefix = log_prefix(request) prefix = log_prefix(request)
msg = '{} {} {}'.format(prefix, 'Send', r) msg = f'{prefix} Send {r}'
log_web_error(msg) log_web_error(msg)
response = Response(str(r)) response = Response(str(r))
response.status_int = 200 response.status_int = 200
......
...@@ -36,7 +36,6 @@ def error(s): ...@@ -36,7 +36,6 @@ def error(s):
sys.exit() sys.exit()
def log_info(s): def log_info(s):
t = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') t = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
t = t[:-3] t = t[:-3]
...@@ -143,7 +142,8 @@ def show_durations(): ...@@ -143,7 +142,8 @@ def show_durations():
if key_fastest != key_slowest: if key_fastest != key_slowest:
log_info('Tercepat {}'.format(messages[key_fastest])) log_info('Tercepat {}'.format(messages[key_fastest]))
log_info('Terlama {}'.format(messages[key_slowest])) log_info('Terlama {}'.format(messages[key_slowest]))
log_info('Rerata {} detik / request'.format(total_duration/len(durations))) log_info('Rerata {} detik / request'.format(
total_duration/len(durations)))
show_errors(errors) show_errors(errors)
......
...@@ -8,7 +8,7 @@ from time import ( ...@@ -8,7 +8,7 @@ from time import (
) )
from threading import Thread from threading import Thread
from argparse import ArgumentParser from argparse import ArgumentParser
from .views.linkaja.structure import ( from pyramid_linkaja.responses import (
InquiryResponse, InquiryResponse,
PaymentResponse, PaymentResponse,
) )
...@@ -159,7 +159,8 @@ def show_durations(): ...@@ -159,7 +159,8 @@ def show_durations():
if tid_fastest != tid_slowest: if tid_fastest != tid_slowest:
log_info('Tercepat {}'.format(messages[tid_fastest])) log_info('Tercepat {}'.format(messages[tid_fastest]))
log_info('Terlama {}'.format(messages[tid_slowest])) log_info('Terlama {}'.format(messages[tid_slowest]))
log_info('Rerata {} detik / request'.format(total_duration/len(durations))) log_info('Rerata {} detik / request'.format(
total_duration/len(durations)))
show_errors(errors) show_errors(errors)
......
...@@ -34,7 +34,7 @@ requires = [ ...@@ -34,7 +34,7 @@ requires = [
'opensipkd-base @ git+https://git.opensipkd.com/sugiana/opensipkd-base.git', 'opensipkd-base @ git+https://git.opensipkd.com/sugiana/opensipkd-base.git',
'opensipkd-iso8583 @ git+https://git.opensipkd.com/sugiana/opensipkd-iso8583.git', 'opensipkd-iso8583 @ git+https://git.opensipkd.com/sugiana/opensipkd-iso8583.git',
'opensipkd-hitung @ git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git', 'opensipkd-hitung @ git+https://git.opensipkd.com/sugiana/opensipkd-hitung.git',
'opensipkd-hitung @ git+https://git.opensipkd.com/sugiana/pyramid-linkaja.git', 'pyramid-linkaja @ git+https://git.opensipkd.com/sugiana/pyramid-linkaja.git',
] ]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!