Skip to content

Commit

Permalink
Donation class, deleted Abstract implemention as its unnecessary, ano…
Browse files Browse the repository at this point in the history
…nymity can be done on the presentation layer
  • Loading branch information
AdrianBalunan committed Feb 19, 2026
1 parent 5164341 commit 95563c2
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 9 deletions.

This file was deleted.

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;
}
}

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 95563c2

Please sign in to comment.