-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add pre and post whitespace to TransactionID regex #420
Conversation
Hi @AndyEPhipps, I tested this. The submission works when only one space is added after the transaction ID is pasted. Still, when I add two spaces after the transaction ID, I see the error message |
Hi Krupa, yeah I only added 0 or 1 spaces to the regex, I guess it doesn't need to be limited to just 1. Re: error message, I figured this was probably better UX to just take care of it behind the scenes (rather than having to build an edgecase into messaging); this was what @corinja suggested in planning but I'm easy either way. |
Yeah, definitely better to strip all leading and trailing whitespace from whatever the input is. Only if that can't work for some reason should we resort to asking the user to do it. |
I've updated the regex to cover 0+ spaces at the end and/or beginning of the transactionID value now. I appreciate your attention to detail, @KrupaPammi, but I guess it's worth reflecting that solutions suggested by non-technical stakeholders aren't aaaaalways best? 😇 |
(I should've added the conversation to the ticket anyways, so that's my bad) |
…en whitespace is added
Thanks for the fix @AndyEPhipps, sorry for being over-detailed; we don't want another request from the stakeholders for one space or 2 spaces issue :)
|
…en whitespace is added
No no, all good, @KrupaPammi! You asked me to do what the ticket called for, and I just didn't feed the 'requirements gathering' conversations into it, so you weren't to know. I also totally should've allowed for any number of spaces from the beginning, so that's a win 🥇 |
@@ -63,6 +63,16 @@ test.describe('Giftaid update form validation @sanity @nightly-sanity', () => { | |||
await page.waitForSelector('div#field-error--transactionId > span'); | |||
await expect(page.locator('div#field-error--transactionId > span')).toContainText('This transaction ID doesn\'t seem to be valid, please check your donation confirmation email or letter'); | |||
|
|||
// transaction ID number with space at the end should not show error message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @KrupaPammi 🙌
https://comicrelief.atlassian.net/browse/ENG-3193
TransactionID field in
/update
now allows for a trailing and/or leading whitespace in order to handle any copy-paste errors, and strips this out of the submission value itself, rather than messing with the input field value directly (which would bring in its own problems).NB: this is passed as both
transactionID
anddonationID
in the payload; I think the latter is some legacy thing maybe, or possibly used by a third party? Either way, I'm doing the same for both.Allowing the new spaces:

Successful submission, showing the trimmed values:
