Skip to content

Commit

Permalink
Finance provider extension with a new card type UNIONPAY and card num…
Browse files Browse the repository at this point in the history
…ber generator for it
  • Loading branch information
badoken authored and kingthorin committed Nov 9, 2024
1 parent 92427bd commit fde98f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/net/datafaker/providers/base/Finance.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public enum CreditCardType {
SOLO,
DANKORT,
FORBRUGSFORENINGEN,
LASER
LASER,
UNIONPAY
}

protected Finance(BaseProviders faker) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/en/finance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ en:
- "/6706###########L/"
- "/6771###########L/"
- "/6709###########L/"
unionpay:
- "/62##-####-####-###L/"
vat_number:
AT: "ATU########"
AR: "AR###########"
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/net/datafaker/providers/base/FinanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ void discoverCard() {
assertThat(creditCard).startsWith("6").hasSize(16);
}

@RepeatedTest(100)
void unionpayCard() {
String creditCard = finance.creditCard(CreditCardType.UNIONPAY).replace("-", "");
assertThat(creditCard).startsWith("62").hasSize(16);
}

@RepeatedTest(100)
void usRoutingNumber() {
String rtn = finance.usRoutingNumber();
Expand Down

0 comments on commit fde98f0

Please sign in to comment.