[#50] Tosspay API Mocking 서버 구현 #51

Merged
pricelees merged 21 commits from feat/#50 into main 2025-10-02 01:13:07 +00:00
3 changed files with 42 additions and 0 deletions
Showing only changes of commit 466b73e5b2 - Show all commits

View File

@ -0,0 +1,24 @@
package com.sangdol.tosspaymock.infrastructure.persistence
import com.sangdol.common.persistence.PersistableBaseEntity
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Table
@Entity
@Table(name = "order_amount")
class OrderAmountEntity(
id: Long,
@Column(unique = true)
val paymentKey: String,
val approvedAmount: Int,
val easypayDiscountAmount: Int,
val cardDiscountAmount: Int,
val transferDiscountAmount: Int
) : PersistableBaseEntity(id) {
fun totalAmount(): Int {
return (approvedAmount + easypayDiscountAmount + cardDiscountAmount + transferDiscountAmount)
}
}

View File

@ -0,0 +1,8 @@
package com.sangdol.tosspaymock.infrastructure.persistence
import org.springframework.data.jpa.repository.JpaRepository
interface OrderAmountRepository : JpaRepository<OrderAmountEntity, Long> {
fun findByPaymentKey(paymentKey: String): OrderAmountEntity?
}

View File

@ -0,0 +1,10 @@
create table if not exists order_amount (
id bigint primary key,
payment_key varchar(255) not null,
approved_amount integer not null,
easypay_discount_amount integer not null,
card_discount_amount integer not null,
transfer_discount_amount integer not null,
constraint uk_order_amount__payment_key unique (payment_key)
);