Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion myconext-server/src/main/java/myconext/sms/SMSServiceImpl.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package myconext.sms;

import lombok.SneakyThrows;
import myconext.tiqr.TiqrController;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
Expand All @@ -19,13 +22,16 @@
@SuppressWarnings("unchecked")
public class SMSServiceImpl implements SMSService {

private static final Log LOG = LogFactory.getLog(SMSServiceImpl.class);

private final String url;
public final String route;
private final String templateNl;
private final String templateEn;
private final RestTemplate restTemplate = new RestTemplate();
private final MultiValueMap<String, String> headers = new HttpHeaders();


@SneakyThrows
public SMSServiceImpl(String url, String bearer, String route) {
this.url = url;
Expand Down Expand Up @@ -53,7 +59,11 @@ public String send(String mobile, String code, Locale locale) {
"recipients", List.of(mobile)
);

RequestEntity<?> requestEntity = new RequestEntity(body, headers, HttpMethod.POST, URI.create(url));
RequestEntity<?> requestEntity = new RequestEntity<>(body, headers, HttpMethod.POST, URI.create(url));
LOG.info(String.format("Sending SMS with url : %s, route : %s body: %s",
url,
route,
body));
restTemplate.exchange(requestEntity, Void.class);
return format;
}
Expand Down
Loading