commit
d4d51ec48f
|
@ -122,12 +122,15 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||||
order.type,
|
order.type,
|
||||||
order.can,
|
order.can,
|
||||||
order.id.count(),
|
order.id.count(),
|
||||||
order.can.sum()
|
order.can.sum(),
|
||||||
|
creatorSettlementRatio.contentSettlementRatio
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(order)
|
.from(order)
|
||||||
.innerJoin(order.audioContent, audioContent)
|
.innerJoin(order.audioContent, audioContent)
|
||||||
.innerJoin(audioContent.member, member)
|
.innerJoin(audioContent.member, member)
|
||||||
|
.leftJoin(creatorSettlementRatio)
|
||||||
|
.on(member.id.eq(creatorSettlementRatio.member.id))
|
||||||
.where(order.isActive.isTrue)
|
.where(order.isActive.isTrue)
|
||||||
.groupBy(member.id, audioContent.id, order.type, order.can)
|
.groupBy(member.id, audioContent.id, order.type, order.can)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package kr.co.vividnext.sodalive.admin.calculate
|
package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
import com.querydsl.core.annotations.QueryProjection
|
||||||
import kotlin.math.roundToInt
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
|
|
||||||
data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
val nickname: String,
|
val nickname: String,
|
||||||
|
@ -13,15 +14,24 @@ data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
val settlementRatio: Int?
|
val settlementRatio: Int?
|
||||||
) {
|
) {
|
||||||
fun toGetCalculateCommunityPostResponse(): GetCalculateCommunityPostResponse {
|
fun toGetCalculateCommunityPostResponse(): GetCalculateCommunityPostResponse {
|
||||||
val totalKrw = totalCan * 100
|
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
||||||
val paymentFee = totalKrw * 0.066f
|
val totalKrw = BigDecimal(totalCan).multiply(BigDecimal(100))
|
||||||
|
|
||||||
|
// 결제수수료 : 6.6%
|
||||||
|
val paymentFee = totalKrw.multiply(BigDecimal(0.066))
|
||||||
|
|
||||||
|
// 정산금액 = (원화 - 결제수수료) 의 70%
|
||||||
val settlementAmount = if (settlementRatio != null) {
|
val settlementAmount = if (settlementRatio != null) {
|
||||||
(totalKrw.toFloat() - paymentFee) * (settlementRatio.toFloat() / 100.0f)
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(settlementRatio).divide(BigDecimal(100.0)))
|
||||||
} else {
|
} else {
|
||||||
(totalKrw.toFloat() - paymentFee) * 0.7f
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(0.7))
|
||||||
}
|
}
|
||||||
val tax = settlementAmount * 0.033
|
|
||||||
val depositAmount = settlementAmount - tax
|
// 원천세 = 정산금액의 3.3%
|
||||||
|
val tax = settlementAmount.multiply(BigDecimal(0.033))
|
||||||
|
|
||||||
|
// 입금액
|
||||||
|
val depositAmount = settlementAmount.subtract(tax)
|
||||||
|
|
||||||
return GetCalculateCommunityPostResponse(
|
return GetCalculateCommunityPostResponse(
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
|
@ -30,11 +40,11 @@ data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
can = can,
|
can = can,
|
||||||
numberOfPurchase = numberOfPurchase.toInt(),
|
numberOfPurchase = numberOfPurchase.toInt(),
|
||||||
totalCan = totalCan,
|
totalCan = totalCan,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw.toInt(),
|
||||||
paymentFee = paymentFee.roundToInt(),
|
paymentFee = paymentFee.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
settlementAmount = settlementAmount.roundToInt(),
|
settlementAmount = settlementAmount.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
tax = tax.roundToInt(),
|
tax = tax.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
depositAmount = depositAmount.roundToInt()
|
depositAmount = depositAmount.setScale(0, RoundingMode.HALF_UP).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package kr.co.vividnext.sodalive.admin.calculate
|
package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
import com.querydsl.core.annotations.QueryProjection
|
||||||
import kotlin.math.roundToInt
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
|
|
||||||
data class GetCalculateContentDonationQueryData @QueryProjection constructor(
|
data class GetCalculateContentDonationQueryData @QueryProjection constructor(
|
||||||
// 등록 크리에이터 닉네임
|
// 등록 크리에이터 닉네임
|
||||||
|
@ -21,25 +22,25 @@ data class GetCalculateContentDonationQueryData @QueryProjection constructor(
|
||||||
) {
|
) {
|
||||||
fun toGetCalculateContentDonationResponse(): GetCalculateContentDonationResponse {
|
fun toGetCalculateContentDonationResponse(): GetCalculateContentDonationResponse {
|
||||||
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
||||||
val totalKrw = totalCan * 100
|
val totalKrw = BigDecimal(totalCan).multiply(BigDecimal(100))
|
||||||
|
|
||||||
// 결제수수료 : 6.6%
|
// 결제수수료 : 6.6%
|
||||||
val paymentFee = totalKrw * 0.066f
|
val paymentFee = totalKrw.multiply(BigDecimal(0.066))
|
||||||
|
|
||||||
// 정산금액
|
// 정산금액
|
||||||
// 유료콘텐츠 (원화 - 결제수수료) 의 90%
|
// 유료콘텐츠 (원화 - 결제수수료) 의 90%
|
||||||
// 무료콘텐츠 (원화 - 결제수수료) 의 70%
|
// 무료콘텐츠 (원화 - 결제수수료) 의 70%
|
||||||
val settlementAmount = if (price > 0) {
|
val settlementAmount = if (price > 0) {
|
||||||
(totalKrw.toFloat() - paymentFee) * 0.9
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(0.9))
|
||||||
} else {
|
} else {
|
||||||
(totalKrw.toFloat() - paymentFee) * 0.7
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(0.7))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 원천세 = 정산금액의 3.3%
|
// 원천세 = 정산금액의 3.3%
|
||||||
val tax = settlementAmount * 0.033
|
val tax = settlementAmount.multiply(BigDecimal(0.033))
|
||||||
|
|
||||||
// 입금액
|
// 입금액
|
||||||
val depositAmount = settlementAmount - tax
|
val depositAmount = settlementAmount.subtract(tax)
|
||||||
|
|
||||||
val paidOrFree = if (price > 0) {
|
val paidOrFree = if (price > 0) {
|
||||||
"유료"
|
"유료"
|
||||||
|
@ -55,11 +56,11 @@ data class GetCalculateContentDonationQueryData @QueryProjection constructor(
|
||||||
donationDate = donationDate,
|
donationDate = donationDate,
|
||||||
numberOfDonation = numberOfDonation.toInt(),
|
numberOfDonation = numberOfDonation.toInt(),
|
||||||
totalCan = totalCan,
|
totalCan = totalCan,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw.toInt(),
|
||||||
paymentFee = paymentFee.roundToInt(),
|
paymentFee = paymentFee.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
settlementAmount = settlementAmount.roundToInt(),
|
settlementAmount = settlementAmount.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
tax = tax.roundToInt(),
|
tax = tax.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
depositAmount = depositAmount.roundToInt()
|
depositAmount = depositAmount.setScale(0, RoundingMode.HALF_UP).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
import com.querydsl.core.annotations.QueryProjection
|
||||||
import kr.co.vividnext.sodalive.content.order.OrderType
|
import kr.co.vividnext.sodalive.content.order.OrderType
|
||||||
import kotlin.math.roundToInt
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
|
|
||||||
data class GetCalculateContentQueryData @QueryProjection constructor(
|
data class GetCalculateContentQueryData @QueryProjection constructor(
|
||||||
// 등록 크리에이터 닉네임
|
// 등록 크리에이터 닉네임
|
||||||
|
@ -32,23 +33,22 @@ data class GetCalculateContentQueryData @QueryProjection constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
||||||
val totalKrw = totalCan * 100
|
val totalKrw = BigDecimal(totalCan).multiply(BigDecimal(100))
|
||||||
|
|
||||||
// 결제수수료 : 6.6%
|
// 결제수수료 : 6.6%
|
||||||
val paymentFee = totalKrw * 0.066f
|
val paymentFee = totalKrw.multiply(BigDecimal(0.066))
|
||||||
|
|
||||||
// 정산금액 = (원화 - 결제수수료) 의 70%
|
// 정산금액 = (원화 - 결제수수료) 의 70%
|
||||||
val settlementAmount = if (settlementRatio != null) {
|
val settlementAmount = if (settlementRatio != null) {
|
||||||
(totalKrw.toFloat() - paymentFee) * (settlementRatio.toFloat() / 100.0f)
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(settlementRatio).divide(BigDecimal(100.0)))
|
||||||
} else {
|
} else {
|
||||||
(totalKrw.toFloat() - paymentFee) * 0.7f
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(0.7))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 원천세 = 정산금액의 3.3%
|
// 원천세 = 정산금액의 3.3%
|
||||||
val tax = settlementAmount * 0.033
|
val tax = settlementAmount.multiply(BigDecimal(0.033))
|
||||||
|
|
||||||
// 입금액
|
val depositAmount = settlementAmount.subtract(tax)
|
||||||
val depositAmount = settlementAmount - tax
|
|
||||||
|
|
||||||
return GetCalculateContentResponse(
|
return GetCalculateContentResponse(
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
|
@ -59,11 +59,11 @@ data class GetCalculateContentQueryData @QueryProjection constructor(
|
||||||
orderPrice = orderPrice,
|
orderPrice = orderPrice,
|
||||||
numberOfPeople = numberOfPeople.toInt(),
|
numberOfPeople = numberOfPeople.toInt(),
|
||||||
totalCan = totalCan,
|
totalCan = totalCan,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw.toInt(),
|
||||||
paymentFee = paymentFee.roundToInt(),
|
paymentFee = paymentFee.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
settlementAmount = settlementAmount.roundToInt(),
|
settlementAmount = settlementAmount.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
tax = tax.roundToInt(),
|
tax = tax.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
depositAmount = depositAmount.roundToInt()
|
depositAmount = depositAmount.setScale(0, RoundingMode.HALF_UP).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package kr.co.vividnext.sodalive.admin.calculate
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
import com.querydsl.core.annotations.QueryProjection
|
||||||
import kr.co.vividnext.sodalive.can.use.CanUsage
|
import kr.co.vividnext.sodalive.can.use.CanUsage
|
||||||
import kotlin.math.roundToInt
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
|
|
||||||
data class GetCalculateLiveQueryData @QueryProjection constructor(
|
data class GetCalculateLiveQueryData @QueryProjection constructor(
|
||||||
val email: String,
|
val email: String,
|
||||||
|
@ -42,23 +43,23 @@ data class GetCalculateLiveQueryData @QueryProjection constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
||||||
val totalKrw = totalAmount * 100
|
val totalKrw = BigDecimal(totalAmount).multiply(BigDecimal(100))
|
||||||
|
|
||||||
// 결제수수료 : 6.6%
|
// 결제수수료 : 6.6%
|
||||||
val paymentFee = totalKrw * 0.066f
|
val paymentFee = totalKrw.multiply(BigDecimal(0.066))
|
||||||
|
|
||||||
// 정산금액 = (원화 - 결제수수료) 의 70%
|
// 정산금액 = (원화 - 결제수수료) 의 70%
|
||||||
val settlementAmount = if (settlementRatio != null) {
|
val settlementAmount = if (settlementRatio != null) {
|
||||||
(totalKrw.toFloat() - paymentFee) * (settlementRatio.toFloat() / 100.0f)
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(settlementRatio).divide(BigDecimal(100.0)))
|
||||||
} else {
|
} else {
|
||||||
(totalKrw.toFloat() - paymentFee) * 0.7f
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(0.7))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 원천세 = 정산금액의 3.3%
|
// 원천세 = 정산금액의 3.3%
|
||||||
val tax = settlementAmount * 0.033
|
val tax = settlementAmount.multiply(BigDecimal(0.033))
|
||||||
|
|
||||||
// 입금액
|
// 입금액
|
||||||
val depositAmount = settlementAmount - tax
|
val depositAmount = settlementAmount.subtract(tax)
|
||||||
|
|
||||||
return GetCalculateLiveResponse(
|
return GetCalculateLiveResponse(
|
||||||
email = email,
|
email = email,
|
||||||
|
@ -69,11 +70,11 @@ data class GetCalculateLiveQueryData @QueryProjection constructor(
|
||||||
canUsageStr = canUsageStr,
|
canUsageStr = canUsageStr,
|
||||||
numberOfPeople = numberOfPeople,
|
numberOfPeople = numberOfPeople,
|
||||||
totalAmount = totalAmount,
|
totalAmount = totalAmount,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw.toInt(),
|
||||||
paymentFee = paymentFee.roundToInt(),
|
paymentFee = paymentFee.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
settlementAmount = settlementAmount.roundToInt(),
|
settlementAmount = settlementAmount.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
tax = tax.roundToInt(),
|
tax = tax.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
depositAmount = depositAmount.roundToInt()
|
depositAmount = depositAmount.setScale(0, RoundingMode.HALF_UP).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@ package kr.co.vividnext.sodalive.admin.calculate
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
import com.querydsl.core.annotations.QueryProjection
|
||||||
import kr.co.vividnext.sodalive.content.order.OrderType
|
import kr.co.vividnext.sodalive.content.order.OrderType
|
||||||
import kotlin.math.roundToInt
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
|
|
||||||
data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
|
data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
|
||||||
// 등록 크리에이터 닉네임
|
// 등록 크리에이터 닉네임
|
||||||
|
@ -19,7 +20,9 @@ data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
|
||||||
// 인원
|
// 인원
|
||||||
val numberOfPeople: Long,
|
val numberOfPeople: Long,
|
||||||
// 합계
|
// 합계
|
||||||
val totalCan: Int
|
val totalCan: Int,
|
||||||
|
// 정산비율
|
||||||
|
val settlementRatio: Int?
|
||||||
) {
|
) {
|
||||||
fun toCumulativeSalesByContentItem(): CumulativeSalesByContentItem {
|
fun toCumulativeSalesByContentItem(): CumulativeSalesByContentItem {
|
||||||
val orderTypeStr = if (orderType == OrderType.RENTAL) {
|
val orderTypeStr = if (orderType == OrderType.RENTAL) {
|
||||||
|
@ -29,19 +32,23 @@ data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
// 원화 = totalCoin * 100 ( 캔 1개 = 100원 )
|
||||||
val totalKrw = totalCan * 100
|
val totalKrw = BigDecimal(totalCan).multiply(BigDecimal(100))
|
||||||
|
|
||||||
// 결제수수료 : 6.6%
|
// 결제수수료 : 6.6%
|
||||||
val paymentFee = totalKrw * 0.066f
|
val paymentFee = totalKrw.multiply(BigDecimal(0.066))
|
||||||
|
|
||||||
// 정산금액 = (원화 - 결제수수료) 의 70%
|
// 정산금액 = (원화 - 결제수수료) 의 70%
|
||||||
val settlementAmount = (totalKrw.toFloat() - paymentFee) * 0.7
|
val settlementAmount = if (settlementRatio != null) {
|
||||||
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(settlementRatio).divide(BigDecimal(100.0)))
|
||||||
|
} else {
|
||||||
|
totalKrw.subtract(paymentFee).multiply(BigDecimal(0.7))
|
||||||
|
}
|
||||||
|
|
||||||
// 원천세 = 정산금액의 3.3%
|
// 원천세 = 정산금액의 3.3%
|
||||||
val tax = settlementAmount * 0.033
|
val tax = settlementAmount.multiply(BigDecimal(0.033))
|
||||||
|
|
||||||
// 입금액
|
// 입금액
|
||||||
val depositAmount = settlementAmount - tax
|
val depositAmount = settlementAmount.subtract(tax)
|
||||||
|
|
||||||
return CumulativeSalesByContentItem(
|
return CumulativeSalesByContentItem(
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
|
@ -51,11 +58,11 @@ data class GetCumulativeSalesByContentQueryData @QueryProjection constructor(
|
||||||
orderPrice = orderPrice,
|
orderPrice = orderPrice,
|
||||||
numberOfPeople = numberOfPeople.toInt(),
|
numberOfPeople = numberOfPeople.toInt(),
|
||||||
totalCan = totalCan,
|
totalCan = totalCan,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw.toInt(),
|
||||||
paymentFee = paymentFee.roundToInt(),
|
paymentFee = paymentFee.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
settlementAmount = settlementAmount.roundToInt(),
|
settlementAmount = settlementAmount.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
tax = tax.roundToInt(),
|
tax = tax.setScale(0, RoundingMode.HALF_UP).toInt(),
|
||||||
depositAmount = depositAmount.roundToInt()
|
depositAmount = depositAmount.setScale(0, RoundingMode.HALF_UP).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@ class ChargeController(private val service: ChargeService) {
|
||||||
@AuthenticationPrincipal user: User
|
@AuthenticationPrincipal user: User
|
||||||
) = ApiResponse.ok(service.verify(user, verifyRequest))
|
) = ApiResponse.ok(service.verify(user, verifyRequest))
|
||||||
|
|
||||||
|
@PostMapping("/verify/hecto")
|
||||||
|
fun verifyHecto(
|
||||||
|
@RequestBody verifyRequest: VerifyRequest,
|
||||||
|
@AuthenticationPrincipal user: User
|
||||||
|
) = ApiResponse.ok(service.verifyHecto(user, verifyRequest))
|
||||||
|
|
||||||
@PostMapping("/apple")
|
@PostMapping("/apple")
|
||||||
fun appleCharge(
|
fun appleCharge(
|
||||||
@RequestBody chargeRequest: AppleChargeRequest,
|
@RequestBody chargeRequest: AppleChargeRequest,
|
||||||
|
|
|
@ -45,6 +45,10 @@ class ChargeService(
|
||||||
private val bootpayApplicationId: String,
|
private val bootpayApplicationId: String,
|
||||||
@Value("\${bootpay.private-key}")
|
@Value("\${bootpay.private-key}")
|
||||||
private val bootpayPrivateKey: String,
|
private val bootpayPrivateKey: String,
|
||||||
|
@Value("\${bootpay.hecto-application-id}")
|
||||||
|
private val bootpayHectoApplicationId: String,
|
||||||
|
@Value("\${bootpay.hecto-private-key}")
|
||||||
|
private val bootpayHectoPrivateKey: String,
|
||||||
@Value("\${apple.iap-verify-sandbox-url}")
|
@Value("\${apple.iap-verify-sandbox-url}")
|
||||||
private val appleInAppVerifySandBoxUrl: String,
|
private val appleInAppVerifySandBoxUrl: String,
|
||||||
@Value("\${apple.iap-verify-url}")
|
@Value("\${apple.iap-verify-url}")
|
||||||
|
@ -137,6 +141,46 @@ class ChargeService(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
fun verifyHecto(user: User, verifyRequest: VerifyRequest) {
|
||||||
|
val charge = chargeRepository.findByIdOrNull(verifyRequest.orderId.toLong())
|
||||||
|
?: throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
|
val member = memberRepository.findByEmail(user.username)
|
||||||
|
?: throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
|
|
||||||
|
if (charge.payment!!.paymentGateway == PaymentGateway.PG) {
|
||||||
|
val bootpay = Bootpay(bootpayHectoApplicationId, bootpayHectoPrivateKey)
|
||||||
|
|
||||||
|
try {
|
||||||
|
bootpay.accessToken
|
||||||
|
val verifyResult = objectMapper.convertValue(
|
||||||
|
bootpay.getReceipt(verifyRequest.receiptId),
|
||||||
|
VerifyResult::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
if (verifyResult.status == 1 && verifyResult.price == charge.can?.price) {
|
||||||
|
charge.payment?.receiptId = verifyResult.receiptId
|
||||||
|
charge.payment?.method = verifyResult.method
|
||||||
|
charge.payment?.status = PaymentStatus.COMPLETE
|
||||||
|
member.charge(charge.chargeCan, charge.rewardCan, "pg")
|
||||||
|
|
||||||
|
applicationEventPublisher.publishEvent(
|
||||||
|
ChargeSpringEvent(
|
||||||
|
chargeId = charge.id!!,
|
||||||
|
memberId = member.id!!
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun appleCharge(member: Member, request: AppleChargeRequest): ChargeResponse {
|
fun appleCharge(member: Member, request: AppleChargeRequest): ChargeResponse {
|
||||||
val charge = Charge(request.chargeCan, 0)
|
val charge = Charge(request.chargeCan, 0)
|
||||||
|
|
|
@ -28,9 +28,9 @@ class ChargeTempService(
|
||||||
|
|
||||||
private val objectMapper: ObjectMapper,
|
private val objectMapper: ObjectMapper,
|
||||||
|
|
||||||
@Value("\${bootpay.application-id}")
|
@Value("\${bootpay.hecto-application-id}")
|
||||||
private val bootpayApplicationId: String,
|
private val bootpayApplicationId: String,
|
||||||
@Value("\${bootpay.private-key}")
|
@Value("\${bootpay.hecto-private-key}")
|
||||||
private val bootpayPrivateKey: String
|
private val bootpayPrivateKey: String
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
|
@ -176,12 +176,15 @@ class CreatorAdminCalculateQueryRepository(private val queryFactory: JPAQueryFac
|
||||||
order.type,
|
order.type,
|
||||||
order.can,
|
order.can,
|
||||||
order.id.count(),
|
order.id.count(),
|
||||||
order.can.sum()
|
order.can.sum(),
|
||||||
|
creatorSettlementRatio.contentSettlementRatio
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(order)
|
.from(order)
|
||||||
.innerJoin(order.audioContent, audioContent)
|
.innerJoin(order.audioContent, audioContent)
|
||||||
.innerJoin(audioContent.member, member)
|
.innerJoin(audioContent.member, member)
|
||||||
|
.leftJoin(creatorSettlementRatio)
|
||||||
|
.on(member.id.eq(creatorSettlementRatio.member.id))
|
||||||
.where(
|
.where(
|
||||||
audioContent.member.id.eq(memberId)
|
audioContent.member.id.eq(memberId)
|
||||||
.and(order.isActive.isTrue)
|
.and(order.isActive.isTrue)
|
||||||
|
|
|
@ -301,11 +301,9 @@ class ExplorerService(
|
||||||
member: Member,
|
member: Member,
|
||||||
pageable: Pageable
|
pageable: Pageable
|
||||||
): GetFollowerListResponse {
|
): GetFollowerListResponse {
|
||||||
val totalCount = queryRepository
|
val totalCount = queryRepository.getFollowerListTotalCount(creatorId)
|
||||||
.getFollowerListTotalCount(creatorId)
|
|
||||||
|
|
||||||
val followerList = queryRepository.getFollowerList(creatorId, pageable.offset, pageable.pageSize.toLong())
|
val followerList = queryRepository.getFollowerList(creatorId, pageable.offset, pageable.pageSize.toLong())
|
||||||
.asSequence()
|
|
||||||
.map {
|
.map {
|
||||||
val isFollow = if (it.role == MemberRole.CREATOR) {
|
val isFollow = if (it.role == MemberRole.CREATOR) {
|
||||||
queryRepository.isFollow(creatorId = it.userId, memberId = member.id!!)
|
queryRepository.isFollow(creatorId = it.userId, memberId = member.id!!)
|
||||||
|
@ -320,7 +318,6 @@ class ExplorerService(
|
||||||
isFollow = isFollow
|
isFollow = isFollow
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.toList()
|
|
||||||
|
|
||||||
return GetFollowerListResponse(totalCount = totalCount, items = followerList)
|
return GetFollowerListResponse(totalCount = totalCount, items = followerList)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@ logging:
|
||||||
bootpay:
|
bootpay:
|
||||||
applicationId: ${BOOTPAY_APPLICATION_ID}
|
applicationId: ${BOOTPAY_APPLICATION_ID}
|
||||||
privateKey: ${BOOTPAY_PRIVATE_KEY}
|
privateKey: ${BOOTPAY_PRIVATE_KEY}
|
||||||
|
hectoApplicationId: ${BOOTPAY_APPLICATION_HECTO_ID}
|
||||||
|
hectoPrivateKey: ${BOOTPAY_PRIVATE_HECTO_KEY}
|
||||||
|
|
||||||
apple:
|
apple:
|
||||||
iapVerifyUrl: https://buy.itunes.apple.com/verifyReceipt
|
iapVerifyUrl: https://buy.itunes.apple.com/verifyReceipt
|
||||||
|
|
Loading…
Reference in New Issue