Commit a0d578ad by aa.gusti

data

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