예제 #1
0
        /// <summary>
        /// Get the details of an invoice.
        /// </summary>
        /// <param name="invoice_id">The invoice_id is the identifier of the invoice.</param>
        /// <param name="parameters">The parameters is the dictionary object which contains the following optional parameters in the key,value pair forms.<br></br>
        /// <table>
        /// <tr><td>print</td><td>Print the exported pdf.</td></tr>
        /// <tr><td>accept</td><td>Get the details of a particular invoice in formats such as json/ pdf/ html. Default format is json.<br></br>Allowed Values: <i>json, pdf</i> and <i>html</i></td></tr>
        /// </table>
        /// </param>
        /// <returns>Invoice object.</returns>
        public Invoice Get(string invoice_id, Dictionary <object, object> parameters)
        {
            string url      = baseAddress + "/" + invoice_id;
            var    responce = ZohoHttpClient.get(url, getQueryParameters(parameters));

            return(InvoiceParser.getInvoice(responce));
        }
예제 #2
0
        /// <summary>
        ///     Update an existing invoice. To delete a line item just remove it from the line_items list.
        /// </summary>
        /// <param name="invoice_id">The invoice_id is the identifier of the invoice.</param>
        /// <param name="update_info">The update_info is the Invoice object which contains the update information.</param>
        /// <param name="parameters">
        ///     The parameters is the dictionary object which contains the following optional parameters in the key,value pair
        ///     forms.<br></br>
        ///     <table>
        ///         <tr>
        ///             <td>ignore_auto_number_generation</td>
        ///             <td>
        ///                 Ignore auto invoice number generation for this invoice. This mandates the invoice number.<br></br>
        ///                 Allowed Values: <i>true</i> and <i>false</i>
        ///             </td>
        ///         </tr>
        ///     </table>
        /// </param>
        /// <returns>Invoice object.</returns>
        public Invoice Update(string invoice_id, Invoice update_info, Dictionary <object, object> parameters)
        {
            var url  = baseAddress + "/" + invoice_id;
            var json = JsonConvert.SerializeObject(update_info);

            parameters.Add("JSONString", json);
            var responce        = ZohoHttpClient.put(url, getQueryParameters(parameters));
            var responceContent = responce.Content.ReadAsStringAsync().Result;

            return(InvoiceParser.getInvoice(responce));
        }
예제 #3
0
        /// <summary>
        /// Create an invoice for customer.
        /// </summary>
        /// <param name="new_invoice_info">The new_invoice_info is the Invoice object .</param>
        /// <param name="parameters">The parameters is the dictionary object which contains the following optional parameters in the key,value pair forms.<br></br>
        /// <table>
        /// <tr><td>send</td><td>Send the invoice to the contact person(s) associated with the invoice.<br></br>Allowed Values: <i>true</i> and <i>false</i></td></tr>
        /// <tr><td>ignore_auto_number_generation</td><td>Ignore auto invoice number generation for this invoice. This mandates the invoice number.<br></br>Allowed Values: <i>true</i> and <i>false</i></td></tr>
        /// </table></param>
        /// <returns>Invoice object.</returns>
        public Invoice Create(Invoice new_invoice_info, Dictionary <object, object> parameters)
        {
            string url  = baseAddress;
            var    json = JsonConvert.SerializeObject(new_invoice_info);

            parameters.Add("JSONString", json);
            var responce        = ZohoHttpClient.post(url, getQueryParameters(parameters));
            var responceContent = responce.Content.ReadAsStringAsync().Result;

            Console.WriteLine("responseContent: {0}", responceContent);
            return(InvoiceParser.getInvoice(responce));
        }