Skip to content

Commit

Permalink
Add channel to LPAs returned from LPA Store (#1222)
Browse files Browse the repository at this point in the history
For MLPAB-1535 #minor
  • Loading branch information
gregtyler authored May 8, 2024
1 parent 75e12f3 commit 9b12bf3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
12 changes: 8 additions & 4 deletions internal/lpastore/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ func TestClientServiceContract(t *testing.T) {
"uid": matchers.Regex("M-0000-1111-2222", "M(-[A-Z0-9]{4}){3}"),
"status": matchers.String("processing"),
"lpaType": matchers.String("personal-welfare"),
"channel": matchers.String("online"),
"donor": matchers.Like(map[string]any{
"firstNames": matchers.String("Homer"),
"lastName": matchers.String("Zoller"),
Expand Down Expand Up @@ -861,8 +862,9 @@ func TestClientServiceContract(t *testing.T) {
}

assert.Equal(t, &Lpa{
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
Channel: actor.ChannelOnline,
Donor: actor.Donor{
FirstNames: "Homer",
LastName: "Zoller",
Expand Down Expand Up @@ -929,6 +931,7 @@ func TestClientServiceContract(t *testing.T) {
"uid": matchers.Regex("M-0000-1111-2222", "M(-[A-Z0-9]{4}){3}"),
"status": matchers.String("processing"),
"lpaType": matchers.String("personal-welfare"),
"channel": matchers.String("online"),
"donor": matchers.Like(map[string]any{
"firstNames": matchers.String("Homer"),
"lastName": matchers.String("Zoller"),
Expand Down Expand Up @@ -991,8 +994,9 @@ func TestClientServiceContract(t *testing.T) {
}

assert.Equal(t, []*Lpa{{
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
Channel: actor.ChannelOnline,
Donor: actor.Donor{
FirstNames: "Homer",
LastName: "Zoller",
Expand Down
3 changes: 3 additions & 0 deletions internal/lpastore/lpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func (c CertificateProvider) FullName() string {
type lpaResponse struct {
LpaType actor.LpaType `json:"lpaType"`
Donor lpaRequestDonor `json:"donor"`
Channel actor.Channel `json:"channel"`
Attorneys []lpaResponseAttorney `json:"attorneys"`
TrustCorporations []lpaResponseTrustCorporation `json:"trustCorporations,omitempty"`
CertificateProvider CertificateProvider `json:"certificateProvider"`
Expand Down Expand Up @@ -372,6 +373,7 @@ type Lpa struct {
PerfectAt time.Time
UpdatedAt time.Time
Type actor.LpaType
Channel actor.Channel
Donor actor.Donor
Attorneys Attorneys
ReplacementAttorneys Attorneys
Expand Down Expand Up @@ -485,6 +487,7 @@ func lpaResponseToLpa(l lpaResponse) *Lpa {
RegisteredAt: l.RegistrationDate,
UpdatedAt: l.UpdatedAt,
Type: l.LpaType,
Channel: l.Channel,
Donor: actor.Donor{
UID: l.Donor.UID,
FirstNames: l.Donor.FirstNames,
Expand Down
20 changes: 12 additions & 8 deletions internal/lpastore/lpa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,9 @@ func TestClientLpa(t *testing.T) {
}{
"minimal": {
donor: &Lpa{
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePropertyAndAffairs,
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePropertyAndAffairs,
Channel: actor.ChannelOnline,
Donor: actor.Donor{
UID: donorUID,
FirstNames: "John Johnson",
Expand Down Expand Up @@ -440,8 +441,9 @@ func TestClientLpa(t *testing.T) {
},
"everything": {
donor: &Lpa{
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
Channel: actor.ChannelOnline,
Donor: actor.Donor{
UID: donorUID,
FirstNames: "John Johnson",
Expand Down Expand Up @@ -746,8 +748,9 @@ func TestClientLpas(t *testing.T) {
"minimal": {
lpas: []*Lpa{
{
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePropertyAndAffairs,
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePropertyAndAffairs,
Channel: actor.ChannelOnline,
Donor: actor.Donor{
UID: donorUID,
FirstNames: "John Johnson",
Expand Down Expand Up @@ -806,8 +809,9 @@ func TestClientLpas(t *testing.T) {
"everything": {
lpas: []*Lpa{
{
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
LpaUID: "M-0000-1111-2222",
Type: actor.LpaTypePersonalWelfare,
Channel: actor.ChannelOnline,
Donor: actor.Donor{
UID: donorUID,
FirstNames: "John Johnson",
Expand Down

0 comments on commit 9b12bf3

Please sign in to comment.