Skip to content

Commit

Permalink
Made the Donation class with accessor-methods and javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheaGjerde committed Mar 1, 2026
1 parent 0857d03 commit 082c2a3
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/edu/group5/app/model/DBRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package edu.group5.app.model;

public class DBRepository {
}
4 changes: 4 additions & 0 deletions src/main/java/edu/group5/app/model/Repository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package edu.group5.app.model;

public class Repository {
}
74 changes: 73 additions & 1 deletion src/main/java/edu/group5/app/model/donation/Donation.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
package edu.group5.app.model.donation;

import java.math.BigDecimal;
import java.sql.Timestamp;

/**
* Represents a verified donation made by a user to an organization.
*/
public class Donation {

private final int donationId;
private final int userId;
private final int organizationId;
private final BigDecimal amount;
private final Timestamp date;
private final String paymentMethod;

/**
* Constructs a new Donation.
*
* @param donationId - the unique ID of this donation
* @param userId - the ID of the user making the donation
* @param organizationId - the ID of the organization receiving the donation
* @param amount - the donation amount
* @param date - the timestamp when the donation was made
* @param paymentMethod - the payment method used
*/
public Donation(int donationId, int userId, int organizationId, BigDecimal amount, Timestamp date, String paymentMethod) {
this.donationId = donationId;
this.userId = userId;
this.organizationId = organizationId;
this.amount = amount;
this.date = date;
this.paymentMethod = paymentMethod;
}

/**
* @return the donation ID
*/
public int getDonationId(){
return donationId;
}

/**
* @return the user ID of the donator
*/
public int getUserId(){
return userId;
}

/**
* @return the organization ID that receives the donation
*/
public int getOrganizationId() {
return organizationId;
}

/**
* @return the donated amount
*/
public BigDecimal getAmount() {
return amount;
}

/**
* @return the timestamp of the donation
*/
public Timestamp getDate() {
return date;
}

/**
* @return the payment method used
*/
public String getPaymentMethod() {
return paymentMethod;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package edu.group5.app.model.donation;

public class DonationRepository {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package edu.group5.app.model.donation;

public class DonationRepositoryTest {
}
4 changes: 4 additions & 0 deletions src/test/java/edu/group5/app/model/donation/DonationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package edu.group5.app.model.donation;

public class DonationTest {
}

0 comments on commit 082c2a3

Please sign in to comment.