Commit: 9c24ca4

Commit Details

SHA9c24ca40dbca995b0007e09659176f7c90e13392
Tree4c630341b69f778f78daa19bfebcc1bfdebe1836
Author<f69e50@finnacloud.com> 1766442705 +0300
Committer<f69e50@finnacloud.com> 1766442705 +0300
Message
add CI configuration and test script for Jenkins build
GPG Signature
-----BEGIN PGP SIGNATURE-----

iQJSBAABCAA8FiEEWJb139mJI+vZ81KkoAIVSUsXI0oFAmlJxtEeHHNvcGhpYS5l
cmFzbGFuQGZpbm5hY2xvdWQuY29tAAoJEKACFUlLFyNKwOEP/RJdPEnaGlYKr4zE
NkU5vATgzcYMHxCO6p3T6JqsfHsvv2d65vedOJ8LsSHFtT9AN/yXqZKV2722R5CG
WLsPzbVYJSXexKVZ8D7Zpf+DTu+/OAlWUE+XHMm+bJYVpDmqUo0ak/qX6vz6VYtW
bSRPMtM9g8WZKZqbBxLK7Sg1IkYFsFjEWmvn6mbD9C7k/0y4Sxp6Xee26xAx1sdI
+srAjwFgF+wJw0OAQoBA2jykTOiib93n9gdc9wbgl4AYUvdcaX3Hxv8LTl3Bu88N
2rqaL+OmjXtkFkEAiBaruvZZCt+aqp14gTgOM0wcLp1I1FP7uOFNOg0F0zSUawzY
Fuw3w6CKebkpbixGfxtJqrLl1IbPAhd92TxRVerZbDEnWpXW3a9HoGWRu5KFX/ny
ww+8M53ziWFNcHqpIyI5adRjG74C+5MdvC04J0/Sh1X8mykWcjE96Wu2/iRY9XQe
07I94ZVO0RaBSjSUnIItfhAgBXi03nzx+ZPw2tM4VHosn2zZjpzT8+KNQ0EXYhuT
AzgqcOKV94ZkM+48ZePvUFXsJxhMSkpXIQxGWWBnU9gjm3QAUsuCyqZGKXgVY9Vo
mDlLBl83Nhx+/7V8AFJO2gUmaph9YB01p3SMDfE++lLqX1BwdguFVrQib30OsRnq
e86d/6MrRABKf+FjtaulHY9+e8LS
=9ZJj
-----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