Skip to content

Instantly share code, notes, and snippets.

@diegolirio
Last active January 11, 2025 13:52
Show Gist options
  • Select an option

  • Save diegolirio/1119ef73690db21677f2d6e4a6d33cc0 to your computer and use it in GitHub Desktop.

Select an option

Save diegolirio/1119ef73690db21677f2d6e4a6d33cc0 to your computer and use it in GitHub Desktop.
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "type",
visible = true
)
@JsonSubTypes(
JsonSubTypes.Type(BuyOperationRequest::class, name = "BUY"),
JsonSubTypes.Type(SellOperationRequest::class, name = "SELL"),
JsonSubTypes.Type(BlockOperationRequest::class, name = "BLOCK")
)
interface MovementOperationRequest: MovementOperation
//
data class BuyOperationRequest(
override var code: String?,
override val type: MovementTypeEnum,
override val value: BigDecimal,
override val pu: BigDecimal,
override val customerId: String,
override val typeLiquidity: LiquidityEnum,
override val product: ProductInfo,
override val ticket: TicketInfo
) : MovementOperationRequest, BuyMovementOperation
//
data class SellOperationRequest(
override var code: String?,
override val type: MovementTypeEnum,
override val customerId: String,
override val value: BigDecimal,
override val rescueType: RescueTypeEnum,
override val custody: CustodyInfo,
override val autoUnblock: String?
): MovementOperationRequest, SellMovementOperation
//
enum class MovementTypeEnum {
BUY,
SELL,
SELL_DUE_DATE,
BLOCK,
UNBLOCK,
TRANSFER_IN,
TRANSFER_OUT,
CANCEL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment