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

Branch code option for SWIFT/BIC codes #1158

Closed
ejcheng opened this issue Jul 17, 2022 · 6 comments · Fixed by #1378
Closed

Branch code option for SWIFT/BIC codes #1158

ejcheng opened this issue Jul 17, 2022 · 6 comments · Fixed by #1378
Assignees
Labels
c: feature Request for new feature m: finance Something is referring to the finance module s: needs decision Needs team/maintainer decision

Comments

@ejcheng
Copy link
Member

ejcheng commented Jul 17, 2022

From bank.codes: "SWIFT codes are laid out in a standard format. You'll find 8 letters or digits for a standard SWIFT code, or 11 if you also have the branch code added. The last 3 digits which show the specific branch an account is held at are not always necessary."

Currently, finance.bic() uses a ternary operator

: prob < 40
? this.faker.helpers.replaceSymbols('###')
: '',
to randomly decide whether to generate an 8 char or 11 char SWIFT code.

I propose that we add a boolean branchCode parameter to finance.bic() to give users the ability to pick whether they want a standard SWIFT code or a code with the branch code at the end.

@ejcheng ejcheng added c: feature Request for new feature s: needs decision Needs team/maintainer decision labels Jul 17, 2022
@ejcheng ejcheng added this to the v7 - Current Major milestone Jul 17, 2022
@Shinigami92
Copy link
Member

It should still be possible to call the function and get 8 or 11 as result so your test suit can handle both kind of data
So we might need a string union literal. Also consider using an option object, even if there is currently only one option, but it's more easy extendable.

@ST-DDT
Copy link
Member

ST-DDT commented Jul 18, 2022

FFR:

: prob < 40
? this.faker.helpers.replaceSymbols('###')
: '',

@ejcheng
Copy link
Member Author

ejcheng commented Jul 18, 2022

It should still be possible to call the function and get 8 or 11 as result so your test suit can handle both kind of data So we might need a string union literal. Also consider using an option object, even if there is currently only one option, but it's more easy extendable.

Yeah, most of the functions with parameters use options objects, so we should keep it consistent and have one here as well.

@hankucz
Copy link
Contributor

hankucz commented Jul 20, 2022

I fixed the bug in #1171, and if you accept it I can extend it with these additional parameters to control branch code generation...

@ejcheng ejcheng moved this to Todo in Faker Roadmap Jul 20, 2022
@ejcheng
Copy link
Member Author

ejcheng commented Jul 20, 2022

I fixed the bug in #1171, and if you accept it I can extend it with these additional parameters to control branch code generation...

Hmm, I would say submit #1171 first, then make a new PR with the options object and new parameter added to the function. Thank you for your PR!

@xDivisionByZerox xDivisionByZerox added the m: finance Something is referring to the finance module label Jul 29, 2022
@ejcheng
Copy link
Member Author

ejcheng commented Sep 4, 2022

I fixed the bug in #1171, and if you accept it I can extend it with these additional parameters to control branch code generation...

Hi Hanna, are you on this issue? I could take it, if you wish. Thank you for your help with the implementation fix!

@ejcheng ejcheng self-assigned this Sep 18, 2022
Repository owner moved this from Todo to Done in Faker Roadmap Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature m: finance Something is referring to the finance module s: needs decision Needs team/maintainer decision
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants