Commit: f0438c2

Commit Details

SHAf0438c2cbc2d838bb66a4d8129dd25b5d48d28ee
Treeb8e53d050248c8b632fa3de86003489acae4670b
Author<f69e50@finnacloud.com> 1766443042 +0300
Committer<f69e50@finnacloud.com> 1766443042 +0300
Message
increment once more
GPG Signature
-----BEGIN PGP SIGNATURE-----

iQJSBAABCAA8FiEEWJb139mJI+vZ81KkoAIVSUsXI0oFAmlJyCIeHHNvcGhpYS5l
cmFzbGFuQGZpbm5hY2xvdWQuY29tAAoJEKACFUlLFyNKtrgP/04FZPSa4Hmx9WpR
gOamzjIXc+1+pBvGQDairLZU6rtDSgNkoryrsqOOLIXZWkkxZ70q8/aXQBFThr+t
YyDIz85u9GiwPOV8o1X4sxzF7bupOd6YmOOPqS2vco1aibpB8w9N9EwlMzW95Otw
vnQ/h0kz8MTp0wfXeRJqvLg8DVPnLgW70ly1TZQe19jEA4NwBZOyK2ksTis8iycX
HUM4WW8Velo8O+OtygAbwISr2dILKvkclTLn9kgfpN5esvBvJu4K+xA5T5alDchc
PY3FFeZteQf3GX4v0EH8K3c/q8OcQFMxuRGO31uYGqNbjbOB7zdZVs3N0B1m1efv
vhCgZ6gyxlz0kiozgO6Sx5WFOzHuTlguCK+x0JOtzCokRL/VLiPzmW5Umt280eJz
AlD7u7Dah3khoqDkzXfCL1lxch9tRMVMUYWRMayxC3iculCFM6OCLgzY9hay5y1j
WP1ZOdy/x9jKPoLv5USnw0KlH4rZIHH+aDMDEzWmWUWYDpShylG7sKafXg75bnho
5LbAfCucnDrkjN+rx1dxaKrZswQlIJ8iZ5Q6DzHnDzl4TaFcN1E3exS+xp46H7va
SbR94UfpCyjpTQ2hHdOS7XHINFUDIzWF3mUZ8gqyEANiqpgJ+RcOGX66s69oILpr
vD20SIdMHWDqJH3G6GMNsg1g5/QU
=YrcG
-----END PGP SIGNATURE-----

✓ Verified

File: src/main/java/com/paymentlink/controller/api/CountryApiController.java

1 package com.paymentlink.controller.api;
2
3 import com.paymentlink.service.TaxService;
4 import org.springframework.http.HttpStatus;
5 import org.springframework.http.ResponseEntity;
6 import org.springframework.web.bind.annotation.GetMapping;
7 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RestController;
9
10 import java.util.*;
11 import java.util.stream.Collectors;
12
13 @RestController
14 @RequestMapping("/api/countries")
15 public class CountryApiController {
16
17 private final TaxService taxService;
18
19 public CountryApiController(TaxService taxService) {
20 this.taxService = taxService;
21 }
22
23 /**
24 * GET /api/countries - Get supported countries
25 */
26 @GetMapping
27 public ResponseEntity<Map<String, Object>> getCountries() {
28 try {
29 Map<String, String> countriesMap = taxService.getSupportedCountries();
30
31 // Convert map to array of objects with code and name
32 List<Map<String, String>> countries = countriesMap.entrySet().stream()
33 .map(entry -> {
34 Map<String, String> country = new HashMap<>();
35 country.put("code", entry.getKey());
36 country.put("name", entry.getValue());
37 return country;
38 })
39 .sorted(Comparator.comparing(c -> c.get("name"))) // Sort by name
40 .collect(Collectors.toList());
41
42 Map<String, Object> response = new HashMap<>();
43 response.put("success", true);
44 response.put("countries", countries);
45 return ResponseEntity.ok(response);
46
47 } catch (Exception e) {
48 Map<String, Object> error = new HashMap<>();
49 error.put("success", false);
50 error.put("error", e.getMessage());
51 return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
52 }
53 }
54 }
55
56