Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-06 18:45:24 +05:00
parent 9bc5ee1684
commit 4cd1bb77a1
21 changed files with 279 additions and 20 deletions

View file

@ -88,6 +88,13 @@ interface TangemPayApi {
@Body body: OrderRequest,
): ApiResponse<OrderResponse>
// TODO: Doston: [REDACTED_TASK_KEY] Unify with method above
@POST("v1/order")
suspend fun createVirtualAccountOrder(
@Header("Authorization") authHeader: String,
@Body body: VirtualAccountOrderRequest,
): ApiResponse<OrderResponse>
/** Customer offers — used to gate the issue-additional-card flow. */
@GET("v1/customer/offers")
suspend fun getCustomerOffers(@Header("Authorization") authHeader: String): ApiResponse<CustomerOffersResponse>

View file

@ -0,0 +1,23 @@
package com.tangem.datasource.api.pay.models.request
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/**
* Request body for creating a Virtual Account on-ramp order (VA MVP0, TWI-1638).
*
* `wallet_address` is the customer's managing (collateral-managing) wallet address; `payment_account_address`
* is the existing collateral address. Distinct from the card-issue [OrderRequest] contract.
*/
@JsonClass(generateAdapter = true)
data class VirtualAccountOrderRequest(
@Json(name = "data") val data: Data,
@Json(name = "idempotency_key") val idempotencyKey: String,
) {
@JsonClass(generateAdapter = true)
data class Data(
@Json(name = "deposit_address") val depositAddress: String,
@Json(name = "type") val type: String = "ACCOUNT_ISSUE_VIRTUAL_RAIN",
@Json(name = "specification_name") val specificationName: String = "SP_000006",
)
}

View file

@ -9,11 +9,16 @@ import com.squareup.moshi.JsonClass
*/
@JsonClass(generateAdapter = true)
data class BankCredentialsResponse(
@Json(name = "type") val type: String?,
@Json(name = "beneficiary_name") val beneficiaryName: String?,
@Json(name = "beneficiary_address") val beneficiaryAddress: String?,
@Json(name = "beneficiary_bank_name") val beneficiaryBankName: String?,
@Json(name = "beneficiary_bank_address") val beneficiaryBankAddress: String?,
@Json(name = "account_number") val accountNumber: String?,
@Json(name = "routing_number") val routingNumber: String?,
)
@Json(name = "result") val result: Result?,
) {
@JsonClass(generateAdapter = true)
data class Result(
@Json(name = "type") val type: String?,
@Json(name = "beneficiary_name") val beneficiaryName: String?,
@Json(name = "beneficiary_address") val beneficiaryAddress: String?,
@Json(name = "beneficiary_bank_name") val beneficiaryBankName: String?,
@Json(name = "beneficiary_bank_address") val beneficiaryBankAddress: String?,
@Json(name = "account_number") val accountNumber: String?,
@Json(name = "routing_number") val routingNumber: String?,
)
}

View file

@ -60,7 +60,7 @@ data class CustomerMeResponse(
data class ProductInstance(
@Json(name = "id") val id: String,
@Json(name = "cid") val cid: String?,
@Json(name = "card_id") val cardId: String,
@Json(name = "card_id") val cardId: String?,
@Json(name = "card_wallet_address") val cardWalletAddress: String?,
@Json(name = "status") val status: Status,
@Json(name = "updated_at") val updatedAt: String,

View file

@ -201,6 +201,9 @@ object PreferencesKeys {
fun getTangemPayOrderIdKey(customerWalletAddress: String) =
stringPreferencesKey("tangem_pay_order_id_key_$customerWalletAddress")
fun getTangemPayVirtualAccountOrderIdKey(customerWalletAddress: String) =
stringPreferencesKey("tangem_pay_va_order_id_key_$customerWalletAddress")
fun getTangemPayCustomerWalletAddressKey(userWalletId: UserWalletId) =
stringPreferencesKey("tangem_pay_customer_wallet_address_key_${userWalletId.stringValue}")

View file

@ -23,6 +23,12 @@ interface TangemPayStorage {
suspend fun clearOrderId(customerWalletAddress: String)
suspend fun storeVirtualAccountOrderId(customerWalletAddress: String, vaOrderId: String)
suspend fun getVirtualAccountOrderId(customerWalletAddress: String): String?
suspend fun clearVirtualAccountOrderId(customerWalletAddress: String)
suspend fun getAddToWalletDone(customerWalletAddress: String): Boolean
suspend fun storeAddToWalletDone(customerWalletAddress: String, isDone: Boolean)