Skip to content

Commit

Permalink
Add account number
Browse files Browse the repository at this point in the history
  • Loading branch information
Nef10 committed Sep 17, 2021
1 parent d63b77a commit 2fb4a6c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Wealthsimple/Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ public struct Account {
public let currency: String
/// Wealthsimple id for the account
public let id: String
/// Number of the account
public let number: String

private init(json: [String: Any]) throws {
guard let id = json["id"] as? String,
let typeString = json["type"] as? String,
let object = json["object"] as? String,
let currency = json["base_currency"] as? String else {
let currency = json["base_currency"] as? String,
let number = json["custodian_account_number"] as? String else {
throw AccountError.missingResultParamenter(json: json)
}
guard let type = AccountType(rawValue: typeString), object == "account" else {
Expand All @@ -79,6 +82,7 @@ public struct Account {
self.id = id
self.accountType = type
self.currency = currency
self.number = number
}

static func getAccounts(token: Token, completion: @escaping (Result<[Account], AccountError>) -> Void) {
Expand Down

0 comments on commit 2fb4a6c

Please sign in to comment.