public override void FixtureSetup() { base.FixtureSetup(); #region BackOffice //// Arrange var usCountry = ShipCountryService.GetShipCountryByCountryCode(Catalog.Key, "US"); var key = Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey; var rateTableProvider = (FixedRateShippingGatewayProvider)MerchelloContext.Gateways.Shipping.CreateInstance(key); rateTableProvider.DeleteAllActiveShipMethods(usCountry); var gwshipMethod1 = (FixedRateShippingGatewayMethod)rateTableProvider.CreateShipMethod(FixedRateShippingGatewayMethod.QuoteType.VaryByPrice, usCountry, "Ground (Vary By Pricc) 1"); gwshipMethod1.RateTable.AddRow(0, 10, 5); gwshipMethod1.RateTable.AddRow(10, 15, 10); gwshipMethod1.RateTable.AddRow(15, 25, 25); gwshipMethod1.RateTable.AddRow(25, 60, 30); // total price should be 50M so we should hit this tier gwshipMethod1.RateTable.AddRow(25, 10000, 50); rateTableProvider.SaveShippingGatewayMethod(gwshipMethod1); var gwshipMethod2 = (FixedRateShippingGatewayMethod)rateTableProvider.CreateShipMethod(FixedRateShippingGatewayMethod.QuoteType.VaryByWeight, usCountry, "Ground (VBW)"); gwshipMethod2.RateTable.AddRow(0, 10, 5); gwshipMethod2.RateTable.AddRow(10, 15, 10); // total weight should be 10M so we should hit this tier gwshipMethod2.RateTable.AddRow(15, 25, 25); gwshipMethod2.RateTable.AddRow(25, 10000, 100); rateTableProvider.SaveShippingGatewayMethod(gwshipMethod2); var gwshipMethod3 = (FixedRateShippingGatewayMethod)rateTableProvider.CreateShipMethod(FixedRateShippingGatewayMethod.QuoteType.VaryByPrice, usCountry, "Ground (Vary By Price) 3"); gwshipMethod3.RateTable.AddRow(0, 10, 5); gwshipMethod3.RateTable.AddRow(10, 15, 10); gwshipMethod3.RateTable.AddRow(15, 25, 25); gwshipMethod3.RateTable.AddRow(25, 60, 30); // total price should be 50M so we should hit this tier gwshipMethod3.RateTable.AddRow(25, 10000, 50); rateTableProvider.SaveShippingGatewayMethod(gwshipMethod3); #endregion _shippingProvider = rateTableProvider; }
internal static ShippingGatewayProviderDisplay ToShipGatewayProviderDisplay(this IShippingGatewayProvider shipGatewayProvider) { return(AutoMapper.Mapper.Map <ShippingGatewayProviderDisplay>(shipGatewayProvider)); }