From 663b50654d45f5fadce6e7567e8e73df88292962 Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 21 Mar 2024 23:30:27 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B5=AC=EA=B8=80=20=EC=9D=B8=20=EC=95=B1=20?= =?UTF-8?q?=EA=B2=B0=EC=A0=9C=20=EA=B2=80=EC=A6=9D=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20-=20AndroidPublisher=20Spring=20Bean?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=93=B1=EB=A1=9D=EB=90=9C=20=EA=B2=83?= =?UTF-8?q?=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/can/charge/ChargeService.kt | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt index 8e7c901..080c6fe 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/can/charge/ChargeService.kt @@ -1,12 +1,7 @@ package kr.co.vividnext.sodalive.can.charge import com.fasterxml.jackson.databind.ObjectMapper -import com.google.api.client.http.javanet.NetHttpTransport -import com.google.api.client.json.gson.GsonFactory import com.google.api.services.androidpublisher.AndroidPublisher -import com.google.api.services.androidpublisher.AndroidPublisherScopes -import com.google.auth.http.HttpCredentialsAdapter -import com.google.auth.oauth2.GoogleCredentials import kr.co.bootpay.Bootpay import kr.co.vividnext.sodalive.can.CanRepository import kr.co.vividnext.sodalive.can.charge.event.ChargeSpringEvent @@ -29,7 +24,6 @@ import org.springframework.http.HttpHeaders import org.springframework.security.core.userdetails.User import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional -import java.io.FileInputStream @Service @Transactional(readOnly = true) @@ -43,6 +37,8 @@ class ChargeService( private val okHttpClient: OkHttpClient, private val applicationEventPublisher: ApplicationEventPublisher, + private val androidPublisher: AndroidPublisher, + @Value("\${bootpay.application-id}") private val bootpayApplicationId: String, @Value("\${bootpay.private-key}") @@ -50,9 +46,7 @@ class ChargeService( @Value("\${apple.iap-verify-sandbox-url}") private val appleInAppVerifySandBoxUrl: String, @Value("\${apple.iap-verify-url}") - private val appleInAppVerifyUrl: String, - @Value("\${firebase.secret-key-path}") - private val secretKeyPath: String + private val appleInAppVerifyUrl: String ) { @Transactional @@ -215,7 +209,7 @@ class ChargeService( ?: throw SodaException("로그인 정보를 확인해주세요.") if (charge.payment!!.paymentGateway == PaymentGateway.GOOGLE_IAP) { - val response = getAndroidPublisher().purchases().products() + val response = androidPublisher.purchases().products() .get("kr.co.vividnext.sodalive", request.productId, request.purchaseToken) .execute() ?: throw SodaException("결제정보에 오류가 있습니다.") @@ -304,16 +298,4 @@ class ChargeService( throw SodaException("결제를 완료하지 못했습니다.") } } - - private fun getAndroidPublisher(): AndroidPublisher { - val jsonFactory = GsonFactory.getDefaultInstance() - val httpTransport = NetHttpTransport() - - val credential = GoogleCredentials.fromStream(FileInputStream(secretKeyPath)) - .createScoped(listOf(AndroidPublisherScopes.ANDROIDPUBLISHER)) - - return AndroidPublisher.Builder(httpTransport, jsonFactory, HttpCredentialsAdapter(credential)) - .setApplicationName("소다라이브") - .build() - } }