-
Notifications
You must be signed in to change notification settings - Fork 35
[volume-10] Collect, Stack, Zip #234
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
Open
sieun0322
wants to merge
5
commits into
Loopers-dev-lab:sieun0322
Choose a base branch
from
sieun0322:main
base: sieun0322
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
96d2a87
refactor: outbox event ๋ถ๋ฆฌ
sieun0322 280cbf9
feat: ๋ฐฐ์น ์ดํ๋ฆฌ์ผ์ด์
์ถ๊ฐ
sieun0322 d89b33e
feat: ์ฃผ๊ฐ, ์๊ฐ ๋ญํน ์ถ๊ฐ
sieun0322 a871e7e
feat: mv ์
๋ฐ์ดํธ์ , Redis ์บ์ ๋ง๋ฃ ์ถ๊ฐ
sieun0322 84ddeea
Merge pull request #9 from sieun0322/feature/collect_stack_zip
sieun0322 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
43 changes: 0 additions & 43 deletions
43
apps/commerce-api/src/main/java/com/loopers/application/event/DataPlatformEventHandler.java
This file was deleted.
Oops, something went wrong.
108 changes: 108 additions & 0 deletions
108
apps/commerce-api/src/main/java/com/loopers/application/event/DataTransferEventHandler.java
This file contains hidden or 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,108 @@ | ||
| package com.loopers.application.event; | ||
|
|
||
| import com.loopers.domain.order.Order; | ||
| import com.loopers.domain.order.OrderService; | ||
| import com.loopers.domain.payment.Payment; | ||
| import com.loopers.domain.payment.PaymentService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.context.ApplicationEventPublisher; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.transaction.event.TransactionalEventListener; | ||
| import org.springframework.transaction.event.TransactionPhase; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| @Component | ||
| public class DataTransferEventHandler { | ||
| private final OrderService orderService; | ||
| private final PaymentService paymentService; | ||
| private final ApplicationEventPublisher eventPublisher; | ||
|
|
||
| @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
| public void handlePaymentSuccess(PaymentSuccessEvent event) { | ||
| log.debug("Handling PaymentSuccessEvent for data transfer: orderId={}", event.orderId()); | ||
|
|
||
| Payment payment = paymentService.findPaymentByOrderId(event.orderId()); | ||
|
|
||
| // ๊ฒฐ์ ์ฑ๊ณต ๋ฐ์ดํฐ ์ ์ก | ||
| eventPublisher.publishEvent(new PaymentDataTransferEvent( | ||
| event.orderId(), | ||
| event.userId(), | ||
| event.amount(), | ||
| payment.getCardType(), | ||
| payment.getStatus(), | ||
| com.loopers.application.payment.TransactionStatus.SUCCESS, | ||
| event.reason(), | ||
| LocalDateTime.now(), | ||
| "PAYMENT_SUCCESS" | ||
| )); | ||
|
|
||
| // ์ฃผ๋ฌธ ๊ฒฐ์ ์๋ฃ ๋ฐ์ดํฐ ์ ์ก (์ด๋ฒคํธ ๋ฐ์ดํฐ ํ์ฉ) | ||
| eventPublisher.publishEvent(new OrderDataTransferEvent( | ||
| event.orderId(), | ||
| event.userId(), | ||
| null, // order.getStatus() ๋์ OrderCompletedEvent์์ ์ฒ๋ฆฌ | ||
| event.totalOrderAmount(), | ||
| LocalDateTime.now(), | ||
| "ORDER_PAID" | ||
| )); | ||
| } | ||
|
|
||
| @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
| public void handlePaymentFailure(PaymentFailureEvent event) { | ||
| log.debug("Handling PaymentFailureEvent for data transfer: orderId={}", event.orderId()); | ||
|
|
||
| Payment payment = paymentService.findPaymentByOrderId(event.orderId()); | ||
|
|
||
| // ๊ฒฐ์ ์คํจ ๋ฐ์ดํฐ ์ ์ก (์ด๋ฒคํธ ๋ฐ์ดํฐ ํ์ฉ) | ||
| eventPublisher.publishEvent(new PaymentDataTransferEvent( | ||
| event.orderId(), | ||
| event.userId(), | ||
| event.amount(), | ||
| payment.getCardType(), | ||
| payment.getStatus(), | ||
| com.loopers.application.payment.TransactionStatus.FAILED, | ||
| event.reason(), | ||
| LocalDateTime.now(), | ||
| "PAYMENT_FAILED" | ||
| )); | ||
| } | ||
|
|
||
| @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
| public void handleOrderCreated(OrderCreatedEvent event) { | ||
| log.debug("Handling OrderCreatedEvent for data transfer: orderId={}", event.orderId()); | ||
|
|
||
| Order order = orderService.getOrder(event.orderId()); | ||
|
|
||
| // ์ฃผ๋ฌธ ์์ฑ ๋ฐ์ดํฐ ์ ์ก | ||
| eventPublisher.publishEvent(new OrderDataTransferEvent( | ||
| event.orderId(), | ||
| event.userId(), | ||
| order.getStatus(), | ||
| order.getTotalPrice(), | ||
| LocalDateTime.now(), | ||
| "ORDER_CREATED" | ||
| )); | ||
| } | ||
|
|
||
| @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
| public void handleOrderCancelled(OrderCancelledEvent event) { | ||
| log.debug("Handling OrderCancelledEvent for data transfer: orderId={}", event.orderId()); | ||
|
|
||
| Order order = orderService.getOrder(event.orderId()); | ||
|
|
||
| // ์ฃผ๋ฌธ ์ทจ์ ๋ฐ์ดํฐ ์ ์ก | ||
| eventPublisher.publishEvent(new OrderDataTransferEvent( | ||
| event.orderId(), | ||
| event.userId(), | ||
| order.getStatus(), | ||
| order.getTotalPrice(), | ||
| LocalDateTime.now(), | ||
| "ORDER_CANCELLED" | ||
| )); | ||
| } | ||
| } |
4 changes: 2 additions & 2 deletions
4
apps/commerce-api/src/main/java/com/loopers/application/event/OrderCancelledEvent.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| package com.loopers.application.event; | ||
|
|
||
| public record OrderCancelledEvent( | ||
| Long orderId, | ||
| String orderId, | ||
| Long userId, | ||
| String reason | ||
| ) {} | ||
| ) {} |
16 changes: 9 additions & 7 deletions
16
apps/commerce-api/src/main/java/com/loopers/application/event/OrderCreatedEvent.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,20 +1,22 @@ | ||
| package com.loopers.application.event; | ||
|
|
||
| import com.loopers.domain.payment.CardType; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record OrderCreatedEvent( | ||
| Long orderId, | ||
| String orderId, | ||
| Long userId, | ||
| Long couponIssueId, | ||
| CardType cardType, | ||
| String cardNo, | ||
| List<OrderItemData> orderItems | ||
| ) { | ||
|
|
||
| public record OrderItemData( | ||
| Long productId, | ||
| Long quantity, | ||
| Long unitPrice | ||
| ) {} | ||
|
|
||
| public record OrderItemData( | ||
| Long productId, | ||
| Long quantity, | ||
| Long unitPrice | ||
| ) { | ||
| } | ||
| } |
5 changes: 3 additions & 2 deletions
5
apps/commerce-api/src/main/java/com/loopers/application/event/OrderDataTransferEvent.java
This file contains hidden or 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 hidden or 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
10 changes: 10 additions & 0 deletions
10
apps/commerce-api/src/main/java/com/loopers/application/event/OrderPaidEvent.java
This file contains hidden or 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,10 @@ | ||
| package com.loopers.application.event; | ||
|
|
||
| import com.loopers.domain.order.Money; | ||
|
|
||
| public record OrderPaidEvent( | ||
| String orderId, | ||
| Long userId, | ||
| Money totalAmount | ||
| ) { | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐งฉ Analysis chain
๐ Script executed:
Repository: Loopers-dev-lab/loopers-spring-java-template
Length of output: 4738
๐ Script executed:
Repository: Loopers-dev-lab/loopers-spring-java-template
Length of output: 5305
๐ Script executed:
Repository: Loopers-dev-lab/loopers-spring-java-template
Length of output: 5058
๐ Script executed:
Repository: Loopers-dev-lab/loopers-spring-java-template
Length of output: 3639
๐ Script executed:
Repository: Loopers-dev-lab/loopers-spring-java-template
Length of output: 4091
๐ Script executed:
Repository: Loopers-dev-lab/loopers-spring-java-template
Length of output: 5391
CouponUsedEvent๊ฐ ๋ฐํ๋์ง ์์ ํธ๋ค๋ฌ ์ฝ๋๊ฐ ์คํ๋์ง ์์
CouponUsedEvent๊ฐ ์ ์๋์ด ์์ง๋ง ์ค์ ๋ก ๋ฐํ๋์ง ์๋ ๊ตฌ์กฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค:CouponService.publishCouponUsedEvent()๋ฉ์๋๋BusinessActionEvent๋ฅผ ๋ฐํํ๋ฉฐ,CouponUsedEvent๋ ์ ํ ๋ฐํ๋์ง ์์ต๋๋คCouponEventHandler.handleCouponUsed()๋ฆฌ์ค๋๋ ๋๋ฌ ๋ถ๊ฐ๋ฅํ ๋ฐ๋ ์ฝ๋์ ๋๋คBusinessActionEvent๋ orderId๋ฅผnull๋ก ์ ๋ฌํ๋ฏ๋ก, ์๋ํ ๊ฒฐ์ ์ฒ๋ฆฌ ๋ก์ง(pgClient.requestPayment(),orderService.cancelPayment())์ด ์คํ๋์ง ์์ต๋๋คCouponUsedEvent๋ฅผ ์ค์ ๋ก ๋ฐํํ๋๋ก ์์ ํ๊ฑฐ๋,CouponEventHandler๋ฅผ ์ ๊ฑฐํด์ผ ํฉ๋๋ค.๐ค Prompt for AI Agents