-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1434 from ministryofjustice/MLPAB-1909-voucher-id…
…entity MLPAB-1909 Add pages for voucher identity check
- Loading branch information
Showing
31 changed files
with
1,031 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
describe('Confirm your identity', () => { | ||
beforeEach(() => { | ||
cy.visit('/fixtures/voucher?redirect=/confirm-your-identity&progress=verifyDonorDetails'); | ||
}); | ||
|
||
it('can be confirmed', () => { | ||
cy.checkA11yApp(); | ||
cy.contains('a', 'Continue').click(); | ||
cy.contains('label', 'Vivian Vaughn').click(); | ||
cy.contains('button', 'Continue').click(); | ||
|
||
cy.url().should('contain', '/one-login-identity-details'); | ||
cy.checkA11yApp(); | ||
cy.contains('a', 'Continue').click(); | ||
|
||
cy.get('.govuk-task-list li:nth-child(3)').should('contain', 'Completed'); | ||
cy.contains('a', 'Confirm your identity').click(); | ||
|
||
cy.url().should('contain', '/one-login-identity-details'); | ||
cy.contains('a', 'Continue').click(); | ||
|
||
cy.contains('a', 'Confirm your name').click(); | ||
cy.contains('a', 'Change').should('not.exist'); | ||
|
||
cy.contains('a', 'Manage your LPAs').click(); | ||
cy.contains('I’m vouching for someone'); | ||
}); | ||
|
||
it('can fail', () => { | ||
cy.contains('a', 'Continue').click(); | ||
cy.contains('label', 'Sam Smith').click(); | ||
cy.contains('button', 'Continue').click(); | ||
|
||
cy.url().should('contain', '/unable-to-confirm-identity'); | ||
|
||
cy.contains('a', 'Manage your LPAs').click(); | ||
cy.contains('I’m vouching for someone').should('not.exist');; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package lpadata | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestVoucherFullName(t *testing.T) { | ||
assert.Equal(t, "John Smith", Voucher{FirstNames: "John", LastName: "Smith"}.FullName()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package voucherpage | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/localize" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/sesh" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/voucher" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/voucher/voucherdata" | ||
) | ||
|
||
func IdentityWithOneLogin(oneLoginClient OneLoginClient, sessionStore SessionStore, randomString func(int) string) Handler { | ||
return func(appData appcontext.Data, w http.ResponseWriter, r *http.Request, _ *voucherdata.Provided) error { | ||
locale := "" | ||
if appData.Lang == localize.Cy { | ||
locale = "cy" | ||
} | ||
|
||
state := randomString(12) | ||
nonce := randomString(12) | ||
|
||
authCodeURL, err := oneLoginClient.AuthCodeURL(state, nonce, locale, true) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err := sessionStore.SetOneLogin(r, w, &sesh.OneLoginSession{ | ||
State: state, | ||
Nonce: nonce, | ||
Locale: locale, | ||
Redirect: voucher.PathIdentityWithOneLoginCallback.Format(appData.LpaID), | ||
}); err != nil { | ||
return err | ||
} | ||
|
||
http.Redirect(w, r, authCodeURL, http.StatusFound) | ||
return nil | ||
} | ||
} |
Oops, something went wrong.