Skip to content

Commit

Permalink
Merge pull request #376 from navikt/ereg
Browse files Browse the repository at this point in the history
added harRegistrertAntallAnsatte boolean expression to ereg integration
  • Loading branch information
piszosta authored Dec 13, 2024
2 parents c46b58a + fbe536e commit c3d713b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions force-app/ereg-handler/classes/KafkaEnhet.cls
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public with sharing class KafkaEnhet {
public Naeringskode1 naeringskode1;
public Naeringskode1 naeringskode2;
public Naeringskode1 naeringskode3;
public Boolean harRegistrertAntallAnsatte;
public Decimal antallAnsatte;
public Postadresse postadresse;
public Forretningsadresse forretningsadresse;
Expand Down
1 change: 1 addition & 0 deletions force-app/ereg-handler/classes/KafkaEnhetHandler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public without sharing class KafkaEnhetHandler implements IKafkaMessageConsumer
// Optional for Enheter, mandatory for Underenheter
acc.INT_ParentOrganizationNumber__c = org.overordnetEnhet;
// Mandatory fields for both Enheter and Underenheter
acc.INT_HasEmployees__c = org.harRegistrertAntallAnsatte != null ? org.harRegistrertAntallAnsatte : acc.INT_HasEmployees__c;
acc.NumberOfEmployees = (Integer) org.antallAnsatte;
acc.Name = org.navn;
acc.INT_OrganizationNumber__c = org.organisasjonsnummer;
Expand Down
13 changes: 10 additions & 3 deletions force-app/ereg-handler/classes/KafkaEnhetHandlerTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,26 @@ public with sharing class KafkaEnhetHandlerTest {
KafkaEnhet parsedMessage = KafkaEnhet.parse(
EncodingUtil.base64Decode(newerMessageFormat.CRM_Value__c).toString()
);
Assert.areEqual(
System.Assert.areEqual(
10.0,
parsedMessage.antallAnsatte,
'Assert that the parsed message contains the expected value for antallAnsatte'
);
// Verify that org with harRegistrertAntallAnsatte true will parse
System.Assert.areEqual(
true,
parsedMessage.harRegistrertAntallAnsatte,
'Assert that the parsed message contains the expected value for harRegistrertAntallAnsatte'
);

Account org810034882 = [
SELECT NumberOfEmployees
SELECT NumberOfEmployees, INT_HasEmployees__c
FROM Account
WHERE INT_OrganizationNumber__c = '810034882'
LIMIT 1
];
Assert.areEqual(10, org810034882.NumberOfEmployees, 'Assert that the number of employees is updated');
System.Assert.areEqual(10, org810034882.NumberOfEmployees, 'Assert that the number of employees is updated');
System.Assert.areEqual(true, org810034882.INT_HasEmployees__c, 'Assert that the boolean INT_HasEmployees__c is updated');
}

@IsTest
Expand Down
2 changes: 1 addition & 1 deletion sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": [
{
"package": "crm-platform-base",
"versionNumber": "0.243.0.LATEST"
"versionNumber": "0.245.0.LATEST"
},
{
"package": "crm-shared-flowComponents",
Expand Down

0 comments on commit c3d713b

Please sign in to comment.