252 lines
7.9 KiB
Python
252 lines
7.9 KiB
Python
import arrow
|
|
|
|
from service_app_test.bases import RequestToApi
|
|
from service_app_test.api_configs import LocalAPI, BothAPIS
|
|
from service_app_test.test_application.evyos.decision_book import (
|
|
run_decision_book_depends, list_decision_books,
|
|
)
|
|
from service_app_test.test_application.evyos.decision_book_items import (
|
|
send_invitation_to_building_residents,
|
|
collect_invitation_to_building_residents,
|
|
assign_people_to_pre_or_wrt, run_decision_book_items,
|
|
)
|
|
from service_app_test.test_application.migrate_old_data.get_type_codes import get_type_codes_key_and_class
|
|
from service_app_test.test_application.migrate_old_data.people import migrate_people
|
|
from service_app_test.test_application.migrate_old_data.building import (
|
|
migrate_build,
|
|
migrate_build_living_space,
|
|
)
|
|
from service_app_test.test_application.migrate_old_data.company import migrate_company
|
|
from service_app_test.test_application.migrate_old_data.accounts import (
|
|
migrate_account_records,
|
|
)
|
|
|
|
|
|
password_token = ""
|
|
login_data = {
|
|
"domain": "evyos.com.tr",
|
|
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
|
"password": "string",
|
|
"remember_me": False,
|
|
"password_token": password_token,
|
|
}
|
|
login_creds_employee = {
|
|
"domain": "evyos.com.tr",
|
|
"access_key": "karatay.berkay.sup@evyos.com.tr",
|
|
"password": "string",
|
|
"remember_me": False,
|
|
"password_token": password_token,
|
|
}
|
|
access_key_president = "mehmet.karatay@hotmail.com"
|
|
login_creds_occupant = {
|
|
"domain": "evyos.com.tr",
|
|
"access_key": access_key_president,
|
|
"password": "string",
|
|
"remember_me": False,
|
|
"password_token": ""
|
|
}
|
|
wrt_creds_occupant = {
|
|
"domain": "evyos.com.tr",
|
|
"access_key": access_key_president,
|
|
"password": "string",
|
|
"remember_me": False,
|
|
"password_token": "",
|
|
}
|
|
|
|
# wag_api = RequestToApi()
|
|
# wag_api.overwrite_base_url(base_url=WagAPI.base_url)
|
|
# wag_api.selected_object = wag_api.login_via_email_and_password(
|
|
# login_data=login_data_wag, is_password_valid=True
|
|
# )
|
|
|
|
local_api = RequestToApi()
|
|
local_api.overwrite_base_url(base_url=LocalAPI.base_url)
|
|
|
|
|
|
both_apis = BothAPIS()
|
|
# both_apis.wag_api = wag_api
|
|
both_apis.local_api = local_api
|
|
|
|
assign_people_to_create_item = -1
|
|
|
|
# selection_list = None
|
|
selection_list = [
|
|
|
|
]
|
|
# selection_list = None
|
|
manager_token = ""
|
|
writers_token = manager_token
|
|
people_uu_id_list = [
|
|
# "af411e80-29ad-4540-9e74-3c805700f461",
|
|
# "af411e80-29ad-4540-9e74-3c805700f461",
|
|
# "af411e80-29ad-4540-9e74-3c805700f461",
|
|
]
|
|
list_of_attendees = [
|
|
|
|
]
|
|
living_space_data = dict(
|
|
build_parts_uu_id="",
|
|
person_uu_id="",
|
|
occupant_type_uu_id="",
|
|
expiry_starts=arrow.now().date().__str__(),
|
|
)
|
|
|
|
|
|
if assign_people_to_create_item == -1:
|
|
local_api.selected_object = local_api.login_via_email_and_password(
|
|
login_data=login_data, is_password_valid=False
|
|
)
|
|
migrate_company(requester=both_apis)
|
|
migrate_people(requester=both_apis)
|
|
migrate_build(requester=both_apis)
|
|
migrate_build_living_space(requester=both_apis)
|
|
# migrate_account_records(requester=both_apis)
|
|
|
|
|
|
if assign_people_to_create_item == 0:
|
|
if not bool(selection_list):
|
|
local_api.selected_object = local_api.login_via_email_and_password(
|
|
login_data=login_data, is_password_valid=True
|
|
)
|
|
response = local_api.post(endpoint="/building/living_space/create", data=living_space_data)
|
|
print('response', response.text)
|
|
|
|
local_api.selected_object = local_api.login_via_email_and_password(
|
|
login_data=login_creds_occupant,
|
|
is_password_valid=bool(selection_list),
|
|
selection_list=selection_list,
|
|
)
|
|
selected_decision_book_uu_id = run_decision_book_depends(
|
|
requester=both_apis.local_api
|
|
)
|
|
send_invitation = {
|
|
"build_decision_book_uu_id": selected_decision_book_uu_id,
|
|
"message": "Request for a Regular Building Meeting",
|
|
"planned_date": arrow.now().shift(days=2).date().__str__(),
|
|
}
|
|
send_invitation_to_building_residents(
|
|
send_invitation_dict=send_invitation, requester=both_apis.local_api
|
|
)
|
|
elif assign_people_to_create_item == 1:
|
|
local_api.selected_object = local_api.login_via_email_and_password(
|
|
login_data=login_creds_occupant,
|
|
is_password_valid=True,
|
|
selection_list=selection_list,
|
|
)
|
|
count = 7
|
|
list_of_attendees.insert(0, manager_token)
|
|
collect_invitation_to_building_residents(
|
|
attended_dict_list=list_of_attendees,
|
|
attend_count=count + 1,
|
|
requester=both_apis.local_api,
|
|
)
|
|
elif assign_people_to_create_item == 2:
|
|
local_api.selected_object = local_api.login_via_email_and_password(
|
|
login_data=login_creds_occupant,
|
|
is_password_valid=True,
|
|
selection_list=selection_list,
|
|
)
|
|
assign_people_to_pre_or_wrt(
|
|
person_uu_id=people_uu_id_list[0],
|
|
manager_token=manager_token,
|
|
occupant_code="MT-VPR",
|
|
requester=both_apis.local_api,
|
|
)
|
|
assign_people_to_pre_or_wrt(
|
|
person_uu_id=people_uu_id_list[1],
|
|
manager_token=manager_token,
|
|
occupant_code="MT-WRT",
|
|
requester=both_apis.local_api,
|
|
)
|
|
assign_people_to_pre_or_wrt(
|
|
person_uu_id=people_uu_id_list[2],
|
|
manager_token=manager_token,
|
|
occupant_code="MT-PRS",
|
|
requester=both_apis.local_api,
|
|
)
|
|
elif assign_people_to_create_item == 3:
|
|
local_api.selected_object = local_api.login_via_email_and_password(
|
|
login_data=wrt_creds_occupant,
|
|
is_password_valid=True,
|
|
selection_list=selection_list,
|
|
)
|
|
|
|
"""
|
|
|
|
"""
|
|
debit_type_uu_id = ""
|
|
|
|
selected_decision_book_uu_id = list_decision_books(requester=both_apis.local_api)["data"][0]["uu_id"]
|
|
print("select_company_uu_id", local_api.selected_object)
|
|
is_fixed_price = False
|
|
|
|
info_type_d_uu_id = get_type_codes_key_and_class(
|
|
class_name="BuildDuesTypes", key_name="BDT-D", requester=both_apis.local_api
|
|
)["data"]["uu_id"]
|
|
unit_price = 15.90
|
|
run_decision_book_items(
|
|
writers_token=writers_token,
|
|
unit_price=unit_price,
|
|
is_fixed=is_fixed_price,
|
|
info_type_uu_id=info_type_d_uu_id,
|
|
requester=both_apis.local_api
|
|
)
|
|
is_fixed_price = True
|
|
|
|
info_type_a_uu_id = get_type_codes_key_and_class(
|
|
class_name="BuildDuesTypes", key_name="BDT-A", requester=both_apis.local_api
|
|
)["data"]["uu_id"]
|
|
start_date, end_date = "2024-11-01", "2025-02-01"
|
|
unit_price = 850
|
|
run_decision_book_items(
|
|
writers_token=writers_token,
|
|
unit_price=unit_price,
|
|
is_fixed=is_fixed_price,
|
|
info_type_uu_id=info_type_a_uu_id,
|
|
start_date=start_date,
|
|
end_date=end_date,
|
|
requester=both_apis.local_api
|
|
)
|
|
|
|
info_type_a_uu_id = get_type_codes_key_and_class(
|
|
class_name="BuildDuesTypes", key_name="BDT-R", requester=both_apis.local_api
|
|
)["data"]["uu_id"]
|
|
unit_price = 5000
|
|
run_decision_book_items(
|
|
writers_token=writers_token,
|
|
unit_price=unit_price,
|
|
is_fixed=is_fixed_price,
|
|
info_type_uu_id=info_type_a_uu_id,
|
|
start_date=start_date,
|
|
end_date=end_date,
|
|
requester=both_apis.local_api
|
|
)
|
|
|
|
info_type_a_uu_id = get_type_codes_key_and_class(
|
|
class_name="BuildDuesTypes", key_name="BDT-R", requester=both_apis.local_api
|
|
)["data"]["uu_id"]
|
|
unit_price = 2000
|
|
run_decision_book_items(
|
|
writers_token=writers_token,
|
|
unit_price=unit_price,
|
|
is_fixed=is_fixed_price,
|
|
info_type_uu_id=info_type_a_uu_id,
|
|
start_date=start_date,
|
|
end_date=end_date,
|
|
requester=both_apis.local_api
|
|
)
|
|
|
|
info_type_a_uu_id = get_type_codes_key_and_class(
|
|
class_name="BuildDuesTypes", key_name="BDT-L", requester=both_apis.local_api
|
|
)["data"]["uu_id"]
|
|
unit_price = 750
|
|
run_decision_book_items(
|
|
writers_token=writers_token,
|
|
unit_price=unit_price,
|
|
is_fixed=is_fixed_price,
|
|
info_type_uu_id=info_type_a_uu_id,
|
|
start_date=start_date,
|
|
end_date=end_date,
|
|
requester=both_apis.local_api
|
|
)
|