Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRA 14646] - Ajout de courtier/négociant sur BSVHU #3645

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Conversation

silto
Copy link
Collaborator

@silto silto commented Oct 8, 2024

Objectif

  • ajouter un courtier au BSVHU
  • ajouter un négociant au BSVHU

Bonus

  • Recipify basé sur le même modèle que Sirenify, rendu utile par l'ajout de recipify broker et trader. Donc au lieu d'avoir 3 fonctions différentes, à réimplémenter dans tous les bsd qui ont besoin de recipify, je me suis permis un refacto.
    J'ai remplacé les recipify sur BSDA et BSFF avec ce nouveau recipify pour l'homogénéité (càd les bordereaux avec validation Zod, sauf PAOH qui a une validation assez différente des autres)
  • dans la validation d'entreprise destinataire VHU, ajout de la validation du sous profil (broyeur/démolisseur) qui n'était pas faite alors que ça devrait être le cas

  • Mettre à jour la documentation
  • Mettre à jour le change log
  • Documenter les manipulations à faire lors de la mise en production (sur le ticket Favro de release)
  • S'assurer que la numérotation des nouvelles migrations est bien cohérente
  • Informer le data engineer de tout changement de schéma DB

@silto silto changed the title feat(BSVHU): add trader/broker (cherry picked) [TRA 14646] - Ajout de courtier/négociant sur BSVHU Oct 9, 2024
@@ -417,7 +417,7 @@ export function toIncomingWaste(bsda: RegistryBsda): Required<IncomingWaste> {
traderRecepisseNumber: null,
brokerCompanyName: bsda.brokerCompanyName,
brokerCompanySiret: bsda.brokerCompanySiret,
brokerRecepisseNumber: null,
brokerRecepisseNumber: bsda.brokerRecepisseNumber,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajout de valeur manquante, je m'en suis rendu compte en regardnt ce qui était fait côté BSDA

Comment on lines +18 to +25
orgIdGetter: () => {
const orgId = getTransporterCompanyOrgId({
transporterCompanySiret:
bsd.transporters![idx].transporterCompanySiret ?? null,
transporterCompanyVatNumber:
bsd.transporters![idx].transporterCompanyVatNumber ?? null
});
return orgId ?? null;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

petite différence avec les accesseurs sirenify, on a une fonction pour récup l'orgId au lieu de juste un champ "siret" pour gérer les récupérations d'orgId qui sont soit vat soit siret comme ici

@@ -725,8 +725,7 @@ export const bsdaEditionRules: BsdaEditionRules = {
sealed: { from: "OPERATION" }
},
brokerRecepisseValidityLimit: {
readableFieldName:
"la date de validité de la certification de l'entreprise de travaux",
readableFieldName: "la date de validité du récépissé du courtier",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wording qui n'était pas le bon, remarqué en regardant ce qui était fait côté BSDA

@@ -292,7 +292,7 @@ export const contextualSchemaAsync = (context: BsdaValidationContext) => {
// `enableCompletionTransformers=false`;
transformedSyncSchema
.transform(sirenifyBsda(context))
.transform(updateTransportersRecepisse)
.transform(recipifyBsda(context))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utilisation du nouveau recipify

Comment on lines +95 to +97
},
wasteVehiclesTypes: {
set: ["BROYEUR", "DEMOLISSEUR"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En raison de l'ajout de la validation du sous profil qui n'était pas faite alors que ça devrait être le cas, j'ai dû ajouter la définition de sous profil dans plein de tests

@@ -295,12 +300,80 @@ export function BsvhuPdf({ bsvhu, qrCode, renderEmpty }: Props) {
</div>
<div></div>
</div>
{/* End Emitter signature*/}
{/* End Emitter signature */}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ajout de trader et broker au pdf. Si il n'y a ni l'un ni l'autre, laisser l'encart vide, si un seul des 2 cocher la case correspondante et afficher 1 encart, si i ly a les 2 afficher un encart supplémentaire pour le broker

@@ -38,7 +40,7 @@ export const checkCompanies: Refinement<ParsedZodBsvhu> = async (
await isDestinationRefinement(
bsvhu.destinationCompanySiret,
zodContext,
"WASTE_VEHICLES"
bsvhu.destinationType ?? "WASTE_VEHICLES"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passage du type de destination attendu à la validation de destination pour voir si ça correspond au sous profil de l'entreprise

isExemptedFromVerification?: (destination: Company | null) => boolean
) {
const company = await refineSiretAndGetCompany(
siret,
ctx,
CompanyRole.Destination
);
if (company) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changement de la validation de destination pour checker les sous profils VHU

@@ -134,3 +135,73 @@ export async function getTransporterReceipt(
transporterRecepisseValidityLimit: transporterReceipt?.validityLimit ?? null
};
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fonction commune de recipify, à laquelle sont passé les accesseurs, basée sur la même architecture que sirenify. La petite différence est que ici on doit aller chercher les recepisse qui peuvent être de type différent (transporteur, trader, broker) donc il y a la gestion des différents cas

Copy link

sonarcloud bot commented Oct 9, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant