Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

For #10248 - Obfuscates credit card numbers autofill prompt #10256

Merged

Conversation

codrut-topliceanu
Copy link
Contributor

@codrut-topliceanu codrut-topliceanu commented May 13, 2021

Fixes #10248

Needs to land before mozilla-mobile/fenix#19420

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks .
  • Tests: This PR includes thorough tests.
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices.

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

Comment on lines 66 to 68
/**
* Number of digits to be displayed after ellipses on an obfuscated credit card number.
*/
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* 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.

Copy link
Member

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 {
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

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

Will request changes then.

Copy link
Contributor Author

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?

Copy link
Member

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 {
Copy link
Member

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
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #10256 (2fe0c06) into master (ffa8a0f) will decrease coverage by 0.03%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ Complexity Δ
...lla/components/concept/engine/prompt/CreditCard.kt 90.00% <66.66%> (-10.00%) 8.00 <1.00> (+1.00) ⬇️
...ure/prompts/creditcard/CreditCardItemViewHolder.kt 100.00% <100.00%> (ø) 4.00 <1.00> (ø)
...vice/nimbus/ui/NimbusExperimentsAdapterDelegate.kt
...illa/components/feature/share/RecentAppsStorage.kt
...wser/menu2/adapter/SmallMenuCandidateViewHolder.kt
...nts/lib/crash/service/SendCrashTelemetryService.kt
...components/service/digitalassetlinks/ext/Client.kt
...lla/components/concept/menu/candidate/TextStyle.kt
...java/mozilla/components/browser/domains/Domains.kt
...zilla/components/concept/menu/ext/MenuCandidate.kt
... and 183 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffa8a0f...2fe0c06. Read the comment docs.

Comment on lines 66 to 68
/**
* Number of digits to be displayed after ellipses on an obfuscated credit card number.
*/
Copy link
Member

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.

@gabrielluong gabrielluong self-assigned this May 17, 2021
@@ -25,4 +25,24 @@ data class CreditCard(
val expiryMonth: String,
val expiryYear: String,
val cardType: String
) : Parcelable
) : Parcelable {
val obfuscatedCardNumber: String
Copy link
Member

Choose a reason for hiding this comment

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

@@ -192,7 +192,24 @@ data class CreditCard(
val timeLastUsed: Long?,
val timeLastModified: Long,
val timesUsed: Long
) : Parcelable
) : Parcelable {
val obfuscatedCardNumber: String
Copy link
Member

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.

@gabrielluong gabrielluong added the 🛬 needs landing (squash) PRs that are ready to land (squashed) label May 19, 2021
@mergify mergify bot merged commit b6ee8b3 into mozilla-mobile:master May 19, 2021
grigoryk pushed a commit to gabrielluong/android-components that referenced this pull request Sep 11, 2021
…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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🛬 needs landing (squash) PRs that are ready to land (squashed)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Select credit card] Display the obfuscated credit card numbers in the select credit card prompt
3 participants