-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransverses_structures.go
180 lines (149 loc) · 6.71 KB
/
transverses_structures.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
package choruspro
import (
"context"
"net/http"
)
// ListeStructuresActivesResponse est la structure de données représentant
// la réponse de la méthode RecupererStructuresActives.
type ListeStructuresActivesResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Structures []StructureActive `json:"listeStructures"`
}
// StructureActive est la structure de données représentant
// une structure active.
type StructureActive struct {
Designation string `json:"designationStructure"`
IdCPP int64 `json:"idStructureCPP"`
Identifiant string `json:"identifiant"`
}
// La méthode RecupererStructuresActivesFactureTravaux permet de
// récupérer la liste des structures actives auxquelles un utilisateur
// est rattaché et habilité à l'espace "factures de travaux".
func (s *TransversesService) RecupererStructuresActivesFactureTravaux(ctx context.Context) (*ListeStructuresActivesResponse, error) {
opts := struct{}{}
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/recuperer/structures/actives/facturetravaux", opts)
if err != nil {
return nil, err
}
res := new(ListeStructuresActivesResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}
// La méthode RecupererStructuresActivesFournisseur permet de récupérer
// la liste des structures actives auxquelles un utilisateur est rattaché
// et habilité à l’espace "factures émises".
func (s *TransversesService) RecupererStructuresActivesFournisseur(ctx context.Context) (*ListeStructuresActivesResponse, error) {
opts := struct{}{}
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/recuperer/structures/actives/fournisseur", opts)
if err != nil {
return nil, err
}
res := new(ListeStructuresActivesResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}
// La méthode RecupererStructuresActivesDestinataire permet de récupérer
// la liste des structures actives auxquelles un utilisateur est rattaché et
// habilité à l'espace "factures reçues".
func (s *TransversesService) RecupererStructuresActivesDestinataire(ctx context.Context) (*ListeStructuresActivesResponse, error) {
opts := struct{}{}
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/recuperer/structures/actives/destinataire", opts)
if err != nil {
return nil, err
}
res := new(ListeStructuresActivesResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}
// InformationsSIRETResponse est la structure de données représentant
// la réponse de la méthode ConsulterInformationsSIRET.
type InformationsSIRETResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Adresse string `json:"adresse,omitempty"`
CategorieEntreprise string `json:"categorieEntreprise,omitempty"`
CategorieJuridique string `json:"categorieJuridique,omitempty"`
Civilite string `json:"civilite,omitempty"`
DateCreationEntreprise string `json:"dateCreationEntreprise,omitempty"`
DateCreationEtablissement string `json:"dateCreationEtablissement,omitempty"`
DateReactivationEtablissement string `json:"dateReactivationEtablissement,omitempty"`
EstActif bool `json:"estActif,omitempty"`
LocalisationSiege string `json:"localisationSiege,omitempty"`
NonDiffusibleInsee bool `json:"nonDiffusibleInsee,omitempty"`
NumeroInterneClassement string `json:"numeroInterneClassement,omitempty"`
RaisonSociale string `json:"raisonSociale,omitempty"`
Siege string `json:"siege,omitempty"`
Siren string `json:"siren,omitempty"`
Siret string `json:"siret,omitempty"`
SiretPredecesseurSuccesseur string `json:"siretPredecesseurSuccesseur,omitempty"`
}
// ConsulterInformationsSIRETOptions est la structure de données utilisée
// pour appeler la méthode ConsulterInformationsSIRET.
type ConsulterInformationsSIRETOptions struct {
Siret string `json:"siretStructure"`
}
// La méthode ConsulterInformationsSIRET permet de récupérer les données
// de la structure de type SIRET correspondant aux paramètres dans le
// référentiel de l'INSEE (service exposé ne fonctionnant pas sur
// l'espace de qualification).
func (s *TransversesService) ConsulterInformationsSIRET(ctx context.Context, opts ConsulterInformationsSIRETOptions) (*InformationsSIRETResponse, error) {
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/consulter/information/siret", opts)
if err != nil {
return nil, err
}
res := new(InformationsSIRETResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}
// ListeDestinatairesResponse est la structure de données représentant
// la réponse de la méthode RechercherDestinataires.
type ListeDestinatairesResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Destinataires []DestinataireRecherche `json:"listeDestinataires"`
Pagination PaginationResponse `json:"parametresRetour"`
}
// DestinataireRecherche est la structure de données représentant
// un destinataire de la liste des destinataires.
type DestinataireRecherche struct {
IdStructureCPP int64 `json:"idStructureCPP"`
Siret string `json:"siret"`
Nom string `json:"nomDestinataire,omitempty"`
AdresseCodePostal string `json:"adresseCodePostal,omitempty"`
AdresseVille string `json:"adresseVille,omitempty"`
}
// ListeDestinatairesOptions est la structure de données utilisée
// pour appeler la méthode RechercherDestinataires.
type ListeDestinatairesOptions struct {
Identifiant string `json:"identifiant,omitempty"`
NomVilleCodePostal string `json:"nomVilleCodePostal,omitempty"`
TypeStructure string `json:"typeStructure,omitempty"`
Pagination *PaginationOptions `json:"parametresRecherche,omitempty"`
}
// La méthode RechercherDestinataires permet de rechercher les
// informations légales d'une structure publique.
func (s *TransversesService) RechercherDestinataires(ctx context.Context, opts ListeDestinatairesOptions) (*ListeDestinatairesResponse, error) {
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/rechercher/destinataire", opts)
if err != nil {
return nil, err
}
res := new(ListeDestinatairesResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}