pkg update

This commit is contained in:
Stephan D
2026-01-30 16:07:28 +01:00
parent 51f5b0804a
commit 809370bda8
13 changed files with 389 additions and 30 deletions

View File

@@ -36,6 +36,37 @@ func ParseAccountStatus(value string) (ledgerv1.AccountStatus, bool) {
}
}
func ParseAccountRole(value string) (ledgerv1.AccountRole, bool) {
switch strings.ToUpper(strings.TrimSpace(value)) {
case "ACCOUNT_ROLE_OPERATING", "OPERATING":
return ledgerv1.AccountRole_ACCOUNT_ROLE_OPERATING, true
case "ACCOUNT_ROLE_HOLD", "HOLD":
return ledgerv1.AccountRole_ACCOUNT_ROLE_HOLD, true
case "ACCOUNT_ROLE_TRANSIT", "TRANSIT":
return ledgerv1.AccountRole_ACCOUNT_ROLE_TRANSIT, true
case "ACCOUNT_ROLE_SETTLEMENT", "SETTLEMENT":
return ledgerv1.AccountRole_ACCOUNT_ROLE_SETTLEMENT, true
case "ACCOUNT_ROLE_CLEARING", "CLEARING":
return ledgerv1.AccountRole_ACCOUNT_ROLE_CLEARING, true
case "ACCOUNT_ROLE_PENDING", "PENDING":
return ledgerv1.AccountRole_ACCOUNT_ROLE_PENDING, true
case "ACCOUNT_ROLE_RESERVE", "RESERVE":
return ledgerv1.AccountRole_ACCOUNT_ROLE_RESERVE, true
case "ACCOUNT_ROLE_LIQUIDITY", "LIQUIDITY":
return ledgerv1.AccountRole_ACCOUNT_ROLE_LIQUIDITY, true
case "ACCOUNT_ROLE_FEE", "FEE":
return ledgerv1.AccountRole_ACCOUNT_ROLE_FEE, true
case "ACCOUNT_ROLE_CHARGEBACK", "CHARGEBACK":
return ledgerv1.AccountRole_ACCOUNT_ROLE_CHARGEBACK, true
case "ACCOUNT_ROLE_ADJUSTMENT", "ADJUSTMENT":
return ledgerv1.AccountRole_ACCOUNT_ROLE_ADJUSTMENT, true
case "ACCOUNT_ROLE_UNSPECIFIED", "UNSPECIFIED", "":
return ledgerv1.AccountRole_ACCOUNT_ROLE_UNSPECIFIED, true
default:
return ledgerv1.AccountRole_ACCOUNT_ROLE_UNSPECIFIED, false
}
}
func IsAccountTypeUnspecified(value string) bool {
switch strings.ToUpper(strings.TrimSpace(value)) {
case "", "ACCOUNT_TYPE_UNSPECIFIED", "UNSPECIFIED":
@@ -53,3 +84,12 @@ func IsAccountStatusUnspecified(value string) bool {
return false
}
}
func IsAccountRoleUnspecified(value string) bool {
switch strings.ToUpper(strings.TrimSpace(value)) {
case "", "ACCOUNT_ROLE_UNSPECIFIED", "UNSPECIFIED":
return true
default:
return false
}
}