예제 #1
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, 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;
     }
 }
예제 #2
0
        public Debit Debit(
                int amount,
                string description,
                string source_uri,
                string appears_on_statement_as,
                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_uri", source_uri);
            if (appears_on_statement_as != null)
                payload.Add("appears_on_statement_as", appears_on_statement_as);
            if (meta != null)
                payload.Add("meta", meta);
            var response = this.client.post(debits_uri, payload);
            Debit debit = new Debit(this.Settings, response);

            return debit;
        }
예제 #3
0
 public Debit capture()
 {
     Dictionary<string, object> payload = new Dictionary<string, object>();
     payload.Add("hold_uri", uri);
     debit = new Debit(this.Settings, payload);
     return debit;
 }