Skip to content
This repository was archived by the owner on Oct 8, 2022. It is now read-only.

Commit

Permalink
Avoid receiving payment of already paid sale
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotcorreia committed Nov 12, 2021
1 parent 9894b78 commit e6bd927
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ggc-core/src/ggc/Warehouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,10 +760,12 @@ public void receivePayment(int transactionId)
if (transaction == null) {
throw new UnknownTransactionKeyException(transactionId);
}
final double paidValue = transaction
.accept(new PaymentProcessor(this.date));
transaction.getPartner().increasePaidSalesValue(paidValue);
this.availableBalance += paidValue;
if (!transaction.isPaid()) {
final double paidValue = transaction
.accept(new PaymentProcessor(this.date));
transaction.getPartner().increasePaidSalesValue(paidValue);
this.availableBalance += paidValue;
}
}

/**
Expand Down

0 comments on commit e6bd927

Please sign in to comment.