Commit a0d578ad by aa.gusti

data

1 parent ab930151
...@@ -99,6 +99,5 @@ class LogSam(Base): ...@@ -99,6 +99,5 @@ class LogSam(Base):
conf_name = Column(String(16), nullable=False) conf_name = Column(String(16), nullable=False)
message = Column(JSON) message = Column(JSON)
mti = Column(String(4), nullable=False) mti = Column(String(4), nullable=False)
bit_003 = Column(String(6)) # Processing Code bit_003 = Column(String(6)) # Processing Code
bit_062_data = Column(JSON) bit_062_data = Column(JSON)
\ No newline at end of file \ No newline at end of file
...@@ -164,7 +164,7 @@ class View(BaseView): ...@@ -164,7 +164,7 @@ class View(BaseView):
iso_req.send() iso_req.send()
if type(iso_req.response) != dict: if type(iso_req.response) != dict:
raise BaseError raise BaseError
iso_req.data = iso_req.response
return self.after_send_iso(data, inq, pay, row, iso_req) return self.after_send_iso(data, inq, pay, row, iso_req)
@csv_method(route_name=ROUTE) @csv_method(route_name=ROUTE)
...@@ -173,6 +173,7 @@ class View(BaseView): ...@@ -173,6 +173,7 @@ class View(BaseView):
if not self.request.POST: if not self.request.POST:
self.log_receive('GET {}'.format(self.request.GET)) self.log_receive('GET {}'.format(self.request.GET))
raise NeedPostError() raise NeedPostError()
items = self.request.POST.items() items = self.request.POST.items()
self.log_receive('POST {}'.format(dict(items))) self.log_receive('POST {}'.format(dict(items)))
items = self.request.POST.items() items = self.request.POST.items()
......
...@@ -72,28 +72,22 @@ PAY_REQ = \ ...@@ -72,28 +72,22 @@ PAY_REQ = \
def send_data(json_data, conf): def send_data(json_data, conf):
#settings = get_settings() # settings = get_settings()
#pload = {'username': 'olivia', 'password': '123'} # pload = {'username': 'olivia', 'password': '123'}
bjb_sam_url = "bjb_sam_url" in conf and conf["bjb_sam_url"] or \ bjb_sam_url = "bjb_sam_url" in conf and conf["bjb_sam_url"] or \
"http://localhost:7001/bjb/sambat/test" "http://localhost:7001/bjb/sambat/test"
data = json_data data = json_data
# todo butuh server buat testing json sementara pake static response # todo butuh server buat testing json sementara pake static response
if json_data["processingCode"] == '321000': if json_data["processingCode"] == '321000':
bjb_sam_url+="/inquiryPaymentRest" bjb_sam_url += "/inquiryPaymentRest"
# return INQ_RESP
elif json_data["processingCode"] == '521000': elif json_data["processingCode"] == '521000':
bjb_sam_url+="/paymentRest" bjb_sam_url += "/paymentRest"
# return PAY_RESP log_web_info(json.dumps(data))
#data=json.dumps(data)
log_web_info(data)
r = requests.post(bjb_sam_url, json=data) r = requests.post(bjb_sam_url, json=data)
if r: if r:
log_web_info(r.text) log_web_info(r.text)
#log_web_info(r.code) # log_web_info(r.json())
log_web_info(r.json)
if r.text: if r.text:
try: try:
return r.json() return r.json()
...@@ -114,14 +108,13 @@ class Transaksi(object): ...@@ -114,14 +108,13 @@ class Transaksi(object):
elif method == "payment": # data Inq ada (berarti payment) elif method == "payment": # data Inq ada (berarti payment)
db_session = get_db_session() db_session = get_db_session()
pay = db_session.query(LogSam).filter_by(rpc_id=inq.id, mti="0200", bit_003='521000').first() pay = db_session.query(LogSam).filter_by(rpc_id=inq.id, mti="0200", bit_003='521000').first()
if pay: if pay:
pay = db_session.query(LogSam).filter_by(rpc_id=inq.id, mti="0210", bit_003='521000').first() pay = db_session.query(LogSam).filter_by(rpc_id=inq.id, mti="0210", bit_003='521000').first()
if pay: if pay:
raise AlreadyPaidError() raise AlreadyPaidError()
inq = db_session.query(LogSam).filter_by(rpc_id=inq.id, mti="0200", bit_003='321000').first() inq = db_session.query(LogSam).filter_by(rpc_id=inq.id, mti="0210", bit_003='321000').first()
if not inq: if not inq:
raise BillRefNotFound() raise BillRefNotFound()
...@@ -132,7 +125,7 @@ class Transaksi(object): ...@@ -132,7 +125,7 @@ class Transaksi(object):
else: else:
self.mti = "0200" self.mti = "0200"
self.data = INQ_REQ.copy() self.data = INQ_REQ.copy()
#self.data["systemTraceAuditNumber"] = "880977" # self.data["systemTraceAuditNumber"] = "880977"
self.data["caCode"] = "ca_code" in conf and conf["ca_code"] or "123456" self.data["caCode"] = "ca_code" in conf and conf["ca_code"] or "123456"
self.data["processingCode"] = "321000" self.data["processingCode"] = "321000"
self.data["billInformation"]["bills"][0]["info"] = p["invoice_id"] self.data["billInformation"]["bills"][0]["info"] = p["invoice_id"]
...@@ -151,6 +144,7 @@ class Transaksi(object): ...@@ -151,6 +144,7 @@ class Transaksi(object):
self.response = send_data(self.data, self.conf) self.response = send_data(self.data, self.conf)
self.mti = self.mti == "0200" and "0210" or "0410" self.mti = self.mti == "0200" and "0210" or "0410"
INVOICE_PROFILE = [ INVOICE_PROFILE = [
("NOMOR BAYAR", 16, "N"), ("NOMOR BAYAR", 16, "N"),
("NOMOR RANGKA", 25), ("NOMOR RANGKA", 25),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!