File History: src/main/java/com/paymentlink/controller/api/ConfigApiController.java

← View file content

File Content at Commit 188fc92

1 package com.paymentlink.controller.api;
2
3 import com.paymentlink.service.StripePaymentService;
4 import jakarta.servlet.http.HttpServletRequest;
5 import org.springframework.http.ResponseEntity;
6 import org.springframework.security.web.csrf.CsrfToken;
7 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController;
10
11 import java.util.HashMap;
12 import java.util.Map;
13
14 @RestController
15 @RequestMapping("/api")
16 public class ConfigApiController {
17
18 private final StripePaymentService stripePaymentService;
19
20 public ConfigApiController(StripePaymentService stripePaymentService) {
21 this.stripePaymentService = stripePaymentService;
22 }
23
24 /**
25 * GET /api/csrf-token - Get CSRF token
26 */
27 @GetMapping("/csrf-token")
28 public ResponseEntity<Map<String, String>> getCsrfToken(HttpServletRequest request) {
29 Map<String, String> response = new HashMap<>();
30 CsrfToken csrfToken = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
31 // CSRF is disabled, return a dummy token for compatibility
32 response.put("token", csrfToken != null ? csrfToken.getToken() : "csrf-disabled");
33 return ResponseEntity.ok(response);
34 }
35
36 /**
37 * GET /api/config/stripe-key - Get Stripe publishable key
38 */
39 @GetMapping("/config/stripe-key")
40 public ResponseEntity<Map<String, Object>> getStripeKey() {
41 Map<String, Object> response = new HashMap<>();
42 response.put("success", true);
43 response.put("publishableKey", stripePaymentService.getPublishableKey());
44 return ResponseEntity.ok(response);
45 }
46 }
47
48

Commits

Commit Author Date Message File SHA Actions
f0438c2 <f69e50@finnacloud.com> 1766443042 +0300 12/22/2025, 10:37:22 PM increment once more 806fcd2 View
188fc92 <f69e50@finnacloud.com> 1766442998 +0300 12/22/2025, 10:36:38 PM increment 806fcd2 Hide
4617f76 <f69e50@finnacloud.com> 1766442953 +0300 12/22/2025, 10:35:53 PM rename branch from main to master oops 806fcd2 View
e6d1548 <f69e50@finnacloud.com> 1766442769 +0300 12/22/2025, 10:32:49 PM add initial test workflow file 806fcd2 View
9c24ca4 <f69e50@finnacloud.com> 1766442705 +0300 12/22/2025, 10:31:45 PM add CI configuration and test script for Jenkins build 806fcd2 View
690c1f6 <f69e50@finnacloud.com> 1766368110 +0300 12/22/2025, 1:48:30 AM initialize backend structure with controllers, DTOs, and configuration files 806fcd2 View