jaswdr / faker

:rocket: Ultimate fake data generator for Go with zero dependencies
https://pkg.go.dev/github.com/jaswdr/faker
MIT License
549 stars 59 forks source link

Implement IBAN generation #172

Closed antfroger closed 4 months ago

antfroger commented 5 months ago

Description

Implement IBAN generation. Generated IBANs are random but valid. IBAN format is based on the country format of the IBAN. Support many countries, based on PHP's faker implementation.

p := New().Payment()
iban := p.Iban()

Are you trying to fix an existing issue?

https://github.com/jaswdr/faker/issues/168

Go Version

$ go version
go version go1.22.2 darwin/amd64

Go Tests

$ go test
2024/04/22 21:10:24 Error while requesting https://loremflickr.com/300/200 : request failed
2024/04/22 21:10:25 Error while creating a temp file: temp file creation failed
2024/04/22 21:10:25 Error while requesting https://randomuser.me : request failed
2024/04/22 21:10:25 Error while creating a temp file: temp file creation failed
PASS
ok      github.com/jaswdr/faker/v2  3.600s
jaswdr commented 4 months ago

Hey @antfroger thank you very much for the PR, my only general comment would be related to code organization, instead of having part of the code in payment.go/payment_test.go can you move everything to the iban.go/iban_test.go files?

This way we keep logic related to IBAN's in their proper files. Then you can use IBAN's methods in Payment to also generate IBAN's from Payment instances.

jaswdr commented 4 months ago

@antfroger LGTM, I merged and release it under v2.3.0. Congratulations on your first PR 🎉