generated from pricelees/issue-pr-template
[#50] Tosspay API Mocking 서버 구현 #51
@ -4,6 +4,7 @@ import com.sangdol.tosspaymock.business.domain.cancel.Cancellation
|
||||
import com.sangdol.tosspaymock.business.domain.card.Card
|
||||
import com.sangdol.tosspaymock.business.domain.easypay.Easypay
|
||||
import com.sangdol.tosspaymock.business.domain.transfer.BankTransfer
|
||||
import com.sangdol.tosspaymock.web.dto.PaymentResponse
|
||||
import java.time.OffsetDateTime
|
||||
|
||||
class Payment(
|
||||
@ -176,4 +177,45 @@ class Payment(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun toResponse() = PaymentResponse(
|
||||
mid = this.mid,
|
||||
lastTransactionKey = this.lastTransactionKey,
|
||||
paymentKey = this.paymentKey,
|
||||
orderId = this.orderId,
|
||||
orderName = this.orderName,
|
||||
taxExemptionAmount = this.taxExemptionAmount,
|
||||
status = this.status.name,
|
||||
requestedAt = this.requestedAt,
|
||||
approvedAt = this.approvedAt,
|
||||
useEscrow = this.useEscrow,
|
||||
cultureExpense = this.cultureExpense,
|
||||
card = this.card?.toResponse(),
|
||||
virtualAccount = this.virtualAccount,
|
||||
transfer = this.transfer?.toResponse(),
|
||||
mobilePhone = this.mobilePhone,
|
||||
giftCertificate = this.giftCertificate,
|
||||
cashReceipt = this.cashReceipt,
|
||||
cashReceipts = this.cashReceipts,
|
||||
discount = this.discount,
|
||||
cancels = this.cancels?.toResponse(),
|
||||
secret = this.secret,
|
||||
type = this.type,
|
||||
easyPay = this.easyPay?.toResponse(),
|
||||
country = this.country,
|
||||
failure = this.failure,
|
||||
isPartialCancelable = this.isPartialCancelable,
|
||||
receipt = this.receipt,
|
||||
checkout = this.checkout,
|
||||
currency = this.currency,
|
||||
totalAmount = this.totalAmount,
|
||||
balanceAmount = this.balanceAmount,
|
||||
suppliedAmount = this.suppliedAmount,
|
||||
vat = this.vat,
|
||||
taxFreeAmount = this.taxFreeAmount,
|
||||
method = this.method.koreanName,
|
||||
version = this.version,
|
||||
metadata = this.metadata,
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.sangdol.tosspaymock.business.domain.cancel
|
||||
|
||||
import com.sangdol.tosspaymock.business.domain.RandomPaymentValueGenerator
|
||||
import com.sangdol.tosspaymock.web.dto.CancelResponse
|
||||
import java.time.OffsetDateTime
|
||||
|
||||
class Cancellation(
|
||||
@ -35,4 +36,20 @@ class Cancellation(
|
||||
cancelAmount = cancelAmount,
|
||||
)
|
||||
}
|
||||
|
||||
fun toResponse() = CancelResponse(
|
||||
transactionKey = this.transactionKey,
|
||||
cancelReason = this.cancelReason,
|
||||
taxExemptionAmount = this.taxExemptionAmount,
|
||||
canceledAt = this.canceledAt,
|
||||
cardDiscountAmount = this.cardDiscountAmount,
|
||||
transferDiscountAmount = this.transferDiscountAmount,
|
||||
easyPayDiscountAmount = this.easyPayDiscountAmount,
|
||||
receiptKey = this.receiptKey,
|
||||
cancelStatus = this.cancelStatus,
|
||||
cancelRequestId = this.cancelRequestId,
|
||||
cancelAmount = this.cancelAmount,
|
||||
taxFreeAmount = this.taxFreeAmount,
|
||||
refundableAmount = this.refundableAmount
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.sangdol.tosspaymock.business.domain.card
|
||||
|
||||
import com.sangdol.tosspaymock.business.domain.RandomCardValueGenerator
|
||||
import com.sangdol.tosspaymock.web.dto.CardResponse
|
||||
|
||||
class Card(
|
||||
val issuerCode: CardIssuerCode,
|
||||
@ -36,4 +37,20 @@ class Card(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun toResponse() = CardResponse(
|
||||
issuerCode = this.issuerCode.code,
|
||||
acquirerCode = this.acquirerCode.code,
|
||||
number = this.number,
|
||||
installmentPlanMonths = this.installmentPlanMonths,
|
||||
isInterestFree = this.isInterestFree,
|
||||
interestPayer = this.interestPayer,
|
||||
approveNo = this.approveNo,
|
||||
useCardPoint = this.useCardPoint,
|
||||
cardType = this.cardType.koreanName,
|
||||
ownerType = this.ownerType.koreanName,
|
||||
acquireStatus = this.acquireStatus.name,
|
||||
amount = this.amount
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.sangdol.tosspaymock.business.domain.easypay
|
||||
|
||||
import com.sangdol.tosspaymock.business.domain.RandomEasypayValueGenerator
|
||||
import com.sangdol.tosspaymock.web.dto.EasypayResponse
|
||||
|
||||
class Easypay(
|
||||
val provider: EasypayProvider,
|
||||
@ -28,4 +29,10 @@ class Easypay(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun toResponse() = EasypayResponse(
|
||||
provider = this.provider.koreanName,
|
||||
amount = this.amount,
|
||||
discountAmount = this.discountAmount
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.sangdol.tosspaymock.business.domain.transfer
|
||||
|
||||
import com.sangdol.tosspaymock.web.dto.BankTransferResponse
|
||||
|
||||
class BankTransfer(
|
||||
val bankCode: BankCode,
|
||||
val settlementStatus: SettlementStatus,
|
||||
@ -12,4 +14,9 @@ class BankTransfer(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun toResponse() = BankTransferResponse(
|
||||
bankCode = this.bankCode.code,
|
||||
settlementStatus = this.settlementStatus.name
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user