Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-17 11:39:17 +04:00
parent 9bd372d0af
commit 5ec38a0d61
23 changed files with 424 additions and 162 deletions

View file

@ -9,6 +9,7 @@ import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Query
@Suppress("TooManyFunctions")
interface TangemPayApi {
// region: auth
@ -32,6 +33,11 @@ interface TangemPayApi {
@POST("v1/auth/token")
suspend fun getTokenByCustomerWallet(@Body request: GetTokenByCustomerWalletRequest): ApiResponse<JWTResponse>
@POST("v1/auth/token/refresh")
suspend fun refreshCustomerWalletAccessToken(
@Body request: RefreshCustomerWalletAccessTokenRequest,
): ApiResponse<JWTResponse>
@POST("v1/auth/token")
suspend fun getAccessTokenByCardWallet(@Body request: GetAccessTokenByCardWalletRequest): ApiResponse<JWTResponse>
@ -106,4 +112,7 @@ interface TangemPayApi {
@GET("v1/customer/me")
suspend fun getCustomerMe(@Header("Authorization") authHeader: String): ApiResponse<CustomerMeResponse>
@POST("v1/deeplink/validate")
suspend fun validateDeeplink(@Body body: DeeplinkValidityRequest): ApiResponse<DeeplinkValidityResponse>
}

View file

@ -0,0 +1,9 @@
package com.tangem.datasource.api.pay.models.request
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class DeeplinkValidityRequest(
@Json(name = "link") val link: String,
)

View file

@ -0,0 +1,10 @@
package com.tangem.datasource.api.pay.models.request
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class RefreshCustomerWalletAccessTokenRequest(
@Json(name = "auth_type") val authType: String = "customer_wallet",
@Json(name = "refresh_token") val refreshToken: String,
)

View file

@ -13,9 +13,9 @@ data class CustomerMeResponse(
@Json(name = "id") val id: String,
@Json(name = "state") val state: String,
@Json(name = "createdAt") val createdAt: String,
@Json(name = "product_instance") val productInstance: ProductInstance,
@Json(name = "payment_account") val paymentAccount: PaymentAccount,
@Json(name = "kyc") val kyc: Kyc,
@Json(name = "product_instance") val productInstance: ProductInstance?,
@Json(name = "payment_account") val paymentAccount: PaymentAccount?,
@Json(name = "kyc") val kyc: Kyc?,
)
@JsonClass(generateAdapter = true)

View file

@ -0,0 +1,15 @@
package com.tangem.datasource.api.pay.models.response
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class DeeplinkValidityResponse(
@Json(name = "result") val result: Result?,
@Json(name = "error") val error: String?,
) {
@JsonClass(generateAdapter = true)
data class Result(
@Json(name = "status") val status: String,
)
}

View file

@ -1,10 +1,16 @@
package com.tangem.datasource.local.visa
import com.tangem.domain.visa.model.VisaAuthTokens
interface TangemPayStorage {
suspend fun store(authHeader: String)
suspend fun storeAuthTokens(customerWalletAddress: String, tokens: VisaAuthTokens)
suspend fun get(): String?
suspend fun getAuthTokens(customerWalletAddress: String): VisaAuthTokens?
suspend fun clear()
suspend fun storeCustomerWalletAddress(customerWalletAddress: String)
suspend fun getCustomerWalletAddress(): String?
suspend fun clear(customerWalletAddress: String)
}