Skip to content

Commit

Permalink
Duplicate vendor exists, Platform connector error resolved (#417)
Browse files Browse the repository at this point in the history
* Duplicate vendor exists, Platform connector error resolved

* Sentry errors resolved

---------

Co-authored-by: Ashwin Thanaraj <[email protected]>
  • Loading branch information
ruuushhh and ashwin1111 authored Apr 27, 2023
1 parent cc2482f commit fc40089
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/fyle/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django_q.tasks import async_task

from fyle_integrations_platform_connector import PlatformConnector
from fyle.platform.exceptions import InvalidTokenError as FyleInvalidTokenError

from apps.workspaces.models import FyleCredential, Workspace, WorkspaceGeneralSettings
from apps.tasks.models import TaskLog
Expand Down Expand Up @@ -197,5 +198,8 @@ def async_create_expense_groups(workspace_id: int, fund_source: List[str], task_


def sync_dimensions(fyle_credentials):
platform = PlatformConnector(fyle_credentials)
platform.import_fyle_dimensions(import_taxes=True)
try:
platform = PlatformConnector(fyle_credentials)
platform.import_fyle_dimensions(import_taxes=True)
except FyleInvalidTokenError:
logger.info('Invalid Token for fyle')
2 changes: 2 additions & 0 deletions apps/mappings/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,8 @@ def auto_create_expense_fields_mappings(
'Error while creating %s workspace_id - %s in Fyle %s %s',
fyle_attribute_type, workspace_id, exception.message, {'error': exception.response}
)
except FyleInvalidTokenError:
logger.info('Invalid Token for fyle')
except Exception:
error = traceback.format_exc()
error = {
Expand Down
4 changes: 4 additions & 0 deletions apps/quickbooks_online/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ def post_vendor(self, vendor_name: str, email: str):
"""
currency = Workspace.objects.get(id=self.workspace_id).fyle_currency

vendor_name = vendor_name.replace("'", "\\'") # Replacing ' with \\'
vendor_name = vendor_name.replace('#', '%23') # Replace '#' with %23
vendor_name = vendor_name.replace('&', '%26') # Replace '&' with %26

vendor = {
'GivenName': vendor_name.split(' ')[0] if email else None,
'FamilyName': (
Expand Down

0 comments on commit fc40089

Please sign in to comment.