Skip to content

Commit

Permalink
add new filds that comes from integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslinhares committed Mar 4, 2024
1 parent ba80ce2 commit aafdd48
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
3 changes: 2 additions & 1 deletion temba/request_logs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def create_from_integrations_response(
url,
response,
status_code,
request,
classifier=None,
channel=None,
ticketer=None,
Expand All @@ -163,7 +164,7 @@ def create_from_integrations_response(
org=org,
log_type=log_type,
url=url,
request=response,
request=request,
response=response,
is_error=is_error,
created_on=timezone.now(),
Expand Down
8 changes: 4 additions & 4 deletions temba/templates/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ def partial_update(self, request, pk):
if waba_id:
HTTPLog.create_from_integrations_response(
HTTPLog.WHATSAPP_TEMPLATES_SYNCED,
f"https://graph.facebook.com/v16.0/{waba_id}/message_templates",
request,
request.data.get("status_code"),
request.data.get("url"),
request.data.get("request"),
200,
request.data.get("response"),
channel=channel,
request_time=request.data.get("request_time"),
)
update_local_templates(channel, request.data.get("data"))
return Response(status=status.HTTP_200_OK)
19 changes: 9 additions & 10 deletions temba/wpp_products/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ def update_catalog(
):
channel = get_object_or_404(Channel, uuid=pk, is_active=True)
if request.data:
wa_business_id = channel.config.get("wa_business_id", None)
if wa_business_id:
HTTPLog.create_from_integrations_response(
HTTPLog.WHATSAPP_CATALOGS_SYNCED,
f"https://graph.facebook.com/v16.0/{wa_business_id}/owned_product_catalogs",
request,
request.data.get("status_code"),
channel=channel,
request_time=request.data.get("request_time"),
)
HTTPLog.create_from_integrations_response(
HTTPLog.WHATSAPP_CATALOGS_SYNCED,
request.data.get("urls"),
request.data.get("responses"),
200,
request.data.get("requests"),
channel=channel,
)

update_local_catalogs(channel, request.data.get("data"))
return Response(status=status.HTTP_200_OK)

0 comments on commit aafdd48

Please sign in to comment.