diff --git a/assets/travelperk.zip b/assets/travelperk.zip index 4c383975..6aed51d3 100644 Binary files a/assets/travelperk.zip and b/assets/travelperk.zip differ diff --git a/scripts/update_recipe_for_all_customers.py b/scripts/update_recipe_for_all_customers.py deleted file mode 100644 index f67810a5..00000000 --- a/scripts/update_recipe_for_all_customers.py +++ /dev/null @@ -1,51 +0,0 @@ -from apps.orgs.actions import post_package -from apps.orgs.models import Org -from apps.travelperk.models import TravelPerk, TravelPerkConfiguration -from workato import Workato - - - -def get_all_managed_user(): - org_ids = Org.objects.values_list('id', flat=True) - return org_ids - - -def post_package_to_workato(): - connector = Workato() - org_ids = get_all_managed_user() - count=0 - for org_id in org_ids: - org = Org.objects.get(id=org_id) - managed_user = None - try: - managed_user = connector.managed_users.get_by_id(org.fyle_org_id) - except: - print("managed user not found") - if org.managed_user_id and managed_user: - travelperk = TravelPerk.objects.filter(org_id = org_id).first() - if travelperk: - travelperk_conf = TravelPerkConfiguration.objects.filter(org_id=org_id).first() - if travelperk_conf.is_recipe_enabled: - try: - connector.recipes.post(org.managed_user_id, travelperk_conf.recipe_id, None, 'stop') - except: - print("recipe not found") - try: - package = post_package( - org_id=org_id, - folder_id=travelperk.folder_id, - package_path='assets/travelperk.zip' - ) - except: - print("package not posted") - travelperk.package_id = package['id'] - travelperk.save() - if travelperk_conf.is_recipe_enabled: - try: - connector.recipes.post(org.managed_user_id, travelperk_conf.recipe_id, None, 'start') - except: - print("recipe not found") - count +=1 - print(org.name, count) - return "Success" - return "No Orgs Found"