Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated direct deposit instructions for 5490 form * added unit tests
- Loading branch information
1 parent
40a42fe
commit 01b1d73
Showing
5 changed files
with
222 additions
and
3 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
134 changes: 134 additions & 0 deletions
134
src/applications/edu-benefits/5490/content/directDepositUpdate.jsx
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,134 @@ | ||
import React from 'react'; | ||
import { isValidRoutingNumber } from 'platform/forms/validations'; | ||
import merge from 'lodash/merge'; | ||
|
||
export const gaBankInfoHelpText = () => { | ||
window.dataLayer.push({ | ||
event: 'edu-5490--form-help-text-clicked', | ||
'help-text-label': 'What if I don’t have a bank account?', | ||
}); | ||
}; | ||
|
||
const bankInfoHelpText = ( | ||
<va-additional-info | ||
trigger="What if I don’t have a bank account?" | ||
onClick={gaBankInfoHelpText} | ||
> | ||
<div className="vads-u-margin-bottom--2"> | ||
<p> | ||
The{' '} | ||
<a href="https://veteransbenefitsbanking.org/"> | ||
Veterans Benefits Banking Program (VBBP) | ||
</a>{' '} | ||
provides a list of Veteran-friendly banks and credit unions. They’ll | ||
work with you to set up an account, or help you qualify for an account, | ||
so you can use direct deposit. To get started, call one of the | ||
participating banks or credit unions listed on the VBBP website. Be sure | ||
to mention the Veterans Benefits Banking Program. | ||
</p> | ||
</div> | ||
</va-additional-info> | ||
); | ||
|
||
const directDepositDescription = ( | ||
<div className="vads-u-margin-top--2 vads-u-margin-bottom--2"> | ||
<p> | ||
Direct Deposit information is not required to determine eligibility. | ||
However, benefits cannot be paid without this information per U.S. | ||
Treasury regulation 31 C.F.R. § 208.3. | ||
</p> | ||
<>{bankInfoHelpText}</> | ||
<p> | ||
Note: Federal regulation, found in 31 C.F.R. § 208.3 provides that, | ||
subject to section 208.4, "all Federal payments made by an agency shall be | ||
made by electronic funds transfer" (EFT). | ||
</p> | ||
<p> | ||
Note: Any bank account information you enter here will update all other | ||
existing Veteran benefits, including Compensation, Pension, and benefits | ||
for certain children with disabilities (Chapter 18) payments. Information | ||
entered here WILL NOT change your existing bank account for VA health | ||
benefits. | ||
</p> | ||
<img | ||
src="/img/direct-deposit-check-guide.svg" | ||
alt="On a personal check, find your bank’s 9-digit routing number listed along the bottom-left edge, and your account number listed beside that." | ||
/> | ||
</div> | ||
); | ||
|
||
export function validateRoutingNumber( | ||
errors, | ||
routingNumber, | ||
formData, | ||
schema, | ||
errorMessages, | ||
) { | ||
if (!isValidRoutingNumber(routingNumber)) { | ||
errors.addError(errorMessages.pattern); | ||
} | ||
} | ||
|
||
export default function createDirectDepositPageUpdate() { | ||
const bankAccountProperties = { | ||
type: 'object', | ||
properties: { | ||
accountType: { | ||
type: 'string', | ||
enum: ['checking', 'savings'], | ||
}, | ||
routingNumber: { | ||
type: 'string', | ||
pattern: '^\\d{9}$', | ||
}, | ||
accountNumber: { | ||
type: 'string', | ||
}, | ||
'view:bankInfoHelpText': { | ||
type: 'object', | ||
properties: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
return { | ||
title: 'Direct deposit', | ||
path: 'personal-information/direct-deposit', | ||
initialData: {}, | ||
uiSchema: { | ||
'ui:title': 'Direct deposit', | ||
'ui:description': directDepositDescription, | ||
bankAccount: merge( | ||
{}, | ||
{ | ||
accountType: { | ||
'ui:title': 'Account type', | ||
'ui:widget': 'radio', | ||
'ui:options': { | ||
labels: { | ||
checking: 'Checking', | ||
savings: 'Savings', | ||
}, | ||
}, | ||
}, | ||
accountNumber: { | ||
'ui:title': 'Bank account number', | ||
}, | ||
routingNumber: { | ||
'ui:title': 'Bank routing number', | ||
'ui:validations': [validateRoutingNumber], | ||
'ui:errorMessages': { | ||
pattern: 'Please enter a valid 9 digit routing number', | ||
}, | ||
}, | ||
}, | ||
), | ||
}, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
bankAccount: bankAccountProperties, | ||
}, | ||
}, | ||
}; | ||
} |
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
66 changes: 66 additions & 0 deletions
66
src/applications/edu-benefits/5490/tests/content/directDepositUpdate.unit.spec.jsx
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,66 @@ | ||
import React from 'react'; | ||
import ReactTestUtils from 'react-dom/test-utils'; | ||
import { findDOMNode } from 'react-dom'; | ||
import { expect } from 'chai'; | ||
import { DefinitionTester } from 'platform/testing/unit/schemaform-utils.jsx'; | ||
import formConfig from '../../config/form'; | ||
import { | ||
gaBankInfoHelpText, | ||
validateRoutingNumber, | ||
} from '../../content/directDepositUpdate'; | ||
|
||
describe('Edu 5490 personalInformation directDepositUpdate', () => { | ||
const { | ||
schema, | ||
uiSchema, | ||
} = formConfig.chapters.personalInformation.pages.directDeposit; | ||
it('should render', () => { | ||
const form = ReactTestUtils.renderIntoDocument( | ||
<DefinitionTester schema={schema} data={{}} uiSchema={uiSchema} />, | ||
); | ||
const formDOM = findDOMNode(form); | ||
expect(formDOM).to.not.be.null; | ||
|
||
// expect(formDOM.querySelectorAll('input, select').length).to.equal(15); | ||
}); | ||
}); | ||
|
||
describe('Edu 5490 directDepositUpdate', () => { | ||
it('should execute validateRoutingNumber', () => { | ||
const errors = { | ||
addError: (pattern = undefined) => { | ||
let result; | ||
if (pattern) { | ||
result = pattern; | ||
} | ||
return result; | ||
}, | ||
}; | ||
const routingNumber = 123; | ||
const validRoutingNumber = '026009593'; | ||
const formData = {}; | ||
const { | ||
schema, | ||
} = formConfig.chapters.personalInformation.pages.directDeposit; | ||
const errorMessages = { | ||
pattern: 'n/a', | ||
}; | ||
validateRoutingNumber( | ||
errors, | ||
routingNumber, | ||
formData, | ||
schema, | ||
errorMessages, | ||
); | ||
validateRoutingNumber( | ||
errors, | ||
validRoutingNumber, | ||
formData, | ||
schema, | ||
errorMessages, | ||
); | ||
}); | ||
it('should execute gaBankInfoHelpText', () => { | ||
gaBankInfoHelpText(); | ||
}); | ||
}); |