Commit 8eb6a40a by aa.gusti

add acc_no to payment request

1 parent a0d578ad
......@@ -5,34 +5,34 @@ from sqlalchemy import create_engine
from sqlalchemy.orm import (
sessionmaker,
scoped_session,
)
)
from zope.sqlalchemy import register
from pyramid.view import (
view_config,
notfound_view_config,
)
)
from pyramid.response import Response
from deform import (
Form,
Button,
ValidationFailure,
)
)
import colander
from opensipkd.string import (
FixLength,
FullDateTimeVar,
)
)
from opensipkd.iso8583.bjb.pbb.structure import INVOICE_PROFILE
from iso8583_web.scripts.tools import iso_to_dict
from iso8583_web.read_conf import web_path_conf
from iso8583_web.scripts.logger import (
log_web_info,
log_web_error,
)
)
from .. import (
WebJob as BaseWebJob,
View as BaseView,
)
)
from .exceptions import (
InvoiceIdError,
NeedPostError,
......@@ -45,18 +45,17 @@ from .exceptions import (
AmountError,
BillRefNotFound,
PaymentNotFound,
)
)
from .structure import (
DataRequest,
InquiryResponse,
PaymentResponse,
)
)
from .renderer import Renderer
from .models import (
Rpc,
Log,
)
)
ROUTE = 'linkaja'
RENDERER = 'csv'
......@@ -104,6 +103,9 @@ def get_inquiry(data):
DBSession = get_db_session()
bill_ref = int(data['bill_ref'])
q = DBSession.query(Rpc).filter_by(id=bill_ref)
# todo: Perlu ditambahkan data["acc_no"] sebagai filter untuk meningkatkan
# validasi data sehingga kesalahan akibat dari client mengubah acc_no
# dapat ditingkatkan.
return q.first()
......@@ -272,14 +274,14 @@ class View(BaseView):
inq = get_inquiry(data)
if not inq:
raise BillRefNotFound()
#ditambahkan karena harus sesuai dengan inq
# ditambahkan karena harus sesuai dengan inq
DBSession = get_db_session()
iso_log = DBSession.query(Log).\
filter(Log.rpc_id==inq.id,
iso_log = DBSession.query(Log). \
filter(Log.rpc_id == inq.id,
Log.bit_062 != None).first()
if not iso_log:
raise BillRefNotFound()
p['bits']={"62": iso_log.bit_062,
p['bits'] = {"62": iso_log.bit_062,
"37": "".join(['000000', iso_log.bit_011])}
else:
pay = get_payment(data)
......@@ -291,8 +293,8 @@ class View(BaseView):
if 'bits' not in p:
p['bits'] = {}
p['bits']['107']='LINKAJA'
p['bits']['49']='AGRATEK-LINKAJA'
p['bits']['107'] = 'LINKAJA'
p['bits']['49'] = 'AGRATEK-LINKAJA'
conn = self.get_connection()
method = get_method(data)
......
......@@ -14,21 +14,14 @@ from opensipkd.string import (
from .structure import INVOICE_PROFILE
from .structure import Transaksi
from .. import View as BaseView
# View as BaseView,
from ..linkaja import (
WebJob,
# View as BaseView,
is_inquiry, get_db_session, is_reversal, is_payment, get_method,
get_form, date_from_str, csv_method, get_template_response, get_inquiry, get_payment)
WebJob, is_inquiry, get_db_session, is_reversal, is_payment, get_method,
get_form, date_from_str, csv_method, get_template_response, get_inquiry,
get_payment)
from ..linkaja.exceptions import (
InvoiceIdError,
NeedPostError,
InternalError,
HostError,
AlreadyPaidError,
BaseError,
AmountError,
BillRefNotFound,
PaymentNotFound,
InvoiceIdError, NeedPostError, InternalError, HostError, AlreadyPaidError,
BaseError, AmountError, BillRefNotFound, PaymentNotFound,
)
from ..linkaja.models import (Rpc, LogSam)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!