2020-08-26 20:02:36 +07:00
|
|
|
package com.cubetiqs.libra.moneyutils
|
|
|
|
|
2020-08-26 21:19:31 +07:00
|
|
|
open class Money(
|
|
|
|
private var value: Double,
|
|
|
|
private var currency: String = "USD"
|
|
|
|
) : StdMoney {
|
|
|
|
override fun getValue(): Double {
|
|
|
|
return this.value
|
|
|
|
}
|
2020-08-26 20:02:36 +07:00
|
|
|
|
2020-08-26 21:19:31 +07:00
|
|
|
fun setValue(value: Double) {
|
|
|
|
this.value = value
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun getCurrency(): String {
|
|
|
|
return this.currency.toUpperCase()
|
|
|
|
}
|
|
|
|
|
|
|
|
fun setCurrency(currency: String) {
|
|
|
|
this.currency = currency
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun toString(): String {
|
|
|
|
return "Money(value=${getValue()}, currency='${getCurrency()}')"
|
|
|
|
}
|
|
|
|
}
|