Commit 8eb6a40a by aa.gusti

add acc_no to payment request

1 parent a0d578ad
...@@ -5,34 +5,34 @@ from sqlalchemy import create_engine ...@@ -5,34 +5,34 @@ from sqlalchemy import create_engine
from sqlalchemy.orm import ( from sqlalchemy.orm import (
sessionmaker, sessionmaker,
scoped_session, scoped_session,
) )
from zope.sqlalchemy import register from zope.sqlalchemy import register
from pyramid.view import ( from pyramid.view import (
view_config, view_config,
notfound_view_config, notfound_view_config,
) )
from pyramid.response import Response from pyramid.response import Response
from deform import ( from deform import (
Form, Form,
Button, Button,
ValidationFailure, ValidationFailure,
) )
import colander import colander
from opensipkd.string import ( from opensipkd.string import (
FixLength, FixLength,
FullDateTimeVar, FullDateTimeVar,
) )
from opensipkd.iso8583.bjb.pbb.structure import INVOICE_PROFILE from opensipkd.iso8583.bjb.pbb.structure import INVOICE_PROFILE
from iso8583_web.scripts.tools import iso_to_dict from iso8583_web.scripts.tools import iso_to_dict
from iso8583_web.read_conf import web_path_conf from iso8583_web.read_conf import web_path_conf
from iso8583_web.scripts.logger import ( 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,
) )
from .exceptions import ( from .exceptions import (
InvoiceIdError, InvoiceIdError,
NeedPostError, NeedPostError,
...@@ -45,18 +45,17 @@ from .exceptions import ( ...@@ -45,18 +45,17 @@ from .exceptions import (
AmountError, AmountError,
BillRefNotFound, BillRefNotFound,
PaymentNotFound, PaymentNotFound,
) )
from .structure import ( from .structure import (
DataRequest, DataRequest,
InquiryResponse, InquiryResponse,
PaymentResponse, PaymentResponse,
) )
from .renderer import Renderer from .renderer import Renderer
from .models import ( from .models import (
Rpc, Rpc,
Log, Log,
) )
ROUTE = 'linkaja' ROUTE = 'linkaja'
RENDERER = 'csv' RENDERER = 'csv'
...@@ -104,6 +103,9 @@ def get_inquiry(data): ...@@ -104,6 +103,9 @@ def get_inquiry(data):
DBSession = get_db_session() DBSession = get_db_session()
bill_ref = int(data['bill_ref']) bill_ref = int(data['bill_ref'])
q = DBSession.query(Rpc).filter_by(id=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() return q.first()
...@@ -272,14 +274,14 @@ class View(BaseView): ...@@ -272,14 +274,14 @@ class View(BaseView):
inq = get_inquiry(data) inq = get_inquiry(data)
if not inq: if not inq:
raise BillRefNotFound() raise BillRefNotFound()
#ditambahkan karena harus sesuai dengan inq # ditambahkan karena harus sesuai dengan inq
DBSession = get_db_session() DBSession = get_db_session()
iso_log = DBSession.query(Log).\ iso_log = DBSession.query(Log). \
filter(Log.rpc_id==inq.id, filter(Log.rpc_id == inq.id,
Log.bit_062 != None).first() Log.bit_062 != None).first()
if not iso_log: if not iso_log:
raise BillRefNotFound() raise BillRefNotFound()
p['bits']={"62": iso_log.bit_062, p['bits'] = {"62": iso_log.bit_062,
"37": "".join(['000000', iso_log.bit_011])} "37": "".join(['000000', iso_log.bit_011])}
else: else:
pay = get_payment(data) pay = get_payment(data)
...@@ -291,8 +293,8 @@ class View(BaseView): ...@@ -291,8 +293,8 @@ class View(BaseView):
if 'bits' not in p: if 'bits' not in p:
p['bits'] = {} p['bits'] = {}
p['bits']['107']='LINKAJA' p['bits']['107'] = 'LINKAJA'
p['bits']['49']='AGRATEK-LINKAJA' p['bits']['49'] = 'AGRATEK-LINKAJA'
conn = self.get_connection() conn = self.get_connection()
method = get_method(data) method = get_method(data)
......
...@@ -14,21 +14,14 @@ from opensipkd.string import ( ...@@ -14,21 +14,14 @@ from opensipkd.string import (
from .structure import INVOICE_PROFILE from .structure import INVOICE_PROFILE
from .structure import Transaksi from .structure import Transaksi
from .. import View as BaseView from .. import View as BaseView
# View as BaseView,
from ..linkaja import ( from ..linkaja import (
WebJob, WebJob, is_inquiry, get_db_session, is_reversal, is_payment, get_method,
# View as BaseView, get_form, date_from_str, csv_method, get_template_response, get_inquiry,
is_inquiry, get_db_session, is_reversal, is_payment, get_method, get_payment)
get_form, date_from_str, csv_method, get_template_response, get_inquiry, get_payment)
from ..linkaja.exceptions import ( from ..linkaja.exceptions import (
InvoiceIdError, InvoiceIdError, NeedPostError, InternalError, HostError, AlreadyPaidError,
NeedPostError, BaseError, AmountError, BillRefNotFound, PaymentNotFound,
InternalError,
HostError,
AlreadyPaidError,
BaseError,
AmountError,
BillRefNotFound,
PaymentNotFound,
) )
from ..linkaja.models import (Rpc, LogSam) 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!