Skip to content

Commit

Permalink
add flag to configured vtex app
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslinhares committed Jan 23, 2024
1 parent 9ef7f16 commit 9d9ce3c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def create(self, request, app_uuid, *args, **kwargs):
status=status.HTTP_400_BAD_REQUEST,
)

self._update_connected_catalog_flag(app)

credentials = {
"app_key": vtex_app.config.get("api_credentials", {}).get("app_key"),
"app_token": vtex_app.config.get("api_credentials", {}).get("app_token"),
Expand Down Expand Up @@ -178,6 +180,10 @@ def disable_catalog(self, request, *args, **kwargs):
)
return Response(status=status.HTTP_200_OK)

def _update_connected_catalog_flag(self, app) -> None:
app.config["connected_catalog"] = True
app.save()


class CommerceSettingsViewSet(BaseViewSet):
serializer_class = ToggleVisibilitySerializer
Expand Down
1 change: 1 addition & 0 deletions marketplace/services/vtex/generic_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def configure(self, app, credentials: APICredentials, wpp_cloud_uuid) -> App:
app.config["wpp_cloud_uuid"] = wpp_cloud_uuid
app.config["initial_sync_completed"] = False
app.config["title"] = credentials.domain
app.config["connected_catalog"] = False
app.config["rules"] = [
"exclude_alcoholic_drinks",
"calculate_by_weight",
Expand Down
1 change: 1 addition & 0 deletions marketplace/wpp_products/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def task_insert_vtex_products(**kwargs):
app_token=credentials.get("app_token"),
domain=credentials.get("domain"),
)

products = vtex_service.first_product_insert(api_credentials, catalog)
dict_catalog = {
"name": catalog.name,
Expand Down

0 comments on commit 9d9ce3c

Please sign in to comment.