-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Donation class, deleted Abstract implemention as its unnecessary, ano…
…nymity can be done on the presentation layer
- Loading branch information
AdrianBalunan
committed
Feb 19, 2026
1 parent
5164341
commit 95563c2
Showing
6 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
4 changes: 0 additions & 4 deletions
4
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/AnonymousDonation.java
This file was deleted.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/Donation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,79 @@ | ||
| package ntnu.sytemutvikling.team6.models; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.UUID; | ||
|
|
||
| public class Donation { | ||
| /* UUID for uniquely identifying each donation */ | ||
| private UUID charityId; | ||
|
|
||
| /* Ammount of money donated */ | ||
| private double amount; | ||
|
|
||
| /* Date and time of the donation */ | ||
| private LocalDateTime date; | ||
|
|
||
| /* The charity that received the donation */ | ||
| private Charity charity; | ||
|
|
||
| /* The user/donor that made the donation */ | ||
| private User donor; | ||
|
|
||
| /** | ||
| * Is the donation made anonymously? | ||
| * This can be null if the donation was made anonymously. | ||
| * | ||
| */ | ||
| private boolean isAnonymous; | ||
|
|
||
| /** | ||
| * Constructor for creating a new donation. | ||
| * The charityId is generated automatically using UUID. | ||
| * If the donation is made anonymously, the isAnonymous parameter is set to true. | ||
| * @param amount | ||
| * @param date | ||
| * @param charity | ||
| * @param donor | ||
| */ | ||
| public Donation(double amount, LocalDateTime date, Charity charity, User donor) { | ||
| this.charityId = UUID.randomUUID(); | ||
| this.amount = amount; | ||
| this.date = date; | ||
| this.charity = charity; | ||
| this.donor = donor; | ||
|
|
||
|
|
||
| // ASSUMES that this is the way to get the anonymous setting from the user's settings. | ||
| if (donor.getSettings().getAnonymous() == false) { | ||
| this.isAnonymous = true; | ||
| } else { | ||
| this.isAnonymous = false; | ||
|
|
||
| } | ||
| } | ||
|
|
||
| /* Getters for the donation's attributes */ | ||
| public boolean isAnonymous() { | ||
| return isAnonymous; | ||
| } | ||
|
|
||
| public UUID getCharityId() { | ||
| return charityId; | ||
| } | ||
|
|
||
| public double getAmount() { | ||
| return amount; | ||
| } | ||
|
|
||
| public LocalDateTime getDate() { | ||
| return date; | ||
| } | ||
|
|
||
| public Charity getCharity() { | ||
| return charity; | ||
| } | ||
|
|
||
| public User getDonor() { | ||
| return donor; | ||
| } | ||
| } |
5 changes: 0 additions & 5 deletions
5
helpmehelpapplication/src/main/java/ntnu/sytemutvikling/team6/models/PublicDonation.java
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-539 Bytes
...mehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/AnonymousDonation.class
Binary file not shown.
Binary file modified
BIN
+1.12 KB
(460%)
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/Donation.class
Binary file not shown.
Binary file removed
BIN
-530 Bytes
helpmehelpapplication/target/classes/ntnu/sytemutvikling/team6/models/PublicDonation.class
Binary file not shown.