For #10248 - Obfuscates credit card numbers autofill prompt #10256
For #10248 - Obfuscates credit card numbers autofill prompt #10256
Conversation
/** | ||
* Number of digits to be displayed after ellipses on an obfuscated credit card number. | ||
*/ |
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.
/** | |
* Number of digits to be displayed after ellipses on an obfuscated credit card number. | |
*/ | |
// Number of digits to be displayed after ellipses on an obfuscated credit card number. |
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.
Still looking for this to be committed.
* Returns the input string preceded by 4 ellipses, locked LTR, to be used for | ||
* obfuscating credit card numbers. | ||
*/ | ||
fun String.addEllipsesToCreditCardNumber(): String { |
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.
I thought our intention was to add a getter in the CreditCard
data class to return the obfuscated card number? This seems ok, but maybe too specific for CreditCards. I will check in with some AC folks to see if there are any strong opinions.
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.
I agree with @gabrielluong, this function is too spesific to CreditCard
to be as String
extension function. If we don't want to add the function directly to CreditCard
we would make this to be an extension function of CreditCard
.
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.
Will request changes then.
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.
@gabrielluong @Amejia481 I agree. I do want to add a getter, but there is more than one crediCard
type object, as you mentioned, and I did not want to have the same code in two places. Should I just add the custom getter to both?
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.
I think either option is fine. The CreditCard
in concept-engine is more specific to the GV Autocomplete CreditCard
, which will have the credit card decrypted at that point. You will also need to get the last 4 digits for that one. So, it seems easier for me to imagine 2 different getters due to the additional need to get the last 4 digits for the concept-engine CreditCard
. I don't really know what a custom getter for both will look like, so feel free to post both version and we can work through it together.
* Returns the input string preceded by 4 ellipses, locked LTR, to be used for | ||
* obfuscating credit card numbers. | ||
*/ | ||
fun String.addEllipsesToCreditCardNumber(): String { |
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.
Will request changes then.
Codecov Report
@@ Coverage Diff @@
## master #10256 +/- ##
============================================
- Coverage 74.18% 74.15% -0.04%
+ Complexity 6290 5176 -1114
============================================
Files 841 650 -191
Lines 31830 25765 -6065
Branches 5294 4348 -946
============================================
- Hits 23613 19105 -4508
+ Misses 5499 4365 -1134
+ Partials 2718 2295 -423 Continue to review full report at Codecov.
|
.../src/test/java/mozilla/components/feature/prompts/creditcard/CreditCardItemViewHolderTest.kt
Outdated
Show resolved
Hide resolved
/** | ||
* Number of digits to be displayed after ellipses on an obfuscated credit card number. | ||
*/ |
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.
Still looking for this to be committed.
...cept/storage/src/main/java/mozilla/components/concept/storage/CreditCardsAddressesStorage.kt
Outdated
Show resolved
Hide resolved
components/concept/engine/src/main/java/mozilla/components/concept/engine/prompt/CreditCard.kt
Outdated
Show resolved
Hide resolved
components/concept/engine/src/main/java/mozilla/components/concept/engine/prompt/CreditCard.kt
Outdated
Show resolved
Hide resolved
@@ -25,4 +25,24 @@ data class CreditCard( | |||
val expiryMonth: String, | |||
val expiryYear: String, | |||
val cardType: String | |||
) : Parcelable | |||
) : Parcelable { | |||
val obfuscatedCardNumber: String |
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 have a test for this https://searchfox.org/mozilla-mobile/source/android-components/components/concept/engine/src/test/java/mozilla/components/concept/engine/prompt/CreditCardTest.kt#13. Can you add a check that to confirm that we output the right value?
@@ -192,7 +192,24 @@ data class CreditCard( | |||
val timeLastUsed: Long?, | |||
val timeLastModified: Long, | |||
val timesUsed: Long | |||
) : Parcelable | |||
) : Parcelable { | |||
val obfuscatedCardNumber: String |
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.
Perhaps add the same test for this too.
…ompt (mozilla-mobile#10256) * For mozilla-mobile#10248 - Obfuscates credit card numbers autofill prompt * For mozilla-mobile#10248 - Changed string extension to getters in CreditCards * For mozilla-mobile#10248 - Addressed comments * For mozilla-mobile#10248 - Updates tests Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fixes #10248
Needs to land before mozilla-mobile/fenix#19420
Pull Request checklist
After merge