public Account getAccount()
 {
     if (account == null)
         account = new Account(this.Settings, account_uri);
     return account;
 }
 public override void deserialize(Dictionary<string, object> payload)
 {
     base.deserialize(payload);
     created_at = Convert.ToDateTime(payload["created_at"].ToString());
     meta = JsonConvert.DeserializeObject<Dictionary<string, string>>(payload["meta"].ToString());
     amount = Convert.ToInt32(payload["amount"].ToString());
     description = (string)payload["description"];
     transaction_number = (string)payload["transaction_number"];
     if (payload.ContainsKey("account_uri"))
     {
         account = null;
         account_uri = (string)payload["account_uri"];
     }
     else
     {
         var acc = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["account"].ToString());
         account = new Account(this.Settings, acc);
         account_uri = account.uri;
     }
     if (payload.ContainsKey("source_uri"))
     {
         card = null;
         card_uri = (string)payload["source_uri"];
     }
     else
     {
         var c = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["source"].ToString());
         card = new Card(this.Settings, c);
         card_uri = card.uri;
     }
     if (payload.ContainsKey("hold_uri"))
     {
         hold = null;
         hold_uri = (String)payload["hold_uri"];
     }
     else if (payload.ContainsKey("hold"))
     {
         var h = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["hold"].ToString());
         hold = new Hold(this.Settings, h);
         hold_uri = hold.uri;
     }
     else
     {
         hold = null;
         hold_uri = null;
     }
     refunds_uri = (string)payload["refunds_uri"];
     refunds = Collections.Refunds(this.Settings, refunds_uri);
 }
 public override void deserialize(Dictionary<string, object> payload)
 {
     base.deserialize(payload);
     if (payload.ContainsKey("account_uri")) {
         account = null;
         account_uri = (String) payload["account_uri"];
     }
     else if (payload.ContainsKey("account") && payload["account"] != null) {
         var acct = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["account"].ToString());
         account = new Account(this.Settings, acct);
         account_uri = account.uri;
     }
     else {
         account = null;
         account_uri = null;
     }
     var ba = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["bank_account"].ToString());
     bank_account = new BankAccount(this.Settings, ba);
     created_at = Convert.ToDateTime(payload["created_at"].ToString());
     amount = Convert.ToInt32(payload["amount"].ToString());
     description = (string) payload["description"];
     status = (string) payload["status"];
     meta = JsonConvert.DeserializeObject<Dictionary<string, string>>(payload["meta"].ToString());
 }
 public override void deserialize(Dictionary<string, object> payload)
 {
     base.deserialize(payload);
     created_at = Convert.ToDateTime(payload["created_at"].ToString());
     meta = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["meta"].ToString());
     amount = Convert.ToInt32(payload["amount"].ToString());
     expires_at = Convert.ToDateTime(payload["expires_at"].ToString());
     description = (string)payload["description"];
     is_void = Convert.ToBoolean(payload["is_void"].ToString());
     if (payload.ContainsKey("account_uri"))
     {
         account = null;
         account_uri = (String)payload["account_uri"];
     }
     else
     {
         var a = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["account"].ToString());
         account = new Account(this.Settings, a);
         account_uri = account.uri;
     }
     if (payload.ContainsKey("debit") && payload["debit"] != null)
     {
         var d = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["debit"].ToString());
         debit = new Debit(this.Settings, d);
     }
     else
         debit = null;
     if (payload.ContainsKey("source_uri"))
     {
         card = null;
         card_uri = (string)payload["source_uri"];
     }
     else
     {
         var c = JsonConvert.DeserializeObject<Dictionary<string, object>>(payload["source"].ToString());
         card = new Card(this.Settings, c);
         card_uri = card.uri;
     }
 }
 public Account CreateAccount(string name, string email_address, Dictionary<string, string> meta)
 {
     var retVal = new Account(this.Settings);
     try
     {
         Dictionary<string, object> payload = new Dictionary<string, object>();
         payload.Add("name", name);
         payload.Add("email_address", email_address);
         if (meta != null)
         {
             payload.Add("meta", meta);
         }
         var response = this.client.post(accounts_uri, payload);
         retVal = new Account(this.Settings, response);
     }
     catch (Exception ex)
     {
         // could not create account
     }
     return retVal;
 }