-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ae2294
commit d93613e
Showing
22 changed files
with
182 additions
and
15 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
19 changes: 18 additions & 1 deletion
19
application/app-api/src/main/java/core/startup/mealtoktok/api/payment/PaymentApiDocs.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 |
---|---|---|
@@ -1,6 +1,23 @@ | ||
package core.startup.mealtoktok.api.payment; | ||
|
||
import core.startup.mealtoktok.api.payment.dto.PaymentCancelRequest; | ||
import core.startup.mealtoktok.api.payment.dto.PaymentFailReason; | ||
import core.startup.mealtoktok.api.payment.dto.PaymentRequest; | ||
import core.startup.mealtoktok.api.payment.dto.PaymentResponse; | ||
import core.startup.mealtoktok.common.dto.Response; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "결제 API") | ||
public interface PaymentApiDocs {} | ||
public interface PaymentApiDocs { | ||
|
||
@Operation(summary = "인증 성공 시") | ||
Response<PaymentResponse> pay(PaymentRequest request); | ||
|
||
@Operation(summary = "인증 실패 시") | ||
Response<Void> fail(PaymentFailReason paymentFailReason); | ||
|
||
@Operation(summary = "결제 취소") | ||
Response<Void> cancel(Long paymentId, PaymentCancelRequest request); | ||
} |
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
3 changes: 3 additions & 0 deletions
3
common/src/main/java/core/startup/mealtoktok/common/domain/BaseId.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
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
17 changes: 17 additions & 0 deletions
17
domain/src/main/java/core/startup/mealtoktok/domain/payment/PaymentManager.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,17 @@ | ||
package core.startup.mealtoktok.domain.payment; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class PaymentManager { | ||
|
||
private final PaymentRepository paymentRepository; | ||
|
||
public void cancel(Payment payment, String cancelReason) { | ||
Payment cancelled = payment.cancel(cancelReason); | ||
paymentRepository.update(cancelled); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...rc/main/java/core/startup/mealtoktok/domain/payment/exception/PaymentDomainException.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,10 @@ | ||
package core.startup.mealtoktok.domain.payment.exception; | ||
|
||
import core.startup.mealtoktok.common.exception.DomainException; | ||
|
||
public class PaymentDomainException extends DomainException { | ||
|
||
public PaymentDomainException(String message) { | ||
super(PaymentErrorCode.PAYMENT_DOMAIN_ERROR.setMessage(message)); | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
domain/src/main/java/core/startup/mealtoktok/domain/user/UserId.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
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
13 changes: 13 additions & 0 deletions
13
...c/main/java/core/startup/mealtoktok/infra/payment/exception/PaymentNotFoundException.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,13 @@ | ||
package core.startup.mealtoktok.infra.payment.exception; | ||
|
||
import core.startup.mealtoktok.common.exception.InfraException; | ||
import core.startup.mealtoktok.domain.payment.exception.PaymentErrorCode; | ||
|
||
public class PaymentNotFoundException extends InfraException { | ||
|
||
public static final PaymentNotFoundException EXCEPTION = new PaymentNotFoundException(); | ||
|
||
private PaymentNotFoundException() { | ||
super(PaymentErrorCode.PAYMENT_NOT_FOUND); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
infra/src/main/java/core/startup/mealtoktok/infra/toss/dto/TossCancelRequest.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,8 @@ | ||
package core.startup.mealtoktok.infra.toss.dto; | ||
|
||
public record TossCancelRequest(String cancelReason) { | ||
|
||
public static TossCancelRequest from(String cancelReason) { | ||
return new TossCancelRequest(cancelReason); | ||
} | ||
} |
Oops, something went wrong.