Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-25 15:18:24 +05:00
parent e3d707b4f8
commit f229849259
6 changed files with 13 additions and 18 deletions

View file

@ -32,7 +32,7 @@ internal class DefaultCustomerOffersRepositoryTest {
fee = CustomerOffersResponse.Fee(amount = BigDecimal("1.00"), currency = "USD"),
data = CustomerOffersResponse.Data(
specificationName = "SP_000004",
orderType = "CARD_ISSUE_ADDITIONAL",
orderType = "CARD_ISSUE_VIRTUAL_RAIN_KYC",
),
),
),

View file

@ -33,12 +33,10 @@ enum class OrderType(val wireValue: String) {
companion object {
/**
* All order types that represent issuing a card: the first virtual card (and its KYC
* variants) and an additional card. Used both to filter `findOrders` and to detect
* issue-card conflicts.
* All order types that represent issuing a card: the virtual card and its KYC variants.
* Used both to filter `findOrders` and to detect issue-card conflicts.
*/
val issueCardTypes = setOf(
CARD_ISSUE_ADDITIONAL,
CARD_ISSUE_VIRTUAL_RAIN,
CARD_ISSUE_VIRTUAL_RAIN_KYC,
CARD_ISSUE_VIRTUAL_RAIN_KYC_V2,

View file

@ -18,8 +18,8 @@ internal class OrderConflictRulesTest {
}
@Test
fun `IssueCard is blocked by an active additional-issue order`() {
val active = listOf(order(type = OrderType.CARD_ISSUE_ADDITIONAL, status = OrderStatus.NEW))
fun `IssueCard is blocked by an active KYC v2 issue order`() {
val active = listOf(order(type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC_V2, status = OrderStatus.NEW))
val resolution = OrderConflictRules.resolve(OrderIntent.IssueCard, active)

View file

@ -30,7 +30,7 @@ internal class CheckOrderConflictUseCaseTest {
@Test
fun `WHEN active issue order exists AND intent is IssueCard THEN returns Blocked`() = runTest {
val activeIssue = order(type = OrderType.CARD_ISSUE_ADDITIONAL, status = OrderStatus.PROCESSING)
val activeIssue = order(type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC, status = OrderStatus.PROCESSING)
coEvery { repository.findOrders(userWalletId, types = emptySet(), statuses = ACTIVE_STATUSES) } returns
listOf(activeIssue).right()

View file

@ -40,7 +40,7 @@ internal class IssueAdditionalCardUseCaseTest {
private val offer = Offer(
type = Offer.Type.CARD_ISSUE_VIRTUAL_RAIN,
fee = Offer.Fee(amount = BigDecimal("1.00"), currency = Currency.getInstance("USD")),
data = Offer.Data(specificationName = spec, orderType = OrderType.CARD_ISSUE_ADDITIONAL),
data = Offer.Data(specificationName = spec, orderType = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC),
)
@Test
@ -58,7 +58,7 @@ internal class IssueAdditionalCardUseCaseTest {
fun `WHEN active issue order exists THEN reuses it without calling createOrder`() = runTest {
val existing = order(
id = "existing",
type = OrderType.CARD_ISSUE_ADDITIONAL,
type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
status = OrderStatus.PROCESSING,
)
coEvery { offersRepository.getOffers(userWalletId) } returns listOf(offer).right()
@ -66,7 +66,6 @@ internal class IssueAdditionalCardUseCaseTest {
orderRepository.findOrders(
userWalletId,
types = setOf(
OrderType.CARD_ISSUE_ADDITIONAL,
OrderType.CARD_ISSUE_VIRTUAL_RAIN,
OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC_V2,
@ -89,7 +88,6 @@ internal class IssueAdditionalCardUseCaseTest {
orderRepository.findOrders(
userWalletId,
types = setOf(
OrderType.CARD_ISSUE_ADDITIONAL,
OrderType.CARD_ISSUE_VIRTUAL_RAIN,
OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC_V2,
@ -100,7 +98,7 @@ internal class IssueAdditionalCardUseCaseTest {
coEvery {
orderRepository.createOrder(
userWalletId = userWalletId,
type = OrderType.CARD_ISSUE_ADDITIONAL,
type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
specificationName = spec,
idempotencyKey = any(),
)
@ -118,7 +116,6 @@ internal class IssueAdditionalCardUseCaseTest {
orderRepository.findOrders(
userWalletId,
types = setOf(
OrderType.CARD_ISSUE_ADDITIONAL,
OrderType.CARD_ISSUE_VIRTUAL_RAIN,
OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC_V2,
@ -128,13 +125,13 @@ internal class IssueAdditionalCardUseCaseTest {
} returns emptyList<Order>().right()
val newOrder = order(
id = "new",
type = OrderType.CARD_ISSUE_ADDITIONAL,
type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
status = OrderStatus.NEW,
)
coEvery {
orderRepository.createOrder(
userWalletId = userWalletId,
type = OrderType.CARD_ISSUE_ADDITIONAL,
type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC,
specificationName = spec,
idempotencyKey = any(),
)

View file

@ -34,7 +34,7 @@ internal class RestoreActiveIssueOrdersUseCaseTest {
@Test
fun `GIVEN active issue orders WHEN invoke THEN each order is stored and polled`() = runTest {
// Arrange
val first = order(id = "first", type = OrderType.CARD_ISSUE_ADDITIONAL, status = OrderStatus.NEW)
val first = order(id = "first", type = OrderType.CARD_ISSUE_VIRTUAL_RAIN, status = OrderStatus.NEW)
val second = order(id = "second", type = OrderType.CARD_ISSUE_VIRTUAL_RAIN_KYC, status = OrderStatus.PROCESSING)
coEvery {
orderRepository.findOrders(
@ -78,7 +78,7 @@ internal class RestoreActiveIssueOrdersUseCaseTest {
@Test
fun `GIVEN a terminal order leaks through WHEN invoke THEN it is filtered out`() = runTest {
// Arrange
val completed = order(id = "done", type = OrderType.CARD_ISSUE_ADDITIONAL, status = OrderStatus.COMPLETED)
val completed = order(id = "done", type = OrderType.CARD_ISSUE_VIRTUAL_RAIN, status = OrderStatus.COMPLETED)
coEvery {
orderRepository.findOrders(userWalletId, types = ISSUE_ORDER_TYPES, statuses = ACTIVE_STATUSES)
} returns listOf(completed).right()