Merge pull request '구글 인 앱 결제 검증 과정 try/catch로 예외 처리' (#149) from test into main
Reviewed-on: #149
This commit is contained in:
commit
300f784f7d
|
@ -210,30 +210,35 @@ class ChargeService(
|
||||||
?: throw SodaException("로그인 정보를 확인해주세요.")
|
?: throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
|
|
||||||
if (charge.payment!!.paymentGateway == PaymentGateway.GOOGLE_IAP) {
|
if (charge.payment!!.paymentGateway == PaymentGateway.GOOGLE_IAP) {
|
||||||
androidPublisher.purchases().products()
|
try {
|
||||||
.consume("kr.co.vividnext.sodalive", request.productId, request.purchaseToken)
|
androidPublisher.purchases().products()
|
||||||
.execute()
|
.consume("kr.co.vividnext.sodalive", request.productId, request.purchaseToken)
|
||||||
|
.execute()
|
||||||
|
|
||||||
val response = androidPublisher.purchases().products()
|
val response = androidPublisher.purchases().products()
|
||||||
.get("kr.co.vividnext.sodalive", request.productId, request.purchaseToken)
|
.get("kr.co.vividnext.sodalive", request.productId, request.purchaseToken)
|
||||||
.execute() ?: throw SodaException("결제정보에 오류가 있습니다.")
|
.execute() ?: throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
if (
|
if (
|
||||||
response.purchaseState == 0 &&
|
response.purchaseState == 0 &&
|
||||||
response.consumptionState == 1 &&
|
response.consumptionState == 1 &&
|
||||||
charge.payment?.status == PaymentStatus.REQUEST
|
charge.payment?.status == PaymentStatus.REQUEST
|
||||||
) {
|
) {
|
||||||
charge.payment?.receiptId = response.purchaseToken
|
charge.payment?.receiptId = response.purchaseToken
|
||||||
charge.payment?.method = "구글(인 앱 결제)"
|
charge.payment?.method = "구글(인 앱 결제)"
|
||||||
charge.payment?.status = PaymentStatus.COMPLETE
|
charge.payment?.status = PaymentStatus.COMPLETE
|
||||||
member.charge(charge.chargeCan, charge.rewardCan, "aos")
|
member.charge(charge.chargeCan, charge.rewardCan, "aos")
|
||||||
|
|
||||||
applicationEventPublisher.publishEvent(
|
applicationEventPublisher.publishEvent(
|
||||||
ChargeSpringEvent(
|
ChargeSpringEvent(
|
||||||
chargeId = charge.id!!,
|
chargeId = charge.id!!,
|
||||||
memberId = member.id!!
|
memberId = member.id!!
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
} else {
|
||||||
} else {
|
throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
throw SodaException("결제정보에 오류가 있습니다.")
|
throw SodaException("결제정보에 오류가 있습니다.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue