Jelajahi Sumber

send draft message to jabber

sayapinavalentina 1 tahun lalu
induk
melakukan
3e55ca6f94
2 mengubah file dengan 8 tambahan dan 4 penghapusan
  1. 5 4
      SharixAdmin/views/partner_info.py
  2. 3 0
      SharixAdmin/views/service_info.py

+ 5 - 4
SharixAdmin/views/partner_info.py

@@ -14,6 +14,10 @@ from core.config import API_URL
 api = AuthAPI("89855703300", "12345")
 import requests
 from django.urls import reverse_lazy
+from django.contrib.auth.hashers import check_password
+
+import xmpp
+from xmpp import cli
 
 class PartnerInformationCreate(UserPassesTestMixin, CreateView):
     model = Company
@@ -30,15 +34,12 @@ class PartnerInformationCreate(UserPassesTestMixin, CreateView):
             "title": "service_create",
             "note": str(form.data),
         }
-        
         resp = requests.post(f"{API_URL}/tickets/api/tickets/", data=new_ticket, headers=api.headers)
         jso = resp.json()
-        print(resp.content)
-        print(resp.json())
-        print(resp)
         form.instance.ticket_status = Task.objects.get(pk=int(jso['id']))
         print(form.cleaned_data)
         responce = super().form_valid(form)
+        cli.send_message("open_tickets_backend@ej.sharix-app.org", "eb177b1c9f99a7a13798928318d7a72c", "open_strequest_new@ej.sharix-app.org", str(jso))
         return responce
 
     def get_context_data(self, **kwargs):

+ 3 - 0
SharixAdmin/views/service_info.py

@@ -13,6 +13,8 @@ api = AuthAPI("89855703300", "12345")
 import requests
 from django.urls import reverse_lazy
 from datetime import timezone
+import xmpp
+from xmpp import cli
 
 class ServiceInformationCreate(UserPassesTestMixin, CreateView):
     model = Service
@@ -33,6 +35,7 @@ class ServiceInformationCreate(UserPassesTestMixin, CreateView):
         form.instance.ticket_status = Task.objects.get(pk=int(jso['id']))
         print(form.cleaned_data)
         responce = super().form_valid(form)
+        cli.send_message("open_tickets_backend@ej.sharix-app.org", "eb177b1c9f99a7a13798928318d7a72c", "open_strequest_new@ej.sharix-app.org", str(jso))
         return responce