Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 서버 배포 #276

Merged
merged 18 commits into from
Nov 19, 2024
Merged
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a5b3af0
#264 feat: 채팅 및 편지 결제 api 추가
aeyongdodam Oct 5, 2024
9e862cd
#264 feat: 일대다 상담 api 추가
aeyongdodam Oct 5, 2024
f42b73d
Merge branch 'develop' of https://github.com/sharemindteam/sharemind-…
aeyongdodam Oct 5, 2024
bd2d66d
#270 feat: Payment에 지급일자 나타내는 settledAt 필드 추가
letskuku Oct 28, 2024
a940aea
#270 fix: PaymentGetCounselorResponse에서 지급일자 필드명 수정, 상담일자 필드 추가
letskuku Oct 28, 2024
efbe218
#270 feat: 정산 총금액 필드 dto에 한번만 사용되도록 dto 구조 수정
letskuku Oct 28, 2024
f72bde9
#270 fix: PaymentGetCustomerResponse에서 상담 결제 날짜 알맞게 반환되도록 수정
letskuku Oct 28, 2024
d46bdf9
Merge pull request #272 from sharemindteam/fix/270-counselor-payment
letskuku Oct 31, 2024
b1d788e
#270 fix: PaymentGetCounselorResponse에서 total 필드 제거
letskuku Oct 31, 2024
ea75121
Merge pull request #273 from sharemindteam/fix/270-counselor-payment
letskuku Oct 31, 2024
1c33236
#271 fix: 수수료율 수정
letskuku Nov 2, 2024
0543dcc
#271 feat: Payment에 수수료 필드 추가
letskuku Nov 2, 2024
a7f9ab5
#271 feat: 순수익 계산 로직 수정
letskuku Nov 2, 2024
90d122e
#271 refactor: 코드 로직 형식 통일
letskuku Nov 2, 2024
3ab1eb1
Merge pull request #274 from sharemindteam/fix/271-payment-fee
letskuku Nov 4, 2024
98e7084
feat: 상담 상태 및 내림차순 정렬
aeyongdodam Nov 11, 2024
5f5ac4d
Merge branch 'develop' of https://github.com/sharemindteam/sharemind-…
aeyongdodam Nov 11, 2024
2f73dd6
Merge pull request #275 from sharemindteam/feature/264-admin-paid-api
aeyongdodam Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ public void updateCompleteMonth(Long amount) {
}

public void updateCompleteAll(Long amount) {
this.completeAll = amount;
this.completeAll += amount;
}

public void clearAll() {
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public class Constants {
public static final Boolean IS_CHAT = true;
public static final Boolean IS_LETTER = false;

public static final Long FEE = 1000L;
public static final Double FEE = 0.2;

public static final Long MAX_COMMENTS = 5L;
}
Original file line number Diff line number Diff line change
@@ -28,8 +28,6 @@
import java.time.LocalDateTime;
import java.util.List;

import static com.example.sharemind.global.constants.Constants.FEE;

@Service
@Transactional(readOnly = true)
@RequiredArgsConstructor
@@ -213,7 +211,7 @@ public void updateSettlement(Counselor counselor) {
paymentRepository.findAllByConsultCounselorAndCounselorStatusAndIsActivatedIsTrue(counselor,
PaymentCounselorStatus.SETTLEMENT_WAITING)
.forEach(payment -> {
Long amount = payment.getConsult().getCost() - FEE;
Long amount = payment.getConsult().getCost() - payment.getFee();
settlement.updateWaitingAll(amount);
if (payment.getUpdatedAt().isAfter(LocalDateTime.now().minusWeeks(1))) {
settlement.updateWaitingWeek(amount);
@@ -225,7 +223,7 @@ public void updateSettlement(Counselor counselor) {
paymentRepository.findAllByConsultCounselorAndCounselorStatusAndIsActivatedIsTrue(counselor,
PaymentCounselorStatus.SETTLEMENT_ONGOING)
.forEach(payment -> {
Long amount = payment.getConsult().getCost() - FEE;
Long amount = payment.getConsult().getCost() - payment.getFee();
settlement.updateOngoingAll(amount);
if (payment.getUpdatedAt().isAfter(LocalDateTime.now().minusWeeks(1))) {
settlement.updateOngoingWeek(amount);
@@ -237,7 +235,7 @@ public void updateSettlement(Counselor counselor) {
paymentRepository.findAllByConsultCounselorAndCounselorStatusAndIsActivatedIsTrue(counselor,
PaymentCounselorStatus.SETTLEMENT_COMPLETE)
.forEach(payment -> {
Long amount = payment.getConsult().getCost() - FEE;
Long amount = payment.getConsult().getCost() - payment.getFee();
settlement.updateCompleteAll(amount);
if (payment.getUpdatedAt().isAfter(LocalDateTime.now().minusWeeks(1))) {
settlement.updateCompleteWeek(amount);
Original file line number Diff line number Diff line change
@@ -39,6 +39,9 @@ public class Payment extends BaseEntity {
@Column
private String method;

@Column(nullable = false)
private Long fee;

@Column(name = "is_paid", nullable = false)
private Boolean isPaid;

@@ -63,6 +66,7 @@ public class Payment extends BaseEntity {
public Payment(String customerPhoneNumber, Consult consult) {
this.customerPhoneNumber = customerPhoneNumber;
this.consult = consult;
this.fee = Math.round(consult.getCost() * FEE);
this.isPaid = false;
updateBothStatusNone();
}
@@ -113,7 +117,7 @@ public void updateCounselorStatusSettlementWaiting() {

public void updateCounselorStatusSettlementOngoing() {
Settlement settlement = this.consult.getCounselor().getSettlement();
long amount = this.consult.getCost() - FEE;
long amount = this.consult.getCost() - this.fee;
if (this.getUpdatedAt().isAfter(LocalDateTime.now().minusWeeks(1))) {
settlement.updateWaitingWeek(-amount);
}
@@ -130,7 +134,7 @@ public void updateCounselorStatusSettlementOngoing() {

public void updateCounselorStatusSettlementComplete() {
Settlement settlement = this.consult.getCounselor().getSettlement();
long amount = this.consult.getCost() - FEE;
long amount = this.consult.getCost() - this.fee;
if (this.getUpdatedAt().isAfter(LocalDateTime.now().minusWeeks(1))) {
settlement.updateOngoingWeek(-amount);
}
Original file line number Diff line number Diff line change
@@ -4,16 +4,12 @@
import com.example.sharemind.payment.domain.Payment;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.time.LocalDateTime;

import static com.example.sharemind.global.constants.Constants.FEE;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class PaymentGetCounselorResponse {

@Schema(description = "payment 아이디")
@@ -45,13 +41,36 @@ public class PaymentGetCounselorResponse {
@Schema(description = "지급 계좌")
private final String account;

@Builder
public PaymentGetCounselorResponse(Long paymentId, String nickname, Boolean isChat, Long profit,
Long cost, Long fee, LocalDateTime consultedAt, LocalDateTime settledAt,
String account) {
this.paymentId = paymentId;
this.nickname = nickname;
this.isChat = isChat;
this.profit = profit;
this.cost = cost;
this.fee = fee;
this.consultedAt = consultedAt;
this.settledAt = settledAt;
this.account = account;
}


public static PaymentGetCounselorResponse of(Payment payment) {
Consult consult = payment.getConsult();
Boolean isChat = consult.getChat() != null;

return new PaymentGetCounselorResponse(payment.getPaymentId(),
consult.getCustomer().getNickname(), isChat, consult.getCost() - FEE,
consult.getCost(), FEE, consult.getConsultedAt(), payment.getSettledAt(),
consult.getCounselor().getAccount());
return PaymentGetCounselorResponse.builder()
.paymentId(payment.getPaymentId())
.nickname(consult.getCustomer().getNickname())
.isChat(isChat)
.profit(consult.getCost() - payment.getFee())
.cost(consult.getCost())
.fee(payment.getFee())
.consultedAt(consult.getConsultedAt())
.settledAt(payment.getSettledAt())
.account(consult.getCounselor().getAccount())
.build();
}
}
Loading