def create_payment(self, inq): pay, urutan = self.sismiop_create_payment(inq) d = pay.to_dict() prefix_ntp = '' for fieldname in PREFIX_NTP_FIELDS: prefix_ntp += d[fieldname] or '00' ntp = self.query.create_ntp(prefix_ntp) iso_pay = models.Payment(id=ntp) iso_pay.inquiry_id = inq.id iso_pay.propinsi = inq.propinsi iso_pay.kabupaten = inq.kabupaten iso_pay.kecamatan = inq.kecamatan iso_pay.kelurahan = inq.kelurahan iso_pay.blok = inq.blok iso_pay.urut = inq.urut iso_pay.jenis = inq.jenis iso_pay.tahun = inq.tahun iso_pay.ke = urutan iso_pay.kd_kanwil_bank = pay.kd_kanwil iso_pay.kd_kppbb_bank = pay.kd_kantor iso_pay.kd_bank_tunggal = '00' iso_pay.kd_bank_persepsi = '00' iso_pay.kd_tp = pay.kd_tp iso_pay.channel = self.parent.from_iso.get_channel() iso_pay.ntb = self.parent.from_iso.get_ntb() iso_pay.iso_request = self.parent.from_iso.raw DBSession.add(iso_pay) DBSession.flush() self.parent.set_ntp(ntp)
def save(): print('{line} -> {ip} {forwarder} {is_send} {mti} {bits}'.format( line=r_log.line, ip=ip, forwarder=forwarder, is_send=is_send, mti=mti, bits=bits)) r_iso = Iso() r_iso.id = conf.nilai_int = r_log.id r_iso.tgl = r_log.tgl r_iso.jenis_id = r_log.jenis_id r_iso.kategori_id = r_log.kategori_id r_iso.ip = ip r_iso.forwarder = forwarder r_iso.is_send = is_send r_iso.mti = mti for key in bits: value = bits[key] n = str(key).zfill(3) fieldname = 'bit_{n}'.format(n=n) setattr(r_iso, fieldname, value) DBSession.add(r_iso) conf.updated = create_now() DBSession.add(conf) try: DBSession.flush() except IntegrityError as err: s_err = str(err) if s_err.find('duplicate key') > -1: print(' sudah ada') DBSession.rollback() else: raise (err) DBSession.commit()
def create_payment(self, inq): pay, urutan = self.sismiop_create_payment(inq) d = pay.to_dict() prefix_ntp = '' for fieldname in PREFIX_NTP_FIELDS: prefix_ntp += d[fieldname] or '00' ntp = query.create_ntp(prefix_ntp) iso_pay = models.Payment(id=ntp) iso_pay.inquiry_id = inq.id iso_pay.propinsi = inq.propinsi iso_pay.kabupaten = inq.kabupaten iso_pay.kecamatan = inq.kecamatan iso_pay.kelurahan = inq.kelurahan iso_pay.blok = inq.blok iso_pay.urut = inq.urut iso_pay.jenis = inq.jenis iso_pay.tahun = inq.tahun iso_pay.ke = urutan iso_pay.kd_kanwil_bank = pay.kd_kanwil iso_pay.kd_kppbb_bank = pay.kd_kantor iso_pay.kd_bank_tunggal = '00' iso_pay.kd_bank_persepsi = '00' iso_pay.kd_tp = pay.kd_tp #iso_pay.channel = self.parent.from_iso.get_channel() iso_pay.ntb = self.parent.from_iso.get_ntb() iso_pay.iso_request = self.parent.from_iso.raw DBSession.add(iso_pay) DBSession.flush() self.set_ntp(ntp)
def save(): print('{line} -> {ip} {forwarder} {is_send} {mti} {bits}'.format( line=r_log.line, ip=ip, forwarder=forwarder, is_send=is_send, mti=mti, bits=bits)) r_iso = Iso() r_iso.id = conf.nilai_int = r_log.id r_iso.tgl = r_log.tgl r_iso.jenis_id = r_log.jenis_id r_iso.kategori_id = r_log.kategori_id r_iso.ip = ip r_iso.forwarder = forwarder r_iso.is_send = is_send r_iso.mti = mti for key in bits: value = bits[key] n = str(key).zfill(3) fieldname = 'bit_{n}'.format(n=n) setattr(r_iso, fieldname, value) DBSession.add(r_iso) conf.updated = create_now() DBSession.add(conf) try: DBSession.flush() except IntegrityError as err: s_err = str(err) if s_err.find('duplicate key') > -1: print(' sudah ada') DBSession.rollback() else: raise(err) DBSession.commit()
def save(): if not line_id: return s = '\n'.join(lines) print([s]) row = Log() row.jenis_id = jenis_id row.line = s row.line_id = line_id row.tgl = waktu row.kategori_id = KATEGORI.index(kategori) DBSession.add(row) try: DBSession.flush() except IntegrityError as err: s_err = str(err) if s_err.find(duplicate_key_message) > -1: print(' sudah ada') DBSession.rollback() else: raise (err) DBSession.commit()
def save_conf(): conf.nilai_int = r_iso.id conf.updated = create_now() DBSession.add(conf) DBSession.flush() DBSession.commit()