Ë
    „l)j¯  ã                   óT  — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 ddl
mZmZ  G d„ d	e«      Z G d
„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zy )!z®
Vues API de facade vers les endpoints DGI.

Ce module expose plusieurs endpoints de relais ou de test pour les operations
fiscales et les consultations de referentiels DGI.
é    )Úrender)ÚAPIView)ÚResponse)ÚstatusÚpermissionsé   )Ú
EdefClientÚEdefClientErrorc                   ó6   — e Zd ZdZej
                  gZd„ Zd„ Zy)ÚInvoiceRootViewuˆ   
    GET  -> statut du service de facturation e-MCF (proxy /api/invoice/)
    POST -> crÃ©er une facture (proxy POST /api/invoice/)
    c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY w©z2Traite la requete HTTP GET pour ce point d'entree.Údetail©r   N)r	   Úget_invoice_statusr   r
   Ústrr   ÚHTTP_502_BAD_GATEWAY©ÚselfÚrequestÚclientÚdataÚes        ú'/var/www/faccontrol_acokin/dgi/views.pyÚgetzInvoiceRootView.get   óW   € ô “ˆð	TØ×,Ñ,Ó.ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túó   Œ' §	A °%AÁA ÁA c                 ó   — t        «       }|j                  }	 |j                  |«      }t        |t        j
                  ¬«      S # t        $ r0}t        dt        |«      it        j                  ¬«      cY d}~S d}~ww xY w)z3Traite la requete HTTP POST pour ce point d'entree.r   r   N)	r	   r   Úcreate_invoicer   r   ÚHTTP_201_CREATEDr
   r   r   )r   r   r   Úpayloadr   r   s         r   ÚpostzInvoiceRootView.post(   sk   € ô “ˆØ—,‘,ˆð	TØ×(Ñ(¨Ó1ˆDÜ˜D¬×)@Ñ)@ÔAÐAøÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Tús   ˜+A Á	A=Á%A8Á2A=Á8A=N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚIsAuthenticatedÚpermission_classesr   r"   © ó    r   r   r      s$   „ ñð &×5Ñ5Ð6ÐòTó	Tr*   r   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInvoiceDetailViewuN   
    GET -> rÃ©cupÃ©rer une facture en attente (proxy /api/invoice/{uid})
    c                 óÈ   — t        «       }	 |j                  |«      }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úget_invoicer   r
   r   r   r   ©r   r   Úuidr   r   r   s         r   r   zInvoiceDetailView.get:   sY   € ô “ˆð	TØ×%Ñ% cÓ*ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túó   Œ( ¨	A!±%AÁA!ÁA!N©r#   r$   r%   r&   r   r'   r(   r   r)   r*   r   r,   r,   4   ó   „ ñð &×5Ñ5Ð6ÐóTr*   r,   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInvoiceConfirmViewz�
    PUT -> confirmer une facture (proxy /api/invoice/{uid}/CONFIRM)
    Body attendu:
    {
      "total": ...,
      "vtotal": ...
    }
    c                 óâ   — t        «       }|j                  }	 |j                  ||«      }t        |«      S # t        $ r0}t        dt        |«      it        j                  ¬«      cY d}~S d}~ww xY w©z2Traite la requete HTTP PUT pour ce point d'entree.r   r   N)r	   r   Úconfirm_invoicer   r
   r   r   r   )r   r   r0   r   r!   r   r   s          r   ÚputzInvoiceConfirmView.putP   sd   € ô “ˆØ—,‘,ˆð	TØ×)Ñ)¨#¨wÓ7ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Tús   ˜5 µ	A.¾%A)Á#A.Á)A.N©r#   r$   r%   r&   r   r'   r(   r9   r)   r*   r   r5   r5   E   s   „ ñð &×5Ñ5Ð6Ðó	Tr*   r5   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInvoiceCancelViewzQ
    PUT -> annuler une facture en attente (proxy /api/invoice/{uid}/CANCEL)
    c                 óÈ   — t        «       }	 |j                  |«      }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr7   )r	   Úcancel_invoicer   r
   r   r   r   r/   s         r   r9   zInvoiceCancelView.putb   sY   € ô “ˆð	TØ×(Ñ(¨Ó-ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túr1   Nr:   r)   r*   r   r<   r<   \   r3   r*   r<   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoStatusViewz#Genere la vue dediee a info status.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_statusr   r
   r   r   r   r   s        r   r   zInfoStatusView.gett   sW   € ô “ˆð	TØ×%Ñ%Ó'ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túr   Nr2   r)   r*   r   r@   r@   o   s   „ Ù-à%×5Ñ5Ð6ÐóTr*   r@   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoTaxGroupsViewz'Genere la vue dediee a info tax groups.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_tax_groupsr   r
   r   r   r   r   s        r   r   zInfoTaxGroupsView.get„   óW   € ô “ˆð	TØ×)Ñ)Ó+ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túr   Nr2   r)   r*   r   rD   rD      ó   „ Ù1à%×5Ñ5Ð6ÐóTr*   rD   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoInvoiceTypesViewz*Genere la vue dediee a info invoice types.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_invoice_typesr   r
   r   r   r   r   s        r   r   zInfoInvoiceTypesView.get”   r   r   Nr2   r)   r*   r   rJ   rJ   �   ó   „ Ù4à%×5Ñ5Ð6ÐóTr*   rJ   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoPaymentTypesViewz*Genere la vue dediee a info payment types.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_payment_typesr   r
   r   r   r   r   s        r   r   zInfoPaymentTypesView.get¤   r   r   Nr2   r)   r*   r   rO   rO   Ÿ   rM   r*   rO   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoClientTypesViewz)Genere la vue dediee a info client types.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_client_typesr   r
   r   r   r   r   s        r   r   zInfoClientTypesView.get´   sW   € ô “ˆð	TØ×+Ñ+Ó-ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túr   Nr2   r)   r*   r   rS   rS   ¯   s   „ Ù3à%×5Ñ5Ð6ÐóTr*   rS   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoReferenceTypesViewz,Genere la vue dediee a info reference types.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_reference_typesr   r
   r   r   r   r   s        r   r   zInfoReferenceTypesView.getÄ   sW   € ô “ˆð	TØ×.Ñ.Ó0ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túr   Nr2   r)   r*   r   rW   rW   ¿   s   „ Ù6à%×5Ñ5Ð6ÐóTr*   rW   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoItemTypesViewz'Genere la vue dediee a info item types.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_item_typesr   r
   r   r   r   r   s        r   r   zInfoItemTypesView.getÔ   rG   r   Nr2   r)   r*   r   r[   r[   Ï   rH   r*   r[   c                   ó0   — e Zd ZdZej
                  gZd„ Zy)ÚInfoCurrencyRatesViewz+Genere la vue dediee a info currency rates.c                 óÆ   — t        «       }	 |j                  «       }t        |«      S # t        $ r0}t        dt	        |«      it
        j                  ¬«      cY d}~S d}~ww xY wr   )r	   Úinfo_currency_ratesr   r
   r   r   r   r   s        r   r   zInfoCurrencyRatesView.getä   sW   € ô “ˆð	TØ×-Ñ-Ó/ˆDÜ˜D“>Ð!øÜò 	TÜ˜X¤s¨1£vÐ.´v×7RÑ7RÔSÕSûð	Túr   Nr2   r)   r*   r   r_   r_   ß   s   „ Ù5à%×5Ñ5Ð6ÐóTr*   r_   N)r&   Údjango.shortcutsr   Úrest_framework.viewsr   Úrest_framework.responser   Úrest_frameworkr   r   Úedef_clientr	   r
   r   r,   r5   r<   r@   rD   rJ   rO   rS   rW   r[   r_   r)   r*   r   ú<module>rg      sÅ   ðñõ $õ )Ý ,ß .ç 4ôT�gô Tô:T˜ô Tô"T˜ô Tô.T˜ô Tô&T�Wô Tô T˜ô Tô T˜7ô Tô T˜7ô Tô T˜'ô Tô T˜Wô Tô T˜ô Tô T˜Gõ Tr*   