|
1 | 1 | package myconext.sms; |
2 | 2 |
|
3 | 3 | import lombok.SneakyThrows; |
| 4 | +import myconext.tiqr.TiqrController; |
4 | 5 | import org.apache.commons.io.IOUtils; |
| 6 | +import org.apache.commons.logging.Log; |
| 7 | +import org.apache.commons.logging.LogFactory; |
5 | 8 | import org.springframework.core.io.ClassPathResource; |
6 | 9 | import org.springframework.http.HttpHeaders; |
7 | 10 | import org.springframework.http.HttpMethod; |
|
19 | 22 | @SuppressWarnings("unchecked") |
20 | 23 | public class SMSServiceImpl implements SMSService { |
21 | 24 |
|
| 25 | + private static final Log LOG = LogFactory.getLog(SMSServiceImpl.class); |
| 26 | + |
22 | 27 | private final String url; |
23 | 28 | public final String route; |
24 | 29 | private final String templateNl; |
25 | 30 | private final String templateEn; |
26 | 31 | private final RestTemplate restTemplate = new RestTemplate(); |
27 | 32 | private final MultiValueMap<String, String> headers = new HttpHeaders(); |
28 | 33 |
|
| 34 | + |
29 | 35 | @SneakyThrows |
30 | 36 | public SMSServiceImpl(String url, String bearer, String route) { |
31 | 37 | this.url = url; |
@@ -53,7 +59,11 @@ public String send(String mobile, String code, Locale locale) { |
53 | 59 | "recipients", List.of(mobile) |
54 | 60 | ); |
55 | 61 |
|
56 | | - RequestEntity<?> requestEntity = new RequestEntity(body, headers, HttpMethod.POST, URI.create(url)); |
| 62 | + RequestEntity<?> requestEntity = new RequestEntity<>(body, headers, HttpMethod.POST, URI.create(url)); |
| 63 | + LOG.info(String.format("Sending SMS with url : %s, route : %s body: %s", |
| 64 | + url, |
| 65 | + route, |
| 66 | + body)); |
57 | 67 | restTemplate.exchange(requestEntity, Void.class); |
58 | 68 | return format; |
59 | 69 | } |
|
0 commit comments