All Downloads are FREE. Search and download functionalities are using the official Maven repository.

model.request.CreateCurrency.kt Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version
package model.request

import MergedCurrency
import model.response.ledger.Fiat
import java.math.BigDecimal

internal val VC_REGEX = "^VC_[a-zA-Z0-9_]+\$".toRegex()

class CreateCurrency(
val name: String,
supply: BigDecimal,
val description: String? = null,
val accountCode: String? = null,
val basePair: MergedCurrency,
val baseRate: BigDecimal? = null,
val accountingCurrency: Fiat? = null,

val customer: CustomerUpdate? = null,
) {
    init {
        require(name.length in 1..30 && name.matches(VC_REGEX))
        require(supply.toString().length <= 38)
        if (description != null) require(description.length in 1..100)
        if (accountCode != null) require(accountCode.length in 1..50)
        if (baseRate != null) require(baseRate >= BigDecimal.ZERO)
    }
    val supply: String = supply.toString()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy