/// <summary> /// Initializes a new instance of the <see cref="AddInvoiceCurrencyCodeColumn"/> class. /// </summary> public AddInvoiceCurrencyCodeColumn() : base(ApplicationContext.Current.DatabaseContext.SqlSyntax, Umbraco.Core.Logging.Logger.CreateWithDefaultLog4NetConfiguration()) { var dbContext = ApplicationContext.Current.DatabaseContext; _database = dbContext.Database; _sqlSyntax = dbContext.SqlSyntax; _invoiceService = (InvoiceService)MerchelloContext.Current.Services.InvoiceService; }
public static IInvoice GetMockInvoiceForTaxation() { var origin = new Address() { Organization = "Mindfly Web Design Studios", Address1 = "114 W. Magnolia St. Suite 300", Locality = "Bellingham", Region = "WA", PostalCode = "98225", CountryCode = "US", Email = "*****@*****.**", Phone = "555-555-5555" }; var billToShipTo = new Address() { Name = "Space Needle", Address1 = "400 Broad St", Locality = "Seattle", Region = "WA", PostalCode = "98109", CountryCode = "US", }; var invoiceService = new InvoiceService(); var invoice = invoiceService.CreateInvoice(Core.Constants.DefaultKeys.InvoiceStatus.Unpaid); invoice.SetBillingAddress(billToShipTo); var extendedData = new ExtendedDataCollection(); // this is typically added automatically in the checkout workflow extendedData.SetValue(Core.Constants.ExtendedDataKeys.CurrencyCode, "USD"); extendedData.SetValue(Core.Constants.ExtendedDataKeys.Taxable, true.ToString()); // make up some line items var l1 = new InvoiceLineItem(LineItemType.Product, "Item 1", "I1", 10, 1, extendedData); var l2 = new InvoiceLineItem(LineItemType.Product, "Item 2", "I2", 2, 40, extendedData); invoice.Items.Add(l1); invoice.Items.Add(l2); var shipment = new ShipmentMock(origin, billToShipTo, invoice.Items); var shipmethod = new ShipMethodMock(); var quote = new ShipmentRateQuote(shipment, shipmethod) { Rate = 16.22M }; invoice.Items.Add(quote.AsLineItemOf<InvoiceLineItem>()); invoice.Total = invoice.Items.Sum(x => x.TotalPrice); return invoice; }
public void Init() { var billTo = new Address() { Organization = "Mindfly Web Design Studios", Address1 = "114 W. Magnolia St. Suite 504", Locality = "Bellingham", Region = "WA", PostalCode = "98225", CountryCode = "US", Email = "*****@*****.**", Phone = "555-555-5555" }; // create an invoice var invoiceService = new InvoiceService(); _invoice = invoiceService.CreateInvoice(Core.Constants.DefaultKeys.InvoiceStatus.Unpaid); _invoice.SetBillingAddress(billTo); _invoice.Total = 120M; var extendedData = new ExtendedDataCollection(); // this is typically added automatically in the checkout workflow extendedData.SetValue(Core.Constants.ExtendedDataKeys.CurrencyCode, "USD"); // make up some line items var l1 = new InvoiceLineItem(LineItemType.Product, "Item 1", "I1", 10, 1, extendedData); var l2 = new InvoiceLineItem(LineItemType.Product, "Item 2", "I2", 2, 40, extendedData); var l3 = new InvoiceLineItem(LineItemType.Shipping, "Shipping", "shipping", 1, 10M, extendedData); var l4 = new InvoiceLineItem(LineItemType.Tax, "Tax", "tax", 1, 10M, extendedData); _invoice.Items.Add(l1); _invoice.Items.Add(l2); _invoice.Items.Add(l3); _invoice.Items.Add(l4); var processorSettings = new AuthorizeNetProcessorSettings { LoginId = ConfigurationManager.AppSettings["xlogin"], TransactionKey = ConfigurationManager.AppSettings["xtrankey"], UseSandbox = true }; Provider.GatewayProviderSettings.ExtendedData.SaveProcessorSettings(processorSettings); if (Provider.PaymentMethods.Any()) return; var resource = Provider.ListResourcesOffered().ToArray(); Provider.CreatePaymentMethod(resource.First(), "Credit Card", "Credit Card"); }
private void MakeInvoice() { var origin = new Address() { Organization = "Mindfly Web Design Studios", Address1 = "114 W. Magnolia St. Suite 300", Locality = "Bellingham", Region = "WA", PostalCode = "98225", CountryCode = "US", Email = "*****@*****.**", Phone = "555-555-5555" }; var billToShipTo = new Address() { Name = "The President of the United States", Address1 = "1600 Pennsylvania Ave NW", Locality = "Washington", Region = "DC", PostalCode = "20500", CountryCode = "US", }; var invoiceService = new InvoiceService(); Invoice = invoiceService.CreateInvoice(Core.Constants.DefaultKeys.InvoiceStatus.Unpaid); Invoice.SetBillingAddress(billToShipTo); Invoice.Total = 120M; var extendedData = new ExtendedDataCollection(); // this is typically added automatically in the checkout workflow extendedData.SetValue(Core.Constants.ExtendedDataKeys.CurrencyCode, "USD"); extendedData.SetValue(Core.Constants.ExtendedDataKeys.Taxable, true.ToString()); // make up some line items var l1 = new InvoiceLineItem(LineItemType.Product, "Item 1", "I1", 10, 1, extendedData); var l2 = new InvoiceLineItem(LineItemType.Product, "Item 2", "I2", 2, 40, extendedData); Invoice.Items.Add(l1); Invoice.Items.Add(l2); var shipment = new ShipmentMock(origin, billToShipTo, Invoice.Items); var shipmethod = new ShipMethodMock(); var quote = new ShipmentRateQuote(shipment, shipmethod) { Rate = 16.22M }; Invoice.Items.Add(quote.AsLineItemOf<InvoiceLineItem>()); }
public void Init() { var billTo = new Address() { Organization = "Flightpath", Address1 = "36 West 25th Street", Locality = "New York", Region = "NY", PostalCode = "10010", CountryCode = "US", Email = "*****@*****.**", Phone = "212-555-5555" }; // create an invoice var invoiceService = new InvoiceService(); _invoice = invoiceService.CreateInvoice(Core.Constants.DefaultKeys.InvoiceStatus.Unpaid); _invoice.SetBillingAddress(billTo); _invoice.Total = 120M; var extendedData = new ExtendedDataCollection(); // this is typically added automatically in the checkout workflow extendedData.SetValue(Core.Constants.ExtendedDataKeys.CurrencyCode, "USD"); // make up some line items var l1 = new InvoiceLineItem(LineItemType.Product, "Item 1", "I1", 10, 1, extendedData); var l2 = new InvoiceLineItem(LineItemType.Product, "Item 2", "I2", 2, 40, extendedData); var l3 = new InvoiceLineItem(LineItemType.Shipping, "Shipping", "shipping", 1, 10M, extendedData); var l4 = new InvoiceLineItem(LineItemType.Tax, "Tax", "tax", 1, 10M, extendedData); _invoice.Items.Add(l1); _invoice.Items.Add(l2); _invoice.Items.Add(l3); _invoice.Items.Add(l4); var processorSettings = new StripeProcessorSettings { ApiKey = ConfigurationManager.AppSettings["stripeApiKey"] }; Provider.GatewayProviderSettings.ExtendedData.SaveProcessorSettings(processorSettings); if (Provider.PaymentMethods.Any()) return; var resource = Provider.ListResourcesOffered().ToArray(); Provider.CreatePaymentMethod(resource.First(), "Credit Card", "Credit Card"); }
public void Can_Finalize_An_Tax_Quote_With_AvaTax() { //// Arrange var method = Provider.GetGatewayTaxMethodByCountryCode("US") as AvaTaxTaxationGatewayMethod; var taxAddress = Provider.ExtendedData.GetAvaTaxProviderSettings().DefaultStoreAddress.ToAddress(); var invoiceService = new InvoiceService(); invoiceService.Save(Invoice); //// Act var result = method.CalculateTaxForInvoice(Invoice, taxAddress, false); //// Assert Assert.NotNull(result); }
public void Init() { var billTo = new Address() { Organization = "Proworks", Address1 = "777 NE 2nd St.", Locality = "Corvallis", Region = "OR", PostalCode = "97330", CountryCode = "US", Email = "*****@*****.**", Phone = "555-555-5555" }; // create an invoice var invoiceService = new InvoiceService(); _invoice = invoiceService.CreateInvoice(Core.Constants.DefaultKeys.InvoiceStatus.Unpaid); var extendedData = new ExtendedDataCollection(); // this is typically added automatically in the checkout workflow extendedData.SetValue(Core.Constants.ExtendedDataKeys.CurrencyCode, "USD"); var processorSettings = new ChaseProcessorSettings { MerchantId = ConfigurationManager.AppSettings["merchantId"], Bin = ConfigurationManager.AppSettings["bin"], Username = ConfigurationManager.AppSettings["username"], Password = ConfigurationManager.AppSettings["password"] }; Provider.GatewayProviderSettings.ExtendedData.SaveProcessorSettings(processorSettings); if (Provider.PaymentMethods.Any()) return; var resource = new GatewayResource("CreditCard", "Credit Card"); _payment = Provider.CreatePaymentMethod(resource, "Credit Card", "Credit Card"); }