Add adavanced config and properties build for money

This commit is contained in:
2021-02-08 13:09:54 +07:00
parent 31760ee901
commit faf80ba967
5 changed files with 49 additions and 58 deletions

View File

@@ -4,4 +4,19 @@ fun StdMoney.exchangeTo(currency: StdMoney.Currency): StdMoney {
return MoneyExchangeUtils.exchange(this, currency)
}
fun StdMoney.isMatchedCurrency(currency: StdMoney.Currency) = this.getMoneyCurrency().getCurrency().equals(currency.getCurrency(), ignoreCase = true)
fun StdMoney.isMatchedCurrency(currency: StdMoney.Currency) =
this.getMoneyCurrency().getCurrency().equals(currency.getCurrency(), ignoreCase = true)
inline fun buildMoneyConfigProperties(
builderAction: MoneyConfig.MoneyConfigProperties.MoneyConfigPropertiesBuilder.() -> Unit
): MoneyConfig.MoneyConfigProperties {
return MoneyConfig
.builder().apply(builderAction)
.build()
}
inline fun applyMoneyConfig(
builderAction: MoneyConfig.() -> Unit,
) {
MoneyConfig.apply(builderAction)
}