AlbaApi

<back to all web services

ClientCountryConfigValidateReq

The following routes are available for this service:
POST/clientcountryconfig/validate
import Foundation
import ServiceStack

public class ClientCountryConfigValidateReq : Codable
{
    public var config:ClientCountryConfig?

    required public init(){}
}

public class ClientCountryConfig : DatedEntity
{
    public var clientCode:String?
    public var clientName:String?
    public var countryCode:String?
    public var source:DataSourceResult?
    public var ageRMin:Int?
    public var ageRMax:Int?
    public var primarySalary:String?
    public var annuityConfig:AnnuityConfig?
    public var assets:[AssetConfig] = []
    public var contTables:[ContributionTableSpec] = []
    public var investments:[InvestmentProduct] = []
    public var content:[String:[Content]] = [:]
    public var environments:[String:String] = [:]
    public var customNumericConstraints:[String:Constraint<Double>] = [:]
    public var assetReturnRates:[String:ReturnRates] = [:]
    public var investmentPropertyRates:Double?
    public var getAssetClassFundDictionary:[String:Bool] = [:]
    public var getTermBasedFundDictionary:[String:Bool] = [:]
    public var getAllocationsDictionary:[String:[Int:[String:Double]]] = [:]
    public var assetNameMap:[String:String] = [:]
    public var assetContNameMap:[String:[String:String]] = [:]
    public var cacheKey:String?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case clientCode
        case clientName
        case countryCode
        case source
        case ageRMin
        case ageRMax
        case primarySalary
        case annuityConfig
        case assets
        case contTables
        case investments
        case content
        case environments
        case customNumericConstraints
        case assetReturnRates
        case investmentPropertyRates
        case getAssetClassFundDictionary
        case getTermBasedFundDictionary
        case getAllocationsDictionary
        case assetNameMap
        case assetContNameMap
        case cacheKey
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        clientCode = try container.decodeIfPresent(String.self, forKey: .clientCode)
        clientName = try container.decodeIfPresent(String.self, forKey: .clientName)
        countryCode = try container.decodeIfPresent(String.self, forKey: .countryCode)
        source = try container.decodeIfPresent(DataSourceResult.self, forKey: .source)
        ageRMin = try container.decodeIfPresent(Int.self, forKey: .ageRMin)
        ageRMax = try container.decodeIfPresent(Int.self, forKey: .ageRMax)
        primarySalary = try container.decodeIfPresent(String.self, forKey: .primarySalary)
        annuityConfig = try container.decodeIfPresent(AnnuityConfig.self, forKey: .annuityConfig)
        assets = try container.decodeIfPresent([AssetConfig].self, forKey: .assets) ?? []
        contTables = try container.decodeIfPresent([ContributionTableSpec].self, forKey: .contTables) ?? []
        investments = try container.decodeIfPresent([InvestmentProduct].self, forKey: .investments) ?? []
        content = try container.decodeIfPresent([String:[Content]].self, forKey: .content) ?? [:]
        environments = try container.decodeIfPresent([String:String].self, forKey: .environments) ?? [:]
        customNumericConstraints = try container.decodeIfPresent([String:Constraint<Double>].self, forKey: .customNumericConstraints) ?? [:]
        assetReturnRates = try container.decodeIfPresent([String:ReturnRates].self, forKey: .assetReturnRates) ?? [:]
        investmentPropertyRates = try container.decodeIfPresent(Double.self, forKey: .investmentPropertyRates)
        getAssetClassFundDictionary = try container.decodeIfPresent([String:Bool].self, forKey: .getAssetClassFundDictionary) ?? [:]
        getTermBasedFundDictionary = try container.decodeIfPresent([String:Bool].self, forKey: .getTermBasedFundDictionary) ?? [:]
        getAllocationsDictionary = try container.decodeIfPresent([String:[Int:[String:Double]]].self, forKey: .getAllocationsDictionary) ?? [:]
        assetNameMap = try container.decodeIfPresent([String:String].self, forKey: .assetNameMap) ?? [:]
        assetContNameMap = try container.decodeIfPresent([String:[String:String]].self, forKey: .assetContNameMap) ?? [:]
        cacheKey = try container.decodeIfPresent(String.self, forKey: .cacheKey)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if clientCode != nil { try container.encode(clientCode, forKey: .clientCode) }
        if clientName != nil { try container.encode(clientName, forKey: .clientName) }
        if countryCode != nil { try container.encode(countryCode, forKey: .countryCode) }
        if source != nil { try container.encode(source, forKey: .source) }
        if ageRMin != nil { try container.encode(ageRMin, forKey: .ageRMin) }
        if ageRMax != nil { try container.encode(ageRMax, forKey: .ageRMax) }
        if primarySalary != nil { try container.encode(primarySalary, forKey: .primarySalary) }
        if annuityConfig != nil { try container.encode(annuityConfig, forKey: .annuityConfig) }
        if assets.count > 0 { try container.encode(assets, forKey: .assets) }
        if contTables.count > 0 { try container.encode(contTables, forKey: .contTables) }
        if investments.count > 0 { try container.encode(investments, forKey: .investments) }
        if content.count > 0 { try container.encode(content, forKey: .content) }
        if environments.count > 0 { try container.encode(environments, forKey: .environments) }
        if customNumericConstraints.count > 0 { try container.encode(customNumericConstraints, forKey: .customNumericConstraints) }
        if assetReturnRates.count > 0 { try container.encode(assetReturnRates, forKey: .assetReturnRates) }
        if investmentPropertyRates != nil { try container.encode(investmentPropertyRates, forKey: .investmentPropertyRates) }
        if getAssetClassFundDictionary.count > 0 { try container.encode(getAssetClassFundDictionary, forKey: .getAssetClassFundDictionary) }
        if getTermBasedFundDictionary.count > 0 { try container.encode(getTermBasedFundDictionary, forKey: .getTermBasedFundDictionary) }
        if getAllocationsDictionary.count > 0 { try container.encode(getAllocationsDictionary, forKey: .getAllocationsDictionary) }
        if assetNameMap.count > 0 { try container.encode(assetNameMap, forKey: .assetNameMap) }
        if assetContNameMap.count > 0 { try container.encode(assetContNameMap, forKey: .assetContNameMap) }
        if cacheKey != nil { try container.encode(cacheKey, forKey: .cacheKey) }
    }
}

public class DatedEntity : Entity, IDatedEntity
{
    public var asAt:Date?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case asAt
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        asAt = try container.decodeIfPresent(Date.self, forKey: .asAt)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if asAt != nil { try container.encode(asAt, forKey: .asAt) }
    }
}

public class Entity : IEntity, Codable
{
    public var id:String?

    required public init(){}
}

public class DataSourceResult : Codable
{
    public var d:DataSource?
    public var t:Int?

    required public init(){}
}

public enum DataSource : String, Codable
{
    case Db
    case Cache
    case Parameter
    case NA
}

public class AnnuityConfig : Codable
{
    public var tableNames:[LifeTableName] = []
    public var imprFactorTableNames:[LifeTableName] = []
    public var reversion:Double?
    public var guarantee:Double?
    public var timing:Double?
    public var allowDiscountPreRet:Bool?
    public var scaleQx:Double?
    public var scaleImpr:Double?
    public var ageRating:Int?
    public var spouseAgeRating:Int?
    public var expense:Double?
    public var percBalanceSpent:Double?
    public var amountSpent:Double?
    public var incomePurchased:Double?
    public var deferralPeriod:Int?
    public var indexationName:String?
    public var drStochastic:String?
    public var impliedInflationStochasticSeries:String?
    public var targetTpx:Double?
    public var priceType:AnnuityPriceType?
    public var price:Double?

    required public init(){}
}

public class LifeTableName : Codable
{
    public var name:String?
    public var gender:Gender?

    required public init(){}
}

public enum Gender : String, Codable
{
    case Female
    case Male
    case Other
}

public enum AnnuityPriceType : String, Codable
{
    case Calc
    case Table
}

public class AssetConfig : Codable
{
    public var code:String?
    public var name:String?
    public var rebalance:Bool?
    public var canEditInvestmentChoice:Bool?
    public var willSpend:Bool?
    public var investments:[String] = []
    public var contributions:[ContributionSpec] = []
    public var isOneOff:Bool?

    required public init(){}
}

public class ContributionSpec : Codable
{
    public var code:String?
    public var name:String?
    public var type:ContributionType?
    public var isEmployeeCont:Bool?
    public var table:String?
    public var ccy:String?
    public var fromAge:Int?
    public var toAge:Int?
    public var indexationType:String?
    public var salaryType:String?
    public var isTaxable:Bool?
    public var relatedRate:String?
    public var order:Int?
    public var editable:Bool?
    public var constraints:[ContributionConstraint] = []
    public var amountType:AmountType?
    public var isOneOff:Bool?

    required public init(){}
}

public enum ContributionType : String, Codable
{
    case Fixed
    case Time
    case Lookup
    case Match
}

public class ContributionConstraint : Codable
{
    public var fromAge:Int?
    public var toAge:Int?
    public var min:Double?
    public var max:Double?
    public var step:Double?

    required public init(){}
}

public enum AmountType : String, Codable
{
    case Any
    case Amount
    case Rate
}

public class ContributionTableSpec : Codable
{
    public var code:String?
    public var type:ContributionType?
    public var rates:[String:Double] = [:]
    public var rateSpecs:[ContributionRateSpec] = []
    public var keyTemplate:String?

    required public init(){}
}

public class ContributionRateSpec : Codable
{
    public var fromAge:Int?
    public var toAge:Int?
    public var fromService:Int?
    public var toService:Int?
    public var sourceRate:Double?
    public var dateFrom:Date?
    public var dateTo:Date?
    public var upperLimit:Double?
    public var rate:Double?
    public var coreRate:Double?
    public var lookupKey:String?

    required public init(){}
}

public class InvestmentProduct : Codable
{
    public var code:String?
    public var name:String?
    public var group:String?
    public var isAssetClassFund:Bool?
    public var allocs:[InvestmentProductAllocationsSpec] = []
    public var order:Int?
    public var allocationsDictionary:[Int:[String:Double]] = [:]

    required public init(){}
}

public class InvestmentProductAllocationsSpec : Codable
{
    public var fromAge:Int?
    public var term:Int?
    public var allocs:[String:Double] = [:]
    public var totalAlloc:Double?

    required public init(){}
}

public class ReturnRates : Codable
{
    public var earningRates:[Double] = []
    public var taxRates:[Double] = []

    required public init(){}
}


Swift ClientCountryConfigValidateReq DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /clientcountryconfig/validate HTTP/1.1 
Host: hcbtas-q-albamfs-api.azurewebsites.net 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"config":{"clientCode":"String","clientName":"String","countryCode":"String","source":{"d":"Db","t":0},"ageRMin":0,"ageRMax":0,"primarySalary":"String","annuityConfig":{"tableNames":[{"name":"String","gender":"Female"}],"imprFactorTableNames":[{"name":"String","gender":"Female"}],"reversion":0,"guarantee":0,"timing":0,"allowDiscountPreRet":false,"scaleQx":0,"scaleImpr":0,"ageRating":0,"spouseAgeRating":0,"expense":0,"percBalanceSpent":0,"amountSpent":0,"incomePurchased":0,"deferralPeriod":0,"indexationName":"String","drStochastic":"String","impliedInflationStochasticSeries":"String","targetTpx":0,"priceType":"Calc","price":0},"assets":[{"code":"String","name":"String","rebalance":false,"canEditInvestmentChoice":false,"willSpend":false,"investments":["String"],"contributions":[{"code":"String","name":"String","type":"Fixed","isEmployeeCont":false,"table":"String","ccy":"String","fromAge":0,"toAge":0,"indexationType":"String","salaryType":"String","isTaxable":false,"relatedRate":"String","order":0,"editable":false,"constraints":[{"fromAge":0,"toAge":0,"min":0,"max":0,"step":0}],"amountType":"Any","isOneOff":false}],"isOneOff":false}],"contTables":[{"code":"String","type":"Fixed","rates":{"String":0},"rateSpecs":[{"fromAge":0,"toAge":0,"fromService":0,"toService":0,"sourceRate":0,"dateFrom":"0001-01-01T00:00:00.0000000","dateTo":"0001-01-01T00:00:00.0000000","upperLimit":0,"rate":0,"coreRate":0,"lookupKey":"String"}],"keyTemplate":"age-service-rate"}],"investments":[{"code":"String","name":"String","group":"String","isAssetClassFund":false,"allocs":[{"fromAge":0,"term":0,"allocs":{"String":0},"totalAlloc":0}],"order":0,"allocationsDictionary":{"0":{}}}],"content":{"String":[{"section":"String","itemId":"String","itemCode":"String","country":"String","lang":"String","app":"String","companyId":"String","company":"String","elements":{"String":"String"},"id":"String"}]},"environments":{"String":"String"},"customNumericConstraints":{"String":{"min":0,"max":0,"step":0}},"assetReturnRates":{"String":{"earningRates":[0],"taxRates":[0]}},"investmentPropertyRates":0,"getAssetClassFundDictionary":{"String":false},"getTermBasedFundDictionary":{"String":true},"getAllocationsDictionary":{"String":{"0":{}}},"assetNameMap":{"String":"String"},"assetContNameMap":{"String":{"String":"String"}},"cacheKey":"ClientCountryConfig-String-String","asAt":"0001-01-01T00:00:00.0000000","id":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"clientCode":"String","clientName":"String","countryCode":"String","source":{"d":"Db","t":0},"ageRMin":0,"ageRMax":0,"primarySalary":"String","annuityConfig":{"tableNames":[{"name":"String","gender":"Female"}],"imprFactorTableNames":[{"name":"String","gender":"Female"}],"reversion":0,"guarantee":0,"timing":0,"allowDiscountPreRet":false,"scaleQx":0,"scaleImpr":0,"ageRating":0,"spouseAgeRating":0,"expense":0,"percBalanceSpent":0,"amountSpent":0,"incomePurchased":0,"deferralPeriod":0,"indexationName":"String","drStochastic":"String","impliedInflationStochasticSeries":"String","targetTpx":0,"priceType":"Calc","price":0},"assets":[{"code":"String","name":"String","rebalance":false,"canEditInvestmentChoice":false,"willSpend":false,"investments":["String"],"contributions":[{"code":"String","name":"String","type":"Fixed","isEmployeeCont":false,"table":"String","ccy":"String","fromAge":0,"toAge":0,"indexationType":"String","salaryType":"String","isTaxable":false,"relatedRate":"String","order":0,"editable":false,"constraints":[{"fromAge":0,"toAge":0,"min":0,"max":0,"step":0}],"amountType":"Any","isOneOff":false}],"isOneOff":false}],"contTables":[{"code":"String","type":"Fixed","rates":{"String":0},"rateSpecs":[{"fromAge":0,"toAge":0,"fromService":0,"toService":0,"sourceRate":0,"dateFrom":"0001-01-01T00:00:00.0000000","dateTo":"0001-01-01T00:00:00.0000000","upperLimit":0,"rate":0,"coreRate":0,"lookupKey":"String"}],"keyTemplate":"age-service-rate"}],"investments":[{"code":"String","name":"String","group":"String","isAssetClassFund":false,"allocs":[{"fromAge":0,"term":0,"allocs":{"String":0},"totalAlloc":0}],"order":0,"allocationsDictionary":{"0":{}}}],"content":{"String":[{"section":"String","itemId":"String","itemCode":"String","country":"String","lang":"String","app":"String","companyId":"String","company":"String","elements":{"String":"String"},"id":"String"}]},"environments":{"String":"String"},"customNumericConstraints":{"String":{"min":0,"max":0,"step":0}},"assetReturnRates":{"String":{"earningRates":[0],"taxRates":[0]}},"investmentPropertyRates":0,"getAssetClassFundDictionary":{"String":false},"getTermBasedFundDictionary":{"String":true},"getAllocationsDictionary":{"String":{"0":{}}},"assetNameMap":{"String":"String"},"assetContNameMap":{"String":{"String":"String"}},"cacheKey":"ClientCountryConfig-String-String","asAt":"0001-01-01T00:00:00.0000000","id":"String"}