구글 인 앱 결제 검증 코드 추가

This commit is contained in:
2024-03-21 16:10:19 +09:00
parent 69331edabb
commit 1c8f5ef7ac
5 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package kr.co.vividnext.sodalive.configs
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 org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import java.io.FileInputStream
@Configuration
class AndroidPublisherConfig(
@Value("\${firebase.secret-key-path}")
private val secretKeyPath: String
) {
@Bean
fun androidPublisher(): 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()
}
}