Commit 4845cdfe by Owo Sugiana

Bug fixed saat --update-from-date

1 parent 8c663c07
......@@ -2,7 +2,10 @@ from datetime import timedelta
import requests
from sqlalchemy import func
import transaction
from opensipkd.waktu import dmyhms
from opensipkd.waktu import (
dmyhms,
as_timezone,
)
from opensipkd.string import FixLength
from sismiop.services.base import INVOICE_ID
from opensipkd.iso8583.bjb.pbb.structure import (
......@@ -131,13 +134,18 @@ class Handler:
elif pay['MTI'] == '0210':
q = self.query_payment(source)
old_pay = q.first()
if old_pay and old_pay.tgl_rekam_byr_sppt < pay['HDATE']:
q_old_payment = q
hdate = as_timezone(pay['HDATE'])
msg = f'INSERT {log_data}'
rpt = self.parent.report_orm(**source)
if old_pay:
if old_pay.tgl_rekam_byr_sppt < hdate:
q_old_payment = q
else:
msg = f'sudah ada yang baru di {hdate}'
rpt = None
invoice_id = pay['H61'].strip()
msg = f'Invoice ID {invoice_id} {msg}'
log_method = self.parent.log.info
e = self.parent.get_estimate(no)
log_method(f'#{no}/{self.parent.count} {msg}, estimate {e}')
msg = f'#{no}/{self.parent.count} {msg}, estimate {e}'
self.parent.log.info(msg)
self.save(pay, rpt, q_old_payment)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!