From 204970856baa4e05c8138e7e2bcf6329e64e6d2e Mon Sep 17 00:00:00 2001 From: Constantin Simonis Date: Wed, 5 Mar 2025 08:57:14 +0100 Subject: [PATCH 1/4] fix: add correct redirect url after deposit --- .../java/de/szut/casino/deposit/DepositController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/de/szut/casino/deposit/DepositController.java b/backend/src/main/java/de/szut/casino/deposit/DepositController.java index 0e1ade5..0312981 100644 --- a/backend/src/main/java/de/szut/casino/deposit/DepositController.java +++ b/backend/src/main/java/de/szut/casino/deposit/DepositController.java @@ -24,11 +24,11 @@ public class DepositController { @Value("${stripe.secret.key}") private String stripeKey; + @Value("${frontend.host}") + private String frontendHost; + @PostMapping("/deposit/checkout") - public ResponseEntity checkout( - @RequestBody @Valid AmountDto amountDto, - @RequestHeader("Origin") String origin - ) throws StripeException { + public ResponseEntity checkout(@RequestBody @Valid AmountDto amountDto) throws StripeException { Stripe.apiKey = stripeKey; SessionCreateParams params = SessionCreateParams.builder() @@ -38,7 +38,7 @@ public class DepositController { .setQuantity(1L) .setName("Einzahlung") .build()) - .setSuccessUrl(origin+"/deposit/success") + .setSuccessUrl(frontendHost+"/deposit/success") .setMode(SessionCreateParams.Mode.PAYMENT) .build(); From f011ade4a8dfcc56d1ac858e0db4cf66b458b10a Mon Sep 17 00:00:00 2001 From: Constantin Simonis Date: Wed, 5 Mar 2025 08:59:34 +0100 Subject: [PATCH 2/4] fix: add frontend host to application properties --- .../src/main/java/de/szut/casino/deposit/DepositController.java | 2 +- backend/src/main/resources/application.properties | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/de/szut/casino/deposit/DepositController.java b/backend/src/main/java/de/szut/casino/deposit/DepositController.java index 0312981..08a9026 100644 --- a/backend/src/main/java/de/szut/casino/deposit/DepositController.java +++ b/backend/src/main/java/de/szut/casino/deposit/DepositController.java @@ -24,7 +24,7 @@ public class DepositController { @Value("${stripe.secret.key}") private String stripeKey; - @Value("${frontend.host}") + @Value("${app.fronend-host}") private String frontendHost; @PostMapping("/deposit/checkout") diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 268279f..7004ce8 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -4,6 +4,7 @@ spring.datasource.password=postgres_pass server.port=8080 spring.jpa.hibernate.ddl-auto=create-drop stripe.secret.key=${STRIPE_SECRET_KEY:sk_test_51QrePYIvCfqz7ANgqam8rEwWcMeKiLOof3j6SCMgu2sl4sESP45DJxca16mWcYo1sQaiBv32CMR6Z4AAAGQPCJo300ubuZKO8I} +app.fronend-host=http://localhost:3000 spring.application.name=lf12_starter #client registration configuration From c102f6ea65f8bb89cd2fc1c89f8b17efa6946edc Mon Sep 17 00:00:00 2001 From: Constantin Simonis Date: Wed, 5 Mar 2025 09:00:41 +0100 Subject: [PATCH 3/4] fix: typo --- .../src/main/java/de/szut/casino/deposit/DepositController.java | 2 +- backend/src/main/resources/application.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/de/szut/casino/deposit/DepositController.java b/backend/src/main/java/de/szut/casino/deposit/DepositController.java index 08a9026..ad1caf9 100644 --- a/backend/src/main/java/de/szut/casino/deposit/DepositController.java +++ b/backend/src/main/java/de/szut/casino/deposit/DepositController.java @@ -24,7 +24,7 @@ public class DepositController { @Value("${stripe.secret.key}") private String stripeKey; - @Value("${app.fronend-host}") + @Value("${app.frontend-host}") private String frontendHost; @PostMapping("/deposit/checkout") diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 7004ce8..792244e 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -4,7 +4,7 @@ spring.datasource.password=postgres_pass server.port=8080 spring.jpa.hibernate.ddl-auto=create-drop stripe.secret.key=${STRIPE_SECRET_KEY:sk_test_51QrePYIvCfqz7ANgqam8rEwWcMeKiLOof3j6SCMgu2sl4sESP45DJxca16mWcYo1sQaiBv32CMR6Z4AAAGQPCJo300ubuZKO8I} -app.fronend-host=http://localhost:3000 +app.frontend-host=http://localhost:3000 spring.application.name=lf12_starter #client registration configuration From bba33135d543a5def323e6d6fdda5dd9522e56eb Mon Sep 17 00:00:00 2001 From: Constantin Simonis Date: Wed, 5 Mar 2025 09:14:10 +0100 Subject: [PATCH 4/4] fix: change redirect route --- .../src/main/java/de/szut/casino/deposit/DepositController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/de/szut/casino/deposit/DepositController.java b/backend/src/main/java/de/szut/casino/deposit/DepositController.java index ad1caf9..c178867 100644 --- a/backend/src/main/java/de/szut/casino/deposit/DepositController.java +++ b/backend/src/main/java/de/szut/casino/deposit/DepositController.java @@ -38,7 +38,7 @@ public class DepositController { .setQuantity(1L) .setName("Einzahlung") .build()) - .setSuccessUrl(frontendHost+"/deposit/success") + .setSuccessUrl(frontendHost+"/home") .setMode(SessionCreateParams.Mode.PAYMENT) .build();