Skip to content

Commit

Permalink
Injecte fournisseur dans requête pièce justificative
Browse files Browse the repository at this point in the history
  • Loading branch information
egaillot committed Aug 9, 2024
1 parent cf85c83 commit 38d9c04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/ebms/requeteJustificatif.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const EnteteRequete = require('./enteteRequete');
const Fournisseur = require('./fournisseur');
const Message = require('./message');
const TypeJustificatif = require('./typeJustificatif');

Expand All @@ -10,6 +11,7 @@ class RequeteJustificatif extends Message {
{
codeDemarche = 'T1',
destinataire = {},
fournisseur = new Fournisseur(),
idConversation = config.adaptateurUUID.genereUUID(),
typeJustificatif = new TypeJustificatif({}),
previsualisationRequise = false,
Expand All @@ -18,6 +20,7 @@ class RequeteJustificatif extends Message {
super(config, { destinataire, idConversation });

this.codeDemarche = codeDemarche;
this.fournisseur = fournisseur;
this.typeJustificatif = typeJustificatif;
this.previsualisationRequise = previsualisationRequise;
}
Expand Down Expand Up @@ -97,14 +100,7 @@ class RequeteJustificatif extends Message {
</rim:Element>
</rim:SlotValue>
</rim:Slot>
<rim:Slot name="EvidenceProvider">
<rim:SlotValue xsi:type="rim:AnyValueType">
<sdg:Agent>
<sdg:Identifier schemeID="urn:cef.eu:names:identifier:EAS:9930">BR_IT_01</sdg:Identifier>
<sdg:Name lang="EN">Italy</sdg:Name>
</sdg:Agent>
</rim:SlotValue>
</rim:Slot>
${this.fournisseur.enXML()}
<query:ResponseOption returnType="LeafClassWithRepositoryItem"/>
<query:Query queryDefinition="DocumentQuery">
<rim:Slot name="NaturalPerson">
Expand Down
12 changes: 12 additions & 0 deletions test/ebms/requeteJustificatif.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { parseXML, verifiePresenceSlot, valeurSlot } = require('./utils');
const Fournisseur = require('../../src/ebms/fournisseur');
const RequeteJustificatif = require('../../src/ebms/requeteJustificatif');
const TypeJustificatif = require('../../src/ebms/typeJustificatif');

Expand Down Expand Up @@ -76,4 +77,15 @@ describe("La vue du message de requête d'un justificatif", () => {
const requete = valeurSlot('EvidenceRequest', xml.QueryRequest.Query);
expect(requete.DataServiceEvidenceType.EvidenceTypeClassification).toBe('unIdentifiant');
});

it('injecte le fournisseur', () => {
const requeteJustificatif = new RequeteJustificatif(
configurationRequete,
{ fournisseur: new Fournisseur({ pointAcces: { typeId: 'unType', id: 'unIdentifiant' } }) },
);
const xml = parseXML(requeteJustificatif.corpsMessageEnXML());

const fournisseur = valeurSlot('EvidenceProvider', xml.QueryRequest);
expect(fournisseur.Agent.Identifier['#text']).toBe('unIdentifiant');
});
});

0 comments on commit 38d9c04

Please sign in to comment.