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()
}