Skip to content

Commit 9c7403a

Browse files
Revert "feat: POST to integrations settings API on onboarding completion (#123)"
This reverts commit 427bd54.
1 parent 4b783a2 commit 9c7403a

File tree

5 files changed

+2
-28
lines changed

5 files changed

+2
-28
lines changed

apps/fyle/helpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def post_request(url, body, refresh_token=None):
2828
data=json.dumps(body)
2929
)
3030

31-
if response.status_code in (200, 201):
31+
if response.status_code == 200:
3232
return json.loads(response.text)
3333
else:
3434
raise Exception(response.text)

apps/workspaces/serializers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44
from typing import Dict
55
from rest_framework import serializers
6-
from apps.workspaces.tasks import post_to_integration_settings
76
from django_q.tasks import async_task
87
from django.core.cache import cache
98
from apps.mappings.models import QBDMapping
@@ -226,5 +225,5 @@ def create(self, validated_data):
226225
workspace.onboarding_state = 'COMPLETE'
227226
workspace.save()
228227
async_task('apps.workspaces.tasks.async_create_admin_subcriptions', workspace_id)
229-
post_to_integration_settings(workspace_id, True)
228+
230229
return advanced_setting

apps/workspaces/tasks.py

-23
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,3 @@ def async_update_timestamp_in_qbd_direct(workspace_id: int) -> None:
170170
raise Exception('Auth Token not present for workspace id {}'.format(workspace.id))
171171
except Exception as e:
172172
logger.error("Failed to sync timestamp to QBD Connector: {}".format(e))
173-
174-
175-
def post_to_integration_settings(workspace_id: int, active: bool):
176-
"""
177-
Post to integration settings
178-
"""
179-
refresh_token = FyleCredential.objects.get(workspace_id=workspace_id).refresh_token
180-
url = '{}/integrations/'.format(settings.INTEGRATIONS_SETTINGS_API)
181-
payload = {
182-
'tpa_id': settings.FYLE_CLIENT_ID,
183-
'tpa_name': 'Fyle Quickbooks Desktop (IIF) Integration',
184-
'type': 'ACCOUNTING',
185-
'is_active': active,
186-
'connected_at': datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%fZ')
187-
}
188-
189-
try:
190-
post_request(url, json.dumps(payload), refresh_token)
191-
org_id = Workspace.objects.get(id=workspace_id).org_id
192-
logger.info(f'New integration record: Fyle Quickbooks Desktop (IIF) Integration (ACCOUNTING) | {workspace_id = } | {org_id = }')
193-
194-
except Exception as error:
195-
logger.error(error)

quickbooks_desktop_api/settings.py

-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@
268268
FYLE_TOKEN_URI = os.environ.get('FYLE_TOKEN_URI')
269269
FYLE_CLIENT_ID = os.environ.get('FYLE_CLIENT_ID')
270270
FYLE_CLIENT_SECRET = os.environ.get('FYLE_CLIENT_SECRET')
271-
INTEGRATIONS_SETTINGS_API = os.environ.get('INTEGRATIONS_SETTINGS_API')
272271

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

quickbooks_desktop_api/tests/settings.py

-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@
246246
FYLE_TOKEN_URI = os.environ.get('FYLE_TOKEN_URI')
247247
FYLE_CLIENT_ID = os.environ.get('FYLE_CLIENT_ID')
248248
FYLE_CLIENT_SECRET = os.environ.get('FYLE_CLIENT_SECRET')
249-
INTEGRATIONS_SETTINGS_API = os.environ.get('INTEGRATIONS_SETTINGS_API')
250249

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

0 commit comments

Comments
 (0)