-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransverses_etats.go
84 lines (69 loc) · 2.97 KB
/
transverses_etats.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
package choruspro
import (
"context"
"net/http"
)
// ListeEtatsTypeDemandePaiementResponse est la structure de données représentant
// la réponse de la méthode RecupererEtatParTypeDemandePaiement.
type ListeEtatsTypeDemandePaiementResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Etats []EtatTypeDemandePaiement `json:"listeEtatDemandePaiement"`
}
// EtatTypeDemandePaiement est la structure de données représentant
// un état de demande de paiement.
type EtatTypeDemandePaiement struct {
Etat string `json:"etatDemandePaiement"`
}
// ListeEtatsTypeDemandePaiementOptions est la structure de données utlisée
// pour appeler la méthode RecupererEtatParTypeDemandePaiement.
type ListeEtatsTypeDemandePaiementOptions struct {
TypeDemandePaiement string `json:"typeDemandePaiement,omitempty"`
}
// La méthode recupererEtatParTypeDemandePaiement permet de récupérer
// l'ensemble des statuts pouvant s'appliquer à une demande de paiement
// en fonction du type de demande de paiement.
func (s *TransversesService) RecupererEtatParTypeDemandePaiement(ctx context.Context, opts ListeEtatsTypeDemandePaiementOptions) (*ListeEtatsTypeDemandePaiementResponse, error) {
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/recuperer/etat/typedp", opts)
if err != nil {
return nil, err
}
res := new(ListeEtatsTypeDemandePaiementResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}
// ListeEtatsTraitementResponse est la structure de données représentant
// la réponse de la méthode RecupererEtatsPossiblesPourTraitement.
type ListeEtatsTraitementResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Etats []EtatTraitement `json:"listeStatutsPossiblesPourTraitement"`
}
// EtatTraitement est la structure de données représentant
// le statut possible pour le traitement d'une facture.
type EtatTraitement struct {
Etat string `json:"statutPossiblePourTraitement"`
}
// ListeEtatsTraitementOptions est la structure de données utlisée
// pour appeler la méthode RecupererEtatsPossiblesPourTraitement.
type ListeEtatsTraitementOptions struct {
EtatCourant string `json:"statutCourant"`
}
// La méthode RecupererEtatsPossiblesPourTraitement permet de récupérer
// la liste des statuts pouvant être renseignés par un destinataire souhaitant
// traiter une facture en fonction du statut actuel de la demande de paiement.
func (s *TransversesService) RecupererEtatsPossiblesPourTraitement(ctx context.Context, opts ListeEtatsTraitementOptions) (*ListeEtatsTraitementResponse, error) {
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/transverses/v1/recuperer/etats/traitement", opts)
if err != nil {
return nil, err
}
res := new(ListeEtatsTraitementResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}