def getTrxIDList(npm): db = va_parent.dbConnectVA() sql = f'SELECT trx_id FROM `upload` where trx_id LIKE "%-{npm}-%" and CURRENT_DATE < expired_date' with db: cur = db.cursor() cur.execute(sql) rows = cur.fetchall() if rows is not (): return rows else: return None
def getDataVaforMahasiswa(phonenumber): phonenumber = numbers.normalize(phonenumber) db = va_parent.dbConnectVA() sql = f"select virtual_account, customer_name, customer_email, customer_phone, trx_amount from upload where customer_phone='{phonenumber}' ORDER BY upload_id DESC LIMIT 1" with db: cur = db.cursor() cur.execute(sql) row = cur.fetchone() if row is not None: return row else: return None
def getDataPayment(npm): db = va_parent.dbConnectVA() sql = f"select * from payment_notification where trx_id='INV-SPP-{npm}-1-0920'" with db: cur = db.cursor() cur.execute(sql) data = cur.fetchone() if data != None: fields = map(lambda x: x[0], cur.description) result = dict(zip(fields, data)) else: result = None return result
def getDataPembayaran(trx_id): db = va_parent.dbConnectVA() sql = f'select * from payment_notification where trx_id="{trx_id}"' with db: cur = db.cursor() cur.execute(sql) row = cur.fetchone() if row is not None: fields = map(lambda x: x[0], cur.description) result = dict(zip(fields, row)) else: result = None return result
def getTrxIdFromUpload(npm): db = va_parent.dbConnectVA() sql = f"select * from upload where trx_id like '%INV-%' and trx_id like '%-SPP-%' and trx_id like '%-{npm}-%' and expired_date > CURRENT_DATE" with db: cur = db.cursor() cur.execute(sql) data = cur.fetchone() if data != None: fields = map(lambda x: x[0], cur.description) result = dict(zip(fields, data)) else: result = None return result
def getULANG(npm): db=va_parent.dbConnectVA() sql=f"SELECT * FROM `upload` where trx_id like '%-ULANG-%{npm}%' order by upload_id desc limit 1" with db: cur=db.cursor() cur.execute(sql) data=cur.fetchone() if data != None: fields = map(lambda x: x[0], cur.description) result = dict(zip(fields, data)) else: result = None return result
def getDataPayment(npm): db = va_parent.dbConnectVA() data_upload = getTrxIdFromUpload(npm) trx_id = data_upload['trx_id'] sql = f"select * from payment_notification where trx_id = '{trx_id}'" with db: cur = db.cursor() cur.execute(sql) data = cur.fetchone() if data != None: fields = map(lambda x: x[0], cur.description) result = dict(zip(fields, data)) else: result = None return result