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

Update Add Debit Card form to match VBA styles #5940

Merged
merged 38 commits into from
Oct 27, 2021

Conversation

Jag96
Copy link
Contributor

@Jag96 Jag96 commented Oct 19, 2021

@luacmartins @marcaaron will you please review this?

Details

This PR updates the add debit card form to match the form styles when adding a bank account.

Fixed Issues

$ #5644

Tests/QA

  1. Sign into an account and go to Settings->Payments->Add Debit Card, confirm that the form fields have the same height
  2. Confirm you can navigate back to the previous page
  3. Submit the empty form, confirm that the fields are outlined in red (except for state field) and an error message displays below each field
  4. Confirm that an alert shows at the bottom of the form, above the submit button, with a link to fix the errors
  5. Confirm properly filling out fields in the form removes the error messages
  6. Confirm you can add different values for the expiration date including MM/YYYY, MMYYYY, MM-YYYY, MM/YY, MMYY, MM-YY

Local Testing (no QA)

  1. You can use 4242424242424242 as a test debit card number to confirm the form submits properly

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web Mobile
image image

@Jag96 Jag96 self-assigned this Oct 19, 2021
@Jag96 Jag96 marked this pull request as ready for review October 26, 2021 00:45
@Jag96 Jag96 requested a review from a team as a code owner October 26, 2021 00:45
@Jag96 Jag96 removed the request for review from a team October 26, 2021 00:45
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a few initial comments and some nabs. Overall looking good! Will test tomorrow.

src/pages/settings/Payments/AddDebitCardPage.js Outdated Show resolved Hide resolved
src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
src/libs/actions/PaymentMethods.js Outdated Show resolved Hide resolved
src/libs/actions/PaymentMethods.js Outdated Show resolved Hide resolved
src/libs/actions/PaymentMethods.js Show resolved Hide resolved
src/pages/settings/Payments/AddDebitCardPage.js Outdated Show resolved Hide resolved
}

/**
* Automatically adds the / character while the user is typing expiration date
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminded me of some conversation about how we did not want to manipulate the user input as it was being entered. Does that apply here? I'll try to dig it up...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we discussed it in this thread. While testing, I noticed that we add / the first time, but not if we delete it and type more chars, which is inconsistent. Maybe we should remove this forced formatting?

Copy link
Contributor Author

@Jag96 Jag96 Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find, ok so what if we do this:

  1. Don't update the input the user is adding (remove the function that monitors and adds /)
  2. Update getYearFromExpirationDateString so that instead of checking if the 3rd character is a /, we just check if it is not a numeric character (here)

That should allow us to let the user enter whatever they want (02/2020 or 022020 or 0220 or 02-2020) and we'd still let it validate, and take 02 as the month and 2020 as the year.

We'd have to update the regex to something like ^(0[1-9]|1[0-2])([^0-9])?([0-9]{4}|([0-9]{2}))$, but I think that will be fine since we're only using it there.

Open to other ideas though!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

src/pages/settings/Payments/AddDebitCardPage.js Outdated Show resolved Hide resolved
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, but left a few comments.

src/libs/ValidationUtils.js Outdated Show resolved Hide resolved
}

/**
* Automatically adds the / character while the user is typing expiration date
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we discussed it in this thread. While testing, I noticed that we add / the first time, but not if we delete it and type more chars, which is inconsistent. Maybe we should remove this forced formatting?

src/pages/settings/Payments/AddDebitCardPage.js Outdated Show resolved Hide resolved
src/pages/settings/Payments/AddDebitCardPage.js Outdated Show resolved Hide resolved
src/pages/settings/Payments/AddDebitCardPage.js Outdated Show resolved Hide resolved
src/languages/en.js Outdated Show resolved Hide resolved
src/languages/en.js Outdated Show resolved Hide resolved
src/languages/en.js Outdated Show resolved Hide resolved
src/languages/en.js Outdated Show resolved Hide resolved
src/languages/en.js Outdated Show resolved Hide resolved
@Jag96
Copy link
Contributor Author

Jag96 commented Oct 26, 2021

Updated the PR and addressed the comments, this is ready for another look!

@luacmartins luacmartins self-requested a review October 27, 2021 00:01
@jasperhuangg jasperhuangg removed their request for review October 27, 2021 00:01
@marcaaron marcaaron self-requested a review October 27, 2021 00:19
Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tested well.

label={this.props.translate('addDebitCardPage.billingAddress')}
containerStyles={[styles.mt4]}
value={this.state.addressStreet}
onChangeText={(fieldName, value) => this.clearErrorAndSetValue(fieldName, value)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow this field is responsible for setting multiple fields? That should be a fun one for the New Expensify Forms detailed conversation :)

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean code and tests well. Great job 👍

@marcaaron marcaaron merged commit ed2d251 into main Oct 27, 2021
@marcaaron marcaaron deleted the joe-update-add-debit-form branch October 27, 2021 00:33
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@Jag96 Jag96 mentioned this pull request Oct 27, 2021
5 tasks
@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @marcaaron in version: 1.1.10-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.11-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants