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