/// <summary> /// /// </summary> /// <param name="bookInvoiceRequest"></param> /// <returns></returns> /// <exception cref="EconomicException"></exception> public Invoice BookWithNumber(BookInvoiceRequest bookInvoiceRequest) { if (!bookInvoiceRequest.bookWithNumber.HasValue) { throw new ArgumentNullException("Book with number method, MUST have a book with number"); } string url = _client.GetUrl("/invoices/booked/" + bookInvoiceRequest.bookWithNumber); try { var response = JsonClient.Put <BookInvoiceRequest, Invoice>(url , bookInvoiceRequest , _client.GetHeaders()); return(response); } catch (JsonClientException e) { var errorMessage = JsonConvert.DeserializeObject <ErrorMessage>(e.Message); throw new EconomicException(errorMessage, e); } catch (Exception e) { throw e; } }
/// <summary> /// Books a draft invoice. If the operation is successful, this returns the full booked invoice. /// </summary> /// <param name="bookInvoiceRequest"></param> /// <exception cref="EconomicException"></exception> public Invoice Book(BookInvoiceRequest bookInvoiceRequest) { string url = _client.GetUrl("/invoices/booked/"); try { var response = JsonClient.Post <BookInvoiceRequest, Invoice>(url , bookInvoiceRequest , _client.GetHeaders()); return(response); } catch (JsonClientException e) { var errorMessage = JsonConvert.DeserializeObject <ErrorMessage>(e.Message); throw new EconomicException(errorMessage, e); } catch (Exception e) { throw e; } }
/// <summary> /// Books a draft invoice. If the operation is successful, this returns the full booked invoice. /// </summary> /// <param name="invoice"></param> /// <returns></returns> public Invoice Book(Invoice invoice) { return(Book(BookInvoiceRequest.FromInvoice(invoice))); }
/// <summary> /// /// </summary> /// <param name="draftInvoice"></param> /// <param name="invoiceNumeric"></param> /// <param name="sendBy"></param> public Invoice BookWithNumber(Invoice draftInvoice, int invoiceNumeric, string sendBy) { return(BookWithNumber(BookInvoiceRequest.FromInvoice(draftInvoice, sendBy, invoiceNumeric))); }