Skip to content

Commit

Permalink
#247 feat: 외부 결제 api 호출 후 메세지 보내는 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
aeyongdodam committed Aug 29, 2024
1 parent 620eba3 commit 08605ec
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.example.sharemind.payment.domain.Payment;
import com.example.sharemind.post.application.PostService;
import com.example.sharemind.post.domain.Post;
import com.example.sharemind.sms.application.SmsService;
import jakarta.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -40,6 +41,7 @@ public class PayAppServiceImpl implements PayAppService {
private final PostService postService;
private final ChatService chatService;
private final LetterService letterService;
private final SmsService smsService;

private final RestClient restClient = RestClient.builder()
.baseUrl(PAY_APP_URL)
Expand Down Expand Up @@ -171,7 +173,8 @@ public String confirmConsult(HttpServletRequest request) {
URLDecoder.decode(request.getParameter("pay_date"), StandardCharsets.UTF_8));

if (!payAppUserId.equals(userId) || !payAppKey.equals(key) || !payAppValue.equals(value)) {
throw new PayAppException(PayAppErrorCode.CONFIRM_BASIC_INFO_FAIL, userId + " " + key + " " + value);
throw new PayAppException(PayAppErrorCode.CONFIRM_BASIC_INFO_FAIL,
userId + " " + key + " " + value);
}

Payment payment = paymentService.getPaymentByPayAppId(payAppId);
Expand All @@ -195,6 +198,7 @@ public String confirmConsult(HttpServletRequest request) {
consult.updateIsPaidAndChat(chat, payMethod.getMethod(), approvedAt);
}
}
smsService.sendSmsCounselor(consult.getCounselor().getCounselorId());
}

return "SUCCESS";
Expand All @@ -216,7 +220,8 @@ public String confirmPost(HttpServletRequest request) {
URLDecoder.decode(request.getParameter("pay_date"), StandardCharsets.UTF_8));

if (!payAppUserId.equals(userId) || !payAppKey.equals(key) || !payAppValue.equals(value)) {
throw new PayAppException(PayAppErrorCode.CONFIRM_BASIC_INFO_FAIL, userId + " " + key + " " + value);
throw new PayAppException(PayAppErrorCode.CONFIRM_BASIC_INFO_FAIL,
userId + " " + key + " " + value);
}

Post post = postService.getPostByPayAppId(payAppId);
Expand Down

0 comments on commit 08605ec

Please sign in to comment.