-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐ :: Api-v0.1.2
- Loading branch information
Showing
62 changed files
with
1,939 additions
and
2,521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
DuDoong-Api/src/main/java/band/gosrock/api/coupon/service/ReadMyPageIssuedCouponUseCase.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
DuDoong-Api/src/main/java/band/gosrock/api/email/dto/OrderMailDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package band.gosrock.api.email.dto; | ||
|
||
|
||
import band.gosrock.infrastructure.config.mail.dto.EmailEventInfo; | ||
import band.gosrock.infrastructure.config.mail.dto.EmailOrderInfo; | ||
import band.gosrock.infrastructure.config.mail.dto.EmailUserInfo; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class OrderMailDto { | ||
private final EmailUserInfo userInfo; | ||
private final EmailOrderInfo orderInfo; | ||
private final EmailEventInfo eventInfo; | ||
} |
38 changes: 38 additions & 0 deletions
38
DuDoong-Api/src/main/java/band/gosrock/api/email/handler/CreateOrderEventEmailHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package band.gosrock.api.email.handler; | ||
|
||
|
||
import band.gosrock.api.email.service.OrderApproveRequestEmailService; | ||
import band.gosrock.api.email.service.OrderMailInfoHelper; | ||
import band.gosrock.domain.common.events.order.CreateOrderEvent; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionPhase; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class CreateOrderEventEmailHandler { | ||
|
||
private final OrderApproveRequestEmailService orderApproveRequestEmailService; | ||
|
||
private final OrderMailInfoHelper orderMailInfoHelper; | ||
|
||
@Async | ||
@TransactionalEventListener( | ||
classes = CreateOrderEvent.class, | ||
phase = TransactionPhase.AFTER_COMMIT) | ||
public void handleDoneOrderFailEvent(CreateOrderEvent createOrderEvent) { | ||
log.info(createOrderEvent.getOrderUuid() + "์ฃผ๋ฌธ ์์ฑ ์ด๋ฉ์ผ ์์ฒญ"); | ||
|
||
// ์น์ธ ์ฃผ๋ฌธ๋ง ์์ฑ์์ ์ด๋ฉ์ผ์ ๋ณด๋ธ๋ค. | ||
if (createOrderEvent.getOrderMethod().isPayment()) { | ||
return; | ||
} | ||
|
||
orderApproveRequestEmailService.execute( | ||
orderMailInfoHelper.execute(createOrderEvent.getOrderUuid())); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
DuDoong-Api/src/main/java/band/gosrock/api/email/handler/DoneOrderEventEmailHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package band.gosrock.api.email.handler; | ||
|
||
|
||
import band.gosrock.api.email.dto.OrderMailDto; | ||
import band.gosrock.api.email.service.OrderApproveConfirmEmailService; | ||
import band.gosrock.api.email.service.OrderMailInfoHelper; | ||
import band.gosrock.api.email.service.OrderPaymentDoneEmailService; | ||
import band.gosrock.domain.common.events.order.DoneOrderEvent; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionPhase; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class DoneOrderEventEmailHandler { | ||
|
||
private final OrderMailInfoHelper orderMailInfoHelper; | ||
|
||
private final OrderApproveConfirmEmailService orderApproveConfirmEmailService; | ||
private final OrderPaymentDoneEmailService orderPaymentDoneEmailService; | ||
|
||
@Async | ||
@TransactionalEventListener( | ||
classes = DoneOrderEvent.class, | ||
phase = TransactionPhase.AFTER_COMMIT) | ||
public void handleDoneOrderEvent(DoneOrderEvent doneOrderEvent) { | ||
log.info(doneOrderEvent.getOrderUuid() + "์ฃผ๋ฌธ ์ํ ์๋ฃ, ์ด๋ฉ์ผ ๋ณด๋ด๊ธฐ"); | ||
OrderMailDto orderMailDto = orderMailInfoHelper.execute(doneOrderEvent.getOrderUuid()); | ||
|
||
// ๊ฒฐ์ ์ฉ | ||
if (doneOrderEvent.getOrderMethod().isPayment()) { | ||
orderPaymentDoneEmailService.execute(orderMailDto); | ||
return; | ||
} | ||
// ์น์ธ์ฉ | ||
orderApproveConfirmEmailService.execute(orderMailDto); | ||
log.info(doneOrderEvent.getOrderUuid() + "์ฃผ๋ฌธ ์ํ ์๋ฃ, ์ด๋ฉ์ผ ๋ณด๋ด๊ธฐ ์๋ฃ"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
DuDoong-Api/src/main/java/band/gosrock/api/email/handler/WithDrawOrderEventEmailHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package band.gosrock.api.email.handler; | ||
|
||
|
||
import band.gosrock.api.email.dto.OrderMailDto; | ||
import band.gosrock.api.email.service.OrderMailInfoHelper; | ||
import band.gosrock.api.email.service.OrderWithDrawCancelEmailService; | ||
import band.gosrock.api.email.service.OrderWithDrawRefundEmailService; | ||
import band.gosrock.domain.common.events.order.WithDrawOrderEvent; | ||
import band.gosrock.domain.domains.order.domain.OrderStatus; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionPhase; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class WithDrawOrderEventEmailHandler { | ||
|
||
private final OrderWithDrawRefundEmailService orderWithDrawRefundEmailService; | ||
private final OrderWithDrawCancelEmailService orderWithDrawCancelEmailService; | ||
private final OrderMailInfoHelper orderMailInfoHelper; | ||
|
||
@Async | ||
@TransactionalEventListener( | ||
classes = WithDrawOrderEvent.class, | ||
phase = TransactionPhase.AFTER_COMMIT) | ||
public void handleWithDrawOrderEvent(WithDrawOrderEvent withDrawOrderEvent) { | ||
OrderStatus orderStatus = withDrawOrderEvent.getOrderStatus(); | ||
OrderMailDto orderMailDto = orderMailInfoHelper.execute(withDrawOrderEvent.getOrderUuid()); | ||
|
||
// ๊ด๋ฆฌ์์ ์ํ ์ทจ์ | ||
if (orderStatus == OrderStatus.CANCELED) { | ||
orderWithDrawCancelEmailService.execute(orderMailDto); | ||
return; | ||
} | ||
// ๊ตฌ๋งค์์์ํ ํ๋ถ ์์ฒญ | ||
orderWithDrawRefundEmailService.execute(orderMailDto); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
DuDoong-Api/src/main/java/band/gosrock/api/email/service/HostInviteEmailService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package band.gosrock.api.email.service; | ||
|
||
|
||
import band.gosrock.domain.domains.host.domain.HostRole; | ||
import band.gosrock.infrastructure.config.mail.dto.EmailUserInfo; | ||
import band.gosrock.infrastructure.config.ses.AwsSesUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.thymeleaf.context.Context; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class HostInviteEmailService { | ||
private final AwsSesUtils awsSesUtils; | ||
|
||
public void execute(EmailUserInfo userInfo, String hostName, HostRole hostRole) { | ||
Context context = new Context(); | ||
context.setVariable("userInfo", userInfo); | ||
context.setVariable("hostName", hostName); | ||
context.setVariable("role", hostRole.getValue()); | ||
awsSesUtils.singleEmailRequest( | ||
userInfo.getEmail(), "๋๋ฅ" + hostName + " ํธ์คํธ ์ด๋ ์๋ฆผ ๋๋ฆฝ๋๋ค.", "hostInvite", context); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ong-Api/src/main/java/band/gosrock/api/email/service/OrderApproveConfirmEmailService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package band.gosrock.api.email.service; | ||
|
||
|
||
import band.gosrock.api.email.dto.OrderMailDto; | ||
import band.gosrock.infrastructure.config.mail.dto.EmailUserInfo; | ||
import band.gosrock.infrastructure.config.ses.AwsSesUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.thymeleaf.context.Context; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class OrderApproveConfirmEmailService { | ||
private final AwsSesUtils awsSesUtils; | ||
|
||
public void execute(OrderMailDto orderMailDto) { | ||
Context context = new Context(); | ||
EmailUserInfo userInfo = orderMailDto.getUserInfo(); | ||
context.setVariable("userInfo", userInfo); | ||
context.setVariable("orderInfo", orderMailDto.getOrderInfo()); | ||
context.setVariable("eventInfo", orderMailDto.getEventInfo()); | ||
awsSesUtils.singleEmailRequest( | ||
userInfo.getEmail(), "๋๋ฅ ์ฃผ๋ฌธ์น์ธ ์๋ฃ ์๋ฆผ๋๋ฆฝ๋๋ค.", "orderApproveConfirm", context); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ong-Api/src/main/java/band/gosrock/api/email/service/OrderApproveRequestEmailService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package band.gosrock.api.email.service; | ||
|
||
|
||
import band.gosrock.api.email.dto.OrderMailDto; | ||
import band.gosrock.infrastructure.config.mail.dto.EmailUserInfo; | ||
import band.gosrock.infrastructure.config.ses.AwsSesUtils; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.thymeleaf.context.Context; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class OrderApproveRequestEmailService { | ||
private final AwsSesUtils awsSesUtils; | ||
|
||
public void execute(OrderMailDto orderMailDto) { | ||
Context context = new Context(); | ||
EmailUserInfo userInfo = orderMailDto.getUserInfo(); | ||
context.setVariable("userInfo", userInfo); | ||
context.setVariable("orderInfo", orderMailDto.getOrderInfo()); | ||
context.setVariable("eventInfo", orderMailDto.getEventInfo()); | ||
awsSesUtils.singleEmailRequest( | ||
userInfo.getEmail(), "๋๋ฅ ์ฃผ๋ฌธ์น์ธ ์์ฒญ ์๋ฆผ๋๋ฆฝ๋๋ค.", "orderApproveRequest", context); | ||
} | ||
} |
Oops, something went wrong.