Commit f89c092d by Owo Sugiana

Bug fixed penggunaan pyramid_linkaja

1 parent caa7ba2d
......@@ -221,7 +221,7 @@ class RequestHandler(BaseRequestHandler, CommonConnection):
def run(self):
try:
BaseRequestHandler.run(self)
except:
except Exception:
self.log_unknown()
......@@ -287,7 +287,7 @@ class Client(BaseClient, CommonConnection):
def run(self):
try:
BaseClient.run(self)
except:
except Exception:
self.log_unknown()
......@@ -337,7 +337,7 @@ class Parser(Log):
self.log_decode(from_iso)
try:
iso = self.connection.job.process(from_iso)
except:
except Exception:
self.log_unknown()
self.running = False
return
......@@ -349,7 +349,7 @@ class Parser(Log):
if for_host:
try:
self.send_iso_for_host(iso)
except:
except Exception:
self.log_unknown()
else:
self.send(iso)
......@@ -376,7 +376,7 @@ class Parser(Log):
try:
iso.continue_response(from_iso)
ok = True
except:
except Exception:
self.log_unknown()
ok = False
if ok:
......
......@@ -24,7 +24,7 @@ from iso8583_web.scripts.logger import (
log_web_info,
log_web_error,
)
from .. import (
from . import (
WebJob as BaseWebJob,
View as BaseView,
)
......@@ -42,15 +42,20 @@ from pyramid_linkaja.exceptions import (
PaymentNotFound,
LinkError,
)
from pyramid_linkaja.response import (
from pyramid_linkaja.responses import (
InquiryResponse,
PaymentResponse,
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'
RENDERER = 'csv'
conf = dict()
......@@ -178,7 +183,8 @@ class View(BaseView):
profile = FixLength(INVOICE_PROFILE)
profile.set_raw(iso_data[62])
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')
if iso_data.get(47):
web_data['Transaction ID'] = row.ntp = iso_data[47] # NTP
......@@ -283,7 +289,7 @@ def view_exception(exc, request):
r['Response Code'] = exc.code
r['Notification Message'] = exc.message
prefix = log_prefix(request)
msg = '{} {} {}'.format(prefix, 'Send', r)
msg = f'{prefix} Send {r}'
log_web_error(msg)
response = Response(str(r))
response.status_int = 200
......
......@@ -36,7 +36,6 @@ def error(s):
sys.exit()
def log_info(s):
t = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
t = t[:-3]
......@@ -143,7 +142,8 @@ def show_durations():
if key_fastest != key_slowest:
log_info('Tercepat {}'.format(messages[key_fastest]))
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)
......
......@@ -8,7 +8,7 @@ from time import (
)
from threading import Thread
from argparse import ArgumentParser
from .views.linkaja.structure import (
from pyramid_linkaja.responses import (
InquiryResponse,
PaymentResponse,
)
......@@ -159,7 +159,8 @@ def show_durations():
if tid_fastest != tid_slowest:
log_info('Tercepat {}'.format(messages[tid_fastest]))
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)
......
......@@ -34,7 +34,7 @@ requires = [
'opensipkd-base @ git+https://git.opensipkd.com/sugiana/opensipkd-base.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/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!