Updated on 2026-08-14
This commit is contained in:
parent
640ba5af98
commit
6f257991e5
39 changed files with 1526 additions and 110 deletions
|
|
@ -46,12 +46,28 @@ interface TangemPayApi {
|
|||
@Path("order_id") orderId: String,
|
||||
): ApiResponse<OrderResponse>
|
||||
|
||||
/**
|
||||
* Find user orders, filtered by types and/or statuses. Source of truth for resolving active orders.
|
||||
*
|
||||
* Multiple values for the same query key are sent as repeated `order_types=A&order_types=B` params.
|
||||
*/
|
||||
@GET("v1/order")
|
||||
suspend fun findOrders(
|
||||
@Header("Authorization") authHeader: String,
|
||||
@Query("order_types") orderTypes: List<String>?,
|
||||
@Query("order_statuses") orderStatuses: List<String>?,
|
||||
): ApiResponse<FindOrdersResponse>
|
||||
|
||||
@POST("v1/order")
|
||||
suspend fun createOrder(
|
||||
@Header("Authorization") authHeader: String,
|
||||
@Body body: OrderRequest,
|
||||
): 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>
|
||||
|
||||
@GET("v1/customer/balance")
|
||||
suspend fun getCardBalance(@Header("Authorization") authHeader: String): ApiResponse<CardBalanceResponse>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,10 @@ import com.squareup.moshi.Json
|
|||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class OrderRequest(@Json(name = "data") val data: Data) {
|
||||
data class OrderRequest(
|
||||
@Json(name = "data") val data: Data,
|
||||
@Json(name = "idempotency_key") val idempotencyKey: String,
|
||||
) {
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Data(
|
||||
@Json(name = "customer_wallet_address") val customerWalletAddress: String,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ data class CustomerMeResponse(
|
|||
@Json(name = "deposit_address") val depositAddress: String?,
|
||||
@Json(name = "card") val card: Card?,
|
||||
@Json(name = "balance") val balance: BalanceResponse?,
|
||||
@Json(name = "product_instances") val productInstances: List<ProductInstance>,
|
||||
@Json(name = "cards") val cards: List<Card>,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
|
@ -99,6 +101,9 @@ data class CustomerMeResponse(
|
|||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Card(
|
||||
// Present in the multi-card `cards[]` array to join a card to its product instance;
|
||||
// absent in the legacy single-card `card` object, where the card joins the single product instance.
|
||||
@Json(name = "card_id") val cardId: String?,
|
||||
@Json(name = "token") val token: String,
|
||||
@Json(name = "expiration_month") val expirationMonth: String,
|
||||
@Json(name = "expiration_year") val expirationYear: String,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.tangem.datasource.api.pay.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import java.math.BigDecimal
|
||||
|
||||
/**
|
||||
* Response from `GET /v1/customer/offers` — list of offers available to the customer.
|
||||
*
|
||||
* Used to gate the issue-additional-card flow.
|
||||
*/
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class CustomerOffersResponse(
|
||||
@Json(name = "result") val result: List<Offer>,
|
||||
) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Offer(
|
||||
@Json(name = "type") val type: String,
|
||||
@Json(name = "fee") val fee: Fee,
|
||||
@Json(name = "data") val data: Data,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Data(
|
||||
@Json(name = "specification_name") val specificationName: String,
|
||||
@Json(name = "order_type") val orderType: String,
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Fee(
|
||||
@Json(name = "amount") val amount: BigDecimal,
|
||||
@Json(name = "currency") val currency: String,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.tangem.datasource.api.pay.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
* Response from `GET /v1/order` (findOrders) — array of orders matching the requested
|
||||
* `order_types` / `order_statuses` filters.
|
||||
*
|
||||
* Each order shares the same shape as the single-order [OrderResponse.Result].
|
||||
*/
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class FindOrdersResponse(
|
||||
@Json(name = "result") val result: List<OrderResponse.Result>,
|
||||
)
|
||||
|
|
@ -85,6 +85,8 @@ sealed interface PaymentAccountStatusValueDM {
|
|||
@JsonClass(generateAdapter = true)
|
||||
data class TangemPayCard(
|
||||
@Json(name = "id") val id: String,
|
||||
@Json(name = "product_instance_id") val productInstanceId: String,
|
||||
@Json(name = "card_status") val cardStatus: String,
|
||||
@Json(name = "has_pin_code") val hasPinCode: Boolean,
|
||||
@Json(name = "display_name") val displayName: String?,
|
||||
@Json(name = "actual_daily_limit") val actualDailyLimit: SerializedBigDecimal?,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue