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

#17 Add credit_card_luhn generater #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bbejot
Copy link

@bbejot bbejot commented Sep 18, 2023

@PumpkinSeed @the-murph37 and I are developers trying to learn Rust. So any advice on conventions or whatever would be greatly appreciated.

@PumpkinSeed
Copy link
Owner

Thanks for the contribution @bbejot. I will review it in this week, but currently I'm on holiday, so let me have a few days. :)

@PumpkinSeed PumpkinSeed linked an issue Sep 20, 2023 that may be closed by this pull request
@@ -26,8 +26,38 @@ pub fn credit_card_number() -> String {
}

pub fn credit_card_luhn_number() -> String {
// @TODO
return String::from("");
let mut cc_str = credit_card_number();
Copy link
Owner

Choose a reason for hiding this comment

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

What do you think writing the algorithm of luhn generation? I think it's much nicer solution to write the function on the way that it generates a proper luhn number sequence for the first run.

Resources:

Let me know your thoughts. :)

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I absolutely think that is the right way to go. I only did it this way because I was trying to stay close to the go fakeit library, but if you're cool diverging a bit, then generating the last digit is much better and potentially future-usable than guess-and-check.

Will change.

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, I'm not a big fan of how gofakeit solves it, so that would be awesome if you could have change it. Thank you.

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

Successfully merging this pull request may close these issues.

Add credit_card_luhn generater
2 participants