Skip to content

Commit

Permalink
feat: send refund admin msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Kang1221 committed Oct 15, 2024
1 parent 53de2fb commit 4885b78
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/co/orange/ddanzi/service/PaymentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import co.orange.ddanzi.domain.product.Product;
import co.orange.ddanzi.domain.product.enums.ItemStatus;
import co.orange.ddanzi.domain.user.User;
import co.orange.ddanzi.domain.user.enums.FcmCase;
import co.orange.ddanzi.dto.payment.*;
import co.orange.ddanzi.global.jwt.AuthUtils;
import co.orange.ddanzi.repository.*;
Expand Down Expand Up @@ -126,7 +125,7 @@ else if(payment.getPayStatus().equals(PayStatus.PAID)){
log.info("Payment is paid!!");
item.updateStatus(ItemStatus.CLOSED);
product.updateStock(product.getStock() - 1);
fcmService.sendMessageToAdmin(FcmCase.C2);
fcmService.sendMessageToAdmins("⚠️관리자 알림: 구매실행", "결제가 실행되었습니다. orderId:" + order.getId());
}

historyService.createPaymentHistory(buyer, payment);
Expand Down Expand Up @@ -206,10 +205,10 @@ public void refundPayment(User user, Order order, String reason){
RestTemplate restTemplate = new RestTemplate();
restTemplate.postForObject(url, entity, String.class);
log.info("결제 취소 api 호출");
fcmService.sendMessageToAdmin(FcmCase.C3);
fcmService.sendMessageToAdmins("⚠️관리자 알림: 환불실행", "중복 결제로 인해 환불되었습니다. orderId:" + order.getId());
}catch (Exception e){
log.info("환불 실패");
fcmService.sendMessageToAdmin(FcmCase.C5);
fcmService.sendMessageToAdmins("⚠️관리자 알림: 환불 실패", "환불에 실패했습니다. orderId:" + order.getId());
}

}
Expand Down

0 comments on commit 4885b78

Please sign in to comment.