package response import ( "encoding/xml" "log" ) type Header struct { Status string `xml:"header>status"` } type AccountDetails struct { XMLName xml.Name `xml:"res"` Header Username string `xml:"body>username"` Currency string `xml:"body>currency"` AccountId int64 `xml:"body>accountId"` AccountType string `xml:"body>accountType"` ProductType string `xml:"body>productType"` RegistrationLegalEntity string `xml:"body>registrationLegalEntity"` DisplayLocale string `xml:"body>displayLocale"` FundingDisallowed bool `xml:"body>fundingDisallowed"` AvailableAccounts []AccountItem `xml:"body>availableAccounts>account"` AvailableSchemes string `xml:"body>availableSchemes"` UserPreferences } type AccountItem struct { AccountId string `xml:"accountId"` AccountName string `xml:"accountName"` } type UserPreferences struct { Version string `xml:"body>userPreferences>version"` Categories []PreferencesCategory `xml:"body>userPreferences>category"` } type PreferencesCategory struct { Name string `xml:"name"` Items []PreferencesItem `xml:"item"` } type PreferencesItem struct { Id string `xml:"id"` Value string `xml:"value"` } func NewAccountDetails(data string) *AccountDetails { r := AccountDetails{} err := xml.Unmarshal([]byte(data), &r) if err != nil { log.Println(err) return nil } return &r }