Add money mixin cast to and updated money extension and add money view for view in web deployer and try to updated and look around the casting

This commit is contained in:
2021-02-09 09:38:11 +07:00
parent 4ba041f2d9
commit 7497e11ee3
4 changed files with 35 additions and 6 deletions

View File

@@ -94,8 +94,21 @@ fun String?.fromStringToMoney(): StdMoney {
}
}
fun StdMoney.isMatchedCurrency(currency: StdMoney.Currency) =
this.getCurrency().getCurrency().equals(currency.getCurrency(), ignoreCase = true)
// check the money currency
fun StdMoney.isMatchedCurrency(currency: StdMoney.Currency) = this.getCurrency().isEquals(currency)
// transfer to any money mixin
fun StdMoney.tryToCastToMixin(): MoneyMixin {
return object : MoneyMixin {
fun getValue(): Double {
return this@tryToCastToMixin.getValue()
}
fun getCurrency(): String {
return this@tryToCastToMixin.getCurrency().getCurrency()
}
}
}
inline fun buildMoneyConfigProperties(
builderAction: MoneyConfig.MoneyConfigProperties.MoneyConfigPropertiesBuilder.() -> Unit