Skip to content

Commit

Permalink
feat: added paymentMethod to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheaGjerde committed Mar 30, 2026
1 parent 18f6520 commit 9a4e4dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/edu/group5/app/control/DonationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void handleDonate() {
User currentUser = appState.getCurrentUser();
Organization currentOrg = appState.getCurrentOrganization();
BigDecimal amount = appState.getCurrentDonationAmount();
String paymentMethod = appState.getCurrentPaymentMethod();

if (currentUser == null) {
System.err.println("Error: No user logged in");
Expand All @@ -60,17 +61,21 @@ public void handleDonate() {
System.err.println("Error: Invalid donation amount");
return;
}
if (paymentMethod == null) {
System.out.println("Error: Invalid payment method");
return;
}

// Create donation via service
boolean success = service.donate(
customer,
currentOrg.orgNumber(),
amount,
"Online"
paymentMethod
);

if (success) {
System.out.println("Donation created: " + amount + " kr to " + currentOrg.name());
System.out.println("Donation created: " + amount + " kr to " + currentOrg.name() + ", with payment method: " + paymentMethod);
} else {
System.err.println("Failed to create donation");
}
Expand Down

0 comments on commit 9a4e4dc

Please sign in to comment.