Compare commits

..

No commits in common. "5bd4ff76104a94fb3b9f1a8c37c2bbd276ed8aa1" and "d693c397ea45f26aaf0af0ac4130b417a0ec98bf" have entirely different histories.

2 changed files with 13 additions and 14 deletions

View File

@ -231,22 +231,19 @@ class ChargeService(
val response = androidPublisher.purchases().products()
.get("kr.co.vividnext.sodalive", productId, purchaseToken)
.execute() ?: throw SodaException("결제정보에 오류가 있습니다.")
charge.payment!!.orderId = response.orderId
if (
response.purchaseState == 0 &&
charge.payment!!.status == PaymentStatus.REQUEST
) {
if (consumeWithRetry(productId, purchaseToken, charge, member)) {
applicationEventPublisher.publishEvent(
ChargeSpringEvent(
chargeId = charge.id!!,
memberId = member.id!!
)
consumeWithRetry(productId, purchaseToken, charge, member)
applicationEventPublisher.publishEvent(
ChargeSpringEvent(
chargeId = charge.id!!,
memberId = member.id!!
)
} else {
throw SodaException("구매를 하지 못했습니다.\n고객센터로 문의해 주세요")
}
)
} else {
throw SodaException("결제정보에 오류가 있습니다.")
}
@ -255,7 +252,7 @@ class ChargeService(
}
}
private fun consumeWithRetry(productId: String, purchaseToken: String, charge: Charge, member: Member): Boolean {
private fun consumeWithRetry(productId: String, purchaseToken: String, charge: Charge, member: Member) {
var attempt = 0
var delay = 2000L
val retries = 3
@ -272,7 +269,7 @@ class ChargeService(
charge.payment!!.status = PaymentStatus.COMPLETE
member.charge(charge.chargeCan, 0, "aos")
return true
return
} catch (e: Exception) {
lastError = e
attempt += 1
@ -281,7 +278,10 @@ class ChargeService(
}
}
lastError?.printStackTrace()
return false
if (attempt == retries) {
throw SodaException("구매를 하지 못했습니다.\n고객센터로 문의해 주세요")
}
}
private fun requestRealServerVerify(verifyRequest: AppleVerifyRequest): Boolean {

View File

@ -27,7 +27,6 @@ data class Payment(
var price: Double = 0.toDouble()
var locale: String? = null
var orderId: String? = null
}
enum class PaymentStatus {