Merge pull request '결제 테이블에 구글결제의 경우 orderId 추가' (#161) from test into main
Reviewed-on: #161
This commit is contained in:
commit
5bd4ff7610
|
@ -231,19 +231,22 @@ 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
|
||||
) {
|
||||
consumeWithRetry(productId, purchaseToken, charge, member)
|
||||
|
||||
applicationEventPublisher.publishEvent(
|
||||
ChargeSpringEvent(
|
||||
chargeId = charge.id!!,
|
||||
memberId = member.id!!
|
||||
if (consumeWithRetry(productId, purchaseToken, charge, member)) {
|
||||
applicationEventPublisher.publishEvent(
|
||||
ChargeSpringEvent(
|
||||
chargeId = charge.id!!,
|
||||
memberId = member.id!!
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
throw SodaException("구매를 하지 못했습니다.\n고객센터로 문의해 주세요")
|
||||
}
|
||||
} else {
|
||||
throw SodaException("결제정보에 오류가 있습니다.")
|
||||
}
|
||||
|
@ -252,7 +255,7 @@ class ChargeService(
|
|||
}
|
||||
}
|
||||
|
||||
private fun consumeWithRetry(productId: String, purchaseToken: String, charge: Charge, member: Member) {
|
||||
private fun consumeWithRetry(productId: String, purchaseToken: String, charge: Charge, member: Member): Boolean {
|
||||
var attempt = 0
|
||||
var delay = 2000L
|
||||
val retries = 3
|
||||
|
@ -269,7 +272,7 @@ class ChargeService(
|
|||
charge.payment!!.status = PaymentStatus.COMPLETE
|
||||
member.charge(charge.chargeCan, 0, "aos")
|
||||
|
||||
return
|
||||
return true
|
||||
} catch (e: Exception) {
|
||||
lastError = e
|
||||
attempt += 1
|
||||
|
@ -278,10 +281,7 @@ class ChargeService(
|
|||
}
|
||||
}
|
||||
lastError?.printStackTrace()
|
||||
|
||||
if (attempt == retries) {
|
||||
throw SodaException("구매를 하지 못했습니다.\n고객센터로 문의해 주세요")
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun requestRealServerVerify(verifyRequest: AppleVerifyRequest): Boolean {
|
||||
|
|
|
@ -27,6 +27,7 @@ data class Payment(
|
|||
|
||||
var price: Double = 0.toDouble()
|
||||
var locale: String? = null
|
||||
var orderId: String? = null
|
||||
}
|
||||
|
||||
enum class PaymentStatus {
|
||||
|
|
Loading…
Reference in New Issue