Skip to content

Commit

Permalink
fix&Update[DonationPage]: fix up merge conflict problems and update d…
Browse files Browse the repository at this point in the history
…onationPage to also include payment method
  • Loading branch information
Fredrik Marjoni committed Apr 14, 2026
1 parent 40b3ba9 commit 0556c5b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/main/java/edu/group5/app/control/DonationController.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public void requestDonationConfirmation() {
confirmDialog.setHeaderText("Confirm Your Donation");
confirmDialog.setContentText(
"Organization: " + currentOrg.name() + "\n" +
"Amount: " + amount + " kr\n\n" +
"Amount: " + amount + " kr\n" +
"Payment Method: " + paymentMethod + "\n\n" +
"Are you sure you want to proceed?"
);

Expand All @@ -88,6 +89,7 @@ private void handleDonate() {
User currentUser = appState.getCurrentUser();
Organization currentOrg = appState.getCurrentOrganization();
BigDecimal amount = appState.getCurrentDonationAmount();
String paymentMethod = appState.getCurrentPaymentMethod();

if (!(currentUser instanceof Customer customer)) {
System.err.println("Error: Only customers can donate");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ public HBox createPaymentMethodSection() {
Button vippsBtn = new Button("Vipps");
Button visaBtn = new Button("Visa");

appleBtn.setUserData("Apple Pay");
vippsBtn.setUserData("Vipps");
visaBtn.setUserData("Visa");

for (Button btn : new Button[]{appleBtn, vippsBtn, visaBtn}) {
btn.getStyleClass().add("payment-method-button");
btn.setOnAction(e -> selectPaymentMethod(btn));
Expand Down Expand Up @@ -200,6 +204,9 @@ private void selectPaymentMethod(Node element) {
}
selectedPaymentMethod = element;
selectedPaymentMethod.getStyleClass().add("payment-method-selected");

String paymentMethod = (String) element.getUserData();
appState.setCurrentPaymentMethod(paymentMethod);
updateDonationButtonState();
}

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/edu/group5/app/view/userpage/UserPageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ private VBox createCausesSection() {
}
}
}
ScrollPane scrollPane = new ScrollPane(causesBox);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(150);
scrollPane.setContent(causesFlow);

Expand Down Expand Up @@ -181,9 +179,6 @@ private VBox createDonationsSection() {

}
}
ScrollPane scrollPane = new ScrollPane(donationsBox);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(200);
scrollPane.setContent(donationsBox);
return new VBox(10, title, searchBox, scrollPane);

Expand Down

0 comments on commit 0556c5b

Please sign in to comment.