bank updated

This commit is contained in:
2024-12-02 11:40:51 +03:00
parent a4fd52c28a
commit 665d961be8
26 changed files with 335 additions and 253 deletions

View File

@@ -1,5 +1,3 @@
class Config:
# IP_ADDRESS: str = "http://10.10.2.46:41575/internal/isbank/retreive"
SERVICE_TIMING: int = 900 # 15 min

View File

@@ -62,6 +62,7 @@ def sender_service():
def is_bank_retrieve_account_records(bank_data):
from databases import AccountRecords
from api_library.date_time_actions.date_functions import system_arrow
data_bulk = json.loads(bank_data)
new_record_list = []
@@ -70,7 +71,7 @@ def is_bank_retrieve_account_records(bank_data):
data_dict["bank_balance"] = data_dict.pop("balance")
data_dict["import_file_name"] = str(data_keys)
data_dict = BankReceive(**data_dict).model_dump()
bank_date = system_arrow.get(str(data_dict['bank_date']))
bank_date = system_arrow.get(str(data_dict["bank_date"]))
data_dict["bank_date_w"] = bank_date.weekday()
data_dict["bank_date_m"] = bank_date.month
data_dict["bank_date_d"] = bank_date.day
@@ -84,12 +85,12 @@ def is_bank_retrieve_account_records(bank_data):
AccountRecords.bank_balance == data_dict["bank_balance"],
system=True,
).data:
print('already @database record', found_record.id)
print("already @database record", found_record.id)
else:
new_account_record = AccountRecords.find_or_create(**data_dict)
new_account_record.save_and_confirm()
new_record_list.append(new_account_record.get_dict())
print('new_account_record is created', new_account_record.id)
print("new_account_record is created", new_account_record.id)
return new_record_list if new_record_list else []

View File

@@ -8,20 +8,26 @@ from isbank_sender import sender_service
if __name__ == "__main__":
print("Bank service booted...")
# while True:
# try:
reader_service()
time.sleep(1)
parser_service()
time.sleep(1)
sender_service()
time.sleep(1)
try:
reader_service()
time.sleep(1)
except Exception as e:
err = e
print("Reader Service : ", err)
try:
parser_service()
time.sleep(1)
except Exception as e:
err = e
print("Reader Service : ", err)
try:
sender_service()
time.sleep(1)
except Exception as e:
err = e
print("Reader Service : ", err)
print(
datetime.datetime.now().__str__(),
" : system completed a cycle without error...",
)
# except Exception as e:
# err = e
# print('Raised Error :', err)
# time.sleep(int(Config.SERVICE_TIMING or 900))
# time.sleep(10)
print("Bank service is completed...")

View File

@@ -17,6 +17,8 @@ COPY ../api_objects ./service_app_banks/api_objects
COPY ../api_validations ./service_app_banks/api_validations
#COPY ../service_app_banks/crontab_list /service_app_banks/crontab_to_write
WORKDIR /service_app_banks
RUN apt-get update && apt-get install -y cron
# 11:00 Istanbul Time (UTC+3) system time is 08:00 UTC