/// <summary>
        /// Find a customer
        /// </summary>
        /// <param name="ID">The customer ID</param>
        /// <returns>Customer</returns>
        public static Customer Find(string ID)
        {
            var response = Gateway.Get <Customer>(String.Format("customers/{0}.json", ID));

            if (response.Successful)
            {
                return(response.Result);
            }
            else
            {
                throw new Exception(String.Format("Error retrieving subscription: {0}", response.Errors));
            }
        }
Exemple #2
0
        /// <summary>
        /// Fetch all subscriptions
        /// </summary>
        /// <returns>List  of all subscriptions</returns>
        public static List <Subscription> All()
        {
            var response = Gateway.Get <List <Subscription> >("subscriptions.json");

            if (response.Successful)
            {
                return(response.Result);
            }
            else
            {
                throw new Exception(String.Format("Error from gateway: {0}", response.Errors));
            }
        }
Exemple #3
0
        /// <summary>
        /// Find a Plan
        /// </summary>
        /// <param name="ID">The Plan ID</param>
        /// <returns>Plan</returns>
        public static Plan Find(string ID)
        {
            var response = Gateway.Get <Plan>(String.Format("plans/{0}.json", ID));

            if (response.Successful)
            {
                return(response.Result);
            }
            else
            {
                throw new Exception(String.Format("Error fetching plan: {0}", response.Errors));
            }
        }
Exemple #4
0
        /// <summary>
        /// Fetches a Direct Debit from the database
        /// If the record cannot be found Null is return.
        /// </summary>
        /// <param name='identifier'>
        /// The DD record ID
        /// </param>
        public static DirectDebit Find(string identifier)
        {
            var response = Gateway.Get <DirectDebit>(String.Format("direct_debits/{0}.json", identifier));
            var dd       = response.Result;

            if (response.Successful)
            {
                return(dd);
            }
            else
            {
                return(null);
            }
        }
Exemple #5
0
        /// <summary>
        /// Fetches a Tokenized Credit Card from the database
        /// If the card cannot be found Null is return.
        /// </summary>
        /// <param name='identifier'>
        /// The card token
        /// </param>
        public static CreditCard Find(string identifier)
        {
            var response = Gateway.Get <CreditCard>(String.Format("credit_cards/{0}.json", identifier));
            var card     = response.Result;

            if (response.Successful && card.CardType != "Unknown")
            {
                return(card);
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// Fetches a purchase from the server.
 /// </summary>
 /// <param name="reference">The purchase reference or Fat Zebra ID.</param>
 public static Response <Purchase> Get(string reference)
 {
     return(Gateway.Get <Purchase> (String.Format("purchases/#{0}.json", reference)));
 }