Skip to content

Commit

Permalink
YEL-144 [fix] apple 결제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonjeongs committed Aug 26, 2023
1 parent f2e53c9 commit 41df0a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
@Builder
public record AppleOrderResponse(
int appAppleId,
String environment,
String JWSTransaction
String environment
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,35 +70,40 @@ private List<SlackAttachment> generateSlackPurchaseAttachment(
HttpServletRequest request
) throws IOException {
final SlackAttachment slackAttachment = new SlackAttachment()
.setColor("green")
.setColor("good")
.setTitle(PURCHASE_TITLE)
.setTitleLink(request.getContextPath())
.setText(PURCHASE_TITLE)
.setColor("green")
.setFields(generateSlackFieldList(request));
return Collections.singletonList(slackAttachment);
}

private List<SlackField> generateSlackFieldList(
HttpServletRequest request
) throws IOException {
final String token = request.getHeader(HttpHeaders.AUTHORIZATION).substring("Bearer ".length());
final String token =
request.getHeader(HttpHeaders.AUTHORIZATION).substring("Bearer ".length());
final Long userId = tokenProvider.getUserId(token);
final Optional<User> user = userRepository.findById(userId);
final String yelloId = user.isPresent() ? user.get().getYelloId() : "null";
final String deviceToken = user.isPresent() ? user.get().getDeviceToken() : "null";

String userInfo = String.format("userId : %d %nyelloId : %s %ndeviceToken : %s", userId, yelloId, deviceToken);
String userInfo =
String.format("userId : %d %nyelloId : %s %ndeviceToken : %s", userId, yelloId,
deviceToken);

return Arrays.asList(
new SlackField().setTitle("Request URL").setValue(request.getRequestURL().toString()),
new SlackField().setTitle("Request Time").setValue(TimeFactory.toDateFormattedString(LocalDateTime.now())),
new SlackField().setTitle("Request Time")
.setValue(TimeFactory.toDateFormattedString(LocalDateTime.now())),
new SlackField().setTitle("Request IP").setValue(request.getRemoteAddr()),
new SlackField().setTitle("Request User-Agent").setValue(request.getHeader(HttpHeaders.USER_AGENT)),
new SlackField().setTitle("Request User-Agent")
.setValue(request.getHeader(HttpHeaders.USER_AGENT)),
new SlackField().setTitle("인증/인가 정보 - Authorization")
.setValue(request.getHeader(HttpHeaders.AUTHORIZATION)),
new SlackField().setTitle("Request Body")
.setValue(StreamUtils.copyToString(request.getInputStream(), StandardCharsets.UTF_8)),
.setValue(
StreamUtils.copyToString(request.getInputStream(), StandardCharsets.UTF_8)),
new SlackField().setTitle("인증/인가 정보 - 유저").setValue(userInfo)
);
}
Expand Down

0 comments on commit 41df0a6

Please sign in to comment.