Skip to content

Commit

Permalink
Add CVV to credit card
Browse files Browse the repository at this point in the history
  • Loading branch information
jkubrynski committed Mar 16, 2018
1 parent 8688163 commit 8ecdff7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ public class CreditCard {

private final String cardVendor;
private final String cardNumber;
private final String cvv;
private final LocalDateTime expiryDate;

public CreditCard(String cardVendor, String cardNumber, LocalDateTime expiryDate) {
public CreditCard(String cardVendor, String cardNumber, String cvv, LocalDateTime expiryDate) {
this.cardVendor = cardVendor;
this.cardNumber = cardNumber;
this.cvv = cvv;
this.expiryDate = expiryDate;
}

Expand All @@ -27,6 +29,10 @@ public String getCardNumber() {
return cardNumber;
}

public String getCvv() {
return cvv;
}

public LocalDateTime getExpiryDate() {
return expiryDate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public CreditCard get() {
String randomNumber = generateNumber();

LocalDateTime expiryDate = dateProducer.randomDateBetweenNowAndFuturePeriod(DEFAULT_VALIDITY);
return new CreditCard(CARD_VENDOR, randomNumber, expiryDate);
return new CreditCard(CARD_VENDOR, randomNumber, baseProducer.numerify("###"), expiryDate);
}

private String generateNumber() {
Expand Down

0 comments on commit 8ecdff7

Please sign in to comment.