안드로이드 인 앱 결제 - 방어코드 추가

This commit is contained in:
Klaus 2024-04-15 21:24:39 +09:00
parent dd3c1f45c8
commit c40220f766
1 changed files with 15 additions and 3 deletions

View File

@ -269,10 +269,21 @@ class ChargeService(
productId,
purchaseToken
)
val response = androidPublisher.purchases().products()
.get("kr.co.vividnext.sodalive", productId, purchaseToken)
.execute() ?: throw SodaException("결제정보에 오류가 있습니다.")
if (response.consumptionState == 1) {
charge.payment!!.status = PaymentStatus.COMPLETE
member.charge(charge.chargeCan, 0, "aos")
return true
} else {
attempt += 1
Thread.sleep(delay)
delay *= 2
}
} catch (e: Exception) {
lastError = e
attempt += 1
@ -280,6 +291,7 @@ class ChargeService(
delay *= 2
}
}
lastError?.printStackTrace()
return false
}