안드로이드 인 앱 결제 - 방어코드 추가
This commit is contained in:
parent
dd3c1f45c8
commit
c40220f766
|
@ -269,10 +269,21 @@ class ChargeService(
|
||||||
productId,
|
productId,
|
||||||
purchaseToken
|
purchaseToken
|
||||||
)
|
)
|
||||||
charge.payment!!.status = PaymentStatus.COMPLETE
|
|
||||||
member.charge(charge.chargeCan, 0, "aos")
|
|
||||||
|
|
||||||
return true
|
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) {
|
} catch (e: Exception) {
|
||||||
lastError = e
|
lastError = e
|
||||||
attempt += 1
|
attempt += 1
|
||||||
|
@ -280,6 +291,7 @@ class ChargeService(
|
||||||
delay *= 2
|
delay *= 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastError?.printStackTrace()
|
lastError?.printStackTrace()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue