Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-28 18:13:46 +04:00
parent 9163a956aa
commit b70933a1e0
47 changed files with 848 additions and 74 deletions

View file

@ -166,4 +166,16 @@ interface TangemPayApi {
@Header("Authorization") authHeader: String,
@Body body: FreezeUnfreezeCardRequest,
): ApiResponse<FreezeUnfreezeCardResponse>
@POST("v1/customer/card/withdraw/data")
suspend fun getWithdrawData(
@Header("Authorization") authHeader: String,
@Body body: WithdrawDataRequest,
): ApiResponse<WithdrawDataResponse>
@POST("v1/customer/card/withdraw")
suspend fun withdraw(
@Header("Authorization") authHeader: String,
@Body body: WithdrawRequest,
): ApiResponse<WithdrawResponse>
}

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 WithdrawDataRequest(
@Json(name = "amount_in_cents") val amountInCents: String,
@Json(name = "recipient_address") val recipientAddress: String,
)

View file

@ -0,0 +1,13 @@
package com.tangem.datasource.api.pay.models.request
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class WithdrawRequest(
@Json(name = "amount_in_cents") val amountInCents: String,
@Json(name = "recipient_address") val recipientAddress: String,
@Json(name = "admin_signature") val adminSignature: String,
@Json(name = "admin_salt") val adminSalt: String,
@Json(name = "sender_address") val senderAddress: String,
)

View file

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

View file

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

View file

@ -145,6 +145,8 @@ object PreferencesKeys {
intPreferencesKey(name = "tronNetworkFeeNotificationShowCount")
}
val TANGEM_PAY_WITHDRAW_ORDERS_KEY by lazy { stringPreferencesKey(name = "tangemPayWithdrawOrders") }
fun getShouldShowNotificationKey(key: String) = booleanPreferencesKey("showShowNotificationUM_$key")
// endregion

View file

@ -24,5 +24,11 @@ interface TangemPayStorage {
suspend fun storeCheckCustomerWalletResult(userWalletId: UserWalletId)
suspend fun checkCustomerWalletResult(userWalletId: UserWalletId): Boolean?
suspend fun storeWithdrawOrder(userWalletId: UserWalletId, orderId: String)
suspend fun getWithdrawOrderId(userWalletId: UserWalletId): String?
suspend fun deleteWithdrawOrder(userWalletId: UserWalletId)
suspend fun clearAll(userWalletId: UserWalletId, customerWalletAddress: String)
}