kotlin
class GnPaymentTokenService {
private val gn = Gerencianet(mapOf(
"client_id" to "Client_Id_...",
"client_secret" to "Client_Secret_...",
"sandbox" to true
))
fun fetchPaymentToken(): Observable> {
return try {
Observable.create {
it.onNext(
gn.call("paymentToken", mapOf(), mapOf(
"brand" to "mastercard",
"number" to "hidden",
"cvv" to "hidden",
"expiration_month" to "hidden",
"expiration_year" to "hidden"
))
)
}
} catch (err: Exception) {
Observable.error(err)
}
}
}