propre
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,14 @@
|
||||
package dev.lions.unionflow.server.api.dto.base;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* Classe de base pour tous les DTOs UnionFlow
|
||||
* Fournit les propriétés communes d'audit et de gestion
|
||||
* Classe de base pour tous les DTOs UnionFlow Fournit les propriétés communes d'audit et de gestion
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
@@ -20,141 +18,143 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public abstract class BaseDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Identifiant unique UUID
|
||||
*/
|
||||
private UUID id;
|
||||
/** Identifiant unique UUID */
|
||||
private UUID id;
|
||||
|
||||
/**
|
||||
* Date de création de l'enregistrement
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateCreation;
|
||||
/** Date de création de l'enregistrement */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
/**
|
||||
* Date de dernière modification
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateModification;
|
||||
/** Date de dernière modification */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
/**
|
||||
* Utilisateur qui a créé l'enregistrement
|
||||
*/
|
||||
private String creePar;
|
||||
/** Utilisateur qui a créé l'enregistrement */
|
||||
private String creePar;
|
||||
|
||||
/**
|
||||
* Utilisateur qui a modifié l'enregistrement en dernier
|
||||
*/
|
||||
private String modifiePar;
|
||||
/** Utilisateur qui a modifié l'enregistrement en dernier */
|
||||
private String modifiePar;
|
||||
|
||||
/**
|
||||
* Version pour gestion de la concurrence optimiste
|
||||
*/
|
||||
private Long version;
|
||||
/** Version pour gestion de la concurrence optimiste */
|
||||
private Long version;
|
||||
|
||||
/**
|
||||
* Indicateur si l'enregistrement est actif
|
||||
*/
|
||||
private Boolean actif;
|
||||
/** Indicateur si l'enregistrement est actif */
|
||||
private Boolean actif;
|
||||
|
||||
// Constructeur par défaut
|
||||
public BaseDTO() {
|
||||
this.id = UUID.randomUUID();
|
||||
this.dateCreation = LocalDateTime.now();
|
||||
this.actif = true;
|
||||
this.version = 0L;
|
||||
// Constructeur par défaut
|
||||
public BaseDTO() {
|
||||
this.id = UUID.randomUUID();
|
||||
this.dateCreation = LocalDateTime.now();
|
||||
this.actif = true;
|
||||
this.version = 0L;
|
||||
}
|
||||
|
||||
// Getters et Setters générés automatiquement par Lombok @Getter/@Setter
|
||||
|
||||
// Méthodes utilitaires
|
||||
|
||||
/**
|
||||
* Marque l'entité comme nouvellement créée
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui crée l'entité
|
||||
*/
|
||||
public void marquerCommeNouveau(String utilisateur) {
|
||||
LocalDateTime maintenant = LocalDateTime.now();
|
||||
this.dateCreation = maintenant;
|
||||
this.dateModification = maintenant;
|
||||
this.creePar = utilisateur;
|
||||
this.modifiePar = utilisateur;
|
||||
this.version = 0L;
|
||||
this.actif = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marque l'entité comme modifiée
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui modifie l'entité
|
||||
*/
|
||||
public void marquerCommeModifie(String utilisateur) {
|
||||
this.dateModification = LocalDateTime.now();
|
||||
this.modifiePar = utilisateur;
|
||||
if (this.version != null) {
|
||||
this.version++;
|
||||
}
|
||||
}
|
||||
|
||||
// Getters et Setters générés automatiquement par Lombok @Getter/@Setter
|
||||
/**
|
||||
* Désactive l'entité (soft delete)
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui désactive l'entité
|
||||
*/
|
||||
public void desactiver(String utilisateur) {
|
||||
this.actif = false;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
/**
|
||||
* Réactive l'entité
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui réactive l'entité
|
||||
*/
|
||||
public void reactiver(String utilisateur) {
|
||||
this.actif = true;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marque l'entité comme nouvellement créée
|
||||
* @param utilisateur L'utilisateur qui crée l'entité
|
||||
*/
|
||||
public void marquerCommeNouveau(String utilisateur) {
|
||||
LocalDateTime maintenant = LocalDateTime.now();
|
||||
this.dateCreation = maintenant;
|
||||
this.dateModification = maintenant;
|
||||
this.creePar = utilisateur;
|
||||
this.modifiePar = utilisateur;
|
||||
this.version = 0L;
|
||||
this.actif = true;
|
||||
}
|
||||
/**
|
||||
* Vérifie si l'entité est nouvelle (pas encore persistée)
|
||||
*
|
||||
* @return true si l'entité est nouvelle
|
||||
*/
|
||||
public boolean isNouveau() {
|
||||
return id == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marque l'entité comme modifiée
|
||||
* @param utilisateur L'utilisateur qui modifie l'entité
|
||||
*/
|
||||
public void marquerCommeModifie(String utilisateur) {
|
||||
this.dateModification = LocalDateTime.now();
|
||||
this.modifiePar = utilisateur;
|
||||
if (this.version != null) {
|
||||
this.version++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Vérifie si l'entité est active
|
||||
*
|
||||
* @return true si l'entité est active
|
||||
*/
|
||||
public boolean isActif() {
|
||||
return Boolean.TRUE.equals(actif);
|
||||
}
|
||||
|
||||
/**
|
||||
* Désactive l'entité (soft delete)
|
||||
* @param utilisateur L'utilisateur qui désactive l'entité
|
||||
*/
|
||||
public void desactiver(String utilisateur) {
|
||||
this.actif = false;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
|
||||
/**
|
||||
* Réactive l'entité
|
||||
* @param utilisateur L'utilisateur qui réactive l'entité
|
||||
*/
|
||||
public void reactiver(String utilisateur) {
|
||||
this.actif = true;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
BaseDTO baseDTO = (BaseDTO) obj;
|
||||
return id != null && id.equals(baseDTO.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'entité est nouvelle (pas encore persistée)
|
||||
* @return true si l'entité est nouvelle
|
||||
*/
|
||||
public boolean isNouveau() {
|
||||
return id == null;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id != null ? id.hashCode() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'entité est active
|
||||
* @return true si l'entité est active
|
||||
*/
|
||||
public boolean isActif() {
|
||||
return Boolean.TRUE.equals(actif);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
|
||||
BaseDTO baseDTO = (BaseDTO) obj;
|
||||
return id != null && id.equals(baseDTO.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id != null ? id.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "{" +
|
||||
"id=" + id +
|
||||
", dateCreation=" + dateCreation +
|
||||
", dateModification=" + dateModification +
|
||||
", creePar='" + creePar + '\'' +
|
||||
", modifiePar='" + modifiePar + '\'' +
|
||||
", version=" + version +
|
||||
", actif=" + actif +
|
||||
'}';
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName()
|
||||
+ "{"
|
||||
+ "id="
|
||||
+ id
|
||||
+ ", dateCreation="
|
||||
+ dateCreation
|
||||
+ ", dateModification="
|
||||
+ dateModification
|
||||
+ ", creePar='"
|
||||
+ creePar
|
||||
+ '\''
|
||||
+ ", modifiePar='"
|
||||
+ modifiePar
|
||||
+ '\''
|
||||
+ ", version="
|
||||
+ version
|
||||
+ ", actif="
|
||||
+ actif
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,6 @@
|
||||
package dev.lions.unionflow.server.api.dto.membre;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.base.BaseDTO;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
@@ -11,12 +8,13 @@ import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Past;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* DTO pour la gestion des membres dans l'API UnionFlow
|
||||
* Contient toutes les informations relatives à un membre d'une organisation
|
||||
* DTO pour la gestion des membres dans l'API UnionFlow Contient toutes les informations relatives à
|
||||
* un membre d'une organisation
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
@@ -25,448 +23,432 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class MembreDTO extends BaseDTO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Numéro unique du membre (format: UF-YYYY-XXXXXXXX)
|
||||
*/
|
||||
@NotBlank(message = "Le numéro de membre est obligatoire")
|
||||
@Pattern(regexp = "^UF-\\d{4}-[A-Z0-9]{8}$", message = "Format de numéro de membre invalide (UF-YYYY-XXXXXXXX)")
|
||||
private String numeroMembre;
|
||||
|
||||
/**
|
||||
* Nom de famille du membre
|
||||
*/
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
@Size(min = 2, max = 50, message = "Le nom doit contenir entre 2 et 50 caractères")
|
||||
@Pattern(regexp = "^[a-zA-ZÀ-ÿ\\s\\-']+$", message = "Le nom ne peut contenir que des lettres, espaces, tirets et apostrophes")
|
||||
private String nom;
|
||||
|
||||
/**
|
||||
* Prénom du membre
|
||||
*/
|
||||
@NotBlank(message = "Le prénom est obligatoire")
|
||||
@Size(min = 2, max = 50, message = "Le prénom doit contenir entre 2 et 50 caractères")
|
||||
@Pattern(regexp = "^[a-zA-ZÀ-ÿ\\s\\-']+$", message = "Le prénom ne peut contenir que des lettres, espaces, tirets et apostrophes")
|
||||
private String prenom;
|
||||
|
||||
/**
|
||||
* Adresse email du membre
|
||||
*/
|
||||
@Email(message = "Format d'email invalide")
|
||||
@Size(max = 100, message = "L'email ne peut pas dépasser 100 caractères")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* Numéro de téléphone du membre
|
||||
*/
|
||||
@Pattern(regexp = "^\\+?[0-9\\s\\-\\(\\)]{8,20}$", message = "Format de téléphone invalide")
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* Date de naissance du membre
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Past(message = "La date de naissance doit être dans le passé")
|
||||
private LocalDate dateNaissance;
|
||||
|
||||
/**
|
||||
* Adresse physique du membre
|
||||
*/
|
||||
@Size(max = 200, message = "L'adresse ne peut pas dépasser 200 caractères")
|
||||
private String adresse;
|
||||
|
||||
/**
|
||||
* Profession du membre
|
||||
*/
|
||||
@Size(max = 100, message = "La profession ne peut pas dépasser 100 caractères")
|
||||
private String profession;
|
||||
|
||||
/**
|
||||
* Statut matrimonial du membre
|
||||
*/
|
||||
@Size(max = 20, message = "Le statut matrimonial ne peut pas dépasser 20 caractères")
|
||||
private String statutMatrimonial;
|
||||
|
||||
/**
|
||||
* Nationalité du membre
|
||||
*/
|
||||
@Size(max = 50, message = "La nationalité ne peut pas dépasser 50 caractères")
|
||||
private String nationalite;
|
||||
|
||||
/**
|
||||
* Numéro de pièce d'identité
|
||||
*/
|
||||
@Size(max = 50, message = "Le numéro d'identité ne peut pas dépasser 50 caractères")
|
||||
private String numeroIdentite;
|
||||
|
||||
/**
|
||||
* Type de pièce d'identité (CNI, Passeport, etc.)
|
||||
*/
|
||||
@Size(max = 20, message = "Le type d'identité ne peut pas dépasser 20 caractères")
|
||||
private String typeIdentite;
|
||||
|
||||
/**
|
||||
* Statut du membre (ACTIF, INACTIF, SUSPENDU, RADIE)
|
||||
*/
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
@Pattern(regexp = "^(ACTIF|INACTIF|SUSPENDU|RADIE)$", message = "Statut invalide")
|
||||
private String statut;
|
||||
|
||||
/**
|
||||
* Identifiant de l'association à laquelle appartient le membre
|
||||
*/
|
||||
@NotNull(message = "L'association est obligatoire")
|
||||
private Long associationId;
|
||||
|
||||
/**
|
||||
* Nom de l'association (lecture seule)
|
||||
*/
|
||||
private String associationNom;
|
||||
|
||||
/**
|
||||
* Date d'adhésion du membre
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateAdhesion;
|
||||
|
||||
/**
|
||||
* Région géographique
|
||||
*/
|
||||
@Size(max = 50, message = "La région ne peut pas dépasser 50 caractères")
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* Ville de résidence
|
||||
*/
|
||||
@Size(max = 50, message = "La ville ne peut pas dépasser 50 caractères")
|
||||
private String ville;
|
||||
|
||||
/**
|
||||
* Quartier de résidence
|
||||
*/
|
||||
@Size(max = 50, message = "Le quartier ne peut pas dépasser 50 caractères")
|
||||
private String quartier;
|
||||
|
||||
/**
|
||||
* Rôle du membre dans l'organisation
|
||||
*/
|
||||
@Size(max = 50, message = "Le rôle ne peut pas dépasser 50 caractères")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* Indique si le membre fait partie du bureau
|
||||
*/
|
||||
private Boolean membreBureau = false;
|
||||
|
||||
/**
|
||||
* Indique si le membre est responsable
|
||||
*/
|
||||
private Boolean responsable = false;
|
||||
|
||||
/**
|
||||
* Photo de profil (URL ou chemin)
|
||||
*/
|
||||
@Size(max = 255, message = "L'URL de la photo ne peut pas dépasser 255 caractères")
|
||||
private String photoUrl;
|
||||
|
||||
// Constructeurs
|
||||
public MembreDTO() {
|
||||
super();
|
||||
this.statut = "ACTIF";
|
||||
this.dateAdhesion = LocalDate.now();
|
||||
this.membreBureau = false;
|
||||
this.responsable = false;
|
||||
}
|
||||
|
||||
public MembreDTO(String numeroMembre, String nom, String prenom, String email) {
|
||||
this();
|
||||
this.numeroMembre = numeroMembre;
|
||||
this.nom = nom;
|
||||
this.prenom = prenom;
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
// Getters et Setters
|
||||
public String getNumeroMembre() {
|
||||
return numeroMembre;
|
||||
}
|
||||
|
||||
public void setNumeroMembre(String numeroMembre) {
|
||||
this.numeroMembre = numeroMembre;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getPrenom() {
|
||||
return prenom;
|
||||
}
|
||||
|
||||
public void setPrenom(String prenom) {
|
||||
this.prenom = prenom;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
public LocalDate getDateNaissance() {
|
||||
return dateNaissance;
|
||||
}
|
||||
|
||||
public void setDateNaissance(LocalDate dateNaissance) {
|
||||
this.dateNaissance = dateNaissance;
|
||||
}
|
||||
|
||||
public String getAdresse() {
|
||||
return adresse;
|
||||
}
|
||||
|
||||
public void setAdresse(String adresse) {
|
||||
this.adresse = adresse;
|
||||
}
|
||||
|
||||
public String getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public void setProfession(String profession) {
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
public String getStatutMatrimonial() {
|
||||
return statutMatrimonial;
|
||||
}
|
||||
|
||||
public void setStatutMatrimonial(String statutMatrimonial) {
|
||||
this.statutMatrimonial = statutMatrimonial;
|
||||
}
|
||||
|
||||
public String getNationalite() {
|
||||
return nationalite;
|
||||
}
|
||||
|
||||
public void setNationalite(String nationalite) {
|
||||
this.nationalite = nationalite;
|
||||
}
|
||||
|
||||
public String getNumeroIdentite() {
|
||||
return numeroIdentite;
|
||||
}
|
||||
|
||||
public void setNumeroIdentite(String numeroIdentite) {
|
||||
this.numeroIdentite = numeroIdentite;
|
||||
}
|
||||
|
||||
public String getTypeIdentite() {
|
||||
return typeIdentite;
|
||||
}
|
||||
|
||||
public void setTypeIdentite(String typeIdentite) {
|
||||
this.typeIdentite = typeIdentite;
|
||||
}
|
||||
|
||||
public String getStatut() {
|
||||
return statut;
|
||||
}
|
||||
|
||||
public void setStatut(String statut) {
|
||||
this.statut = statut;
|
||||
}
|
||||
|
||||
public Long getAssociationId() {
|
||||
return associationId;
|
||||
}
|
||||
|
||||
public void setAssociationId(Long associationId) {
|
||||
this.associationId = associationId;
|
||||
}
|
||||
|
||||
public String getAssociationNom() {
|
||||
return associationNom;
|
||||
}
|
||||
|
||||
public void setAssociationNom(String associationNom) {
|
||||
this.associationNom = associationNom;
|
||||
}
|
||||
|
||||
public LocalDate getDateAdhesion() {
|
||||
return dateAdhesion;
|
||||
}
|
||||
|
||||
public void setDateAdhesion(LocalDate dateAdhesion) {
|
||||
this.dateAdhesion = dateAdhesion;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getVille() {
|
||||
return ville;
|
||||
}
|
||||
|
||||
public void setVille(String ville) {
|
||||
this.ville = ville;
|
||||
}
|
||||
|
||||
public String getQuartier() {
|
||||
return quartier;
|
||||
}
|
||||
|
||||
public void setQuartier(String quartier) {
|
||||
this.quartier = quartier;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public Boolean getMembreBureau() {
|
||||
return membreBureau;
|
||||
}
|
||||
|
||||
public void setMembreBureau(Boolean membreBureau) {
|
||||
this.membreBureau = membreBureau;
|
||||
}
|
||||
|
||||
public Boolean getResponsable() {
|
||||
return responsable;
|
||||
}
|
||||
|
||||
public void setResponsable(Boolean responsable) {
|
||||
this.responsable = responsable;
|
||||
}
|
||||
|
||||
public String getPhotoUrl() {
|
||||
return photoUrl;
|
||||
}
|
||||
|
||||
public void setPhotoUrl(String photoUrl) {
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Retourne le nom complet du membre (prénom + nom)
|
||||
* @return Le nom complet
|
||||
*/
|
||||
public String getNomComplet() {
|
||||
if (prenom != null && nom != null) {
|
||||
return prenom + " " + nom;
|
||||
} else if (nom != null) {
|
||||
return nom;
|
||||
} else if (prenom != null) {
|
||||
return prenom;
|
||||
}
|
||||
return "";
|
||||
/** Numéro unique du membre (format: UF-YYYY-XXXXXXXX) */
|
||||
@NotBlank(message = "Le numéro de membre est obligatoire")
|
||||
@Pattern(
|
||||
regexp = "^UF-\\d{4}-[A-Z0-9]{8}$",
|
||||
message = "Format de numéro de membre invalide (UF-YYYY-XXXXXXXX)")
|
||||
private String numeroMembre;
|
||||
|
||||
/** Nom de famille du membre */
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
@Size(min = 2, max = 50, message = "Le nom doit contenir entre 2 et 50 caractères")
|
||||
@Pattern(
|
||||
regexp = "^[a-zA-ZÀ-ÿ\\s\\-']+$",
|
||||
message = "Le nom ne peut contenir que des lettres, espaces, tirets et apostrophes")
|
||||
private String nom;
|
||||
|
||||
/** Prénom du membre */
|
||||
@NotBlank(message = "Le prénom est obligatoire")
|
||||
@Size(min = 2, max = 50, message = "Le prénom doit contenir entre 2 et 50 caractères")
|
||||
@Pattern(
|
||||
regexp = "^[a-zA-ZÀ-ÿ\\s\\-']+$",
|
||||
message = "Le prénom ne peut contenir que des lettres, espaces, tirets et apostrophes")
|
||||
private String prenom;
|
||||
|
||||
/** Adresse email du membre */
|
||||
@Email(message = "Format d'email invalide")
|
||||
@Size(max = 100, message = "L'email ne peut pas dépasser 100 caractères")
|
||||
private String email;
|
||||
|
||||
/** Numéro de téléphone du membre */
|
||||
@Pattern(regexp = "^\\+?[0-9\\s\\-\\(\\)]{8,20}$", message = "Format de téléphone invalide")
|
||||
private String telephone;
|
||||
|
||||
/** Date de naissance du membre */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Past(message = "La date de naissance doit être dans le passé")
|
||||
private LocalDate dateNaissance;
|
||||
|
||||
/** Adresse physique du membre */
|
||||
@Size(max = 200, message = "L'adresse ne peut pas dépasser 200 caractères")
|
||||
private String adresse;
|
||||
|
||||
/** Profession du membre */
|
||||
@Size(max = 100, message = "La profession ne peut pas dépasser 100 caractères")
|
||||
private String profession;
|
||||
|
||||
/** Statut matrimonial du membre */
|
||||
@Size(max = 20, message = "Le statut matrimonial ne peut pas dépasser 20 caractères")
|
||||
private String statutMatrimonial;
|
||||
|
||||
/** Nationalité du membre */
|
||||
@Size(max = 50, message = "La nationalité ne peut pas dépasser 50 caractères")
|
||||
private String nationalite;
|
||||
|
||||
/** Numéro de pièce d'identité */
|
||||
@Size(max = 50, message = "Le numéro d'identité ne peut pas dépasser 50 caractères")
|
||||
private String numeroIdentite;
|
||||
|
||||
/** Type de pièce d'identité (CNI, Passeport, etc.) */
|
||||
@Size(max = 20, message = "Le type d'identité ne peut pas dépasser 20 caractères")
|
||||
private String typeIdentite;
|
||||
|
||||
/** Statut du membre (ACTIF, INACTIF, SUSPENDU, RADIE) */
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
@Pattern(regexp = "^(ACTIF|INACTIF|SUSPENDU|RADIE)$", message = "Statut invalide")
|
||||
private String statut;
|
||||
|
||||
/** Identifiant de l'association à laquelle appartient le membre */
|
||||
@NotNull(message = "L'association est obligatoire")
|
||||
private Long associationId;
|
||||
|
||||
/** Nom de l'association (lecture seule) */
|
||||
private String associationNom;
|
||||
|
||||
/** Date d'adhésion du membre */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateAdhesion;
|
||||
|
||||
/** Région géographique */
|
||||
@Size(max = 50, message = "La région ne peut pas dépasser 50 caractères")
|
||||
private String region;
|
||||
|
||||
/** Ville de résidence */
|
||||
@Size(max = 50, message = "La ville ne peut pas dépasser 50 caractères")
|
||||
private String ville;
|
||||
|
||||
/** Quartier de résidence */
|
||||
@Size(max = 50, message = "Le quartier ne peut pas dépasser 50 caractères")
|
||||
private String quartier;
|
||||
|
||||
/** Rôle du membre dans l'organisation */
|
||||
@Size(max = 50, message = "Le rôle ne peut pas dépasser 50 caractères")
|
||||
private String role;
|
||||
|
||||
/** Indique si le membre fait partie du bureau */
|
||||
private Boolean membreBureau = false;
|
||||
|
||||
/** Indique si le membre est responsable */
|
||||
private Boolean responsable = false;
|
||||
|
||||
/** Photo de profil (URL ou chemin) */
|
||||
@Size(max = 255, message = "L'URL de la photo ne peut pas dépasser 255 caractères")
|
||||
private String photoUrl;
|
||||
|
||||
// Constructeurs
|
||||
public MembreDTO() {
|
||||
super();
|
||||
this.statut = "ACTIF";
|
||||
this.dateAdhesion = LocalDate.now();
|
||||
this.membreBureau = false;
|
||||
this.responsable = false;
|
||||
}
|
||||
|
||||
public MembreDTO(String numeroMembre, String nom, String prenom, String email) {
|
||||
this();
|
||||
this.numeroMembre = numeroMembre;
|
||||
this.nom = nom;
|
||||
this.prenom = prenom;
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
// Getters et Setters
|
||||
public String getNumeroMembre() {
|
||||
return numeroMembre;
|
||||
}
|
||||
|
||||
public void setNumeroMembre(String numeroMembre) {
|
||||
this.numeroMembre = numeroMembre;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getPrenom() {
|
||||
return prenom;
|
||||
}
|
||||
|
||||
public void setPrenom(String prenom) {
|
||||
this.prenom = prenom;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
public LocalDate getDateNaissance() {
|
||||
return dateNaissance;
|
||||
}
|
||||
|
||||
public void setDateNaissance(LocalDate dateNaissance) {
|
||||
this.dateNaissance = dateNaissance;
|
||||
}
|
||||
|
||||
public String getAdresse() {
|
||||
return adresse;
|
||||
}
|
||||
|
||||
public void setAdresse(String adresse) {
|
||||
this.adresse = adresse;
|
||||
}
|
||||
|
||||
public String getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public void setProfession(String profession) {
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
public String getStatutMatrimonial() {
|
||||
return statutMatrimonial;
|
||||
}
|
||||
|
||||
public void setStatutMatrimonial(String statutMatrimonial) {
|
||||
this.statutMatrimonial = statutMatrimonial;
|
||||
}
|
||||
|
||||
public String getNationalite() {
|
||||
return nationalite;
|
||||
}
|
||||
|
||||
public void setNationalite(String nationalite) {
|
||||
this.nationalite = nationalite;
|
||||
}
|
||||
|
||||
public String getNumeroIdentite() {
|
||||
return numeroIdentite;
|
||||
}
|
||||
|
||||
public void setNumeroIdentite(String numeroIdentite) {
|
||||
this.numeroIdentite = numeroIdentite;
|
||||
}
|
||||
|
||||
public String getTypeIdentite() {
|
||||
return typeIdentite;
|
||||
}
|
||||
|
||||
public void setTypeIdentite(String typeIdentite) {
|
||||
this.typeIdentite = typeIdentite;
|
||||
}
|
||||
|
||||
public String getStatut() {
|
||||
return statut;
|
||||
}
|
||||
|
||||
public void setStatut(String statut) {
|
||||
this.statut = statut;
|
||||
}
|
||||
|
||||
public Long getAssociationId() {
|
||||
return associationId;
|
||||
}
|
||||
|
||||
public void setAssociationId(Long associationId) {
|
||||
this.associationId = associationId;
|
||||
}
|
||||
|
||||
public String getAssociationNom() {
|
||||
return associationNom;
|
||||
}
|
||||
|
||||
public void setAssociationNom(String associationNom) {
|
||||
this.associationNom = associationNom;
|
||||
}
|
||||
|
||||
public LocalDate getDateAdhesion() {
|
||||
return dateAdhesion;
|
||||
}
|
||||
|
||||
public void setDateAdhesion(LocalDate dateAdhesion) {
|
||||
this.dateAdhesion = dateAdhesion;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getVille() {
|
||||
return ville;
|
||||
}
|
||||
|
||||
public void setVille(String ville) {
|
||||
this.ville = ville;
|
||||
}
|
||||
|
||||
public String getQuartier() {
|
||||
return quartier;
|
||||
}
|
||||
|
||||
public void setQuartier(String quartier) {
|
||||
this.quartier = quartier;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public Boolean getMembreBureau() {
|
||||
return membreBureau;
|
||||
}
|
||||
|
||||
public void setMembreBureau(Boolean membreBureau) {
|
||||
this.membreBureau = membreBureau;
|
||||
}
|
||||
|
||||
public Boolean getResponsable() {
|
||||
return responsable;
|
||||
}
|
||||
|
||||
public void setResponsable(Boolean responsable) {
|
||||
this.responsable = responsable;
|
||||
}
|
||||
|
||||
public String getPhotoUrl() {
|
||||
return photoUrl;
|
||||
}
|
||||
|
||||
public void setPhotoUrl(String photoUrl) {
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
|
||||
/**
|
||||
* Retourne le nom complet du membre (prénom + nom)
|
||||
*
|
||||
* @return Le nom complet
|
||||
*/
|
||||
public String getNomComplet() {
|
||||
if (prenom != null && nom != null) {
|
||||
return prenom + " " + nom;
|
||||
} else if (nom != null) {
|
||||
return nom;
|
||||
} else if (prenom != null) {
|
||||
return prenom;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le membre est majeur (18 ans ou plus)
|
||||
* @return true si le membre est majeur, false sinon
|
||||
*/
|
||||
public boolean isMajeur() {
|
||||
if (dateNaissance == null) {
|
||||
return false;
|
||||
}
|
||||
return LocalDate.now().minusYears(18).isAfter(dateNaissance) ||
|
||||
LocalDate.now().minusYears(18).isEqual(dateNaissance);
|
||||
/**
|
||||
* Vérifie si le membre est majeur (18 ans ou plus)
|
||||
*
|
||||
* @return true si le membre est majeur, false sinon
|
||||
*/
|
||||
public boolean isMajeur() {
|
||||
if (dateNaissance == null) {
|
||||
return false;
|
||||
}
|
||||
return LocalDate.now().minusYears(18).isAfter(dateNaissance)
|
||||
|| LocalDate.now().minusYears(18).isEqual(dateNaissance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule l'âge du membre
|
||||
* @return L'âge en années, ou -1 si la date de naissance n'est pas définie
|
||||
*/
|
||||
public int getAge() {
|
||||
if (dateNaissance == null) {
|
||||
return -1;
|
||||
}
|
||||
return LocalDate.now().getYear() - dateNaissance.getYear();
|
||||
/**
|
||||
* Calcule l'âge du membre
|
||||
*
|
||||
* @return L'âge en années, ou -1 si la date de naissance n'est pas définie
|
||||
*/
|
||||
public int getAge() {
|
||||
if (dateNaissance == null) {
|
||||
return -1;
|
||||
}
|
||||
return LocalDate.now().getYear() - dateNaissance.getYear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le membre est actif
|
||||
* @return true si le statut est ACTIF
|
||||
*/
|
||||
public boolean isActif() {
|
||||
return "ACTIF".equals(statut);
|
||||
}
|
||||
/**
|
||||
* Vérifie si le membre est actif
|
||||
*
|
||||
* @return true si le statut est ACTIF
|
||||
*/
|
||||
public boolean isActif() {
|
||||
return "ACTIF".equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le membre a un rôle de direction
|
||||
* @return true si le membre fait partie du bureau ou est responsable
|
||||
*/
|
||||
public boolean hasRoleDirection() {
|
||||
return Boolean.TRUE.equals(membreBureau) || Boolean.TRUE.equals(responsable);
|
||||
}
|
||||
/**
|
||||
* Vérifie si le membre a un rôle de direction
|
||||
*
|
||||
* @return true si le membre fait partie du bureau ou est responsable
|
||||
*/
|
||||
public boolean hasRoleDirection() {
|
||||
return Boolean.TRUE.equals(membreBureau) || Boolean.TRUE.equals(responsable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne une représentation textuelle du statut
|
||||
* @return Le libellé du statut
|
||||
*/
|
||||
public String getStatutLibelle() {
|
||||
if (statut == null) return "Non défini";
|
||||
/**
|
||||
* Retourne une représentation textuelle du statut
|
||||
*
|
||||
* @return Le libellé du statut
|
||||
*/
|
||||
public String getStatutLibelle() {
|
||||
if (statut == null) return "Non défini";
|
||||
|
||||
return switch (statut) {
|
||||
case "ACTIF" -> "Actif";
|
||||
case "INACTIF" -> "Inactif";
|
||||
case "SUSPENDU" -> "Suspendu";
|
||||
case "RADIE" -> "Radié";
|
||||
default -> statut;
|
||||
};
|
||||
}
|
||||
return switch (statut) {
|
||||
case "ACTIF" -> "Actif";
|
||||
case "INACTIF" -> "Inactif";
|
||||
case "SUSPENDU" -> "Suspendu";
|
||||
case "RADIE" -> "Radié";
|
||||
default -> statut;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Valide les données essentielles du membre
|
||||
* @return true si les données sont valides
|
||||
*/
|
||||
public boolean isDataValid() {
|
||||
return numeroMembre != null && !numeroMembre.trim().isEmpty() &&
|
||||
nom != null && !nom.trim().isEmpty() &&
|
||||
prenom != null && !prenom.trim().isEmpty() &&
|
||||
statut != null && !statut.trim().isEmpty() &&
|
||||
associationId != null;
|
||||
}
|
||||
/**
|
||||
* Valide les données essentielles du membre
|
||||
*
|
||||
* @return true si les données sont valides
|
||||
*/
|
||||
public boolean isDataValid() {
|
||||
return numeroMembre != null
|
||||
&& !numeroMembre.trim().isEmpty()
|
||||
&& nom != null
|
||||
&& !nom.trim().isEmpty()
|
||||
&& prenom != null
|
||||
&& !prenom.trim().isEmpty()
|
||||
&& statut != null
|
||||
&& !statut.trim().isEmpty()
|
||||
&& associationId != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MembreDTO{" +
|
||||
"numeroMembre='" + numeroMembre + '\'' +
|
||||
", nom='" + nom + '\'' +
|
||||
", prenom='" + prenom + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", statut='" + statut + '\'' +
|
||||
", associationId=" + associationId +
|
||||
", dateAdhesion=" + dateAdhesion +
|
||||
"} " + super.toString();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MembreDTO{"
|
||||
+ "numeroMembre='"
|
||||
+ numeroMembre
|
||||
+ '\''
|
||||
+ ", nom='"
|
||||
+ nom
|
||||
+ '\''
|
||||
+ ", prenom='"
|
||||
+ prenom
|
||||
+ '\''
|
||||
+ ", email='"
|
||||
+ email
|
||||
+ '\''
|
||||
+ ", statut='"
|
||||
+ statut
|
||||
+ '\''
|
||||
+ ", associationId="
|
||||
+ associationId
|
||||
+ ", dateAdhesion="
|
||||
+ dateAdhesion
|
||||
+ "} "
|
||||
+ super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
package dev.lions.unionflow.server.api.dto.organisation;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.base.BaseDTO;
|
||||
import dev.lions.unionflow.server.api.enums.organisation.TypeOrganisation;
|
||||
import dev.lions.unionflow.server.api.enums.organisation.StatutOrganisation;
|
||||
import dev.lions.unionflow.server.api.enums.organisation.TypeOrganisation;
|
||||
import jakarta.validation.constraints.DecimalMax;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.Digits;
|
||||
@@ -18,12 +12,16 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* DTO pour la gestion des organisations (Lions Club, Associations, Coopératives, etc.)
|
||||
* Représente une organisation avec ses informations complètes et sa hiérarchie
|
||||
* DTO pour la gestion des organisations (Lions Club, Associations, Coopératives, etc.) Représente
|
||||
* une organisation avec ses informations complètes et sa hiérarchie
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
@@ -33,470 +31,442 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class OrganisationDTO extends BaseDTO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Nom de l'organisation */
|
||||
@NotBlank(message = "Le nom de l'organisation est obligatoire")
|
||||
@Size(min = 2, max = 200, message = "Le nom doit contenir entre 2 et 200 caractères")
|
||||
private String nom;
|
||||
|
||||
/** Nom court ou sigle */
|
||||
@Size(max = 50, message = "Le nom court ne peut pas dépasser 50 caractères")
|
||||
private String nomCourt;
|
||||
|
||||
/**
|
||||
* Nom de l'organisation
|
||||
*/
|
||||
@NotBlank(message = "Le nom de l'organisation est obligatoire")
|
||||
@Size(min = 2, max = 200, message = "Le nom doit contenir entre 2 et 200 caractères")
|
||||
private String nom;
|
||||
/** Type d'organisation */
|
||||
@NotNull(message = "Le type d'organisation est obligatoire")
|
||||
private TypeOrganisation typeOrganisation;
|
||||
|
||||
/**
|
||||
* Nom court ou sigle
|
||||
*/
|
||||
@Size(max = 50, message = "Le nom court ne peut pas dépasser 50 caractères")
|
||||
private String nomCourt;
|
||||
/** Statut de l'organisation */
|
||||
@NotNull(message = "Le statut de l'organisation est obligatoire")
|
||||
private StatutOrganisation statut;
|
||||
|
||||
/**
|
||||
* Type d'organisation
|
||||
*/
|
||||
@NotNull(message = "Le type d'organisation est obligatoire")
|
||||
private TypeOrganisation typeOrganisation;
|
||||
/** Description de l'organisation */
|
||||
@Size(max = 2000, message = "La description ne peut pas dépasser 2000 caractères")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* Statut de l'organisation
|
||||
*/
|
||||
@NotNull(message = "Le statut de l'organisation est obligatoire")
|
||||
private StatutOrganisation statut;
|
||||
/** Date de fondation */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateFondation;
|
||||
|
||||
/**
|
||||
* Description de l'organisation
|
||||
*/
|
||||
@Size(max = 2000, message = "La description ne peut pas dépasser 2000 caractères")
|
||||
private String description;
|
||||
/** Numéro d'enregistrement officiel */
|
||||
@Size(max = 100, message = "Le numéro d'enregistrement ne peut pas dépasser 100 caractères")
|
||||
private String numeroEnregistrement;
|
||||
|
||||
/**
|
||||
* Date de fondation
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateFondation;
|
||||
/** Adresse complète */
|
||||
@Size(max = 500, message = "L'adresse ne peut pas dépasser 500 caractères")
|
||||
private String adresse;
|
||||
|
||||
/**
|
||||
* Numéro d'enregistrement officiel
|
||||
*/
|
||||
@Size(max = 100, message = "Le numéro d'enregistrement ne peut pas dépasser 100 caractères")
|
||||
private String numeroEnregistrement;
|
||||
/** Ville */
|
||||
@Size(max = 100, message = "La ville ne peut pas dépasser 100 caractères")
|
||||
private String ville;
|
||||
|
||||
/**
|
||||
* Adresse complète
|
||||
*/
|
||||
@Size(max = 500, message = "L'adresse ne peut pas dépasser 500 caractères")
|
||||
private String adresse;
|
||||
/** Région/Province */
|
||||
@Size(max = 100, message = "La région ne peut pas dépasser 100 caractères")
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* Ville
|
||||
*/
|
||||
@Size(max = 100, message = "La ville ne peut pas dépasser 100 caractères")
|
||||
private String ville;
|
||||
/** Pays */
|
||||
@Size(max = 100, message = "Le pays ne peut pas dépasser 100 caractères")
|
||||
private String pays;
|
||||
|
||||
/**
|
||||
* Région/Province
|
||||
*/
|
||||
@Size(max = 100, message = "La région ne peut pas dépasser 100 caractères")
|
||||
private String region;
|
||||
/** Code postal */
|
||||
@Pattern(regexp = "^[0-9A-Z\\-\\s]{3,10}$", message = "Format de code postal invalide")
|
||||
private String codePostal;
|
||||
|
||||
/**
|
||||
* Pays
|
||||
*/
|
||||
@Size(max = 100, message = "Le pays ne peut pas dépasser 100 caractères")
|
||||
private String pays;
|
||||
/** Latitude pour géolocalisation */
|
||||
@DecimalMin(value = "-90.0", message = "La latitude doit être comprise entre -90 et 90")
|
||||
@DecimalMax(value = "90.0", message = "La latitude doit être comprise entre -90 et 90")
|
||||
@Digits(
|
||||
integer = 2,
|
||||
fraction = 8,
|
||||
message = "La latitude ne peut avoir plus de 2 chiffres entiers et 8 décimales")
|
||||
private BigDecimal latitude;
|
||||
|
||||
/**
|
||||
* Code postal
|
||||
*/
|
||||
@Pattern(regexp = "^[0-9A-Z\\-\\s]{3,10}$", message = "Format de code postal invalide")
|
||||
private String codePostal;
|
||||
/** Longitude pour géolocalisation */
|
||||
@DecimalMin(value = "-180.0", message = "La longitude doit être comprise entre -180 et 180")
|
||||
@DecimalMax(value = "180.0", message = "La longitude doit être comprise entre -180 et 180")
|
||||
@Digits(
|
||||
integer = 3,
|
||||
fraction = 8,
|
||||
message = "La longitude ne peut avoir plus de 3 chiffres entiers et 8 décimales")
|
||||
private BigDecimal longitude;
|
||||
|
||||
/**
|
||||
* Latitude pour géolocalisation
|
||||
*/
|
||||
@DecimalMin(value = "-90.0", message = "La latitude doit être comprise entre -90 et 90")
|
||||
@DecimalMax(value = "90.0", message = "La latitude doit être comprise entre -90 et 90")
|
||||
@Digits(integer = 2, fraction = 8, message = "La latitude ne peut avoir plus de 2 chiffres entiers et 8 décimales")
|
||||
private BigDecimal latitude;
|
||||
/** Téléphone principal */
|
||||
@Pattern(regexp = "^\\+?[0-9\\s\\-\\(\\)]{8,20}$", message = "Format de téléphone invalide")
|
||||
private String telephone;
|
||||
|
||||
/**
|
||||
* Longitude pour géolocalisation
|
||||
*/
|
||||
@DecimalMin(value = "-180.0", message = "La longitude doit être comprise entre -180 et 180")
|
||||
@DecimalMax(value = "180.0", message = "La longitude doit être comprise entre -180 et 180")
|
||||
@Digits(integer = 3, fraction = 8, message = "La longitude ne peut avoir plus de 3 chiffres entiers et 8 décimales")
|
||||
private BigDecimal longitude;
|
||||
/** Téléphone secondaire */
|
||||
@Pattern(regexp = "^\\+?[0-9\\s\\-\\(\\)]{8,20}$", message = "Format de téléphone invalide")
|
||||
private String telephoneSecondaire;
|
||||
|
||||
/**
|
||||
* Téléphone principal
|
||||
*/
|
||||
@Pattern(regexp = "^\\+?[0-9\\s\\-\\(\\)]{8,20}$", message = "Format de téléphone invalide")
|
||||
private String telephone;
|
||||
/** Email principal */
|
||||
@Email(message = "Format d'email invalide")
|
||||
@Size(max = 200, message = "L'email ne peut pas dépasser 200 caractères")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* Téléphone secondaire
|
||||
*/
|
||||
@Pattern(regexp = "^\\+?[0-9\\s\\-\\(\\)]{8,20}$", message = "Format de téléphone invalide")
|
||||
private String telephoneSecondaire;
|
||||
/** Email secondaire */
|
||||
@Email(message = "Format d'email invalide")
|
||||
@Size(max = 200, message = "L'email ne peut pas dépasser 200 caractères")
|
||||
private String emailSecondaire;
|
||||
|
||||
/**
|
||||
* Email principal
|
||||
*/
|
||||
@Email(message = "Format d'email invalide")
|
||||
@Size(max = 200, message = "L'email ne peut pas dépasser 200 caractères")
|
||||
private String email;
|
||||
/** Site web */
|
||||
@Pattern(
|
||||
regexp =
|
||||
"^https?://[\\w\\-]+(\\.[\\w\\-]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?$",
|
||||
message = "Format d'URL invalide")
|
||||
@Size(max = 500, message = "L'URL ne peut pas dépasser 500 caractères")
|
||||
private String siteWeb;
|
||||
|
||||
/**
|
||||
* Email secondaire
|
||||
*/
|
||||
@Email(message = "Format d'email invalide")
|
||||
@Size(max = 200, message = "L'email ne peut pas dépasser 200 caractères")
|
||||
private String emailSecondaire;
|
||||
/** Logo de l'organisation (URL ou nom de fichier) */
|
||||
@Size(max = 500, message = "Le logo ne peut pas dépasser 500 caractères")
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* Site web
|
||||
*/
|
||||
@Pattern(regexp = "^https?://[\\w\\-]+(\\.[\\w\\-]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?$",
|
||||
message = "Format d'URL invalide")
|
||||
@Size(max = 500, message = "L'URL ne peut pas dépasser 500 caractères")
|
||||
private String siteWeb;
|
||||
/** Organisation parente (pour hiérarchie) */
|
||||
private UUID organisationParenteId;
|
||||
|
||||
/**
|
||||
* Logo de l'organisation (URL ou nom de fichier)
|
||||
*/
|
||||
@Size(max = 500, message = "Le logo ne peut pas dépasser 500 caractères")
|
||||
private String logo;
|
||||
/** Nom de l'organisation parente */
|
||||
private String nomOrganisationParente;
|
||||
|
||||
/**
|
||||
* Organisation parente (pour hiérarchie)
|
||||
*/
|
||||
private UUID organisationParenteId;
|
||||
/** Niveau hiérarchique (0 = racine) */
|
||||
private Integer niveauHierarchique;
|
||||
|
||||
/**
|
||||
* Nom de l'organisation parente
|
||||
*/
|
||||
private String nomOrganisationParente;
|
||||
/** Nombre de membres actifs */
|
||||
private Integer nombreMembres;
|
||||
|
||||
/**
|
||||
* Niveau hiérarchique (0 = racine)
|
||||
*/
|
||||
private Integer niveauHierarchique;
|
||||
/** Nombre d'administrateurs */
|
||||
private Integer nombreAdministrateurs;
|
||||
|
||||
/**
|
||||
* Nombre de membres actifs
|
||||
*/
|
||||
private Integer nombreMembres;
|
||||
/** Budget annuel */
|
||||
@DecimalMin(value = "0.0", message = "Le budget doit être positif")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "Le budget ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal budgetAnnuel;
|
||||
|
||||
/**
|
||||
* Nombre d'administrateurs
|
||||
*/
|
||||
private Integer nombreAdministrateurs;
|
||||
/** Devise du budget */
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String devise;
|
||||
|
||||
/**
|
||||
* Budget annuel
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "Le budget doit être positif")
|
||||
@Digits(integer = 12, fraction = 2, message = "Le budget ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal budgetAnnuel;
|
||||
/** Objectifs de l'organisation */
|
||||
@Size(max = 2000, message = "Les objectifs ne peuvent pas dépasser 2000 caractères")
|
||||
private String objectifs;
|
||||
|
||||
/**
|
||||
* Devise du budget
|
||||
*/
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String devise;
|
||||
/** Activités principales */
|
||||
@Size(max = 2000, message = "Les activités ne peuvent pas dépasser 2000 caractères")
|
||||
private String activitesPrincipales;
|
||||
|
||||
/**
|
||||
* Objectifs de l'organisation
|
||||
*/
|
||||
@Size(max = 2000, message = "Les objectifs ne peuvent pas dépasser 2000 caractères")
|
||||
private String objectifs;
|
||||
/** Réseaux sociaux (JSON) */
|
||||
@Size(max = 1000, message = "Les réseaux sociaux ne peuvent pas dépasser 1000 caractères")
|
||||
private String reseauxSociaux;
|
||||
|
||||
/**
|
||||
* Activités principales
|
||||
*/
|
||||
@Size(max = 2000, message = "Les activités ne peuvent pas dépasser 2000 caractères")
|
||||
private String activitesPrincipales;
|
||||
/** Certifications ou labels */
|
||||
@Size(max = 500, message = "Les certifications ne peuvent pas dépasser 500 caractères")
|
||||
private String certifications;
|
||||
|
||||
/**
|
||||
* Réseaux sociaux (JSON)
|
||||
*/
|
||||
@Size(max = 1000, message = "Les réseaux sociaux ne peuvent pas dépasser 1000 caractères")
|
||||
private String reseauxSociaux;
|
||||
/** Partenaires principaux */
|
||||
@Size(max = 1000, message = "Les partenaires ne peuvent pas dépasser 1000 caractères")
|
||||
private String partenaires;
|
||||
|
||||
/**
|
||||
* Certifications ou labels
|
||||
*/
|
||||
@Size(max = 500, message = "Les certifications ne peuvent pas dépasser 500 caractères")
|
||||
private String certifications;
|
||||
/** Notes administratives */
|
||||
@Size(max = 1000, message = "Les notes ne peuvent pas dépasser 1000 caractères")
|
||||
private String notes;
|
||||
|
||||
/**
|
||||
* Partenaires principaux
|
||||
*/
|
||||
@Size(max = 1000, message = "Les partenaires ne peuvent pas dépasser 1000 caractères")
|
||||
private String partenaires;
|
||||
/** Organisation publique (visible dans l'annuaire) */
|
||||
private Boolean organisationPublique;
|
||||
|
||||
/**
|
||||
* Notes administratives
|
||||
*/
|
||||
@Size(max = 1000, message = "Les notes ne peuvent pas dépasser 1000 caractères")
|
||||
private String notes;
|
||||
/** Accepte nouveaux membres */
|
||||
private Boolean accepteNouveauxMembres;
|
||||
|
||||
/**
|
||||
* Organisation publique (visible dans l'annuaire)
|
||||
*/
|
||||
private Boolean organisationPublique;
|
||||
/** Cotisation obligatoire */
|
||||
private Boolean cotisationObligatoire;
|
||||
|
||||
/**
|
||||
* Accepte nouveaux membres
|
||||
*/
|
||||
private Boolean accepteNouveauxMembres;
|
||||
/** Montant cotisation annuelle */
|
||||
@DecimalMin(value = "0.0", message = "Le montant de cotisation doit être positif")
|
||||
@Digits(
|
||||
integer = 10,
|
||||
fraction = 2,
|
||||
message = "Le montant ne peut avoir plus de 10 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montantCotisationAnnuelle;
|
||||
|
||||
/**
|
||||
* Cotisation obligatoire
|
||||
*/
|
||||
private Boolean cotisationObligatoire;
|
||||
// Constructeurs
|
||||
public OrganisationDTO() {
|
||||
super();
|
||||
this.statut = StatutOrganisation.ACTIVE;
|
||||
this.typeOrganisation = TypeOrganisation.ASSOCIATION;
|
||||
this.devise = "XOF";
|
||||
this.niveauHierarchique = 0;
|
||||
this.nombreMembres = 0;
|
||||
this.nombreAdministrateurs = 0;
|
||||
this.organisationPublique = true;
|
||||
this.accepteNouveauxMembres = true;
|
||||
this.cotisationObligatoire = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Montant cotisation annuelle
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "Le montant de cotisation doit être positif")
|
||||
@Digits(integer = 10, fraction = 2, message = "Le montant ne peut avoir plus de 10 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montantCotisationAnnuelle;
|
||||
public OrganisationDTO(String nom, TypeOrganisation type) {
|
||||
this();
|
||||
this.nom = nom;
|
||||
this.typeOrganisation = type;
|
||||
}
|
||||
|
||||
// Constructeurs
|
||||
public OrganisationDTO() {
|
||||
super();
|
||||
this.statut = StatutOrganisation.ACTIVE;
|
||||
this.typeOrganisation = TypeOrganisation.ASSOCIATION;
|
||||
this.devise = "XOF";
|
||||
this.niveauHierarchique = 0;
|
||||
this.nombreMembres = 0;
|
||||
this.nombreAdministrateurs = 0;
|
||||
this.organisationPublique = true;
|
||||
this.accepteNouveauxMembres = true;
|
||||
this.cotisationObligatoire = false;
|
||||
// Méthodes utilitaires
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est active
|
||||
*
|
||||
* @return true si l'organisation est active
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return StatutOrganisation.ACTIVE.equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est inactive
|
||||
*
|
||||
* @return true si l'organisation est inactive
|
||||
*/
|
||||
public boolean isInactive() {
|
||||
return StatutOrganisation.INACTIVE.equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est suspendue
|
||||
*
|
||||
* @return true si l'organisation est suspendue
|
||||
*/
|
||||
public boolean isSuspendue() {
|
||||
return StatutOrganisation.SUSPENDUE.equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est en cours de création
|
||||
*
|
||||
* @return true si l'organisation est en création
|
||||
*/
|
||||
public boolean isEnCreation() {
|
||||
return StatutOrganisation.EN_CREATION.equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est dissoute
|
||||
*
|
||||
* @return true si l'organisation est dissoute
|
||||
*/
|
||||
public boolean isDissoute() {
|
||||
return StatutOrganisation.DISSOUTE.equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule l'ancienneté de l'organisation en années
|
||||
*
|
||||
* @return L'ancienneté en années
|
||||
*/
|
||||
public int getAncienneteAnnees() {
|
||||
if (dateFondation == null) return 0;
|
||||
return Period.between(dateFondation, LocalDate.now()).getYears();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule l'ancienneté de l'organisation en mois
|
||||
*
|
||||
* @return L'ancienneté en mois
|
||||
*/
|
||||
public int getAncienneteMois() {
|
||||
if (dateFondation == null) return 0;
|
||||
Period periode = Period.between(dateFondation, LocalDate.now());
|
||||
return periode.getYears() * 12 + periode.getMonths();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation a une géolocalisation
|
||||
*
|
||||
* @return true si latitude et longitude sont définies
|
||||
*/
|
||||
public boolean hasGeolocalisation() {
|
||||
return latitude != null && longitude != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est une organisation racine (sans parent)
|
||||
*
|
||||
* @return true si l'organisation n'a pas de parent
|
||||
*/
|
||||
public boolean isOrganisationRacine() {
|
||||
return organisationParenteId == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation a des sous-organisations
|
||||
*
|
||||
* @return true si le niveau hiérarchique est supérieur à 0
|
||||
*/
|
||||
public boolean hasSousOrganisations() {
|
||||
return niveauHierarchique != null && niveauHierarchique > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le nom d'affichage (nom court si disponible, sinon nom complet)
|
||||
*
|
||||
* @return Le nom d'affichage
|
||||
*/
|
||||
public String getNomAffichage() {
|
||||
return (nomCourt != null && !nomCourt.trim().isEmpty()) ? nomCourt : nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne l'adresse complète formatée
|
||||
*
|
||||
* @return L'adresse complète
|
||||
*/
|
||||
public String getAdresseComplete() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (adresse != null && !adresse.trim().isEmpty()) {
|
||||
sb.append(adresse);
|
||||
}
|
||||
|
||||
public OrganisationDTO(String nom, TypeOrganisation type) {
|
||||
this();
|
||||
this.nom = nom;
|
||||
this.typeOrganisation = type;
|
||||
if (ville != null && !ville.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(", ");
|
||||
sb.append(ville);
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est active
|
||||
* @return true si l'organisation est active
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return StatutOrganisation.ACTIVE.equals(statut);
|
||||
if (codePostal != null && !codePostal.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(" ");
|
||||
sb.append(codePostal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est inactive
|
||||
* @return true si l'organisation est inactive
|
||||
*/
|
||||
public boolean isInactive() {
|
||||
return StatutOrganisation.INACTIVE.equals(statut);
|
||||
if (region != null && !region.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(", ");
|
||||
sb.append(region);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est suspendue
|
||||
* @return true si l'organisation est suspendue
|
||||
*/
|
||||
public boolean isSuspendue() {
|
||||
return StatutOrganisation.SUSPENDUE.equals(statut);
|
||||
if (pays != null && !pays.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(", ");
|
||||
sb.append(pays);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est en cours de création
|
||||
* @return true si l'organisation est en création
|
||||
*/
|
||||
public boolean isEnCreation() {
|
||||
return StatutOrganisation.EN_CREATION.equals(statut);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule le ratio administrateurs/membres
|
||||
*
|
||||
* @return Le pourcentage d'administrateurs
|
||||
*/
|
||||
public double getRatioAdministrateurs() {
|
||||
if (nombreMembres == null || nombreMembres == 0) return 0.0;
|
||||
if (nombreAdministrateurs == null) return 0.0;
|
||||
return (nombreAdministrateurs.doubleValue() / nombreMembres.doubleValue()) * 100.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation a un budget défini
|
||||
*
|
||||
* @return true si un budget annuel est défini
|
||||
*/
|
||||
public boolean hasBudget() {
|
||||
return budgetAnnuel != null && budgetAnnuel.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Active l'organisation
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui active l'organisation
|
||||
*/
|
||||
public void activer(String utilisateur) {
|
||||
this.statut = StatutOrganisation.ACTIVE;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend l'organisation
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui suspend l'organisation
|
||||
*/
|
||||
public void suspendre(String utilisateur) {
|
||||
this.statut = StatutOrganisation.SUSPENDUE;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dissout l'organisation
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui dissout l'organisation
|
||||
*/
|
||||
public void dissoudre(String utilisateur) {
|
||||
this.statut = StatutOrganisation.DISSOUTE;
|
||||
this.accepteNouveauxMembres = false;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Met à jour le nombre de membres
|
||||
*
|
||||
* @param nouveauNombre Le nouveau nombre de membres
|
||||
* @param utilisateur L'utilisateur qui fait la mise à jour
|
||||
*/
|
||||
public void mettreAJourNombreMembres(int nouveauNombre, String utilisateur) {
|
||||
this.nombreMembres = nouveauNombre;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute un membre
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui ajoute le membre
|
||||
*/
|
||||
public void ajouterMembre(String utilisateur) {
|
||||
if (nombreMembres == null) nombreMembres = 0;
|
||||
nombreMembres++;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retire un membre
|
||||
*
|
||||
* @param utilisateur L'utilisateur qui retire le membre
|
||||
*/
|
||||
public void retirerMembre(String utilisateur) {
|
||||
if (nombreMembres != null && nombreMembres > 0) {
|
||||
nombreMembres--;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est dissoute
|
||||
* @return true si l'organisation est dissoute
|
||||
*/
|
||||
public boolean isDissoute() {
|
||||
return StatutOrganisation.DISSOUTE.equals(statut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule l'ancienneté de l'organisation en années
|
||||
* @return L'ancienneté en années
|
||||
*/
|
||||
public int getAncienneteAnnees() {
|
||||
if (dateFondation == null) return 0;
|
||||
return Period.between(dateFondation, LocalDate.now()).getYears();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule l'ancienneté de l'organisation en mois
|
||||
* @return L'ancienneté en mois
|
||||
*/
|
||||
public int getAncienneteMois() {
|
||||
if (dateFondation == null) return 0;
|
||||
Period periode = Period.between(dateFondation, LocalDate.now());
|
||||
return periode.getYears() * 12 + periode.getMonths();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation a une géolocalisation
|
||||
* @return true si latitude et longitude sont définies
|
||||
*/
|
||||
public boolean hasGeolocalisation() {
|
||||
return latitude != null && longitude != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation est une organisation racine (sans parent)
|
||||
* @return true si l'organisation n'a pas de parent
|
||||
*/
|
||||
public boolean isOrganisationRacine() {
|
||||
return organisationParenteId == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation a des sous-organisations
|
||||
* @return true si le niveau hiérarchique est supérieur à 0
|
||||
*/
|
||||
public boolean hasSousOrganisations() {
|
||||
return niveauHierarchique != null && niveauHierarchique > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le nom d'affichage (nom court si disponible, sinon nom complet)
|
||||
* @return Le nom d'affichage
|
||||
*/
|
||||
public String getNomAffichage() {
|
||||
return (nomCourt != null && !nomCourt.trim().isEmpty()) ? nomCourt : nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne l'adresse complète formatée
|
||||
* @return L'adresse complète
|
||||
*/
|
||||
public String getAdresseComplete() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (adresse != null && !adresse.trim().isEmpty()) {
|
||||
sb.append(adresse);
|
||||
}
|
||||
|
||||
if (ville != null && !ville.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(", ");
|
||||
sb.append(ville);
|
||||
}
|
||||
|
||||
if (codePostal != null && !codePostal.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(" ");
|
||||
sb.append(codePostal);
|
||||
}
|
||||
|
||||
if (region != null && !region.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(", ");
|
||||
sb.append(region);
|
||||
}
|
||||
|
||||
if (pays != null && !pays.trim().isEmpty()) {
|
||||
if (sb.length() > 0) sb.append(", ");
|
||||
sb.append(pays);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule le ratio administrateurs/membres
|
||||
* @return Le pourcentage d'administrateurs
|
||||
*/
|
||||
public double getRatioAdministrateurs() {
|
||||
if (nombreMembres == null || nombreMembres == 0) return 0.0;
|
||||
if (nombreAdministrateurs == null) return 0.0;
|
||||
return (nombreAdministrateurs.doubleValue() / nombreMembres.doubleValue()) * 100.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si l'organisation a un budget défini
|
||||
* @return true si un budget annuel est défini
|
||||
*/
|
||||
public boolean hasBudget() {
|
||||
return budgetAnnuel != null && budgetAnnuel.compareTo(BigDecimal.ZERO) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Active l'organisation
|
||||
* @param utilisateur L'utilisateur qui active l'organisation
|
||||
*/
|
||||
public void activer(String utilisateur) {
|
||||
this.statut = StatutOrganisation.ACTIVE;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend l'organisation
|
||||
* @param utilisateur L'utilisateur qui suspend l'organisation
|
||||
*/
|
||||
public void suspendre(String utilisateur) {
|
||||
this.statut = StatutOrganisation.SUSPENDUE;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dissout l'organisation
|
||||
* @param utilisateur L'utilisateur qui dissout l'organisation
|
||||
*/
|
||||
public void dissoudre(String utilisateur) {
|
||||
this.statut = StatutOrganisation.DISSOUTE;
|
||||
this.accepteNouveauxMembres = false;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Met à jour le nombre de membres
|
||||
* @param nouveauNombre Le nouveau nombre de membres
|
||||
* @param utilisateur L'utilisateur qui fait la mise à jour
|
||||
*/
|
||||
public void mettreAJourNombreMembres(int nouveauNombre, String utilisateur) {
|
||||
this.nombreMembres = nouveauNombre;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute un membre
|
||||
* @param utilisateur L'utilisateur qui ajoute le membre
|
||||
*/
|
||||
public void ajouterMembre(String utilisateur) {
|
||||
if (nombreMembres == null) nombreMembres = 0;
|
||||
nombreMembres++;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retire un membre
|
||||
* @param utilisateur L'utilisateur qui retire le membre
|
||||
*/
|
||||
public void retirerMembre(String utilisateur) {
|
||||
if (nombreMembres != null && nombreMembres > 0) {
|
||||
nombreMembres--;
|
||||
marquerCommeModifie(utilisateur);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrganisationDTO{" +
|
||||
"nom='" + nom + '\'' +
|
||||
", nomCourt='" + nomCourt + '\'' +
|
||||
", typeOrganisation=" + typeOrganisation +
|
||||
", statut=" + statut +
|
||||
", ville='" + ville + '\'' +
|
||||
", pays='" + pays + '\'' +
|
||||
", nombreMembres=" + nombreMembres +
|
||||
", anciennete=" + getAncienneteAnnees() + " ans" +
|
||||
"} " + super.toString();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrganisationDTO{"
|
||||
+ "nom='"
|
||||
+ nom
|
||||
+ '\''
|
||||
+ ", nomCourt='"
|
||||
+ nomCourt
|
||||
+ '\''
|
||||
+ ", typeOrganisation="
|
||||
+ typeOrganisation
|
||||
+ ", statut="
|
||||
+ statut
|
||||
+ ", ville='"
|
||||
+ ville
|
||||
+ '\''
|
||||
+ ", pays='"
|
||||
+ pays
|
||||
+ '\''
|
||||
+ ", nombreMembres="
|
||||
+ nombreMembres
|
||||
+ ", anciennete="
|
||||
+ getAncienneteAnnees()
|
||||
+ " ans"
|
||||
+ "} "
|
||||
+ super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
package dev.lions.unionflow.server.api.dto.paiement;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.base.BaseDTO;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.Digits;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* DTO pour la consultation du solde Wave Money (Balance API)
|
||||
* Représente le solde d'un wallet Wave Business
|
||||
* DTO pour la consultation du solde Wave Money (Balance API) Représente le solde d'un wallet Wave
|
||||
* Business
|
||||
*
|
||||
* Basé sur l'API officielle Wave : https://docs.wave.com/business#balance-api
|
||||
* <p>Basé sur l'API officielle Wave : https://docs.wave.com/business#balance-api
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
@@ -28,339 +26,338 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class WaveBalanceDTO extends BaseDTO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Solde disponible
|
||||
*/
|
||||
@NotNull(message = "Le solde disponible est obligatoire")
|
||||
@DecimalMin(value = "0.0", message = "Le solde doit être positif ou nul")
|
||||
@Digits(integer = 12, fraction = 2, message = "Le solde ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal soldeDisponible;
|
||||
/** Solde disponible */
|
||||
@NotNull(message = "Le solde disponible est obligatoire")
|
||||
@DecimalMin(value = "0.0", message = "Le solde doit être positif ou nul")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "Le solde ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal soldeDisponible;
|
||||
|
||||
/**
|
||||
* Solde en attente (transactions en cours)
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "Le solde en attente doit être positif ou nul")
|
||||
@Digits(integer = 12, fraction = 2, message = "Le solde ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal soldeEnAttente;
|
||||
/** Solde en attente (transactions en cours) */
|
||||
@DecimalMin(value = "0.0", message = "Le solde en attente doit être positif ou nul")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "Le solde ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal soldeEnAttente;
|
||||
|
||||
/**
|
||||
* Solde total (disponible + en attente)
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "Le solde total doit être positif ou nul")
|
||||
@Digits(integer = 12, fraction = 2, message = "Le solde ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal soldeTotal;
|
||||
/** Solde total (disponible + en attente) */
|
||||
@DecimalMin(value = "0.0", message = "Le solde total doit être positif ou nul")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "Le solde ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal soldeTotal;
|
||||
|
||||
/**
|
||||
* Devise du wallet
|
||||
*/
|
||||
@NotBlank(message = "La devise est obligatoire")
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String devise = "XOF";
|
||||
/** Devise du wallet */
|
||||
@NotBlank(message = "La devise est obligatoire")
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String devise = "XOF";
|
||||
|
||||
/**
|
||||
* Numéro du wallet Wave
|
||||
*/
|
||||
@NotBlank(message = "Le numéro de wallet est obligatoire")
|
||||
private String numeroWallet;
|
||||
/** Numéro du wallet Wave */
|
||||
@NotBlank(message = "Le numéro de wallet est obligatoire")
|
||||
private String numeroWallet;
|
||||
|
||||
/**
|
||||
* Nom du business associé au wallet
|
||||
*/
|
||||
private String nomBusiness;
|
||||
/** Nom du business associé au wallet */
|
||||
private String nomBusiness;
|
||||
|
||||
/**
|
||||
* Date de dernière mise à jour du solde
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateDerniereMiseAJour;
|
||||
/** Date de dernière mise à jour du solde */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateDerniereMiseAJour;
|
||||
|
||||
/**
|
||||
* Date de dernière synchronisation avec Wave
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateDerniereSynchronisation;
|
||||
/** Date de dernière synchronisation avec Wave */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateDerniereSynchronisation;
|
||||
|
||||
/**
|
||||
* Statut du wallet
|
||||
*/
|
||||
@Pattern(regexp = "^(ACTIVE|INACTIVE|SUSPENDED|BLOCKED)$",
|
||||
message = "Le statut doit être ACTIVE, INACTIVE, SUSPENDED ou BLOCKED")
|
||||
private String statutWallet;
|
||||
/** Statut du wallet */
|
||||
@Pattern(
|
||||
regexp = "^(ACTIVE|INACTIVE|SUSPENDED|BLOCKED)$",
|
||||
message = "Le statut doit être ACTIVE, INACTIVE, SUSPENDED ou BLOCKED")
|
||||
private String statutWallet;
|
||||
|
||||
/**
|
||||
* Limite de transaction quotidienne
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "La limite doit être positive ou nulle")
|
||||
@Digits(integer = 12, fraction = 2, message = "La limite ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal limiteQuotidienne;
|
||||
/** Limite de transaction quotidienne */
|
||||
@DecimalMin(value = "0.0", message = "La limite doit être positive ou nulle")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "La limite ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal limiteQuotidienne;
|
||||
|
||||
/**
|
||||
* Montant déjà utilisé aujourd'hui
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "Le montant utilisé doit être positif ou nul")
|
||||
@Digits(integer = 12, fraction = 2, message = "Le montant ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montantUtiliseAujourdhui;
|
||||
/** Montant déjà utilisé aujourd'hui */
|
||||
@DecimalMin(value = "0.0", message = "Le montant utilisé doit être positif ou nul")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "Le montant ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montantUtiliseAujourdhui;
|
||||
|
||||
/**
|
||||
* Limite mensuelle
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "La limite doit être positive ou nulle")
|
||||
@Digits(integer = 12, fraction = 2, message = "La limite ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal limiteMensuelle;
|
||||
/** Limite mensuelle */
|
||||
@DecimalMin(value = "0.0", message = "La limite doit être positive ou nulle")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "La limite ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal limiteMensuelle;
|
||||
|
||||
/**
|
||||
* Montant utilisé ce mois
|
||||
*/
|
||||
@DecimalMin(value = "0.0", message = "Le montant utilisé doit être positif ou nul")
|
||||
@Digits(integer = 12, fraction = 2, message = "Le montant ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montantUtiliseCeMois;
|
||||
/** Montant utilisé ce mois */
|
||||
@DecimalMin(value = "0.0", message = "Le montant utilisé doit être positif ou nul")
|
||||
@Digits(
|
||||
integer = 12,
|
||||
fraction = 2,
|
||||
message = "Le montant ne peut avoir plus de 12 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montantUtiliseCeMois;
|
||||
|
||||
/**
|
||||
* Nombre de transactions aujourd'hui
|
||||
*/
|
||||
private Integer nombreTransactionsAujourdhui;
|
||||
/** Nombre de transactions aujourd'hui */
|
||||
private Integer nombreTransactionsAujourdhui;
|
||||
|
||||
/**
|
||||
* Nombre de transactions ce mois
|
||||
*/
|
||||
private Integer nombreTransactionsCeMois;
|
||||
/** Nombre de transactions ce mois */
|
||||
private Integer nombreTransactionsCeMois;
|
||||
|
||||
/**
|
||||
* Dernière erreur de synchronisation
|
||||
*/
|
||||
private String derniereErreur;
|
||||
/** Dernière erreur de synchronisation */
|
||||
private String derniereErreur;
|
||||
|
||||
/**
|
||||
* Code de la dernière erreur
|
||||
*/
|
||||
private String codeDerniereErreur;
|
||||
/** Code de la dernière erreur */
|
||||
private String codeDerniereErreur;
|
||||
|
||||
// Constructeurs
|
||||
public WaveBalanceDTO() {
|
||||
super();
|
||||
this.devise = "XOF";
|
||||
this.statutWallet = "ACTIVE";
|
||||
this.soldeEnAttente = BigDecimal.ZERO;
|
||||
this.montantUtiliseAujourdhui = BigDecimal.ZERO;
|
||||
this.montantUtiliseCeMois = BigDecimal.ZERO;
|
||||
this.nombreTransactionsAujourdhui = 0;
|
||||
this.nombreTransactionsCeMois = 0;
|
||||
// Constructeurs
|
||||
public WaveBalanceDTO() {
|
||||
super();
|
||||
this.devise = "XOF";
|
||||
this.statutWallet = "ACTIVE";
|
||||
this.soldeEnAttente = BigDecimal.ZERO;
|
||||
this.montantUtiliseAujourdhui = BigDecimal.ZERO;
|
||||
this.montantUtiliseCeMois = BigDecimal.ZERO;
|
||||
this.nombreTransactionsAujourdhui = 0;
|
||||
this.nombreTransactionsCeMois = 0;
|
||||
}
|
||||
|
||||
public WaveBalanceDTO(String numeroWallet, BigDecimal soldeDisponible) {
|
||||
this();
|
||||
this.numeroWallet = numeroWallet;
|
||||
this.soldeDisponible = soldeDisponible;
|
||||
this.soldeTotal = soldeDisponible;
|
||||
}
|
||||
|
||||
// Getters et Setters
|
||||
public BigDecimal getSoldeDisponible() {
|
||||
return soldeDisponible;
|
||||
}
|
||||
|
||||
public void setSoldeDisponible(BigDecimal soldeDisponible) {
|
||||
this.soldeDisponible = soldeDisponible;
|
||||
calculerSoldeTotal();
|
||||
}
|
||||
|
||||
public BigDecimal getSoldeEnAttente() {
|
||||
return soldeEnAttente;
|
||||
}
|
||||
|
||||
public void setSoldeEnAttente(BigDecimal soldeEnAttente) {
|
||||
this.soldeEnAttente = soldeEnAttente;
|
||||
calculerSoldeTotal();
|
||||
}
|
||||
|
||||
public BigDecimal getSoldeTotal() {
|
||||
return soldeTotal;
|
||||
}
|
||||
|
||||
public void setSoldeTotal(BigDecimal soldeTotal) {
|
||||
this.soldeTotal = soldeTotal;
|
||||
}
|
||||
|
||||
public String getDevise() {
|
||||
return devise;
|
||||
}
|
||||
|
||||
public void setDevise(String devise) {
|
||||
this.devise = devise;
|
||||
}
|
||||
|
||||
public String getNumeroWallet() {
|
||||
return numeroWallet;
|
||||
}
|
||||
|
||||
public void setNumeroWallet(String numeroWallet) {
|
||||
this.numeroWallet = numeroWallet;
|
||||
}
|
||||
|
||||
public String getNomBusiness() {
|
||||
return nomBusiness;
|
||||
}
|
||||
|
||||
public void setNomBusiness(String nomBusiness) {
|
||||
this.nomBusiness = nomBusiness;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateDerniereMiseAJour() {
|
||||
return dateDerniereMiseAJour;
|
||||
}
|
||||
|
||||
public void setDateDerniereMiseAJour(LocalDateTime dateDerniereMiseAJour) {
|
||||
this.dateDerniereMiseAJour = dateDerniereMiseAJour;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateDerniereSynchronisation() {
|
||||
return dateDerniereSynchronisation;
|
||||
}
|
||||
|
||||
public void setDateDerniereSynchronisation(LocalDateTime dateDerniereSynchronisation) {
|
||||
this.dateDerniereSynchronisation = dateDerniereSynchronisation;
|
||||
}
|
||||
|
||||
public String getStatutWallet() {
|
||||
return statutWallet;
|
||||
}
|
||||
|
||||
public void setStatutWallet(String statutWallet) {
|
||||
this.statutWallet = statutWallet;
|
||||
}
|
||||
|
||||
public BigDecimal getLimiteQuotidienne() {
|
||||
return limiteQuotidienne;
|
||||
}
|
||||
|
||||
public void setLimiteQuotidienne(BigDecimal limiteQuotidienne) {
|
||||
this.limiteQuotidienne = limiteQuotidienne;
|
||||
}
|
||||
|
||||
public BigDecimal getMontantUtiliseAujourdhui() {
|
||||
return montantUtiliseAujourdhui;
|
||||
}
|
||||
|
||||
public void setMontantUtiliseAujourdhui(BigDecimal montantUtiliseAujourdhui) {
|
||||
this.montantUtiliseAujourdhui = montantUtiliseAujourdhui;
|
||||
}
|
||||
|
||||
public BigDecimal getLimiteMensuelle() {
|
||||
return limiteMensuelle;
|
||||
}
|
||||
|
||||
public void setLimiteMensuelle(BigDecimal limiteMensuelle) {
|
||||
this.limiteMensuelle = limiteMensuelle;
|
||||
}
|
||||
|
||||
public BigDecimal getMontantUtiliseCeMois() {
|
||||
return montantUtiliseCeMois;
|
||||
}
|
||||
|
||||
public void setMontantUtiliseCeMois(BigDecimal montantUtiliseCeMois) {
|
||||
this.montantUtiliseCeMois = montantUtiliseCeMois;
|
||||
}
|
||||
|
||||
public Integer getNombreTransactionsAujourdhui() {
|
||||
return nombreTransactionsAujourdhui;
|
||||
}
|
||||
|
||||
public void setNombreTransactionsAujourdhui(Integer nombreTransactionsAujourdhui) {
|
||||
this.nombreTransactionsAujourdhui = nombreTransactionsAujourdhui;
|
||||
}
|
||||
|
||||
public Integer getNombreTransactionsCeMois() {
|
||||
return nombreTransactionsCeMois;
|
||||
}
|
||||
|
||||
public void setNombreTransactionsCeMois(Integer nombreTransactionsCeMois) {
|
||||
this.nombreTransactionsCeMois = nombreTransactionsCeMois;
|
||||
}
|
||||
|
||||
public String getDerniereErreur() {
|
||||
return derniereErreur;
|
||||
}
|
||||
|
||||
public void setDerniereErreur(String derniereErreur) {
|
||||
this.derniereErreur = derniereErreur;
|
||||
}
|
||||
|
||||
public String getCodeDerniereErreur() {
|
||||
return codeDerniereErreur;
|
||||
}
|
||||
|
||||
public void setCodeDerniereErreur(String codeDerniereErreur) {
|
||||
this.codeDerniereErreur = codeDerniereErreur;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
|
||||
/** Calcule le solde total */
|
||||
private void calculerSoldeTotal() {
|
||||
if (soldeDisponible != null && soldeEnAttente != null) {
|
||||
this.soldeTotal = soldeDisponible.add(soldeEnAttente);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le wallet est actif
|
||||
*
|
||||
* @return true si le wallet est actif
|
||||
*/
|
||||
public boolean isWalletActif() {
|
||||
return "ACTIVE".equals(statutWallet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le solde est suffisant pour un montant donné
|
||||
*
|
||||
* @param montant Le montant à vérifier
|
||||
* @return true si le solde est suffisant
|
||||
*/
|
||||
public boolean isSoldeSuffisant(BigDecimal montant) {
|
||||
return soldeDisponible != null && soldeDisponible.compareTo(montant) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule le solde disponible restant pour aujourd'hui
|
||||
*
|
||||
* @return Le montant encore disponible aujourd'hui
|
||||
*/
|
||||
public BigDecimal getSoldeDisponibleAujourdhui() {
|
||||
if (limiteQuotidienne == null || montantUtiliseAujourdhui == null) {
|
||||
return soldeDisponible;
|
||||
}
|
||||
|
||||
public WaveBalanceDTO(String numeroWallet, BigDecimal soldeDisponible) {
|
||||
this();
|
||||
this.numeroWallet = numeroWallet;
|
||||
this.soldeDisponible = soldeDisponible;
|
||||
this.soldeTotal = soldeDisponible;
|
||||
}
|
||||
BigDecimal limiteRestante = limiteQuotidienne.subtract(montantUtiliseAujourdhui);
|
||||
return soldeDisponible.min(limiteRestante);
|
||||
}
|
||||
|
||||
// Getters et Setters
|
||||
public BigDecimal getSoldeDisponible() {
|
||||
return soldeDisponible;
|
||||
}
|
||||
/**
|
||||
* Met à jour les statistiques après une transaction
|
||||
*
|
||||
* @param montant Le montant de la transaction
|
||||
*/
|
||||
public void mettreAJourApresTransaction(BigDecimal montant) {
|
||||
if (montantUtiliseAujourdhui == null) montantUtiliseAujourdhui = BigDecimal.ZERO;
|
||||
if (montantUtiliseCeMois == null) montantUtiliseCeMois = BigDecimal.ZERO;
|
||||
if (nombreTransactionsAujourdhui == null) nombreTransactionsAujourdhui = 0;
|
||||
if (nombreTransactionsCeMois == null) nombreTransactionsCeMois = 0;
|
||||
|
||||
public void setSoldeDisponible(BigDecimal soldeDisponible) {
|
||||
this.soldeDisponible = soldeDisponible;
|
||||
calculerSoldeTotal();
|
||||
}
|
||||
this.montantUtiliseAujourdhui = montantUtiliseAujourdhui.add(montant);
|
||||
this.montantUtiliseCeMois = montantUtiliseCeMois.add(montant);
|
||||
this.nombreTransactionsAujourdhui++;
|
||||
this.nombreTransactionsCeMois++;
|
||||
this.dateDerniereMiseAJour = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public BigDecimal getSoldeEnAttente() {
|
||||
return soldeEnAttente;
|
||||
}
|
||||
|
||||
public void setSoldeEnAttente(BigDecimal soldeEnAttente) {
|
||||
this.soldeEnAttente = soldeEnAttente;
|
||||
calculerSoldeTotal();
|
||||
}
|
||||
|
||||
public BigDecimal getSoldeTotal() {
|
||||
return soldeTotal;
|
||||
}
|
||||
|
||||
public void setSoldeTotal(BigDecimal soldeTotal) {
|
||||
this.soldeTotal = soldeTotal;
|
||||
}
|
||||
|
||||
public String getDevise() {
|
||||
return devise;
|
||||
}
|
||||
|
||||
public void setDevise(String devise) {
|
||||
this.devise = devise;
|
||||
}
|
||||
|
||||
public String getNumeroWallet() {
|
||||
return numeroWallet;
|
||||
}
|
||||
|
||||
public void setNumeroWallet(String numeroWallet) {
|
||||
this.numeroWallet = numeroWallet;
|
||||
}
|
||||
|
||||
public String getNomBusiness() {
|
||||
return nomBusiness;
|
||||
}
|
||||
|
||||
public void setNomBusiness(String nomBusiness) {
|
||||
this.nomBusiness = nomBusiness;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateDerniereMiseAJour() {
|
||||
return dateDerniereMiseAJour;
|
||||
}
|
||||
|
||||
public void setDateDerniereMiseAJour(LocalDateTime dateDerniereMiseAJour) {
|
||||
this.dateDerniereMiseAJour = dateDerniereMiseAJour;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateDerniereSynchronisation() {
|
||||
return dateDerniereSynchronisation;
|
||||
}
|
||||
|
||||
public void setDateDerniereSynchronisation(LocalDateTime dateDerniereSynchronisation) {
|
||||
this.dateDerniereSynchronisation = dateDerniereSynchronisation;
|
||||
}
|
||||
|
||||
public String getStatutWallet() {
|
||||
return statutWallet;
|
||||
}
|
||||
|
||||
public void setStatutWallet(String statutWallet) {
|
||||
this.statutWallet = statutWallet;
|
||||
}
|
||||
|
||||
public BigDecimal getLimiteQuotidienne() {
|
||||
return limiteQuotidienne;
|
||||
}
|
||||
|
||||
public void setLimiteQuotidienne(BigDecimal limiteQuotidienne) {
|
||||
this.limiteQuotidienne = limiteQuotidienne;
|
||||
}
|
||||
|
||||
public BigDecimal getMontantUtiliseAujourdhui() {
|
||||
return montantUtiliseAujourdhui;
|
||||
}
|
||||
|
||||
public void setMontantUtiliseAujourdhui(BigDecimal montantUtiliseAujourdhui) {
|
||||
this.montantUtiliseAujourdhui = montantUtiliseAujourdhui;
|
||||
}
|
||||
|
||||
public BigDecimal getLimiteMensuelle() {
|
||||
return limiteMensuelle;
|
||||
}
|
||||
|
||||
public void setLimiteMensuelle(BigDecimal limiteMensuelle) {
|
||||
this.limiteMensuelle = limiteMensuelle;
|
||||
}
|
||||
|
||||
public BigDecimal getMontantUtiliseCeMois() {
|
||||
return montantUtiliseCeMois;
|
||||
}
|
||||
|
||||
public void setMontantUtiliseCeMois(BigDecimal montantUtiliseCeMois) {
|
||||
this.montantUtiliseCeMois = montantUtiliseCeMois;
|
||||
}
|
||||
|
||||
public Integer getNombreTransactionsAujourdhui() {
|
||||
return nombreTransactionsAujourdhui;
|
||||
}
|
||||
|
||||
public void setNombreTransactionsAujourdhui(Integer nombreTransactionsAujourdhui) {
|
||||
this.nombreTransactionsAujourdhui = nombreTransactionsAujourdhui;
|
||||
}
|
||||
|
||||
public Integer getNombreTransactionsCeMois() {
|
||||
return nombreTransactionsCeMois;
|
||||
}
|
||||
|
||||
public void setNombreTransactionsCeMois(Integer nombreTransactionsCeMois) {
|
||||
this.nombreTransactionsCeMois = nombreTransactionsCeMois;
|
||||
}
|
||||
|
||||
public String getDerniereErreur() {
|
||||
return derniereErreur;
|
||||
}
|
||||
|
||||
public void setDerniereErreur(String derniereErreur) {
|
||||
this.derniereErreur = derniereErreur;
|
||||
}
|
||||
|
||||
public String getCodeDerniereErreur() {
|
||||
return codeDerniereErreur;
|
||||
}
|
||||
|
||||
public void setCodeDerniereErreur(String codeDerniereErreur) {
|
||||
this.codeDerniereErreur = codeDerniereErreur;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
|
||||
/**
|
||||
* Calcule le solde total
|
||||
*/
|
||||
private void calculerSoldeTotal() {
|
||||
if (soldeDisponible != null && soldeEnAttente != null) {
|
||||
this.soldeTotal = soldeDisponible.add(soldeEnAttente);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le wallet est actif
|
||||
* @return true si le wallet est actif
|
||||
*/
|
||||
public boolean isWalletActif() {
|
||||
return "ACTIVE".equals(statutWallet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le solde est suffisant pour un montant donné
|
||||
* @param montant Le montant à vérifier
|
||||
* @return true si le solde est suffisant
|
||||
*/
|
||||
public boolean isSoldeSuffisant(BigDecimal montant) {
|
||||
return soldeDisponible != null && soldeDisponible.compareTo(montant) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcule le solde disponible restant pour aujourd'hui
|
||||
* @return Le montant encore disponible aujourd'hui
|
||||
*/
|
||||
public BigDecimal getSoldeDisponibleAujourdhui() {
|
||||
if (limiteQuotidienne == null || montantUtiliseAujourdhui == null) {
|
||||
return soldeDisponible;
|
||||
}
|
||||
|
||||
BigDecimal limiteRestante = limiteQuotidienne.subtract(montantUtiliseAujourdhui);
|
||||
return soldeDisponible.min(limiteRestante);
|
||||
}
|
||||
|
||||
/**
|
||||
* Met à jour les statistiques après une transaction
|
||||
* @param montant Le montant de la transaction
|
||||
*/
|
||||
public void mettreAJourApresTransaction(BigDecimal montant) {
|
||||
if (montantUtiliseAujourdhui == null) montantUtiliseAujourdhui = BigDecimal.ZERO;
|
||||
if (montantUtiliseCeMois == null) montantUtiliseCeMois = BigDecimal.ZERO;
|
||||
if (nombreTransactionsAujourdhui == null) nombreTransactionsAujourdhui = 0;
|
||||
if (nombreTransactionsCeMois == null) nombreTransactionsCeMois = 0;
|
||||
|
||||
this.montantUtiliseAujourdhui = montantUtiliseAujourdhui.add(montant);
|
||||
this.montantUtiliseCeMois = montantUtiliseCeMois.add(montant);
|
||||
this.nombreTransactionsAujourdhui++;
|
||||
this.nombreTransactionsCeMois++;
|
||||
this.dateDerniereMiseAJour = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WaveBalanceDTO{" +
|
||||
"numeroWallet='" + numeroWallet + '\'' +
|
||||
", soldeDisponible=" + soldeDisponible +
|
||||
", soldeTotal=" + soldeTotal +
|
||||
", devise='" + devise + '\'' +
|
||||
", statutWallet='" + statutWallet + '\'' +
|
||||
"} " + super.toString();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WaveBalanceDTO{"
|
||||
+ "numeroWallet='"
|
||||
+ numeroWallet
|
||||
+ '\''
|
||||
+ ", soldeDisponible="
|
||||
+ soldeDisponible
|
||||
+ ", soldeTotal="
|
||||
+ soldeTotal
|
||||
+ ", devise='"
|
||||
+ devise
|
||||
+ '\''
|
||||
+ ", statutWallet='"
|
||||
+ statutWallet
|
||||
+ '\''
|
||||
+ "} "
|
||||
+ super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package dev.lions.unionflow.server.api.dto.paiement;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.base.BaseDTO;
|
||||
import dev.lions.unionflow.server.api.enums.paiement.StatutSession;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
@@ -14,14 +9,17 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* DTO pour les sessions de paiement Wave Money (Checkout API)
|
||||
* Représente une session de paiement créée via l'API Wave Checkout
|
||||
* DTO pour les sessions de paiement Wave Money (Checkout API) Représente une session de paiement
|
||||
* créée via l'API Wave Checkout
|
||||
*
|
||||
* Basé sur l'API officielle Wave : https://docs.wave.com/business#checkout-api
|
||||
* <p>Basé sur l'API officielle Wave : https://docs.wave.com/business#checkout-api
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
@@ -31,196 +29,140 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class WaveCheckoutSessionDTO extends BaseDTO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID de la session Wave (retourné par l'API) */
|
||||
@NotBlank(message = "L'ID de session Wave est obligatoire")
|
||||
private String waveSessionId;
|
||||
|
||||
/** URL de la session de paiement Wave (générée par l'API Wave) */
|
||||
@Size(max = 500, message = "L'URL ne peut pas dépasser 500 caractères")
|
||||
private String waveUrl;
|
||||
|
||||
/**
|
||||
* ID de la session Wave (retourné par l'API)
|
||||
*/
|
||||
@NotBlank(message = "L'ID de session Wave est obligatoire")
|
||||
private String waveSessionId;
|
||||
/** Montant du paiement */
|
||||
@NotNull(message = "Le montant est obligatoire")
|
||||
@DecimalMin(value = "0.01", message = "Le montant doit être positif")
|
||||
@Digits(
|
||||
integer = 10,
|
||||
fraction = 2,
|
||||
message = "Le montant ne peut avoir plus de 10 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montant;
|
||||
|
||||
/**
|
||||
* URL de la session de paiement Wave (générée par l'API Wave)
|
||||
*/
|
||||
@Size(max = 500, message = "L'URL ne peut pas dépasser 500 caractères")
|
||||
private String waveUrl;
|
||||
/** Devise (XOF pour le Sénégal) */
|
||||
@NotBlank(message = "La devise est obligatoire")
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String devise = "XOF";
|
||||
|
||||
/**
|
||||
* Montant du paiement
|
||||
*/
|
||||
@NotNull(message = "Le montant est obligatoire")
|
||||
@DecimalMin(value = "0.01", message = "Le montant doit être positif")
|
||||
@Digits(integer = 10, fraction = 2, message = "Le montant ne peut avoir plus de 10 chiffres entiers et 2 décimales")
|
||||
private BigDecimal montant;
|
||||
/** URL de succès (redirection après paiement réussi) */
|
||||
@NotBlank(message = "L'URL de succès est obligatoire")
|
||||
@Size(max = 500, message = "L'URL de succès ne peut pas dépasser 500 caractères")
|
||||
private String successUrl;
|
||||
|
||||
/**
|
||||
* Devise (XOF pour le Sénégal)
|
||||
*/
|
||||
@NotBlank(message = "La devise est obligatoire")
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String devise = "XOF";
|
||||
/** URL d'erreur (redirection après échec) */
|
||||
@NotBlank(message = "L'URL d'erreur est obligatoire")
|
||||
@Size(max = 500, message = "L'URL d'erreur ne peut pas dépasser 500 caractères")
|
||||
private String errorUrl;
|
||||
|
||||
/**
|
||||
* URL de succès (redirection après paiement réussi)
|
||||
*/
|
||||
@NotBlank(message = "L'URL de succès est obligatoire")
|
||||
@Size(max = 500, message = "L'URL de succès ne peut pas dépasser 500 caractères")
|
||||
private String successUrl;
|
||||
/** Statut de la session */
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
private StatutSession statut;
|
||||
|
||||
/**
|
||||
* URL d'erreur (redirection après échec)
|
||||
*/
|
||||
@NotBlank(message = "L'URL d'erreur est obligatoire")
|
||||
@Size(max = 500, message = "L'URL d'erreur ne peut pas dépasser 500 caractères")
|
||||
private String errorUrl;
|
||||
/** ID de l'organisation qui effectue le paiement */
|
||||
private UUID organisationId;
|
||||
|
||||
/**
|
||||
* Statut de la session
|
||||
*/
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
private StatutSession statut;
|
||||
/** Nom de l'organisation */
|
||||
private String nomOrganisation;
|
||||
|
||||
/**
|
||||
* ID de l'organisation qui effectue le paiement
|
||||
*/
|
||||
private UUID organisationId;
|
||||
/** ID du membre qui effectue le paiement */
|
||||
private UUID membreId;
|
||||
|
||||
/**
|
||||
* Nom de l'organisation
|
||||
*/
|
||||
private String nomOrganisation;
|
||||
/** Nom du membre */
|
||||
private String nomMembre;
|
||||
|
||||
/**
|
||||
* ID du membre qui effectue le paiement
|
||||
*/
|
||||
private UUID membreId;
|
||||
/** Type de paiement (COTISATION, ABONNEMENT, DON, AUTRE) */
|
||||
@Pattern(
|
||||
regexp = "^(COTISATION|ABONNEMENT|DON|EVENEMENT|FORMATION|AUTRE)$",
|
||||
message = "Type de paiement invalide")
|
||||
private String typePaiement;
|
||||
|
||||
/**
|
||||
* Nom du membre
|
||||
*/
|
||||
private String nomMembre;
|
||||
/** Référence du paiement dans UnionFlow */
|
||||
@Size(max = 100, message = "La référence ne peut pas dépasser 100 caractères")
|
||||
private String referenceUnionFlow;
|
||||
|
||||
/**
|
||||
* Type de paiement (COTISATION, ABONNEMENT, DON, AUTRE)
|
||||
*/
|
||||
@Pattern(regexp = "^(COTISATION|ABONNEMENT|DON|EVENEMENT|FORMATION|AUTRE)$",
|
||||
message = "Type de paiement invalide")
|
||||
private String typePaiement;
|
||||
/** Description du paiement */
|
||||
@Size(max = 500, message = "La description ne peut pas dépasser 500 caractères")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* Référence du paiement dans UnionFlow
|
||||
*/
|
||||
@Size(max = 100, message = "La référence ne peut pas dépasser 100 caractères")
|
||||
private String referenceUnionFlow;
|
||||
/** Nom du business affiché (override_business_name) */
|
||||
@Size(max = 100, message = "Le nom du business ne peut pas dépasser 100 caractères")
|
||||
private String nomBusinessAffiche;
|
||||
|
||||
/**
|
||||
* Description du paiement
|
||||
*/
|
||||
@Size(max = 500, message = "La description ne peut pas dépasser 500 caractères")
|
||||
private String description;
|
||||
/** ID du marchand agrégé (si applicable) */
|
||||
private String aggregatedMerchantId;
|
||||
|
||||
/**
|
||||
* Nom du business affiché (override_business_name)
|
||||
*/
|
||||
@Size(max = 100, message = "Le nom du business ne peut pas dépasser 100 caractères")
|
||||
private String nomBusinessAffiche;
|
||||
/** Date d'expiration de la session */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateExpiration;
|
||||
|
||||
/**
|
||||
* ID du marchand agrégé (si applicable)
|
||||
*/
|
||||
private String aggregatedMerchantId;
|
||||
/** Date de completion du paiement */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateCompletion;
|
||||
|
||||
/**
|
||||
* Date d'expiration de la session
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateExpiration;
|
||||
/** Numéro de téléphone du payeur (si fourni) */
|
||||
@Pattern(regexp = "^\\+?[0-9]{8,15}$", message = "Format de numéro de téléphone invalide")
|
||||
private String telephonePayeur;
|
||||
|
||||
/**
|
||||
* Date de completion du paiement
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateCompletion;
|
||||
/** Email du payeur (si fourni) */
|
||||
@Pattern(regexp = "^[A-Za-z0-9+_.-]+@(.+)$", message = "Format d'email invalide")
|
||||
private String emailPayeur;
|
||||
|
||||
/**
|
||||
* Numéro de téléphone du payeur (si fourni)
|
||||
*/
|
||||
@Pattern(regexp = "^\\+?[0-9]{8,15}$", message = "Format de numéro de téléphone invalide")
|
||||
private String telephonePayeur;
|
||||
/** Adresse IP du client */
|
||||
private String adresseIpClient;
|
||||
|
||||
/**
|
||||
* Email du payeur (si fourni)
|
||||
*/
|
||||
@Pattern(regexp = "^[A-Za-z0-9+_.-]+@(.+)$", message = "Format d'email invalide")
|
||||
private String emailPayeur;
|
||||
/** User Agent du navigateur */
|
||||
@Size(max = 500, message = "Le User Agent ne peut pas dépasser 500 caractères")
|
||||
private String userAgent;
|
||||
|
||||
/**
|
||||
* Adresse IP du client
|
||||
*/
|
||||
private String adresseIpClient;
|
||||
/** Données de callback reçues de Wave */
|
||||
@Size(max = 2000, message = "Les données callback ne peuvent pas dépasser 2000 caractères")
|
||||
private String callbackData;
|
||||
|
||||
/**
|
||||
* User Agent du navigateur
|
||||
*/
|
||||
@Size(max = 500, message = "Le User Agent ne peut pas dépasser 500 caractères")
|
||||
private String userAgent;
|
||||
/** Code d'erreur Wave (si échec) */
|
||||
private String codeErreurWave;
|
||||
|
||||
/**
|
||||
* Données de callback reçues de Wave
|
||||
*/
|
||||
@Size(max = 2000, message = "Les données callback ne peuvent pas dépasser 2000 caractères")
|
||||
private String callbackData;
|
||||
/** Message d'erreur Wave (si échec) */
|
||||
@Size(max = 500, message = "Le message d'erreur ne peut pas dépasser 500 caractères")
|
||||
private String messageErreurWave;
|
||||
|
||||
/**
|
||||
* Code d'erreur Wave (si échec)
|
||||
*/
|
||||
private String codeErreurWave;
|
||||
/** Nombre de tentatives de paiement */
|
||||
private Integer nombreTentatives;
|
||||
|
||||
/**
|
||||
* Message d'erreur Wave (si échec)
|
||||
*/
|
||||
@Size(max = 500, message = "Le message d'erreur ne peut pas dépasser 500 caractères")
|
||||
private String messageErreurWave;
|
||||
/** Session liée à un webhook */
|
||||
private Boolean webhookRecu;
|
||||
|
||||
/**
|
||||
* Nombre de tentatives de paiement
|
||||
*/
|
||||
private Integer nombreTentatives;
|
||||
/** Date de réception du webhook */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateWebhook;
|
||||
|
||||
/**
|
||||
* Session liée à un webhook
|
||||
*/
|
||||
private Boolean webhookRecu;
|
||||
/** Données du webhook reçu */
|
||||
@Size(max = 2000, message = "Les données webhook ne peuvent pas dépasser 2000 caractères")
|
||||
private String donneesWebhook;
|
||||
|
||||
/**
|
||||
* Date de réception du webhook
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateWebhook;
|
||||
// Constructeurs
|
||||
public WaveCheckoutSessionDTO() {
|
||||
super();
|
||||
this.devise = "XOF";
|
||||
this.statut = StatutSession.PENDING;
|
||||
this.nombreTentatives = 0;
|
||||
this.webhookRecu = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Données du webhook reçu
|
||||
*/
|
||||
@Size(max = 2000, message = "Les données webhook ne peuvent pas dépasser 2000 caractères")
|
||||
private String donneesWebhook;
|
||||
public WaveCheckoutSessionDTO(BigDecimal montant, String successUrl, String errorUrl) {
|
||||
this();
|
||||
this.montant = montant;
|
||||
this.successUrl = successUrl;
|
||||
this.errorUrl = errorUrl;
|
||||
}
|
||||
|
||||
// Constructeurs
|
||||
public WaveCheckoutSessionDTO() {
|
||||
super();
|
||||
this.devise = "XOF";
|
||||
this.statut = StatutSession.PENDING;
|
||||
this.nombreTentatives = 0;
|
||||
this.webhookRecu = false;
|
||||
}
|
||||
|
||||
public WaveCheckoutSessionDTO(BigDecimal montant, String successUrl, String errorUrl) {
|
||||
this();
|
||||
this.montant = montant;
|
||||
this.successUrl = successUrl;
|
||||
this.errorUrl = errorUrl;
|
||||
}
|
||||
|
||||
// Getters et Setters générés automatiquement par Lombok @Getter/@Setter
|
||||
// Getters et Setters générés automatiquement par Lombok @Getter/@Setter
|
||||
}
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
package dev.lions.unionflow.server.api.dto.paiement;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.base.BaseDTO;
|
||||
import dev.lions.unionflow.server.api.enums.paiement.TypeEvenement;
|
||||
import dev.lions.unionflow.server.api.enums.paiement.StatutTraitement;
|
||||
import dev.lions.unionflow.server.api.enums.paiement.TypeEvenement;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* DTO pour les webhooks Wave Money
|
||||
* Représente les notifications reçues de Wave lors d'événements
|
||||
* DTO pour les webhooks Wave Money Représente les notifications reçues de Wave lors d'événements
|
||||
*
|
||||
* Basé sur l'API officielle Wave : https://docs.wave.com/business#webhooks
|
||||
* <p>Basé sur l'API officielle Wave : https://docs.wave.com/business#webhooks
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
@@ -30,489 +27,438 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class WaveWebhookDTO extends BaseDTO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ID unique du webhook Wave
|
||||
*/
|
||||
@NotBlank(message = "L'ID du webhook est obligatoire")
|
||||
private String webhookId;
|
||||
|
||||
/**
|
||||
* Type d'événement
|
||||
*/
|
||||
@NotNull(message = "Le type d'événement est obligatoire")
|
||||
private TypeEvenement typeEvenement;
|
||||
|
||||
/**
|
||||
* Code de l'événement tel que reçu de Wave
|
||||
*/
|
||||
@NotBlank(message = "Le code événement est obligatoire")
|
||||
private String codeEvenement;
|
||||
|
||||
/**
|
||||
* Statut de traitement du webhook
|
||||
*/
|
||||
@NotNull(message = "Le statut de traitement est obligatoire")
|
||||
private StatutTraitement statutTraitement;
|
||||
|
||||
/**
|
||||
* Payload JSON complet reçu de Wave
|
||||
*/
|
||||
@NotBlank(message = "Le payload est obligatoire")
|
||||
@Size(max = 5000, message = "Le payload ne peut pas dépasser 5000 caractères")
|
||||
private String payloadJson;
|
||||
|
||||
/**
|
||||
* Headers HTTP reçus
|
||||
*/
|
||||
@Size(max = 2000, message = "Les headers ne peuvent pas dépasser 2000 caractères")
|
||||
private String headersHttp;
|
||||
|
||||
/**
|
||||
* Signature Wave pour vérification
|
||||
*/
|
||||
private String signatureWave;
|
||||
|
||||
/**
|
||||
* Date de réception du webhook
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateReception;
|
||||
|
||||
/**
|
||||
* Date de traitement du webhook
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateTraitement;
|
||||
|
||||
/**
|
||||
* ID de la session checkout concernée (si applicable)
|
||||
*/
|
||||
private String sessionCheckoutId;
|
||||
|
||||
/**
|
||||
* ID de la transaction Wave concernée
|
||||
*/
|
||||
private String transactionWaveId;
|
||||
|
||||
/**
|
||||
* Montant de la transaction (si applicable)
|
||||
*/
|
||||
private BigDecimal montantTransaction;
|
||||
|
||||
/**
|
||||
* Devise de la transaction
|
||||
*/
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String deviseTransaction;
|
||||
|
||||
/**
|
||||
* Statut de la transaction Wave
|
||||
*/
|
||||
private String statutTransactionWave;
|
||||
|
||||
/**
|
||||
* ID de l'organisation UnionFlow concernée
|
||||
*/
|
||||
private UUID organisationId;
|
||||
|
||||
/**
|
||||
* ID du membre UnionFlow concerné
|
||||
*/
|
||||
private UUID membreId;
|
||||
|
||||
/**
|
||||
* Référence UnionFlow liée
|
||||
*/
|
||||
private String referenceUnionFlow;
|
||||
|
||||
/**
|
||||
* Type de paiement UnionFlow
|
||||
*/
|
||||
@Pattern(regexp = "^(COTISATION|ABONNEMENT|DON|EVENEMENT|FORMATION|AUTRE)$",
|
||||
message = "Type de paiement invalide")
|
||||
private String typePaiementUnionFlow;
|
||||
|
||||
/**
|
||||
* Adresse IP source du webhook
|
||||
*/
|
||||
private String adresseIpSource;
|
||||
|
||||
/**
|
||||
* User Agent du webhook
|
||||
*/
|
||||
@Size(max = 500, message = "Le User Agent ne peut pas dépasser 500 caractères")
|
||||
private String userAgentSource;
|
||||
|
||||
/**
|
||||
* Nombre de tentatives de traitement
|
||||
*/
|
||||
private Integer nombreTentativesTraitement;
|
||||
|
||||
/**
|
||||
* Message d'erreur de traitement (si échec)
|
||||
*/
|
||||
@Size(max = 1000, message = "Le message d'erreur ne peut pas dépasser 1000 caractères")
|
||||
private String messageErreurTraitement;
|
||||
|
||||
/**
|
||||
* Code d'erreur de traitement (si échec)
|
||||
*/
|
||||
private String codeErreurTraitement;
|
||||
|
||||
/**
|
||||
* Stack trace de l'erreur (si échec)
|
||||
*/
|
||||
@Size(max = 3000, message = "La stack trace ne peut pas dépasser 3000 caractères")
|
||||
private String stackTraceErreur;
|
||||
|
||||
/**
|
||||
* Webhook traité automatiquement
|
||||
*/
|
||||
private Boolean traitementAutomatique;
|
||||
|
||||
/**
|
||||
* Webhook nécessitant une intervention manuelle
|
||||
*/
|
||||
private Boolean interventionManuelleRequise;
|
||||
|
||||
/**
|
||||
* Notes de traitement manuel
|
||||
*/
|
||||
@Size(max = 1000, message = "Les notes ne peuvent pas dépasser 1000 caractères")
|
||||
private String notesTraitementManuel;
|
||||
|
||||
/**
|
||||
* Utilisateur ayant traité manuellement
|
||||
*/
|
||||
private String utilisateurTraitementManuel;
|
||||
|
||||
/**
|
||||
* Date du traitement manuel
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateTraitementManuel;
|
||||
|
||||
// Constructeurs
|
||||
public WaveWebhookDTO() {
|
||||
super();
|
||||
this.statutTraitement = StatutTraitement.RECU;
|
||||
this.dateReception = LocalDateTime.now();
|
||||
this.nombreTentativesTraitement = 0;
|
||||
this.traitementAutomatique = true;
|
||||
this.interventionManuelleRequise = false;
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public WaveWebhookDTO(String webhookId, TypeEvenement typeEvenement, String payloadJson) {
|
||||
this();
|
||||
this.webhookId = webhookId;
|
||||
this.typeEvenement = typeEvenement;
|
||||
this.codeEvenement = typeEvenement.getCodeWave();
|
||||
this.payloadJson = payloadJson;
|
||||
}
|
||||
/** ID unique du webhook Wave */
|
||||
@NotBlank(message = "L'ID du webhook est obligatoire")
|
||||
private String webhookId;
|
||||
|
||||
// Getters et Setters
|
||||
public String getWebhookId() {
|
||||
return webhookId;
|
||||
}
|
||||
/** Type d'événement */
|
||||
@NotNull(message = "Le type d'événement est obligatoire")
|
||||
private TypeEvenement typeEvenement;
|
||||
|
||||
public void setWebhookId(String webhookId) {
|
||||
this.webhookId = webhookId;
|
||||
}
|
||||
/** Code de l'événement tel que reçu de Wave */
|
||||
@NotBlank(message = "Le code événement est obligatoire")
|
||||
private String codeEvenement;
|
||||
|
||||
public TypeEvenement getTypeEvenement() {
|
||||
return typeEvenement;
|
||||
}
|
||||
/** Statut de traitement du webhook */
|
||||
@NotNull(message = "Le statut de traitement est obligatoire")
|
||||
private StatutTraitement statutTraitement;
|
||||
|
||||
public void setTypeEvenement(TypeEvenement typeEvenement) {
|
||||
this.typeEvenement = typeEvenement;
|
||||
if (typeEvenement != null) {
|
||||
this.codeEvenement = typeEvenement.getCodeWave();
|
||||
}
|
||||
}
|
||||
/** Payload JSON complet reçu de Wave */
|
||||
@NotBlank(message = "Le payload est obligatoire")
|
||||
@Size(max = 5000, message = "Le payload ne peut pas dépasser 5000 caractères")
|
||||
private String payloadJson;
|
||||
|
||||
public String getCodeEvenement() {
|
||||
return codeEvenement;
|
||||
}
|
||||
|
||||
public void setCodeEvenement(String codeEvenement) {
|
||||
this.codeEvenement = codeEvenement;
|
||||
this.typeEvenement = TypeEvenement.fromCode(codeEvenement);
|
||||
}
|
||||
|
||||
public StatutTraitement getStatutTraitement() {
|
||||
return statutTraitement;
|
||||
}
|
||||
|
||||
public void setStatutTraitement(StatutTraitement statutTraitement) {
|
||||
this.statutTraitement = statutTraitement;
|
||||
}
|
||||
|
||||
public String getPayloadJson() {
|
||||
return payloadJson;
|
||||
}
|
||||
|
||||
public void setPayloadJson(String payloadJson) {
|
||||
this.payloadJson = payloadJson;
|
||||
}
|
||||
|
||||
public String getHeadersHttp() {
|
||||
return headersHttp;
|
||||
}
|
||||
|
||||
public void setHeadersHttp(String headersHttp) {
|
||||
this.headersHttp = headersHttp;
|
||||
}
|
||||
|
||||
public String getSignatureWave() {
|
||||
return signatureWave;
|
||||
}
|
||||
|
||||
public void setSignatureWave(String signatureWave) {
|
||||
this.signatureWave = signatureWave;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateReception() {
|
||||
return dateReception;
|
||||
}
|
||||
|
||||
public void setDateReception(LocalDateTime dateReception) {
|
||||
this.dateReception = dateReception;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateTraitement() {
|
||||
return dateTraitement;
|
||||
}
|
||||
|
||||
public void setDateTraitement(LocalDateTime dateTraitement) {
|
||||
this.dateTraitement = dateTraitement;
|
||||
}
|
||||
|
||||
public String getSessionCheckoutId() {
|
||||
return sessionCheckoutId;
|
||||
}
|
||||
|
||||
public void setSessionCheckoutId(String sessionCheckoutId) {
|
||||
this.sessionCheckoutId = sessionCheckoutId;
|
||||
}
|
||||
|
||||
public String getTransactionWaveId() {
|
||||
return transactionWaveId;
|
||||
}
|
||||
|
||||
public void setTransactionWaveId(String transactionWaveId) {
|
||||
this.transactionWaveId = transactionWaveId;
|
||||
}
|
||||
/** Headers HTTP reçus */
|
||||
@Size(max = 2000, message = "Les headers ne peuvent pas dépasser 2000 caractères")
|
||||
private String headersHttp;
|
||||
|
||||
public BigDecimal getMontantTransaction() {
|
||||
return montantTransaction;
|
||||
}
|
||||
/** Signature Wave pour vérification */
|
||||
private String signatureWave;
|
||||
|
||||
public void setMontantTransaction(BigDecimal montantTransaction) {
|
||||
this.montantTransaction = montantTransaction;
|
||||
}
|
||||
/** Date de réception du webhook */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateReception;
|
||||
|
||||
public String getDeviseTransaction() {
|
||||
return deviseTransaction;
|
||||
}
|
||||
/** Date de traitement du webhook */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateTraitement;
|
||||
|
||||
public void setDeviseTransaction(String deviseTransaction) {
|
||||
this.deviseTransaction = deviseTransaction;
|
||||
}
|
||||
/** ID de la session checkout concernée (si applicable) */
|
||||
private String sessionCheckoutId;
|
||||
|
||||
public String getStatutTransactionWave() {
|
||||
return statutTransactionWave;
|
||||
}
|
||||
/** ID de la transaction Wave concernée */
|
||||
private String transactionWaveId;
|
||||
|
||||
public void setStatutTransactionWave(String statutTransactionWave) {
|
||||
this.statutTransactionWave = statutTransactionWave;
|
||||
}
|
||||
/** Montant de la transaction (si applicable) */
|
||||
private BigDecimal montantTransaction;
|
||||
|
||||
public UUID getOrganisationId() {
|
||||
return organisationId;
|
||||
}
|
||||
/** Devise de la transaction */
|
||||
@Pattern(regexp = "^[A-Z]{3}$", message = "La devise doit être un code ISO à 3 lettres")
|
||||
private String deviseTransaction;
|
||||
|
||||
public void setOrganisationId(UUID organisationId) {
|
||||
this.organisationId = organisationId;
|
||||
}
|
||||
/** Statut de la transaction Wave */
|
||||
private String statutTransactionWave;
|
||||
|
||||
public UUID getMembreId() {
|
||||
return membreId;
|
||||
}
|
||||
/** ID de l'organisation UnionFlow concernée */
|
||||
private UUID organisationId;
|
||||
|
||||
public void setMembreId(UUID membreId) {
|
||||
this.membreId = membreId;
|
||||
}
|
||||
/** ID du membre UnionFlow concerné */
|
||||
private UUID membreId;
|
||||
|
||||
public String getReferenceUnionFlow() {
|
||||
return referenceUnionFlow;
|
||||
}
|
||||
/** Référence UnionFlow liée */
|
||||
private String referenceUnionFlow;
|
||||
|
||||
public void setReferenceUnionFlow(String referenceUnionFlow) {
|
||||
this.referenceUnionFlow = referenceUnionFlow;
|
||||
}
|
||||
/** Type de paiement UnionFlow */
|
||||
@Pattern(
|
||||
regexp = "^(COTISATION|ABONNEMENT|DON|EVENEMENT|FORMATION|AUTRE)$",
|
||||
message = "Type de paiement invalide")
|
||||
private String typePaiementUnionFlow;
|
||||
|
||||
public String getTypePaiementUnionFlow() {
|
||||
return typePaiementUnionFlow;
|
||||
}
|
||||
/** Adresse IP source du webhook */
|
||||
private String adresseIpSource;
|
||||
|
||||
public void setTypePaiementUnionFlow(String typePaiementUnionFlow) {
|
||||
this.typePaiementUnionFlow = typePaiementUnionFlow;
|
||||
}
|
||||
/** User Agent du webhook */
|
||||
@Size(max = 500, message = "Le User Agent ne peut pas dépasser 500 caractères")
|
||||
private String userAgentSource;
|
||||
|
||||
public String getAdresseIpSource() {
|
||||
return adresseIpSource;
|
||||
}
|
||||
/** Nombre de tentatives de traitement */
|
||||
private Integer nombreTentativesTraitement;
|
||||
|
||||
public void setAdresseIpSource(String adresseIpSource) {
|
||||
this.adresseIpSource = adresseIpSource;
|
||||
}
|
||||
/** Message d'erreur de traitement (si échec) */
|
||||
@Size(max = 1000, message = "Le message d'erreur ne peut pas dépasser 1000 caractères")
|
||||
private String messageErreurTraitement;
|
||||
|
||||
public String getUserAgentSource() {
|
||||
return userAgentSource;
|
||||
}
|
||||
/** Code d'erreur de traitement (si échec) */
|
||||
private String codeErreurTraitement;
|
||||
|
||||
public void setUserAgentSource(String userAgentSource) {
|
||||
this.userAgentSource = userAgentSource;
|
||||
}
|
||||
/** Stack trace de l'erreur (si échec) */
|
||||
@Size(max = 3000, message = "La stack trace ne peut pas dépasser 3000 caractères")
|
||||
private String stackTraceErreur;
|
||||
|
||||
public Integer getNombreTentativesTraitement() {
|
||||
return nombreTentativesTraitement;
|
||||
}
|
||||
/** Webhook traité automatiquement */
|
||||
private Boolean traitementAutomatique;
|
||||
|
||||
public void setNombreTentativesTraitement(Integer nombreTentativesTraitement) {
|
||||
this.nombreTentativesTraitement = nombreTentativesTraitement;
|
||||
}
|
||||
/** Webhook nécessitant une intervention manuelle */
|
||||
private Boolean interventionManuelleRequise;
|
||||
|
||||
public String getMessageErreurTraitement() {
|
||||
return messageErreurTraitement;
|
||||
}
|
||||
/** Notes de traitement manuel */
|
||||
@Size(max = 1000, message = "Les notes ne peuvent pas dépasser 1000 caractères")
|
||||
private String notesTraitementManuel;
|
||||
|
||||
public void setMessageErreurTraitement(String messageErreurTraitement) {
|
||||
this.messageErreurTraitement = messageErreurTraitement;
|
||||
}
|
||||
/** Utilisateur ayant traité manuellement */
|
||||
private String utilisateurTraitementManuel;
|
||||
|
||||
public String getCodeErreurTraitement() {
|
||||
return codeErreurTraitement;
|
||||
}
|
||||
/** Date du traitement manuel */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime dateTraitementManuel;
|
||||
|
||||
public void setCodeErreurTraitement(String codeErreurTraitement) {
|
||||
this.codeErreurTraitement = codeErreurTraitement;
|
||||
}
|
||||
// Constructeurs
|
||||
public WaveWebhookDTO() {
|
||||
super();
|
||||
this.statutTraitement = StatutTraitement.RECU;
|
||||
this.dateReception = LocalDateTime.now();
|
||||
this.nombreTentativesTraitement = 0;
|
||||
this.traitementAutomatique = true;
|
||||
this.interventionManuelleRequise = false;
|
||||
}
|
||||
|
||||
public String getStackTraceErreur() {
|
||||
return stackTraceErreur;
|
||||
}
|
||||
public WaveWebhookDTO(String webhookId, TypeEvenement typeEvenement, String payloadJson) {
|
||||
this();
|
||||
this.webhookId = webhookId;
|
||||
this.typeEvenement = typeEvenement;
|
||||
this.codeEvenement = typeEvenement.getCodeWave();
|
||||
this.payloadJson = payloadJson;
|
||||
}
|
||||
|
||||
public void setStackTraceErreur(String stackTraceErreur) {
|
||||
this.stackTraceErreur = stackTraceErreur;
|
||||
}
|
||||
// Getters et Setters
|
||||
public String getWebhookId() {
|
||||
return webhookId;
|
||||
}
|
||||
|
||||
public Boolean getTraitementAutomatique() {
|
||||
return traitementAutomatique;
|
||||
}
|
||||
public void setWebhookId(String webhookId) {
|
||||
this.webhookId = webhookId;
|
||||
}
|
||||
|
||||
public void setTraitementAutomatique(Boolean traitementAutomatique) {
|
||||
this.traitementAutomatique = traitementAutomatique;
|
||||
}
|
||||
public TypeEvenement getTypeEvenement() {
|
||||
return typeEvenement;
|
||||
}
|
||||
|
||||
public Boolean getInterventionManuelleRequise() {
|
||||
return interventionManuelleRequise;
|
||||
public void setTypeEvenement(TypeEvenement typeEvenement) {
|
||||
this.typeEvenement = typeEvenement;
|
||||
if (typeEvenement != null) {
|
||||
this.codeEvenement = typeEvenement.getCodeWave();
|
||||
}
|
||||
}
|
||||
|
||||
public String getCodeEvenement() {
|
||||
return codeEvenement;
|
||||
}
|
||||
|
||||
public void setCodeEvenement(String codeEvenement) {
|
||||
this.codeEvenement = codeEvenement;
|
||||
this.typeEvenement = TypeEvenement.fromCode(codeEvenement);
|
||||
}
|
||||
|
||||
public void setInterventionManuelleRequise(Boolean interventionManuelleRequise) {
|
||||
this.interventionManuelleRequise = interventionManuelleRequise;
|
||||
}
|
||||
public StatutTraitement getStatutTraitement() {
|
||||
return statutTraitement;
|
||||
}
|
||||
|
||||
public void setStatutTraitement(StatutTraitement statutTraitement) {
|
||||
this.statutTraitement = statutTraitement;
|
||||
}
|
||||
|
||||
public String getPayloadJson() {
|
||||
return payloadJson;
|
||||
}
|
||||
|
||||
public void setPayloadJson(String payloadJson) {
|
||||
this.payloadJson = payloadJson;
|
||||
}
|
||||
|
||||
public String getHeadersHttp() {
|
||||
return headersHttp;
|
||||
}
|
||||
|
||||
public void setHeadersHttp(String headersHttp) {
|
||||
this.headersHttp = headersHttp;
|
||||
}
|
||||
|
||||
public String getSignatureWave() {
|
||||
return signatureWave;
|
||||
}
|
||||
|
||||
public void setSignatureWave(String signatureWave) {
|
||||
this.signatureWave = signatureWave;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateReception() {
|
||||
return dateReception;
|
||||
}
|
||||
|
||||
public void setDateReception(LocalDateTime dateReception) {
|
||||
this.dateReception = dateReception;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateTraitement() {
|
||||
return dateTraitement;
|
||||
}
|
||||
|
||||
public void setDateTraitement(LocalDateTime dateTraitement) {
|
||||
this.dateTraitement = dateTraitement;
|
||||
}
|
||||
|
||||
public String getSessionCheckoutId() {
|
||||
return sessionCheckoutId;
|
||||
}
|
||||
|
||||
public void setSessionCheckoutId(String sessionCheckoutId) {
|
||||
this.sessionCheckoutId = sessionCheckoutId;
|
||||
}
|
||||
|
||||
public String getTransactionWaveId() {
|
||||
return transactionWaveId;
|
||||
}
|
||||
|
||||
public void setTransactionWaveId(String transactionWaveId) {
|
||||
this.transactionWaveId = transactionWaveId;
|
||||
}
|
||||
|
||||
public BigDecimal getMontantTransaction() {
|
||||
return montantTransaction;
|
||||
}
|
||||
|
||||
public String getNotesTraitementManuel() {
|
||||
return notesTraitementManuel;
|
||||
}
|
||||
public void setMontantTransaction(BigDecimal montantTransaction) {
|
||||
this.montantTransaction = montantTransaction;
|
||||
}
|
||||
|
||||
public void setNotesTraitementManuel(String notesTraitementManuel) {
|
||||
this.notesTraitementManuel = notesTraitementManuel;
|
||||
}
|
||||
public String getDeviseTransaction() {
|
||||
return deviseTransaction;
|
||||
}
|
||||
|
||||
public String getUtilisateurTraitementManuel() {
|
||||
return utilisateurTraitementManuel;
|
||||
}
|
||||
public void setDeviseTransaction(String deviseTransaction) {
|
||||
this.deviseTransaction = deviseTransaction;
|
||||
}
|
||||
|
||||
public void setUtilisateurTraitementManuel(String utilisateurTraitementManuel) {
|
||||
this.utilisateurTraitementManuel = utilisateurTraitementManuel;
|
||||
}
|
||||
public String getStatutTransactionWave() {
|
||||
return statutTransactionWave;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateTraitementManuel() {
|
||||
return dateTraitementManuel;
|
||||
}
|
||||
public void setStatutTransactionWave(String statutTransactionWave) {
|
||||
this.statutTransactionWave = statutTransactionWave;
|
||||
}
|
||||
|
||||
public void setDateTraitementManuel(LocalDateTime dateTraitementManuel) {
|
||||
this.dateTraitementManuel = dateTraitementManuel;
|
||||
}
|
||||
public UUID getOrganisationId() {
|
||||
return organisationId;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
public void setOrganisationId(UUID organisationId) {
|
||||
this.organisationId = organisationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le webhook concerne un checkout
|
||||
* @return true si c'est un événement de checkout
|
||||
*/
|
||||
public boolean isEvenementCheckout() {
|
||||
return typeEvenement == TypeEvenement.CHECKOUT_COMPLETE ||
|
||||
typeEvenement == TypeEvenement.CHECKOUT_CANCELLED ||
|
||||
typeEvenement == TypeEvenement.CHECKOUT_EXPIRED;
|
||||
}
|
||||
public UUID getMembreId() {
|
||||
return membreId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le webhook concerne un payout
|
||||
* @return true si c'est un événement de payout
|
||||
*/
|
||||
public boolean isEvenementPayout() {
|
||||
return typeEvenement == TypeEvenement.PAYOUT_COMPLETE ||
|
||||
typeEvenement == TypeEvenement.PAYOUT_FAILED;
|
||||
}
|
||||
public void setMembreId(UUID membreId) {
|
||||
this.membreId = membreId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marque le webhook comme traité avec succès
|
||||
*/
|
||||
public void marquerCommeTraite() {
|
||||
this.statutTraitement = StatutTraitement.TRAITE;
|
||||
this.dateTraitement = LocalDateTime.now();
|
||||
marquerCommeModifie("SYSTEM");
|
||||
}
|
||||
public String getReferenceUnionFlow() {
|
||||
return referenceUnionFlow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marque le webhook comme échoué
|
||||
* @param messageErreur Le message d'erreur
|
||||
* @param codeErreur Le code d'erreur
|
||||
*/
|
||||
public void marquerCommeEchec(String messageErreur, String codeErreur) {
|
||||
this.statutTraitement = StatutTraitement.ECHEC;
|
||||
this.messageErreurTraitement = messageErreur;
|
||||
this.codeErreurTraitement = codeErreur;
|
||||
this.nombreTentativesTraitement++;
|
||||
this.dateTraitement = LocalDateTime.now();
|
||||
marquerCommeModifie("SYSTEM");
|
||||
}
|
||||
public void setReferenceUnionFlow(String referenceUnionFlow) {
|
||||
this.referenceUnionFlow = referenceUnionFlow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Démarre le traitement du webhook
|
||||
*/
|
||||
public void demarrerTraitement() {
|
||||
this.statutTraitement = StatutTraitement.EN_COURS;
|
||||
this.nombreTentativesTraitement++;
|
||||
marquerCommeModifie("SYSTEM");
|
||||
}
|
||||
public String getTypePaiementUnionFlow() {
|
||||
return typePaiementUnionFlow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WaveWebhookDTO{" +
|
||||
"webhookId='" + webhookId + '\'' +
|
||||
", typeEvenement=" + typeEvenement +
|
||||
", statutTraitement=" + statutTraitement +
|
||||
", dateReception=" + dateReception +
|
||||
", sessionCheckoutId='" + sessionCheckoutId + '\'' +
|
||||
", montantTransaction=" + montantTransaction +
|
||||
"} " + super.toString();
|
||||
}
|
||||
public void setTypePaiementUnionFlow(String typePaiementUnionFlow) {
|
||||
this.typePaiementUnionFlow = typePaiementUnionFlow;
|
||||
}
|
||||
|
||||
public String getAdresseIpSource() {
|
||||
return adresseIpSource;
|
||||
}
|
||||
|
||||
public void setAdresseIpSource(String adresseIpSource) {
|
||||
this.adresseIpSource = adresseIpSource;
|
||||
}
|
||||
|
||||
public String getUserAgentSource() {
|
||||
return userAgentSource;
|
||||
}
|
||||
|
||||
public void setUserAgentSource(String userAgentSource) {
|
||||
this.userAgentSource = userAgentSource;
|
||||
}
|
||||
|
||||
public Integer getNombreTentativesTraitement() {
|
||||
return nombreTentativesTraitement;
|
||||
}
|
||||
|
||||
public void setNombreTentativesTraitement(Integer nombreTentativesTraitement) {
|
||||
this.nombreTentativesTraitement = nombreTentativesTraitement;
|
||||
}
|
||||
|
||||
public String getMessageErreurTraitement() {
|
||||
return messageErreurTraitement;
|
||||
}
|
||||
|
||||
public void setMessageErreurTraitement(String messageErreurTraitement) {
|
||||
this.messageErreurTraitement = messageErreurTraitement;
|
||||
}
|
||||
|
||||
public String getCodeErreurTraitement() {
|
||||
return codeErreurTraitement;
|
||||
}
|
||||
|
||||
public void setCodeErreurTraitement(String codeErreurTraitement) {
|
||||
this.codeErreurTraitement = codeErreurTraitement;
|
||||
}
|
||||
|
||||
public String getStackTraceErreur() {
|
||||
return stackTraceErreur;
|
||||
}
|
||||
|
||||
public void setStackTraceErreur(String stackTraceErreur) {
|
||||
this.stackTraceErreur = stackTraceErreur;
|
||||
}
|
||||
|
||||
public Boolean getTraitementAutomatique() {
|
||||
return traitementAutomatique;
|
||||
}
|
||||
|
||||
public void setTraitementAutomatique(Boolean traitementAutomatique) {
|
||||
this.traitementAutomatique = traitementAutomatique;
|
||||
}
|
||||
|
||||
public Boolean getInterventionManuelleRequise() {
|
||||
return interventionManuelleRequise;
|
||||
}
|
||||
|
||||
public void setInterventionManuelleRequise(Boolean interventionManuelleRequise) {
|
||||
this.interventionManuelleRequise = interventionManuelleRequise;
|
||||
}
|
||||
|
||||
public String getNotesTraitementManuel() {
|
||||
return notesTraitementManuel;
|
||||
}
|
||||
|
||||
public void setNotesTraitementManuel(String notesTraitementManuel) {
|
||||
this.notesTraitementManuel = notesTraitementManuel;
|
||||
}
|
||||
|
||||
public String getUtilisateurTraitementManuel() {
|
||||
return utilisateurTraitementManuel;
|
||||
}
|
||||
|
||||
public void setUtilisateurTraitementManuel(String utilisateurTraitementManuel) {
|
||||
this.utilisateurTraitementManuel = utilisateurTraitementManuel;
|
||||
}
|
||||
|
||||
public LocalDateTime getDateTraitementManuel() {
|
||||
return dateTraitementManuel;
|
||||
}
|
||||
|
||||
public void setDateTraitementManuel(LocalDateTime dateTraitementManuel) {
|
||||
this.dateTraitementManuel = dateTraitementManuel;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
|
||||
/**
|
||||
* Vérifie si le webhook concerne un checkout
|
||||
*
|
||||
* @return true si c'est un événement de checkout
|
||||
*/
|
||||
public boolean isEvenementCheckout() {
|
||||
return typeEvenement == TypeEvenement.CHECKOUT_COMPLETE
|
||||
|| typeEvenement == TypeEvenement.CHECKOUT_CANCELLED
|
||||
|| typeEvenement == TypeEvenement.CHECKOUT_EXPIRED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifie si le webhook concerne un payout
|
||||
*
|
||||
* @return true si c'est un événement de payout
|
||||
*/
|
||||
public boolean isEvenementPayout() {
|
||||
return typeEvenement == TypeEvenement.PAYOUT_COMPLETE
|
||||
|| typeEvenement == TypeEvenement.PAYOUT_FAILED;
|
||||
}
|
||||
|
||||
/** Marque le webhook comme traité avec succès */
|
||||
public void marquerCommeTraite() {
|
||||
this.statutTraitement = StatutTraitement.TRAITE;
|
||||
this.dateTraitement = LocalDateTime.now();
|
||||
marquerCommeModifie("SYSTEM");
|
||||
}
|
||||
|
||||
/**
|
||||
* Marque le webhook comme échoué
|
||||
*
|
||||
* @param messageErreur Le message d'erreur
|
||||
* @param codeErreur Le code d'erreur
|
||||
*/
|
||||
public void marquerCommeEchec(String messageErreur, String codeErreur) {
|
||||
this.statutTraitement = StatutTraitement.ECHEC;
|
||||
this.messageErreurTraitement = messageErreur;
|
||||
this.codeErreurTraitement = codeErreur;
|
||||
this.nombreTentativesTraitement++;
|
||||
this.dateTraitement = LocalDateTime.now();
|
||||
marquerCommeModifie("SYSTEM");
|
||||
}
|
||||
|
||||
/** Démarre le traitement du webhook */
|
||||
public void demarrerTraitement() {
|
||||
this.statutTraitement = StatutTraitement.EN_COURS;
|
||||
this.nombreTentativesTraitement++;
|
||||
marquerCommeModifie("SYSTEM");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WaveWebhookDTO{"
|
||||
+ "webhookId='"
|
||||
+ webhookId
|
||||
+ '\''
|
||||
+ ", typeEvenement="
|
||||
+ typeEvenement
|
||||
+ ", statutTraitement="
|
||||
+ statutTraitement
|
||||
+ ", dateReception="
|
||||
+ dateReception
|
||||
+ ", sessionCheckoutId='"
|
||||
+ sessionCheckoutId
|
||||
+ '\''
|
||||
+ ", montantTransaction="
|
||||
+ montantTransaction
|
||||
+ "} "
|
||||
+ super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,25 +2,25 @@ package dev.lions.unionflow.server.api.enums.abonnement;
|
||||
|
||||
/**
|
||||
* Énumération des statuts d'abonnements UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutAbonnement {
|
||||
ACTIF("Actif"),
|
||||
SUSPENDU("Suspendu"),
|
||||
EXPIRE("Expiré"),
|
||||
ANNULE("Annulé"),
|
||||
EN_ATTENTE_PAIEMENT("En attente de paiement");
|
||||
ACTIF("Actif"),
|
||||
SUSPENDU("Suspendu"),
|
||||
EXPIRE("Expiré"),
|
||||
ANNULE("Annulé"),
|
||||
EN_ATTENTE_PAIEMENT("En attente de paiement");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutAbonnement(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutAbonnement(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@ package dev.lions.unionflow.server.api.enums.abonnement;
|
||||
|
||||
/**
|
||||
* Énumération des statuts de formules d'abonnement UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutFormule {
|
||||
ACTIVE("Active"),
|
||||
INACTIVE("Inactive"),
|
||||
ARCHIVEE("Archivée"),
|
||||
BIENTOT_DISPONIBLE("Bientôt Disponible");
|
||||
ACTIVE("Active"),
|
||||
INACTIVE("Inactive"),
|
||||
ARCHIVEE("Archivée"),
|
||||
BIENTOT_DISPONIBLE("Bientôt Disponible");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutFormule(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutFormule(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@ package dev.lions.unionflow.server.api.enums.abonnement;
|
||||
|
||||
/**
|
||||
* Énumération des types de formules d'abonnement UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum TypeFormule {
|
||||
BASIC("Formule Basique"),
|
||||
STANDARD("Formule Standard"),
|
||||
PREMIUM("Formule Premium"),
|
||||
ENTERPRISE("Formule Entreprise");
|
||||
BASIC("Formule Basique"),
|
||||
STANDARD("Formule Standard"),
|
||||
PREMIUM("Formule Premium"),
|
||||
ENTERPRISE("Formule Entreprise");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
TypeFormule(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
TypeFormule(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,29 +2,29 @@ package dev.lions.unionflow.server.api.enums.evenement;
|
||||
|
||||
/**
|
||||
* Énumération des types d'événements métier dans UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum TypeEvenementMetier {
|
||||
ASSEMBLEE_GENERALE("Assemblée Générale"),
|
||||
FORMATION("Formation"),
|
||||
ACTIVITE_SOCIALE("Activité Sociale"),
|
||||
ACTION_CARITATIVE("Action Caritative"),
|
||||
REUNION_BUREAU("Réunion de Bureau"),
|
||||
CONFERENCE("Conférence"),
|
||||
ATELIER("Atelier"),
|
||||
CEREMONIE("Cérémonie"),
|
||||
AUTRE("Autre");
|
||||
ASSEMBLEE_GENERALE("Assemblée Générale"),
|
||||
FORMATION("Formation"),
|
||||
ACTIVITE_SOCIALE("Activité Sociale"),
|
||||
ACTION_CARITATIVE("Action Caritative"),
|
||||
REUNION_BUREAU("Réunion de Bureau"),
|
||||
CONFERENCE("Conférence"),
|
||||
ATELIER("Atelier"),
|
||||
CEREMONIE("Cérémonie"),
|
||||
AUTRE("Autre");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
TypeEvenementMetier(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
TypeEvenementMetier(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,26 +2,26 @@ package dev.lions.unionflow.server.api.enums.finance;
|
||||
|
||||
/**
|
||||
* Énumération des statuts de cotisations dans UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutCotisation {
|
||||
EN_ATTENTE("En attente"),
|
||||
PAYEE("Payée"),
|
||||
PARTIELLEMENT_PAYEE("Partiellement payée"),
|
||||
EN_RETARD("En retard"),
|
||||
ANNULEE("Annulée"),
|
||||
REMBOURSEE("Remboursée");
|
||||
EN_ATTENTE("En attente"),
|
||||
PAYEE("Payée"),
|
||||
PARTIELLEMENT_PAYEE("Partiellement payée"),
|
||||
EN_RETARD("En retard"),
|
||||
ANNULEE("Annulée"),
|
||||
REMBOURSEE("Remboursée");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutCotisation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutCotisation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,24 @@ package dev.lions.unionflow.server.api.enums.membre;
|
||||
|
||||
/**
|
||||
* Énumération des statuts de membres dans UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutMembre {
|
||||
ACTIF("Actif"),
|
||||
INACTIF("Inactif"),
|
||||
SUSPENDU("Suspendu"),
|
||||
RADIE("Radié");
|
||||
ACTIF("Actif"),
|
||||
INACTIF("Inactif"),
|
||||
SUSPENDU("Suspendu"),
|
||||
RADIE("Radié");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutMembre(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutMembre(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,25 @@ package dev.lions.unionflow.server.api.enums.organisation;
|
||||
|
||||
/**
|
||||
* Énumération des statuts d'organisations dans UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutOrganisation {
|
||||
ACTIVE("Active"),
|
||||
INACTIVE("Inactive"),
|
||||
SUSPENDUE("Suspendue"),
|
||||
EN_CREATION("En Création"),
|
||||
DISSOUTE("Dissoute");
|
||||
ACTIVE("Active"),
|
||||
INACTIVE("Inactive"),
|
||||
SUSPENDUE("Suspendue"),
|
||||
EN_CREATION("En Création"),
|
||||
DISSOUTE("Dissoute");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutOrganisation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutOrganisation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@ package dev.lions.unionflow.server.api.enums.organisation;
|
||||
|
||||
/**
|
||||
* Énumération des types d'organisations supportés par UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum TypeOrganisation {
|
||||
LIONS_CLUB("Lions Club"),
|
||||
ASSOCIATION("Association"),
|
||||
FEDERATION("Fédération"),
|
||||
COOPERATIVE("Coopérative"),
|
||||
MUTUELLE("Mutuelle"),
|
||||
SYNDICAT("Syndicat"),
|
||||
FONDATION("Fondation"),
|
||||
ONG("ONG");
|
||||
LIONS_CLUB("Lions Club"),
|
||||
ASSOCIATION("Association"),
|
||||
FEDERATION("Fédération"),
|
||||
COOPERATIVE("Coopérative"),
|
||||
MUTUELLE("Mutuelle"),
|
||||
SYNDICAT("Syndicat"),
|
||||
FONDATION("Fondation"),
|
||||
ONG("ONG");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
TypeOrganisation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
TypeOrganisation(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,25 @@ package dev.lions.unionflow.server.api.enums.paiement;
|
||||
|
||||
/**
|
||||
* Énumération des statuts de sessions de paiement Wave Money
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutSession {
|
||||
PENDING("En attente"),
|
||||
COMPLETED("Complétée"),
|
||||
CANCELLED("Annulée"),
|
||||
EXPIRED("Expirée"),
|
||||
FAILED("Échouée");
|
||||
PENDING("En attente"),
|
||||
COMPLETED("Complétée"),
|
||||
CANCELLED("Annulée"),
|
||||
EXPIRED("Expirée"),
|
||||
FAILED("Échouée");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutSession(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutSession(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,25 +2,25 @@ package dev.lions.unionflow.server.api.enums.paiement;
|
||||
|
||||
/**
|
||||
* Énumération des statuts de traitement des webhooks Wave Money
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutTraitement {
|
||||
RECU("Reçu"),
|
||||
EN_COURS("En cours de traitement"),
|
||||
TRAITE("Traité avec succès"),
|
||||
ECHEC("Échec de traitement"),
|
||||
IGNORE("Ignoré");
|
||||
RECU("Reçu"),
|
||||
EN_COURS("En cours de traitement"),
|
||||
TRAITE("Traité avec succès"),
|
||||
ECHEC("Échec de traitement"),
|
||||
IGNORE("Ignoré");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutTraitement(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutTraitement(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,42 +2,43 @@ package dev.lions.unionflow.server.api.enums.paiement;
|
||||
|
||||
/**
|
||||
* Énumération des types d'événements Wave Money pour les webhooks
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum TypeEvenement {
|
||||
CHECKOUT_COMPLETE("checkout.complete"),
|
||||
CHECKOUT_CANCELLED("checkout.cancelled"),
|
||||
CHECKOUT_EXPIRED("checkout.expired"),
|
||||
PAYOUT_COMPLETE("payout.complete"),
|
||||
PAYOUT_FAILED("payout.failed"),
|
||||
BALANCE_UPDATED("balance.updated"),
|
||||
TRANSACTION_CREATED("transaction.created"),
|
||||
TRANSACTION_UPDATED("transaction.updated");
|
||||
CHECKOUT_COMPLETE("checkout.complete"),
|
||||
CHECKOUT_CANCELLED("checkout.cancelled"),
|
||||
CHECKOUT_EXPIRED("checkout.expired"),
|
||||
PAYOUT_COMPLETE("payout.complete"),
|
||||
PAYOUT_FAILED("payout.failed"),
|
||||
BALANCE_UPDATED("balance.updated"),
|
||||
TRANSACTION_CREATED("transaction.created"),
|
||||
TRANSACTION_UPDATED("transaction.updated");
|
||||
|
||||
private final String codeWave;
|
||||
private final String codeWave;
|
||||
|
||||
TypeEvenement(String codeWave) {
|
||||
this.codeWave = codeWave;
|
||||
}
|
||||
|
||||
public String getCodeWave() {
|
||||
return codeWave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trouve un type d'événement par son code Wave
|
||||
* @param code Le code Wave
|
||||
* @return Le type d'événement correspondant ou null si non trouvé
|
||||
*/
|
||||
public static TypeEvenement fromCode(String code) {
|
||||
for (TypeEvenement type : values()) {
|
||||
if (type.codeWave.equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
TypeEvenement(String codeWave) {
|
||||
this.codeWave = codeWave;
|
||||
}
|
||||
|
||||
public String getCodeWave() {
|
||||
return codeWave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trouve un type d'événement par son code Wave
|
||||
*
|
||||
* @param code Le code Wave
|
||||
* @return Le type d'événement correspondant ou null si non trouvé
|
||||
*/
|
||||
public static TypeEvenement fromCode(String code) {
|
||||
for (TypeEvenement type : values()) {
|
||||
if (type.codeWave.equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@ package dev.lions.unionflow.server.api.enums.solidarite;
|
||||
|
||||
/**
|
||||
* Énumération des statuts d'aide dans le système de solidarité UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum StatutAide {
|
||||
EN_ATTENTE("En attente"),
|
||||
EN_COURS("En cours d'évaluation"),
|
||||
APPROUVEE("Approuvée"),
|
||||
REJETEE("Rejetée"),
|
||||
EN_COURS_VERSEMENT("En cours de versement"),
|
||||
VERSEE("Versée"),
|
||||
ANNULEE("Annulée"),
|
||||
SUSPENDUE("Suspendue");
|
||||
EN_ATTENTE("En attente"),
|
||||
EN_COURS("En cours d'évaluation"),
|
||||
APPROUVEE("Approuvée"),
|
||||
REJETEE("Rejetée"),
|
||||
EN_COURS_VERSEMENT("En cours de versement"),
|
||||
VERSEE("Versée"),
|
||||
ANNULEE("Annulée"),
|
||||
SUSPENDUE("Suspendue");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
StatutAide(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
StatutAide(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,29 +2,29 @@ package dev.lions.unionflow.server.api.enums.solidarite;
|
||||
|
||||
/**
|
||||
* Énumération des types d'aide dans le système de solidarité UnionFlow
|
||||
*
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-10
|
||||
*/
|
||||
public enum TypeAide {
|
||||
AIDE_FINANCIERE("Aide Financière"),
|
||||
AIDE_MEDICALE("Aide Médicale"),
|
||||
AIDE_EDUCATIVE("Aide Éducative"),
|
||||
AIDE_LOGEMENT("Aide au Logement"),
|
||||
AIDE_ALIMENTAIRE("Aide Alimentaire"),
|
||||
AIDE_JURIDIQUE("Aide Juridique"),
|
||||
AIDE_PROFESSIONNELLE("Aide Professionnelle"),
|
||||
AIDE_URGENCE("Aide d'Urgence"),
|
||||
AUTRE("Autre");
|
||||
AIDE_FINANCIERE("Aide Financière"),
|
||||
AIDE_MEDICALE("Aide Médicale"),
|
||||
AIDE_EDUCATIVE("Aide Éducative"),
|
||||
AIDE_LOGEMENT("Aide au Logement"),
|
||||
AIDE_ALIMENTAIRE("Aide Alimentaire"),
|
||||
AIDE_JURIDIQUE("Aide Juridique"),
|
||||
AIDE_PROFESSIONNELLE("Aide Professionnelle"),
|
||||
AIDE_URGENCE("Aide d'Urgence"),
|
||||
AUTRE("Autre");
|
||||
|
||||
private final String libelle;
|
||||
private final String libelle;
|
||||
|
||||
TypeAide(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
TypeAide(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user