Skip to content

Commit

Permalink
currently running ok. Add missing functionality for lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
acn-sbuad committed Jun 4, 2024
1 parent dbb354b commit 7d4d945
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 21 deletions.
31 changes: 13 additions & 18 deletions src/Notifications/LocalTestNotifications/LocalProfileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,20 @@ public async Task<List<UserContactPoints>> GetUserContactPoints(List<string> nat
List<UserContactPoints> contactPoints = new();
var data = await _testDataService.GetTestData();

List<UserProfile> users = new();

foreach (var item in data.Profile.User)
{
users.AddRange(data.Profile.User
.Where(u => nationalIdentityNumbers.Contains(u.Value.Party.SSN))
.Select(u => u.Value)
.ToList());
}

foreach (UserProfile user in users)
{
contactPoints.Add(new UserContactPoints()

contactPoints.AddRange(data.Profile.User
.Where(u => nationalIdentityNumbers.Contains(u.Value.Party.SSN))
.Select(u =>
{
NationalIdentityNumber = user.Party.SSN,
Email = user.Email,
MobileNumber = user.PhoneNumber
});
}
var user = u.Value;
return new UserContactPoints()
{
NationalIdentityNumber = user.Party.SSN,
Email = user.Email,
MobileNumber = user.PhoneNumber
};
})
.ToList());

return contactPoints;

Expand Down
34 changes: 32 additions & 2 deletions src/Notifications/LocalTestNotifications/LocalRegisterClient.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
using Altinn.Notifications.Core.Integrations;
using Altinn.Notifications.Core.Models.ContactPoints;
using Altinn.Platform.Profile.Models;
using Altinn.Platform.Register.Models;

using LocalTest.Services.TestData;

namespace LocalTest.Notifications.LocalTestNotifications
{
public class LocalRegisterClient : IRegisterClient
{
public Task<List<OrganizationContactPoints>> GetOrganizationContactPoints(List<string> organizationNumbers)
private readonly TestDataService _testDataService;

public LocalRegisterClient(TestDataService testDataService)
{
_testDataService = testDataService;
}

public async Task<List<OrganizationContactPoints>> GetOrganizationContactPoints(List<string> organizationNumbers)
{
throw new NotImplementedException();
var data = await _testDataService.GetTestData();

List<OrganizationContactPoints> orgContactPoints = new();


orgContactPoints.AddRange(data.Register.Org
.Where(o => organizationNumbers.Contains(o.Value.OrgNumber))
.Select(o =>
{
var organization = o.Value;
return new OrganizationContactPoints()
{
OrganizationNumber = organization.OrgNumber,
EmailList = new List<string>() { organization.EMailAddress },
MobileNumberList = new List<string>() { organization.MobileNumber }
};
})
.ToList());

return orgContactPoints;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using Altinn.Notifications.Core.Configuration;
using Altinn.Notifications.Core.Integrations;
using Altinn.Notifications.Core.Persistence;
using Altinn.Notifications.Core.Services;
using Altinn.Notifications.Core.Services.Interfaces;
using Altinn.Notifications.Extensions;
using Altinn.Notifications.Models;
using Altinn.Notifications.Validators;

using FluentValidation;
using LocalTest.Notifications.Persistence.Repository;
using LocalTest.Services.TestData;

namespace LocalTest.Notifications.LocalTestNotifications;

Expand All @@ -26,6 +29,10 @@ public static void AddNotificationServices(this IServiceCollection services, str
.AddSingleton<IOrderRepository, LocalOrderRepository>()
.AddSingleton<IGuidService, GuidService>()
.AddSingleton<IDateTimeService, DateTimeService>()
.AddSingleton<IOrderRequestService, OrderRequestService>();
.AddSingleton<IOrderRequestService, OrderRequestService>()
.AddSingleton<IContactPointService, ContactPointService>();

services.AddSingleton<IRegisterClient, LocalRegisterClient>();
services.AddSingleton<IProfileClient, LocalProfileClient>();
}
}

0 comments on commit 7d4d945

Please sign in to comment.