Skip to content

Commit

Permalink
Merge 282c89c into 7a67df5
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx authored Aug 8, 2024
2 parents 7a67df5 + 282c89c commit f2efdb0
Show file tree
Hide file tree
Showing 128 changed files with 2,142 additions and 1,527 deletions.
1 change: 1 addition & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ packages:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter/supporterdata:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter/supporterpage:
github.com/ministryofjustice/opg-modernising-lpa/internal/supporter:
github.com/ministryofjustice/opg-modernising-lpa/internal/task:
github.com/ministryofjustice/opg-modernising-lpa/internal/uid:
github.com/ministryofjustice/opg-modernising-lpa/internal/validation:
5 changes: 3 additions & 2 deletions cmd/event-received/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/lambda"
"github.com/ministryofjustice/opg-modernising-lpa/internal/localize"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore/lpadata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/notify"
"github.com/ministryofjustice/opg-modernising-lpa/internal/page"
"github.com/ministryofjustice/opg-modernising-lpa/internal/random"
Expand All @@ -31,7 +32,7 @@ type LambdaClient interface {

type LpaStoreClient interface {
SendLpa(ctx context.Context, donor *donordata.Provided) error
Lpa(ctx context.Context, uid string) (*lpastore.Lpa, error)
Lpa(ctx context.Context, uid string) (*lpadata.Lpa, error)
}

type SecretsClient interface {
Expand All @@ -41,7 +42,7 @@ type SecretsClient interface {
type ShareCodeSender interface {
SendCertificateProviderInvite(context.Context, appcontext.Data, page.CertificateProviderInvite) error
SendCertificateProviderPrompt(context.Context, appcontext.Data, *donordata.Provided) error
SendAttorneys(context.Context, appcontext.Data, *lpastore.Lpa) error
SendAttorneys(context.Context, appcontext.Data, *lpadata.Lpa) error
}

type UidStore interface {
Expand Down
16 changes: 8 additions & 8 deletions cmd/event-received/mock_lpaStoreClient_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions cmd/event-received/mock_shareCodeSender_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 19 additions & 20 deletions cmd/event-received/sirius_event_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
donordata "github.com/ministryofjustice/opg-modernising-lpa/internal/donor/donordata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/event"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore/lpadata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/page"
"github.com/ministryofjustice/opg-modernising-lpa/internal/pay"
Expand Down Expand Up @@ -722,9 +721,9 @@ func TestHandleDonorSubmissionCompleted(t *testing.T) {
appData := appcontext.Data{}
uid := actoruid.New()

lpa := &lpastore.Lpa{
Donor: lpastore.Donor{FirstNames: "Dave", LastName: "Smith"},
CertificateProvider: lpastore.CertificateProvider{
lpa := &lpadata.Lpa{
Donor: lpadata.Donor{FirstNames: "Dave", LastName: "Smith"},
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelOnline,
UID: uid,
FirstNames: "John",
Expand Down Expand Up @@ -793,8 +792,8 @@ func TestHandleDonorSubmissionCompleted(t *testing.T) {
func TestHandleDonorSubmissionCompletedWhenPaperCertificateProvider(t *testing.T) {
appData := appcontext.Data{}

lpa := &lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
lpa := &lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelPaper,
},
}
Expand Down Expand Up @@ -858,8 +857,8 @@ func TestHandleDonorSubmissionCompletedWhenDynamoPutError(t *testing.T) {
func TestHandleDonorSubmissionCompletedWhenLpaStoreError(t *testing.T) {
appData := appcontext.Data{}

lpa := &lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
lpa := &lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelOnline,
},
}
Expand All @@ -884,8 +883,8 @@ func TestHandleDonorSubmissionCompletedWhenLpaStoreError(t *testing.T) {
func TestHandleDonorSubmissionCompletedWhenShareCodeSenderError(t *testing.T) {
appData := appcontext.Data{}

lpa := &lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
lpa := &lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelOnline,
},
}
Expand Down Expand Up @@ -920,8 +919,8 @@ var certificateProviderSubmissionCompletedEvent = events.CloudWatchEvent{
func TestHandleCertificateProviderSubmissionCompleted(t *testing.T) {
appData := appcontext.Data{}

lpa := &lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
lpa := &lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelPaper,
},
}
Expand Down Expand Up @@ -954,8 +953,8 @@ func TestHandleCertificateProviderSubmissionCompleted(t *testing.T) {
}

func TestHandleCertificateProviderSubmissionCompletedWhenOnline(t *testing.T) {
lpa := &lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
lpa := &lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelOnline,
},
}
Expand Down Expand Up @@ -1006,8 +1005,8 @@ func TestHandleCertificateProviderSubmissionCompletedWhenShareCodeSenderErrors(t
lpaStoreClient := newMockLpaStoreClient(t)
lpaStoreClient.EXPECT().
Lpa(ctx, "M-1111-2222-3333").
Return(&lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
Return(&lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelPaper,
},
}, nil)
Expand Down Expand Up @@ -1037,8 +1036,8 @@ func TestHandleCertificateProviderSubmissionCompletedWhenShareCodeSenderFactoryE
lpaStoreClient := newMockLpaStoreClient(t)
lpaStoreClient.EXPECT().
Lpa(ctx, "M-1111-2222-3333").
Return(&lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
Return(&lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelPaper,
},
}, nil)
Expand All @@ -1060,8 +1059,8 @@ func TestHandleCertificateProviderSubmissionCompletedWhenAppDataFactoryErrors(t
lpaStoreClient := newMockLpaStoreClient(t)
lpaStoreClient.EXPECT().
Lpa(ctx, "M-1111-2222-3333").
Return(&lpastore.Lpa{
CertificateProvider: lpastore.CertificateProvider{
Return(&lpadata.Lpa{
CertificateProvider: lpadata.CertificateProvider{
Channel: lpadata.ChannelPaper,
},
}, nil)
Expand Down
3 changes: 2 additions & 1 deletion internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/sharecode"
"github.com/ministryofjustice/opg-modernising-lpa/internal/supporter"
"github.com/ministryofjustice/opg-modernising-lpa/internal/supporter/supporterpage"
"github.com/ministryofjustice/opg-modernising-lpa/internal/task"
)

type ErrorHandler func(http.ResponseWriter, *http.Request, error)
Expand Down Expand Up @@ -103,7 +104,7 @@ func App(
evidenceReceivedStore := &evidenceReceivedStore{dynamoClient: lpaDynamoClient}
organisationStore := supporter.NewOrganisationStore(lpaDynamoClient)
memberStore := supporter.NewMemberStore(lpaDynamoClient)
progressTracker := page.ProgressTracker{Localizer: localizer}
progressTracker := task.ProgressTracker{Localizer: localizer}

shareCodeSender := page.NewShareCodeSender(shareCodeStore, notifyClient, appPublicURL, random.String, eventClient)
witnessCodeSender := page.NewWitnessCodeSender(donorStore, notifyClient)
Expand Down
5 changes: 1 addition & 4 deletions internal/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/ministryofjustice/opg-go-common/template"
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/localize"
Expand All @@ -26,16 +25,14 @@ import (
"github.com/ministryofjustice/opg-modernising-lpa/internal/search"
"github.com/ministryofjustice/opg-modernising-lpa/internal/sesh"
"github.com/stretchr/testify/assert"
mock "github.com/stretchr/testify/mock"
"github.com/stretchr/testify/mock"
)

var (
ctx = context.Background()
expectedError = errors.New("err")
testNow = time.Date(2023, time.April, 2, 3, 4, 5, 6, time.UTC)
testNowFn = func() time.Time { return testNow }
testUID = actoruid.New()
testUIDFn = func() actoruid.UID { return testUID }
)

func (m *mockDynamoClient) ExpectOne(ctx, pk, sk, data interface{}, err error) {
Expand Down
16 changes: 8 additions & 8 deletions internal/app/mock_LpaStoreResolvingService_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/ministryofjustice/opg-go-common/template"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/attorney/attorneydata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore/lpadata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/notify"
"github.com/ministryofjustice/opg-modernising-lpa/internal/page"
"github.com/ministryofjustice/opg-modernising-lpa/internal/validation"
Expand All @@ -16,7 +16,7 @@ import (
type confirmDontWantToBeAttorneyData struct {
App appcontext.Data
Errors validation.List
Lpa *lpastore.Lpa
Lpa *lpadata.Lpa
}

func ConfirmDontWantToBeAttorney(tmpl template.Template, lpaStoreResolvingService LpaStoreResolvingService, attorneyStore AttorneyStore, notifyClient NotifyClient, appPublicURL string) Handler {
Expand All @@ -32,7 +32,7 @@ func ConfirmDontWantToBeAttorney(tmpl template.Template, lpaStoreResolvingServic
}

if r.Method == http.MethodPost {
attorneyFullName, err := findAttorneyFullName(lpa, attorneyProvidedDetails.UID, attorneyProvidedDetails.IsTrustCorporation, attorneyProvidedDetails.IsReplacement)
attorneyFullName, err := findAttorneyFullName(lpa, attorneyProvidedDetails.UID)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit f2efdb0

Please sign in to comment.