generated from pricelees/issue-pr-template
<!-- 제목 양식 --> <!-- [이슈번호] 작업 요약 (예시: [#10] Gitea 템플릿 생성) --> ## 📝 관련 이슈 및 PR **PR과 관련된 이슈 번호** - #41 ## ✨ 작업 내용 <!-- 어떤 작업을 했는지 알려주세요! --> - 예약 스키마 & API 재정의 - 새로운 기능에 맞춘 프론트엔드 페이지 추가 - Controller 이후 응답(성공, 실패) 로그에 Endpoint 추가 - 전환으로 인해 미사용되는 코드 및 테스트 전체 제거 ## 🧪 테스트 <!-- 어떤 테스트를 생각했고 진행했는지 알려주세요! --> <img width="528" alt="테스트 커버리지" src="attachments/a4899c0a-2919-4993-bd3b-a71bc601137d"> - 예약 & 결제 통합 테스트 작성 완료 - 결제 테스트는 통합 테스트에서는 Client를 mocking하는 방식 + 별도의 Client 슬라이스 테스트로 진행 ## 📚 참고 자료 및 기타 <!-- 참고한 자료, 또는 논의할 사항이 있다면 알려주세요! --> Reviewed-on: #42 Co-authored-by: pricelees <priceelees@gmail.com> Co-committed-by: pricelees <priceelees@gmail.com>
289 lines
9.7 KiB
Kotlin
289 lines
9.7 KiB
Kotlin
package roomescape.payment
|
|
|
|
import java.time.OffsetDateTime
|
|
|
|
object SampleTosspayConstant {
|
|
const val PAYMENT_KEY: String = "5EnNZRJGvaBX7zk2yd8ydw26XvwXkLrx9POLqKQjmAw4b0e1"
|
|
const val ORDER_ID: String = "MC4wODU4ODQwMzg4NDk0"
|
|
const val AMOUNT: Int = 100_000
|
|
const val CANCEL_REASON: String = "테스트 결제 취소"
|
|
|
|
val confirmRequestJson: String = """
|
|
{
|
|
"paymentKey": "$PAYMENT_KEY",
|
|
"orderId": "$ORDER_ID",
|
|
"amount": "$AMOUNT"
|
|
}
|
|
""".trimIndent()
|
|
|
|
val cancelRequestJson: String = """
|
|
{
|
|
"cancelReason": "$CANCEL_REASON",
|
|
"cancelAmount": "$AMOUNT"
|
|
}
|
|
""".trimIndent()
|
|
|
|
val tossPaymentErrorJson: String = """
|
|
{
|
|
"code": "ERROR_CODE",
|
|
"message": "Error message"
|
|
}
|
|
""".trimIndent()
|
|
|
|
val easypayCardConfirmJson: String = """
|
|
{
|
|
"mId": "tgen_docs",
|
|
"lastTransactionKey": "txrd_a01k4mtanmyx0hm6hmmbvfvmhky",
|
|
"paymentKey": "$PAYMENT_KEY",
|
|
"orderId": "$ORDER_ID",
|
|
"orderName": "Sonya Aguirre 예약 결제",
|
|
"taxExemptionAmount": 0,
|
|
"status": "DONE",
|
|
"requestedAt": "${OffsetDateTime.now()}",
|
|
"approvedAt": "${OffsetDateTime.now().plusSeconds(5)}",
|
|
"useEscrow": false,
|
|
"cultureExpense": false,
|
|
"card": {
|
|
"issuerCode": "41",
|
|
"acquirerCode": "41",
|
|
"number": "12748273****675*",
|
|
"installmentPlanMonths": 0,
|
|
"isInterestFree": false,
|
|
"interestPayer": null,
|
|
"approveNo": "00000000",
|
|
"useCardPoint": false,
|
|
"cardType": "신용",
|
|
"ownerType": "개인",
|
|
"acquireStatus": "READY",
|
|
"amount": $AMOUNT
|
|
},
|
|
"virtualAccount": null,
|
|
"transfer": null,
|
|
"mobilePhone": null,
|
|
"giftCertificate": null,
|
|
"cashReceipt": null,
|
|
"cashReceipts": null,
|
|
"discount": null,
|
|
"cancels": null,
|
|
"secret": "ps_6BYq7GWPVvGNAwZeRBDLrNE5vbo1",
|
|
"type": "NORMAL",
|
|
"easyPay": {
|
|
"provider": "토스페이",
|
|
"amount": 0,
|
|
"discountAmount": 0
|
|
},
|
|
"country": "KR",
|
|
"failure": null,
|
|
"isPartialCancelable": true,
|
|
"receipt": {
|
|
"url": "https://dashboard-sandbox.tosspayments.com/receipt/redirection?transactionId=tgen_20250908230510v2rY2&ref=PX"
|
|
},
|
|
"checkout": {
|
|
"url": "https://api.tosspayments.com/v1/payments/tgen_20250908230510v2rY2/checkout"
|
|
},
|
|
"currency": "KRW",
|
|
"totalAmount": $AMOUNT,
|
|
"balanceAmount": $AMOUNT,
|
|
"suppliedAmount": ${(AMOUNT * 0.9).toInt()},
|
|
"vat": ${(AMOUNT * 0.1).toInt()},
|
|
"taxFreeAmount": 0,
|
|
"method": "간편결제",
|
|
"version": "2022-11-16",
|
|
"metadata": null
|
|
}
|
|
""".trimIndent()
|
|
|
|
val easypayCardCancelJson: String = """
|
|
{
|
|
"mId": "tgen_docs",
|
|
"lastTransactionKey": "txrd_a01k4mtgh26vgrn1evbdckyqmdr",
|
|
"paymentKey": "$PAYMENT_KEY",
|
|
"orderId": "$ORDER_ID",
|
|
"orderName": "Sonya Aguirre 예약 결제",
|
|
"taxExemptionAmount": 0,
|
|
"status": "CANCELED",
|
|
"requestedAt": "${OffsetDateTime.now()}",
|
|
"approvedAt": "${OffsetDateTime.now().plusSeconds(5)}",
|
|
"useEscrow": false,
|
|
"cultureExpense": false,
|
|
"card": {
|
|
"issuerCode": "41",
|
|
"acquirerCode": "41",
|
|
"number": "12748273****675*",
|
|
"installmentPlanMonths": 0,
|
|
"isInterestFree": false,
|
|
"interestPayer": null,
|
|
"approveNo": "00000000",
|
|
"useCardPoint": false,
|
|
"cardType": "신용",
|
|
"ownerType": "개인",
|
|
"acquireStatus": "READY",
|
|
"amount": $AMOUNT
|
|
},
|
|
"virtualAccount": null,
|
|
"transfer": null,
|
|
"mobilePhone": null,
|
|
"giftCertificate": null,
|
|
"cashReceipt": null,
|
|
"cashReceipts": null,
|
|
"discount": null,
|
|
"cancels": [
|
|
{
|
|
"transactionKey": "txrd_a01k4mtgh26vgrn1evbdckyqmdr",
|
|
"cancelReason": "$CANCEL_REASON",
|
|
"taxExemptionAmount": 0,
|
|
"canceledAt": "${OffsetDateTime.now().plusMinutes(1)}",
|
|
"cardDiscountAmount": 0,
|
|
"transferDiscountAmount": 0,
|
|
"easyPayDiscountAmount": 0,
|
|
"receiptKey": null,
|
|
"cancelStatus": "DONE",
|
|
"cancelRequestId": null,
|
|
"cancelAmount": $AMOUNT,
|
|
"taxFreeAmount": 0,
|
|
"refundableAmount": 0
|
|
}
|
|
],
|
|
"secret": "ps_6BYq7GWPVvGNAwZeRBDLrNE5vbo1",
|
|
"type": "NORMAL",
|
|
"easyPay": {
|
|
"provider": "토스페이",
|
|
"amount": 0,
|
|
"discountAmount": 0
|
|
},
|
|
"country": "KR",
|
|
"failure": null,
|
|
"isPartialCancelable": true,
|
|
"receipt": {
|
|
"url": "https://dashboard-sandbox.tosspayments.com/receipt/redirection?transactionId=tgen_20250908230510v2rY2&ref=PX"
|
|
},
|
|
"checkout": {
|
|
"url": "https://api.tosspayments.com/v1/payments/tgen_20250908230510v2rY2/checkout"
|
|
},
|
|
"currency": "KRW",
|
|
"totalAmount": ${AMOUNT},
|
|
"balanceAmount": 0,
|
|
"suppliedAmount": 0,
|
|
"vat": 0,
|
|
"taxFreeAmount": 0,
|
|
"method": "간편결제",
|
|
"version": "2022-11-16",
|
|
"metadata": null
|
|
}
|
|
""".trimIndent()
|
|
|
|
val transferConfirmJson: String = """
|
|
{
|
|
"mId": "tgen_docs",
|
|
"lastTransactionKey": "txrd_a01k4mtanmyx0hm6hmmbvfvmhky",
|
|
"paymentKey": "$PAYMENT_KEY",
|
|
"orderId": "$ORDER_ID",
|
|
"orderName": "Sonya Aguirre 예약 결제",
|
|
"taxExemptionAmount": 0,
|
|
"status": "DONE",
|
|
"requestedAt": "${OffsetDateTime.now()}",
|
|
"approvedAt": "${OffsetDateTime.now().plusSeconds(5)}",
|
|
"useEscrow": false,
|
|
"cultureExpense": false,
|
|
"card": null,
|
|
"virtualAccount": null,
|
|
"transfer": {
|
|
"bankCode": "92",
|
|
"settlementStatus": "COMPLETED"
|
|
},
|
|
"mobilePhone": null,
|
|
"giftCertificate": null,
|
|
"cashReceipt": null,
|
|
"cashReceipts": null,
|
|
"discount": null,
|
|
"cancels": null,
|
|
"secret": "ps_6BYq7GWPVvGNAwZeRBDLrNE5vbo1",
|
|
"type": "NORMAL",
|
|
"easyPay": null,
|
|
"country": "KR",
|
|
"failure": null,
|
|
"isPartialCancelable": true,
|
|
"receipt": {
|
|
"url": "https://dashboard-sandbox.tosspayments.com/receipt/redirection?transactionId=tgen_20250908230510v2rY2&ref=PX"
|
|
},
|
|
"checkout": {
|
|
"url": "https://api.tosspayments.com/v1/payments/tgen_20250908230510v2rY2/checkout"
|
|
},
|
|
"currency": "KRW",
|
|
"totalAmount": $AMOUNT,
|
|
"balanceAmount": $AMOUNT,
|
|
"suppliedAmount": ${(AMOUNT * 0.9).toInt()},
|
|
"vat": ${(AMOUNT * 0.1).toInt()},
|
|
"taxFreeAmount": 0,
|
|
"method": "간편결제",
|
|
"version": "2022-11-16",
|
|
"metadata": null
|
|
}
|
|
""".trimIndent()
|
|
|
|
val transferCancelJson: String = """
|
|
{
|
|
"mId": "tgen_docs",
|
|
"lastTransactionKey": "txrd_a01k4mtanmyx0hm6hmmbvfvmhky",
|
|
"paymentKey": "$PAYMENT_KEY",
|
|
"orderId": "$ORDER_ID",
|
|
"orderName": "Sonya Aguirre 예약 결제",
|
|
"taxExemptionAmount": 0,
|
|
"status": "DONE",
|
|
"requestedAt": "${OffsetDateTime.now()}",
|
|
"approvedAt": "${OffsetDateTime.now().plusSeconds(5)}",
|
|
"useEscrow": false,
|
|
"cultureExpense": false,
|
|
"card": null,
|
|
"virtualAccount": null,
|
|
"transfer": {
|
|
"bankCode": "92",
|
|
"settlementStatus": "COMPLETED"
|
|
},
|
|
"mobilePhone": null,
|
|
"giftCertificate": null,
|
|
"cashReceipt": null,
|
|
"cashReceipts": null,
|
|
"discount": null,
|
|
"cancels": [
|
|
{
|
|
"transactionKey": "txrd_a01k4mtgh26vgrn1evbdckyqmdr",
|
|
"cancelReason": "$CANCEL_REASON",
|
|
"taxExemptionAmount": 0,
|
|
"canceledAt": "${OffsetDateTime.now().plusMinutes(1)}",
|
|
"cardDiscountAmount": 0,
|
|
"transferDiscountAmount": 0,
|
|
"easyPayDiscountAmount": 0,
|
|
"receiptKey": null,
|
|
"cancelStatus": "DONE",
|
|
"cancelRequestId": null,
|
|
"cancelAmount": $AMOUNT,
|
|
"taxFreeAmount": 0,
|
|
"refundableAmount": 0
|
|
}
|
|
],
|
|
"secret": "ps_6BYq7GWPVvGNAwZeRBDLrNE5vbo1",
|
|
"type": "NORMAL",
|
|
"easyPay": null,
|
|
"country": "KR",
|
|
"failure": null,
|
|
"isPartialCancelable": true,
|
|
"receipt": {
|
|
"url": "https://dashboard-sandbox.tosspayments.com/receipt/redirection?transactionId=tgen_20250908230510v2rY2&ref=PX"
|
|
},
|
|
"checkout": {
|
|
"url": "https://api.tosspayments.com/v1/payments/tgen_20250908230510v2rY2/checkout"
|
|
},
|
|
"currency": "KRW",
|
|
"totalAmount": $AMOUNT,
|
|
"balanceAmount": $AMOUNT,
|
|
"suppliedAmount": ${(AMOUNT * 0.9).toInt()},
|
|
"vat": ${(AMOUNT * 0.1).toInt()},
|
|
"taxFreeAmount": 0,
|
|
"method": "간편결제",
|
|
"version": "2022-11-16",
|
|
"metadata": null
|
|
}
|
|
""".trimIndent()
|
|
}
|