Skip to content

Commit

Permalink
Merge pull request #184 from WE-ARE-RACCOONS/develop
Browse files Browse the repository at this point in the history
RAC-325 HotFix : 수정중 사라진 API복구
  • Loading branch information
ywj9811 authored Mar 18, 2024
2 parents 9c84d6a + f99900e commit b86a872
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.postgraduate.domain.admin.application.dto.MentoringInfo;
import com.postgraduate.domain.admin.application.dto.UserMentoringInfo;
import com.postgraduate.domain.admin.application.dto.res.MentoringManageResponse;
import com.postgraduate.domain.admin.application.dto.res.MentoringWithPaymentResponse;
import com.postgraduate.domain.admin.application.mapper.AdminMapper;
import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.service.MentoringGetService;
Expand All @@ -24,7 +23,6 @@

import java.util.List;

import static com.postgraduate.domain.admin.application.mapper.AdminMapper.mapToMentoringWithPaymentResponse;
import static com.postgraduate.domain.admin.application.mapper.AdminMapper.mapToUserMentoringInfo;
import static com.postgraduate.domain.mentoring.domain.entity.constant.Status.DONE;

Expand Down Expand Up @@ -61,12 +59,6 @@ public MentoringManageResponse userMentoringInfos(Long userId) {
return new MentoringManageResponse(mentoringInfos, userInfo);
}

public MentoringWithPaymentResponse paymentMentoringInfo(Long paymentId) {
Payment payment = paymentGetService.byId(paymentId);
Mentoring mentoring = mentoringGetService.byPayment(payment);
return mapToMentoringWithPaymentResponse(mentoring);
}

public void refundMentoring(User user, Long mentoringId) {
Mentoring mentoring = mentoringGetService.byMentoringId(mentoringId);
Payment payment = mentoring.getPayment();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.postgraduate.domain.adminssr.application.usecase;

import com.postgraduate.domain.admin.application.dto.PaymentInfo;
import com.postgraduate.domain.admin.application.dto.res.MentoringWithPaymentResponse;
import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.service.MentoringGetService;
import com.postgraduate.domain.payment.application.usecase.PaymentManageUseCase;
Expand All @@ -13,6 +14,7 @@

import java.util.List;

import static com.postgraduate.domain.admin.application.mapper.AdminMapper.mapToMentoringWithPaymentResponse;
import static com.postgraduate.domain.admin.application.mapper.AdminMapper.mapToPaymentInfo;

@Service
Expand All @@ -35,6 +37,12 @@ public List<PaymentInfo> paymentInfos() {
.toList();
}

public MentoringWithPaymentResponse paymentMentoringInfo(Long paymentId) {
Payment payment = paymentGetService.byId(paymentId);
Mentoring mentoring = mentoringGetService.byPayment(payment);
return mapToMentoringWithPaymentResponse(mentoring);
}

public void refundPayment(User user, Long paymentId) {
paymentManageUseCase.refundPayByAdmin(user, paymentId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.postgraduate.domain.admin.application.dto.*;
import com.postgraduate.domain.admin.application.dto.res.CertificationDetailsResponse;
import com.postgraduate.domain.admin.application.dto.res.MentoringManageResponse;
import com.postgraduate.domain.admin.application.dto.res.MentoringWithPaymentResponse;
import com.postgraduate.domain.admin.application.dto.res.WishResponse;
import com.postgraduate.domain.adminssr.application.dto.req.Login;
import com.postgraduate.domain.adminssr.application.usecase.*;
Expand Down Expand Up @@ -136,6 +137,13 @@ public String paymentInfo(Model model) {
return "adminPayment";
}

@GetMapping("/payment/mentoring")
public String paymentWithMentoring(Long paymentId, Model model) {
MentoringWithPaymentResponse mentoringWithPaymentResponse = adminPaymentUseCase.paymentMentoringInfo(paymentId);
model.addAttribute("mentoringInfo", mentoringWithPaymentResponse);
return "paymentMentoring";
}

@PostMapping("/payment/refund/{paymentId}")
public String refundPayment(@AuthenticationPrincipal User user, @PathVariable Long paymentId) {
adminPaymentUseCase.refundPayment(user, paymentId);
Expand Down

0 comments on commit b86a872

Please sign in to comment.