support sub account

This commit is contained in:
MaysWind
2020-11-15 01:16:17 +08:00
parent afd6996c69
commit af809a098e
10 changed files with 243 additions and 46 deletions
+6
View File
@@ -4,6 +4,8 @@ import (
"github.com/go-playground/validator/v10"
)
const PARENT_ACCOUNT_CURRENCY_PLACEHODLER = "---"
// ISO 4217
var ALL_CURRENCY_NAMES = map[string]bool {
"AED": true, //UAE Dirham
@@ -167,6 +169,10 @@ var ALL_CURRENCY_NAMES = map[string]bool {
func ValidCurrency(fl validator.FieldLevel) bool {
if value, ok := fl.Field().Interface().(string); ok {
if value == PARENT_ACCOUNT_CURRENCY_PLACEHODLER {
return true
}
_, ok := ALL_CURRENCY_NAMES[value]
return ok
}