Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When advancing from the download page, make a call to VA Notify endpoint #92783

Closed
2 tasks
oddball-lindsay opened this issue Sep 12, 2024 · 2 comments · Fixed by department-of-veterans-affairs/vets-website#32029
Assignees
Labels
accredited-representation-management-team Accredited Representation Management team frontend mvp Initial version of thing

Comments

@oddball-lindsay
Copy link
Contributor

oddball-lindsay commented Sep 12, 2024

Background

When a user clicks "Continue" on the download page, we ned to make a request to VA Notify to send a confirmation email.

Related work:

Tasks

  • Make a request to the VA Notify endpoint

Acceptance Criteria

  • When the user clicks "Continue" on the download page, VA Notify is engaged and the user (if their email is included) will receive an email that confirms completion and has next steps.
@oddball-lindsay oddball-lindsay added accredited-representation-management-team Accredited Representation Management team frontend mvp Initial version of thing labels Sep 12, 2024
@oddball-lindsay oddball-lindsay changed the title When advancing from the download page, engage VA Notify When advancing from the download page, make a call to VA Notify Sep 17, 2024
@oddball-lindsay oddball-lindsay changed the title When advancing from the download page, make a call to VA Notify When advancing from the download page, make a call to VA Notify endpoint Sep 17, 2024
@holdenhinkle
Copy link
Collaborator

@holdenhinkle
Copy link
Collaborator

@cosu419

Hey Colin - I just added a bunch of unit tests to that PR - department-of-veterans-affairs/vets-website#32029

I moved a bunch of functions from the component pages into the helpers.js file so they can easily be tested (and to dry some things up).

This spec file is failing locally - src/applications/representative-appoint/tests/components/ContactCard.unit.spec.jsx

I think it’s because of that strange issue with this import (we talked about it):

import { parsePhoneNumber } from '../utilities/helpers';

Would you mind handling this for me? I have one more silent failures thing to do, but I want to checkout for my vacation.

Yes, when I create this file - src/applications/representative-appoint/utilities/parsePhoneNumber.js

const parsePhoneNumber = phone => {
  if (!phone) {
    return { contact: null, extension: null };
  }
  let sanitizedNumber = phone
    .replace(/[()\s]/g, '') // remove parentheses
    .replace(/(?<=.)([+.*])/g, '-'); // replace .*+ symbols being used as dashes

  // return null for non-US country codes
  if (sanitizedNumber.match(/\+(\d+)[^\d1]/g)) {
    return { contact: null, extension: null };
  }

  // remove US country codes +1 or 1
  sanitizedNumber = sanitizedNumber.replace(/^(\+1|1)\s*/, '');

  // capture first 10 digits + ext if applicable
  const parserRegex = /^(\d{10})(\D*?(\d+))?/;
  const contact = sanitizedNumber.replace(/-/g, '').replace(parserRegex, '$1');
  const extension =
    sanitizedNumber
      .replace(/-/g, '')
      .replace(parserRegex, '$3')
      .replace(/\D/g, '') || null;

  const isValidContactNumberRegex = /^(?:[2-9]\d{2})[2-9]\d{2}\d{4}$/;

  if (isValidContactNumberRegex.test(contact)) {
    return { contact, extension };
  }
  return { contact: null, extension: null };
};

export default parsePhoneNumber;

And change the import in src/applications/representative-appoint/components/ContactCard.jsx to import parsePhoneNumber from '../utilities/parsePhoneNumber'; the tests pass. So weird.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accredited-representation-management-team Accredited Representation Management team frontend mvp Initial version of thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants