|
|
|
@ -42,13 +42,8 @@ import lombok.extern.slf4j.*;
|
|
|
|
|
@Component
|
|
|
|
|
public class KkoTalkApiService {
|
|
|
|
|
|
|
|
|
|
private static final String PROFILE = System.getProperty("spring.profiles.active");
|
|
|
|
|
/**
|
|
|
|
|
* profile : local 여부
|
|
|
|
|
*/
|
|
|
|
|
private static final boolean IS_PROFILE_LOCAL = PROFILE.matches("local.*");
|
|
|
|
|
private static final String PRODUCT_CD = IS_PROFILE_LOCAL ? "D10_1T" : "D10_2";
|
|
|
|
|
|
|
|
|
|
@Value("${spring.profiles.active}")
|
|
|
|
|
private String PROFILE;
|
|
|
|
|
|
|
|
|
|
@Value("${contract.kakao.talk.host}")
|
|
|
|
|
private String HOST;
|
|
|
|
@ -83,7 +78,7 @@ public class KkoTalkApiService {
|
|
|
|
|
* @return KkotalkDTO.SendResponse
|
|
|
|
|
*/
|
|
|
|
|
public ResponseEntity<String> requestSend(final OrgMng orgMng, final KkotalkDTO.SendRequest reqDTO) {
|
|
|
|
|
reqDTO.setProductCode(PRODUCT_CD);
|
|
|
|
|
reqDTO.setProductCode(getProductCd());
|
|
|
|
|
|
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
|
errors = validate(reqDTO.getEnvelope(), errors);
|
|
|
|
@ -183,7 +178,7 @@ public class KkoTalkApiService {
|
|
|
|
|
*/
|
|
|
|
|
public ResponseEntity<String> requestSendBulk(final OrgMng orgMng, final KkotalkDTO.BulkSendRequest reqDTO) {
|
|
|
|
|
ResponseEntity<String> resEntity = null;
|
|
|
|
|
reqDTO.setProductCode(PRODUCT_CD);
|
|
|
|
|
reqDTO.setProductCode(getProductCd());
|
|
|
|
|
|
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
|
|
|
|
|
@ -374,9 +369,14 @@ public class KkoTalkApiService {
|
|
|
|
|
headers.setContentType(new MediaType(MediaType.APPLICATION_JSON, Charset.forName("utf-8")));
|
|
|
|
|
headers.set(HttpHeaders.AUTHORIZATION, String.format("KakaoAK %s", orgMng.getKakaoDealerRestApiKey()));
|
|
|
|
|
headers.set("Target-Authorization", String.format("KakaoAK %s", orgMng.getKakaoPartnerRestApiKey()));
|
|
|
|
|
headers.set("settle-Id", IS_PROFILE_LOCAL ? orgMng.getKakaoDevSettleId() : orgMng.getKakaoProdSettleId());
|
|
|
|
|
headers.set("settle-Id", PROFILE.matches("local.*") ? orgMng.getKakaoDevSettleId() : orgMng.getKakaoProdSettleId());
|
|
|
|
|
|
|
|
|
|
return headers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getProductCd() {
|
|
|
|
|
final boolean IS_PROFILE_LOCAL = PROFILE.matches("local.*");
|
|
|
|
|
return IS_PROFILE_LOCAL ? "D10_1T" : "D10_2";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|