-
Notifications
You must be signed in to change notification settings - Fork 472
Issue #10363 - Handle authentication of the credit card selection for a prompt request #10369
Conversation
components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt
Outdated
Show resolved
Hide resolved
components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt
Outdated
Show resolved
Hide resolved
...ture/prompts/src/main/java/mozilla/components/feature/prompts/creditcard/CreditCardPicker.kt
Outdated
Show resolved
Hide resolved
5a4c8a9
to
3875fa2
Compare
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.
It looks pretty good, awesome work 🏅
I added some comments, I will like to do some manual tests as sanity checks, I will report after.
components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt
Show resolved
Hide resolved
.../prompts/src/test/java/mozilla/components/feature/prompts/creditcard/CreditCardPickerTest.kt
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
fun `GIVEN a selected credit card WHEN onAuthFailuree is called THEN the prompt request is dismissed`() { |
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.
nit: onAuthFailure
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.
Could we also confirm the prompt request was consume and dismissed? :)
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.
Yes, we already check with assertTrue(onDismissCalled)
below
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 the clarification, as this value is shared for multiple tests, it could be reset it on setup()
👍🏽 .
Maybe making it default to null could be a good idea.
@@ -105,6 +112,32 @@ class CreditCardPickerTest { | |||
verify(creditCardSelectBar).showPrompt(promptRequest.creditCards) | |||
} | |||
|
|||
@Test | |||
fun `GIVEN a selected credit card WHEN onAuthSuccess is called THEN the confirmed credit card is received`() { | |||
assertNull(creditCardPicker.selectedCreditCard) |
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.
Could we also confirm the prompt request was consume and confirmed? :)
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.
We do that by assertEquals(creditCard, confirmedCreditCard)
check below
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 the clarification, as this value is shared for multiple tests, could be reset it on setup()
👍🏽
Additionally, it will be good to add this new cool feature to the changelog file. |
3dd4c3c
to
88e4658
Compare
* @param isAuthenticated True if the user is authenticated successfully from the biometric | ||
* authentication prompt or false otherwise. | ||
*/ | ||
fun onBiometricResult(isAuthenticated: Boolean) { |
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.
small nit on naming: we're sort of lock ourselves into the idea that we always want biometrics for confirmation.
This isn't worth fixing at this point though.
… selection for a prompt request Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
Fixes #10363
Pull Request checklist
After merge