-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP-5496: Standardise currency handling accross the app
Certain currency/amount fields accepted humanized monetary values while others did not. Some would accept but clean `£` and `,` values such that `£1,000` would become `1000` while others would error. Yet others would ignore `£` and `,` values for validation purposes but when peristing this data would not, resulting in, for example, `£2,000` become a stored value of `2.0`. This PR standardise the approach, removing `£` and `,` values prior to saving across regular incomes, regular outgoings, cash incomes, cash outgoings, state benefits, housing benefit and student finance monetary amount fields. In shouldbe noted that some forms validate currency, which cleans/ignores `£` and `,` chars, while others do not validate this way. This has not been changed.
- Loading branch information
Showing
15 changed files
with
230 additions
and
12 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
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
115 changes: 115 additions & 0 deletions
115
features/providers/regressions/enter_humanized_currency_amounts.feature
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,115 @@ | ||
@javascript | ||
Feature: Entering humanized monetary amounts on various forms | ||
Scenario: I can enter humanized monetary amounts like 1,000 for cash income | ||
Given csrf is enabled | ||
And I have completed a non-passported employed application for "client" with bank statements as far as the end of the means income section | ||
Then I should be on the "check_income_answers" page showing "Check your answers" | ||
|
||
When I click Check Your Answers Change link for applicant 'cash_income' | ||
And I select "Maintenance payments from a former partner" | ||
And I fill "aggregated-cash-income-maintenance-in1-field" with "£2,654.33" | ||
And I fill "aggregated-cash-income-maintenance-in2-field" with "£3,654.33" | ||
And I fill "aggregated-cash-income-maintenance-in3-field" with "£4,654.33" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
And I should see "£2,654.33" | ||
And I should see "£3,654.33" | ||
And I should see "£4,654.33" | ||
|
||
Scenario: I can enter humanized monetary amounts like 1,000 for cash outgoings and housing benefit | ||
Given csrf is enabled | ||
And I have completed a non-passported employed application for "client" with bank statements as far as the end of the means income section | ||
Then I should be on the "check_income_answers" page showing "Check your answers" | ||
|
||
When I click Check Your Answers Change link for applicant 'cash_outgoings' | ||
And I select "Housing payments" | ||
And I fill "aggregated-cash-outgoings-rent-or-mortgage1-field" with "£2,275.43" | ||
And I fill "aggregated-cash-outgoings-rent-or-mortgage2-field" with "£3,275.43" | ||
And I fill "aggregated-cash-outgoings-rent-or-mortgage3-field" with "£4,275.43" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on the 'housing_benefits' page showing "Does your client get Housing Benefit?" | ||
|
||
When I choose "Yes" | ||
And I fill "providers-means-housing-benefit-form-housing-benefit-amount-field" with "£1,322.55" | ||
And I choose "Monthly" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
And I should see "£2,275.43" | ||
And I should see "£3,275.43" | ||
And I should see "£4,275.43" | ||
And I should see "£1,322.55" | ||
|
||
Scenario: I can enter humanized monetary amounts like 1,000 for state benefits | ||
Given csrf is enabled | ||
And I have completed a non-passported employed application for "client" with bank statements as far as the end of the means income section | ||
Then I should be on the "check_income_answers" page showing "Check your answers" | ||
|
||
When I click Check Your Answers Change link for applicant 'state_benefits' | ||
And I choose "Yes" | ||
And I click 'Save and continue' | ||
|
||
Then I should be on a page with title "Add benefit, charitable or government payment details" | ||
And I fill 'regular-transaction-description-field' with "my government handout" | ||
And I fill 'regular-transaction-amount-field' with "£1,222,333.44" | ||
And I choose "Every week" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on the 'add_other_state_benefits' page showing 'You added 1 benefit, charitable or government payment' | ||
And I should see "£1,222,333.44" | ||
|
||
Scenario: I can enter humanized monetary amounts like 1,000 for student finance | ||
Given csrf is enabled | ||
And I have completed a non-passported employed application for "client" with bank statements as far as the end of the means income section | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
|
||
When I click Check Your Answers Change link for applicant 'student_finance' | ||
Then I should be on a page with title "Does your client get student finance?" | ||
And I choose "Yes" | ||
And I fill 'applicant-student-finance-amount-field' with "£5,432.11" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
And I should see "£5,432.11" | ||
|
||
Scenario: I can enter humanized monetary amounts like 1,000 for regular income | ||
Given csrf is enabled | ||
And I have completed a non-passported employed application for "client" with bank statements as far as the end of the means income section | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
|
||
When I click Check Your Answers Change link for "Payments your client receives" | ||
Then I should be on a page with title "Which of these payments does your client get?" | ||
And I select "Financial help from friends or family" | ||
And I fill "Friends or family" with "£1,112.33" | ||
And I choose the "Monthly" frequency for "Friends or family" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on a page with title "Select payments your client receives in cash" | ||
And I select "My client receives none of these payments in cash" | ||
And I click 'Save and continue' | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
And I should see "£1,112.33" | ||
|
||
Scenario: I can enter humanized monetary amounts like 1,000 for regular outgoings and housing benefit | ||
Given csrf is enabled | ||
And I have completed a non-passported employed application for "client" with bank statements as far as the end of the means income section | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
|
||
When I click Check Your Answers Change link for "Payments your client makes" | ||
Then I should be on a page with title "Which of these payments does your client pay?" | ||
And I select "Maintenance payments to a former partner" | ||
And I fill "Maintenance out" with "£2,322.22" | ||
And I choose the "Monthly" frequency for "Maintenance out" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on a page with title "Select payments your client pays in cash" | ||
|
||
When I select "None of the above" | ||
And I click 'Save and continue' | ||
Then I should be on a page with title "Does your client get Housing Benefit?" | ||
|
||
When I click 'Save and continue' | ||
Then I should be on the 'check_income_answers' page showing 'Check your answers' | ||
And I should see "£2,322.22" |
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