parent
75140a4055
commit
60012a7aad
|
@ -40,12 +40,15 @@ class AuthService(
|
||||||
val authId = repository.getAuthIdByMemberId(memberId = memberId)
|
val authId = repository.getAuthIdByMemberId(memberId = memberId)
|
||||||
if (authId != null) throw SodaException("이미 인증된 계정입니다.")
|
if (authId != null) throw SodaException("이미 인증된 계정입니다.")
|
||||||
|
|
||||||
try {
|
val certificateResult: AuthCertificateResult = try {
|
||||||
val token = bootpay.accessToken
|
val token = bootpay.accessToken
|
||||||
if (token["error_code"] != null) throw SodaException("인증정보에 오류가 있습니다.\n다시 시도해 주세요.")
|
if (token["error_code"] != null) throw SodaException("인증정보에 오류가 있습니다.\n다시 시도해 주세요.")
|
||||||
|
|
||||||
val res = bootpay.certificate(request.receiptId)
|
val res = bootpay.certificate(request.receiptId)
|
||||||
val certificateResult = objectMapper.convertValue(res, AuthCertificateResult::class.java)
|
objectMapper.convertValue(res, AuthCertificateResult::class.java)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw SodaException(e.message ?: "인증정보에 오류가 있습니다.\n다시 시도해 주세요.")
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
certificateResult.status == 12 &&
|
certificateResult.status == 12 &&
|
||||||
|
@ -53,17 +56,19 @@ class AuthService(
|
||||||
certificateResult.receiptId == request.receiptId
|
certificateResult.receiptId == request.receiptId
|
||||||
) {
|
) {
|
||||||
val certificate = certificateResult.authenticateData
|
val certificate = certificateResult.authenticateData
|
||||||
val nowYear = LocalDate.now().year
|
|
||||||
val certificateYear = certificate.birth.substring(0, 4).toInt()
|
|
||||||
|
|
||||||
if (isBlockAuth(certificate)) {
|
if (isBlockAuth(certificate)) {
|
||||||
try {
|
try {
|
||||||
signOut(memberId = memberId)
|
signOut(memberId = memberId)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
throw SodaException(blockMessage)
|
throw SodaException(blockMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val nowYear = LocalDate.now().year
|
||||||
|
val certificateYear = certificate.birth.substring(0, 4).toInt()
|
||||||
|
|
||||||
if (nowYear - certificateYear >= 19) {
|
if (nowYear - certificateYear >= 19) {
|
||||||
val memberIds = repository.getActiveMemberIdsByDi(di = certificate.di)
|
val memberIds = repository.getActiveMemberIdsByDi(di = certificate.di)
|
||||||
if (memberIds.size >= 3) {
|
if (memberIds.size >= 3) {
|
||||||
|
@ -89,9 +94,6 @@ class AuthService(
|
||||||
} else {
|
} else {
|
||||||
throw SodaException("인증정보에 오류가 있습니다.\n다시 시도해 주세요.")
|
throw SodaException("인증정보에 오류가 있습니다.\n다시 시도해 주세요.")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
|
||||||
throw SodaException(e.message ?: "인증정보에 오류가 있습니다.\n다시 시도해 주세요.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isBlockAuth(certificate: AuthVerifyCertificate): Boolean {
|
private fun isBlockAuth(certificate: AuthVerifyCertificate): Boolean {
|
||||||
|
|
Loading…
Reference in New Issue