Skip to content

Commit

Permalink
Merge branch 'EI-146_AddAccountLegalEntityIdToAgreementSigned' into E…
Browse files Browse the repository at this point in the history
…I-146_EI-239_EI-215
  • Loading branch information
MichaelYoung1981 committed Aug 20, 2020
2 parents f69a859 + 875b9a5 commit b4b98f5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ resources:
endpoint: "GitHub (SFA)"

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 2.2.x'
inputs:
version: 2.2.x

- task: gittools.gitversion.gitversion-task.GitVersion@5
displayName: GitVersion
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class SignedAgreementEvent : Event
public Guid UserRef { get; set; }
public string OrganisationName { get; set; }
public long AgreementId { get; set; }
public long AccountLegalEntityId { get; set; }
public long LegalEntityId { get; set; }
public bool CohortCreated { get; set; }
public AgreementType AgreementType { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class WhenISignAnEmployerAgreement
private const long LegalEntityId = 111333;
private const string OrganisationName = "Foo";
private const string HashedLegalEntityId = "2635JHG";
private const long AccountLegalEntityId = 9568456;
private const AgreementType AgreementType = Common.Domain.Types.AgreementType.NonLevyExpressionOfInterest;

[SetUp]
Expand Down Expand Up @@ -80,6 +81,7 @@ public void Setup()
LegalEntityName = OrganisationName,
AgreementType = AgreementType,
AccountId = AccountId,
AccountLegalEntityId = AccountLegalEntityId,
Id = AgreementId
};

Expand Down Expand Up @@ -230,6 +232,7 @@ public async Task ThenTheServiceShouldBeNotified()
message.AccountId.Should().Be(AccountId);
message.AgreementId.Should().Be(AgreementId);
message.OrganisationName.Should().Be(OrganisationName);
message.AccountLegalEntityId.Should().Be(AccountLegalEntityId);
message.LegalEntityId.Should().Be(LegalEntityId);
message.CohortCreated.Should().BeTrue();
message.UserName.Should().Be(_owner.FullName());
Expand All @@ -255,6 +258,7 @@ public async Task ThenIfICannotGetCommitmentsForTheAccountIStillNotifyTheService
message.AccountId.Should().Be(AccountId);
message.AgreementId.Should().Be(AgreementId);
message.OrganisationName.Should().Be(OrganisationName);
message.AccountLegalEntityId.Should().Be(AccountLegalEntityId);
message.LegalEntityId.Should().Be(LegalEntityId);
message.CohortCreated.Should().BeFalse();
message.UserName.Should().Be(_owner.FullName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private async Task PublihAgreementSignedMessage(EmployerAgreementView agreement,
var commitments = await _commitmentService.GetEmployerCommitments(agreement.AccountId);
var accountHasCommitments = commitments?.Any() ?? false;

await PublishAgreementSignedMessage(agreement.AccountId, agreement.LegalEntityId, agreement.LegalEntityName,
await PublishAgreementSignedMessage(agreement.AccountId, agreement.AccountLegalEntityId, agreement.LegalEntityId, agreement.LegalEntityName,
agreement.Id, accountHasCommitments, owner.FullName(), owner.UserRef, agreement.AgreementType,
agreement.VersionNumber, correlationId);
}
Expand Down Expand Up @@ -141,14 +141,15 @@ private async Task SignAgreement(SignEmployerAgreementCommand message, long agre
}

private Task PublishAgreementSignedMessage(
long accountId, long legalEntityId, string legalEntityName, long agreementId,
long accountId, long accountLegalEntityId, long legalEntityId, string legalEntityName, long agreementId,
bool cohortCreated, string currentUserName, Guid currentUserRef,
AgreementType agreementType, int versionNumber, string correlationId)
{
return _eventPublisher.Publish(new SignedAgreementEvent
{
AccountId = accountId,
AgreementId = agreementId,
AccountLegalEntityId = accountLegalEntityId,
LegalEntityId = legalEntityId,
OrganisationName = legalEntityName,
CohortCreated = cohortCreated,
Expand Down

0 comments on commit b4b98f5

Please sign in to comment.