Skip to content

Commit

Permalink
Revert "feat: POST to integrations settings API on onboarding complet…
Browse files Browse the repository at this point in the history
…ion (#123)" (#126)

This reverts commit 427bd54.
  • Loading branch information
JustARatherRidiculouslyLongUsername committed Jan 31, 2025
1 parent 57c525c commit 20dc0c1
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apps/fyle/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def post_request(url, body, refresh_token=None):
data=json.dumps(body)
)

if response.status_code in (200, 201):
if response.status_code == 200:
return json.loads(response.text)
else:
raise Exception(response.text)
Expand Down
3 changes: 1 addition & 2 deletions apps/workspaces/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
from typing import Dict
from rest_framework import serializers
from apps.workspaces.tasks import post_to_integration_settings
from django_q.tasks import async_task
from django.core.cache import cache
from apps.mappings.models import QBDMapping
Expand Down Expand Up @@ -226,5 +225,5 @@ def create(self, validated_data):
workspace.onboarding_state = 'COMPLETE'
workspace.save()
async_task('apps.workspaces.tasks.async_create_admin_subcriptions', workspace_id)
post_to_integration_settings(workspace_id, True)

return advanced_setting
23 changes: 0 additions & 23 deletions apps/workspaces/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,3 @@ def async_update_timestamp_in_qbd_direct(workspace_id: int) -> None:
raise Exception('Auth Token not present for workspace id {}'.format(workspace.id))
except Exception as e:
logger.error("Failed to sync timestamp to QBD Connector: {}".format(e))


def post_to_integration_settings(workspace_id: int, active: bool):
"""
Post to integration settings
"""
refresh_token = FyleCredential.objects.get(workspace_id=workspace_id).refresh_token
url = '{}/integrations/'.format(settings.INTEGRATIONS_SETTINGS_API)
payload = {
'tpa_id': settings.FYLE_CLIENT_ID,
'tpa_name': 'Fyle Quickbooks Desktop (IIF) Integration',
'type': 'ACCOUNTING',
'is_active': active,
'connected_at': datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%fZ')
}

try:
post_request(url, json.dumps(payload), refresh_token)
org_id = Workspace.objects.get(id=workspace_id).org_id
logger.info(f'New integration record: Fyle Quickbooks Desktop (IIF) Integration (ACCOUNTING) | {workspace_id = } | {org_id = }')

except Exception as error:
logger.error(error)
1 change: 0 additions & 1 deletion quickbooks_desktop_api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@
FYLE_TOKEN_URI = os.environ.get('FYLE_TOKEN_URI')
FYLE_CLIENT_ID = os.environ.get('FYLE_CLIENT_ID')
FYLE_CLIENT_SECRET = os.environ.get('FYLE_CLIENT_SECRET')
INTEGRATIONS_SETTINGS_API = os.environ.get('INTEGRATIONS_SETTINGS_API')

QBD_DIRECT_API_URL = os.environ.get('QBD_DIRECT_API_URL')

Expand Down
1 change: 0 additions & 1 deletion quickbooks_desktop_api/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@
FYLE_TOKEN_URI = os.environ.get('FYLE_TOKEN_URI')
FYLE_CLIENT_ID = os.environ.get('FYLE_CLIENT_ID')
FYLE_CLIENT_SECRET = os.environ.get('FYLE_CLIENT_SECRET')
INTEGRATIONS_SETTINGS_API = os.environ.get('INTEGRATIONS_SETTINGS_API')

QBD_DIRECT_API_URL = os.environ.get('QBD_DIRECT_API_URL')

Expand Down

0 comments on commit 20dc0c1

Please sign in to comment.