Browse Source

TS 연동 성공시 param 전송

pull/18/head
지대한 10 months ago
parent
commit
29f63b91c2
  1. 54
      pav-server/src/main/java/com/palnet/biz/api/external/controller/ExternalLaancController.java

54
pav-server/src/main/java/com/palnet/biz/api/external/controller/ExternalLaancController.java vendored

@ -46,7 +46,7 @@ public class ExternalLaancController {
TsPlanRq tsPlanRq; TsPlanRq tsPlanRq;
try { try {
tsPlanRq = JsonUtils.fromJson(body, TsPlanRq.class); tsPlanRq = JsonUtils.fromJson(body, TsPlanRq.class);
} catch (Exception e){ } catch (Exception e) {
ErrorCode errorCode = ErrorCode.TS_PARAM; ErrorCode errorCode = ErrorCode.TS_PARAM;
Map<String, String> error = new HashMap<>(); Map<String, String> error = new HashMap<>();
error.put("rspCode", "300"); error.put("rspCode", "300");
@ -75,22 +75,56 @@ public class ExternalLaancController {
Map<String, String> error = new HashMap<>(); Map<String, String> error = new HashMap<>();
error.put("rspCode", ErrorCode.TS_ETC.code()); error.put("rspCode", ErrorCode.TS_ETC.code());
error.put("rspMessage", ErrorCode.TS_ETC.message()); error.put("rspMessage", ErrorCode.TS_ETC.message());
return ResponseEntity.status(300).body(error); return ResponseEntity.status(700).body(error);
} }
return ResponseEntity.ok().build();
Map<String, String> successRs = new HashMap<>();
successRs.put("rspCode", ErrorCode.TS_SUCCESS.code().replaceAll("TS", ""));
successRs.put("rspMessage", ErrorCode.TS_SUCCESS.message());
return ResponseEntity.ok().body(successRs);
} }
// TS VC 유효성 검토 callback url - endpoint // TS VC 유효성 검토 callback url - endpoint
@PostMapping("/vc/callback") @PostMapping("/vc/callback")
public ResponseEntity<?> vcCallback(@RequestBody TsQrcodeRs rs) { public ResponseEntity<?> vcCallback(@RequestBody String body) {
log.info(">>>> vc/callback body: {}", rs); log.info(">>>> vc/callback body: {}", body);
tsService.vcCallback(rs); TsQrcodeRs rs;
return ResponseEntity.ok().build(); try {
rs = JsonUtils.fromJson(body, TsQrcodeRs.class);
} catch (Exception e) {
ErrorCode errorCode = ErrorCode.TS_PARAM;
Map<String, String> error = new HashMap<>();
error.put("rspCode", "300");
error.put("rspMessage", errorCode.message());
return ResponseEntity.status(300).body(error);
} }
public static void main(String[] args) { try {
ErrorCode errorCode = ErrorCode.fromCode("TS200"); tsService.vcCallback(rs);
System.out.println(errorCode); } catch (CustomException e) {
log.error("IGNORE: ", e);
ErrorCode errorCode = ErrorCode.fromCode(e.getErrorCode());
if (errorCode == null) errorCode = ErrorCode.TS_ETC;
String tsErrorCode = errorCode.code().replaceAll("TS", "");
Map<String, String> error = new HashMap<>();
error.put("rspCode", tsErrorCode);
error.put("rspMessage", errorCode.message());
return ResponseEntity.status(Integer.parseInt(tsErrorCode)).body(error);
} catch (Exception e) {
log.error("IGNORE: ", e);
Map<String, String> error = new HashMap<>();
error.put("rspCode", ErrorCode.TS_ETC.code().replaceAll("TS", ""));
error.put("rspMessage", ErrorCode.TS_ETC.message());
return ResponseEntity.status(700).body(error);
}
Map<String, String> successRs = new HashMap<>();
successRs.put("rspCode", ErrorCode.TS_SUCCESS.code().replaceAll("TS", ""));
successRs.put("rspMessage", ErrorCode.TS_SUCCESS.message());
return ResponseEntity.ok().body(successRs);
} }
} }

Loading…
Cancel
Save