Exemplo n.º 1
0
 public Hold getHold()
 {
     if (hold == null)
         hold = new Hold(this.Settings, hold_uri);
     return hold;
 }
Exemplo n.º 2
0
 public Hold Hold(
         int amount,
         string description,
         string source_uri,
         Dictionary<string, string> meta)
 {
     Dictionary<string, object> payload = new Dictionary<string,object>();
     payload.Add("amount", amount);
     if (description != null)
         payload.Add("description", description);
     if (source_uri != null)
         payload.Add("source", source_uri);
     if (meta != null)
         payload.Add("meta", meta);
     var response = this.client.post(holds_uri, payload);
     Hold hold = new Hold(this.Settings, response);
     return hold;
 }
Exemplo n.º 3
0
 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);
 }