구글 인 앱 결제 검증 코드 추가
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user