parent
e87f19a8df
commit
9d7bd8e9ab
|
@ -33,6 +33,12 @@ class ChargeController(private val service: ChargeService) {
|
|||
@AuthenticationPrincipal user: User
|
||||
) = 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")
|
||||
fun appleCharge(
|
||||
@RequestBody chargeRequest: AppleChargeRequest,
|
||||
|
|
|
@ -45,6 +45,10 @@ class ChargeService(
|
|||
private val bootpayApplicationId: String,
|
||||
@Value("\${bootpay.private-key}")
|
||||
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}")
|
||||
private val appleInAppVerifySandBoxUrl: String,
|
||||
@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
|
||||
fun appleCharge(member: Member, request: AppleChargeRequest): ChargeResponse {
|
||||
val charge = Charge(request.chargeCan, 0)
|
||||
|
|
|
@ -28,9 +28,9 @@ class ChargeTempService(
|
|||
|
||||
private val objectMapper: ObjectMapper,
|
||||
|
||||
@Value("\${bootpay.application-id}")
|
||||
@Value("\${bootpay.hecto-application-id}")
|
||||
private val bootpayApplicationId: String,
|
||||
@Value("\${bootpay.private-key}")
|
||||
@Value("\${bootpay.hecto-private-key}")
|
||||
private val bootpayPrivateKey: String
|
||||
) {
|
||||
|
||||
|
|
|
@ -301,11 +301,9 @@ class ExplorerService(
|
|||
member: Member,
|
||||
pageable: Pageable
|
||||
): GetFollowerListResponse {
|
||||
val totalCount = queryRepository
|
||||
.getFollowerListTotalCount(creatorId)
|
||||
val totalCount = queryRepository.getFollowerListTotalCount(creatorId)
|
||||
|
||||
val followerList = queryRepository.getFollowerList(creatorId, pageable.offset, pageable.pageSize.toLong())
|
||||
.asSequence()
|
||||
.map {
|
||||
val isFollow = if (it.role == MemberRole.CREATOR) {
|
||||
queryRepository.isFollow(creatorId = it.userId, memberId = member.id!!)
|
||||
|
@ -320,7 +318,6 @@ class ExplorerService(
|
|||
isFollow = isFollow
|
||||
)
|
||||
}
|
||||
.toList()
|
||||
|
||||
return GetFollowerListResponse(totalCount = totalCount, items = followerList)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ logging:
|
|||
bootpay:
|
||||
applicationId: ${BOOTPAY_APPLICATION_ID}
|
||||
privateKey: ${BOOTPAY_PRIVATE_KEY}
|
||||
hectoApplicationId: ${BOOTPAY_APPLICATION_HECTO_ID}
|
||||
hectoPrivateKey: ${BOOTPAY_PRIVATE_HECTO_KEY}
|
||||
|
||||
apple:
|
||||
iapVerifyUrl: https://buy.itunes.apple.com/verifyReceipt
|
||||
|
|
Loading…
Reference in New Issue