private InvoiceOptions CreateInvoiceOptions(InvoiceKind kind, long clientId, DateTime issuedAt, DateTime?dueAt = null, Currency?currency = null, string subject = null, string notes = null, string number = null, long[] projectIds = null, List <InvoiceItem> lineItems = null) { var invoice = new InvoiceOptions() { Kind = kind, ClientId = clientId, IssuedAt = issuedAt, DueAt = dueAt, Currency = currency, Subject = subject, Notes = notes, Number = number, }; if (projectIds != null) { invoice.ProjectsToInvoice = string.Join(",", projectIds.Select(id => id.ToString())); } invoice.SetInvoiceItems(lineItems); return(invoice); }
public void CreateInvoice_WithItemsContainsItems() { var client = Api.ListClients().First(); var options = new InvoiceOptions() { ClientId = client.Id, Subject = "Test Items Invoice", Kind = InvoiceKind.FreeForm }; options.SetInvoiceItems(new List <InvoiceItem>() { new InvoiceItem() { Kind = "Product", Description = "Description 1", Quantity = 1, Amount = 10 }, new InvoiceItem() { Kind = "Product", Description = "Description 2", Quantity = 2, Amount = 10 } }); _toDelete = Api.CreateInvoice(options); Assert.Equal(2, _toDelete.ListLineItems().Count()); }
/// <summary> /// Update an existing invoice on the authenticated account. Makes both a PUT and a GET request to the Invoices resource. /// </summary> /// <param name="invoiceId">The ID of the invoice to update</param> /// <param name="options">The fields to be updated</param> public Invoice UpdateInvoice(long invoiceId, InvoiceOptions options) { var request = Request("invoices/" + invoiceId, RestSharp.Method.PUT); request.AddBody(options); return(Execute <Invoice>(request)); }
/// <summary> /// Create a new invoice on the authenticated account. Makes both a POST and a GET request to the Invoices resource. /// </summary> /// <param name="options">The options for the new invoice to create</param> public Invoice CreateInvoice(InvoiceOptions options) { var request = Request("invoices", RestSharp.Method.POST); request.AddBody(options); return(Execute <Invoice>(request)); }
private IRestRequest UpdateInvoiceRequest(long invoiceId, InvoiceOptions options) { var request = Request("invoices/" + invoiceId, RestSharp.Method.PUT); request.AddBody(options); return(request); }
private IRestRequest CreateInvoiceRequest(InvoiceOptions options) { var request = Request("invoices", RestSharp.Method.POST); request.AddBody(options); return(request); }
/// <summary> /// Update an existing invoice on the authenticated account. Makes both a PUT and a GET request to the Invoices resource. /// </summary> /// <param name="invoiceId">The ID of the invoice to update</param> /// <param name="options">The fields to be updated</param> public Task <Invoice> UpdateInvoiceAsync(long invoiceId, InvoiceOptions options) { var request = UpdateRequest(INVOICES_RESOURCE, invoiceId, options); return(ExecuteAsync <Invoice>(request)); }
/// <summary> /// Update an existing invoice on the authenticated account. Makes both a PUT and a GET request to the Invoices resource. /// </summary> /// <param name="invoiceId">The ID of the invoice to update</param> /// <param name="options">The fields to be updated</param> public Invoice UpdateInvoice(long invoiceId, InvoiceOptions options) { var request = UpdateRequest(INVOICES_RESOURCE, invoiceId, options); return(Execute <Invoice>(request)); }
/// <summary> /// Create a new invoice on the authenticated account. Makes both a POST and a GET request to the Invoices resource. /// </summary> /// <param name="options">The options for the new invoice to create</param> public Task <Invoice> CreateInvoiceAsync(InvoiceOptions options) { var request = CreateRequest(INVOICES_RESOURCE, options); return(ExecuteAsync <Invoice>(request)); }
/// <summary> /// Create a new invoice on the authenticated account. Makes both a POST and a GET request to the Invoices resource. /// </summary> /// <param name="options">The options for the new invoice to create</param> public Invoice CreateInvoice(InvoiceOptions options) { var request = CreateRequest(INVOICES_RESOURCE, options); return(Execute <Invoice>(request)); }
private void LoadControls() { if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutTotalsMiniControl)) { _checkoutTotalsDetailed = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutTotalsDetailedControl) as CheckoutTotalsDetailed; plCheckOutTotalsDetails.Controls.Add(_checkoutTotalsDetailed); } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOrderSummary)) { _checkoutOrderSummary = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOrderSummary) as CheckoutOrderSummary; _checkoutOrderSummary.DisplayReadOnlyGrid = true; _checkoutOrderSummary.FlattenProductDetails = true; _checkoutOrderSummary.OrderSummaryText = GetLocalResourceObject("OrderSummaryStaticText").ToString(); _checkoutOrderSummary.OmnitureState = "purchase|" + OrderNumber; plCheckOutOrderDetails.Controls.Add(_checkoutOrderSummary); } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOptionsControl)) { var _checkoutOptionsControl = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckoutOptionsControl); var _checkOutOptions = _checkoutOptionsControl as CheckOutOptions; _checkOutOptions.IsStatic = (Page as ProductsBase).CheckoutOptionsAreStatic; _checkOutOptions.DisplayHoursOfOperationForPickup = true; var _Message = (Label)_checkOutOptions.FindControl("lblMessage"); var _Notifiaction = (Label)_checkOutOptions.FindControl("lblMessageNotifyReadOnly"); if (_Message != null && _Notifiaction != null) { _Message.Visible = HLConfigManager.Configurations.CheckoutConfiguration.CheckOutShowNotification; _Notifiaction.Visible = HLConfigManager.Configurations.CheckoutConfiguration.CheckOutMessageNotify; } plCheckOutOptions.Controls.Add(_checkOutOptions); } if (DisplayInvoiceOptions) { if (!String.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.InvoiceOptionsControl)) { _invoicOptions = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.InvoiceOptionsControl) as InvoiceOptions; _invoicOptions.IsReadOnly = true; plInvoiceOptions.Controls.Add(_invoicOptions); } } if (!String.IsNullOrEmpty(HLConfigManager.Configurations.PaymentsConfiguration.PaymentsSummaryControl)) { _paymentsSummary = LoadControl(HLConfigManager.Configurations.PaymentsConfiguration.PaymentsSummaryControl) as PaymentsSummary; plPaymentOptions.Controls.Add(_paymentsSummary); } PolicyMessage.Visible = HLConfigManager.Platform == "PCAD"; if ( HLConfigManager.Configurations.DOConfiguration .AllowHFFModal) { var _hFFModal = LoadControl("~/Ordering/Controls/HFFModal.ascx") as HFFModal; plHFFModal.Controls.Add(_hFFModal); ((OrderingMaster)Page.Master).EventBus.RegisterObject(_hFFModal); } // Display the HFF message if the item is in the cart if (HLConfigManager.Configurations.DOConfiguration.AllowHFF && HLConfigManager.Configurations.DOConfiguration.ShowHFFMessage && !string.IsNullOrEmpty(HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeSku)) { if ( ShoppingCart.CartItems.Any( i => i.SKU == HLConfigManager.Configurations.DOConfiguration.HFFHerbalifeSku)) { HFFMessage.Visible = true; } } if (HLConfigManager.Configurations.DOConfiguration.AllowHAP && SessionInfo.IsHAPMode && !string.IsNullOrEmpty(HLConfigManager.Configurations.CheckoutConfiguration.CheckOutHAPOptionsControl)) { var _checkoutHAPOptions = LoadControl(HLConfigManager.Configurations.CheckoutConfiguration.CheckOutHAPOptionsControl); plCheckOutHAPOptions.Controls.Add(_checkoutHAPOptions); } }
/// <summary> /// Update an existing invoice on the authenticated account. Makes both a PUT and a GET request to the Invoices resource. /// </summary> /// <param name="invoiceId">The ID of the invoice to update</param> /// <param name="options">The fields to be updated</param> public async Task <Invoice> UpdateInvoiceAsync(long invoiceId, InvoiceOptions options, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <Invoice>(UpdateInvoiceRequest(invoiceId, options), cancellationToken)); }
/// <summary> /// Update an existing invoice on the authenticated account. Makes both a PUT and a GET request to the Invoices resource. /// </summary> /// <param name="invoiceId">The ID of the invoice to update</param> /// <param name="options">The fields to be updated</param> public Invoice UpdateInvoice(long invoiceId, InvoiceOptions options) { return(Execute <Invoice>(UpdateInvoiceRequest(invoiceId, options))); }
/// <summary> /// Create a new invoice on the authenticated account. Makes both a POST and a GET request to the Invoices resource. /// </summary> /// <param name="options">The options for the new invoice to create</param> public async Task <Invoice> CreateInvoiceAsync(InvoiceOptions options, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <Invoice>(CreateInvoiceRequest(options), cancellationToken)); }
/// <summary> /// Create a new invoice on the authenticated account. Makes both a POST and a GET request to the Invoices resource. /// </summary> /// <param name="options">The options for the new invoice to create</param> public Invoice CreateInvoice(InvoiceOptions options) { return(Execute <Invoice>(CreateInvoiceRequest(options))); }
public GenerateInvoiceMessageHandler(IOptions <InvoiceOptions> options, ILogger <GenerateInvoiceMessageHandler> logger) { _logger = logger; _options = options.Value; }