Skip to content

Commit

Permalink
Merge pull request #1578 from ministryofjustice/MLPAB-2327-send-paper…
Browse files Browse the repository at this point in the history
…-form-requested

MLPAB-2327 Always send invite from donor submission completed
  • Loading branch information
hawx authored Oct 29, 2024
2 parents 22fc7b0 + 3b684c8 commit f55a1e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 40 deletions.
26 changes: 12 additions & 14 deletions cmd/event-received/sirius_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,18 @@ func handleDonorSubmissionCompleted(ctx context.Context, client dynamodbClient,
return err
}

if lpa.CertificateProvider.Channel.IsOnline() {
if err := shareCodeSender.SendCertificateProviderInvite(ctx, appData, sharecode.CertificateProviderInvite{
LpaKey: lpa.LpaKey,
LpaOwnerKey: lpa.LpaOwnerKey,
LpaUID: lpa.LpaUID,
Type: lpa.Type,
DonorFirstNames: lpa.Donor.FirstNames,
DonorFullName: lpa.Donor.FullName(),
CertificateProviderUID: lpa.CertificateProvider.UID,
CertificateProviderFullName: lpa.CertificateProvider.FullName(),
CertificateProviderEmail: lpa.CertificateProvider.Email,
}); err != nil {
return fmt.Errorf("failed to send share code to certificate provider: %w", err)
}
if err := shareCodeSender.SendCertificateProviderInvite(ctx, appData, sharecode.CertificateProviderInvite{
LpaKey: lpa.LpaKey,
LpaOwnerKey: lpa.LpaOwnerKey,
LpaUID: lpa.LpaUID,
Type: lpa.Type,
DonorFirstNames: lpa.Donor.FirstNames,
DonorFullName: lpa.Donor.FullName(),
CertificateProviderUID: lpa.CertificateProvider.UID,
CertificateProviderFullName: lpa.CertificateProvider.FullName(),
CertificateProviderEmail: lpa.CertificateProvider.Email,
}); err != nil {
return fmt.Errorf("failed to send share code to certificate provider: %w", err)
}

return nil
Expand Down
26 changes: 0 additions & 26 deletions cmd/event-received/sirius_event_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,32 +789,6 @@ func TestHandleDonorSubmissionCompleted(t *testing.T) {
assert.Nil(t, err)
}

func TestHandleDonorSubmissionCompletedWhenPaperCertificateProvider(t *testing.T) {
appData := appcontext.Data{}

lpa := &lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelPaper,
},
}

client := newMockDynamodbClient(t)
client.EXPECT().
OneByUID(ctx, "M-1111-2222-3333", mock.Anything).
Return(dynamo.NotFoundError{})
client.EXPECT().
Put(ctx, mock.Anything).
Return(nil)

lpaStoreClient := newMockLpaStoreClient(t)
lpaStoreClient.EXPECT().
Lpa(ctx, "M-1111-2222-3333").
Return(lpa, nil)

err := handleDonorSubmissionCompleted(ctx, client, donorSubmissionCompletedEvent, nil, appData, lpaStoreClient, testUuidStringFn, testNowFn)
assert.Nil(t, err)
}

func TestHandleDonorSubmissionCompletedWhenDynamoExists(t *testing.T) {
appData := appcontext.Data{}

Expand Down

0 comments on commit f55a1e5

Please sign in to comment.