Tabnine Logo
TaxCategoryDraft.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
io.sphere.sdk.taxcategories.TaxCategoryDraft

Best Java code snippets using io.sphere.sdk.taxcategories.TaxCategoryDraft.of (Showing top 14 results out of 315)

origin: com.commercetools.sdk.jvm.core/commercetools-models

  static TaxCategoryDraft of(final String name, final List<TaxRateDraft> taxRates) {
    return of(name, taxRates, null);
  }
}
origin: commercetools/commercetools-jvm-sdk

  static TaxCategoryDraft of(final String name, final List<TaxRateDraft> taxRates) {
    return of(name, taxRates, null);
  }
}
origin: io.sphere.sdk.jvm/sphere-models

public static TaxCategoryDraft of(final String name, final List<TaxRate> taxRates) {
  return of(name, taxRates, null);
}
origin: io.sphere.sdk.jvm/products

public static TaxCategoryDraft of(final String name, final String description, final List<TaxRate> taxRates) {
  return of(name, Optional.ofNullable(description), taxRates);
}
origin: io.sphere.sdk.jvm/models

public static TaxCategoryDraft of(final String name, final List<TaxRate> taxRates) {
  return of(name, Optional.empty(), taxRates);
}
origin: io.sphere.sdk.jvm/products

public static TaxCategoryDraft of(final String name, final List<TaxRate> taxRates) {
  return of(name, Optional.empty(), taxRates);
}
origin: io.sphere.sdk.jvm/models

public static TaxCategoryDraft of(final String name, final String description, final List<TaxRate> taxRates) {
  return of(name, Optional.ofNullable(description), taxRates);
}
origin: commercetools/commercetools-jvm-sdk

public static void withTaxCategory(final BlockingSphereClient client, final String name, final Consumer<TaxCategory> user) {
  final TaxCategoryDraft de19 = TaxCategoryDraft.of(name, singletonList(TaxRateDraftBuilder.of("de19", 0.19, true, CountryCode.DE).build()));
  withTaxCategory(client, de19, user);
}
origin: commercetools/commercetools-jvm-sdk

public static TaxCategory defaultTaxCategory(final BlockingSphereClient client) {
  final String name = "sdk-default-tax-cat-1";
  final TaxCategoryDraft categoryDraft = TaxCategoryDraft.of(name, singletonList(TaxRateDraft.of("xyz", 0.20, true, DE)));
  return client.executeBlocking(TaxCategoryQuery.of().byName(name)).head().orElseGet(() -> client.executeBlocking(TaxCategoryCreateCommand.of(categoryDraft)));
}
origin: commercetools/commercetools-jvm-sdk

public static void withTaxCategory(final BlockingSphereClient client, final Consumer<TaxCategory> user) {
  final QueryPredicate<TaxCategory> predicate = TaxCategoryQueryModel.of().name().is(STANDARD_TAX_CATEGORY);
  final List<TaxCategory> results = client.executeBlocking(TaxCategoryQuery.of().withPredicates(predicate)).getResults();
  final TaxCategory taxCategory;
  if (results.isEmpty()) {
    final List<TaxRateDraft> taxRates = asList(TaxRateDraft.of("5% US", 0.05, false, US), TaxRateDraft.of("19% MwSt", 0.19, true, DE));
    taxCategory = client.executeBlocking(TaxCategoryCreateCommand.of(TaxCategoryDraft.of(STANDARD_TAX_CATEGORY, taxRates)));
  } else {
    taxCategory = results.get(0);
  }
  user.accept(taxCategory);
}
origin: commercetools/commercetools-jvm-sdk

  public static void withUpdateableTaxCategory(final BlockingSphereClient client, final UnaryOperator<TaxCategory> testApplicationFunction) {
    final TaxCategoryDraft draft = TaxCategoryDraft.of(randomKey(), singletonList(TaxRateDraftBuilder.of("de19", 0.19, true, CountryCode.DE).build()));
    final PagedQueryResult<TaxCategory> results = client.executeBlocking(TaxCategoryQuery.of().byName(draft.getName()));
    results.getResults().forEach(tc -> client.executeBlocking(TaxCategoryDeleteCommand.of(tc)));
    final TaxCategory taxCategory = client.executeBlocking(TaxCategoryCreateCommand.of(draft));
    final TaxCategory updated = testApplicationFunction.apply(taxCategory);
    client.executeBlocking(TaxCategoryDeleteCommand.of(updated));
  }
}
origin: commercetools/commercetools-jvm-sdk

  private static void withTaxedAndPricedProduct(final BlockingSphereClient client, final long centAmount,
                         final double taxRate, final boolean taxIncluded, final Consumer<Product> operator) {
    final List<TaxRateDraft> taxRateDrafts = singletonList(TaxRateDraftBuilder.of(randomKey(), taxRate, taxIncluded, CountryCode.DE).build());
    final TaxCategoryDraft taxCategoryDraft = TaxCategoryDraft.of(randomString(), taxRateDrafts);
    withTaxCategory(client, taxCategoryDraft, taxCategory ->
        withProduct(client, product -> {
          final PriceDraft priceDraft = PriceDraft.of(MoneyImpl.ofCents(centAmount, EUR)).withCountry(DE);
          final ProductUpdateCommand setPricesCmd = ProductUpdateCommand.of(product, asList(
              AddPrice.of(MASTER_VARIANT_ID, priceDraft),
              SetTaxCategory.of(taxCategory),
              Publish.of()));
          final Product productWithPrice = client.executeBlocking(setPricesCmd);
          operator.accept(productWithPrice);
        })
    );
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void execution() throws Exception {
  final CurrencyUnit currencyUnit = USD;
  final TaxRateDraft taxRate = TaxRateDraft.of("x20", 0.20, true, COUNTRY_CODE);
  withZone(client(), zone -> {
    withTaxCategory(client(), TaxCategoryDraft.of("taxcat", asList(taxRate)), taxCategory -> {
      final ZoneRateDraft zoneRate = ZoneRateDraftBuilder.of(zone.toResourceIdentifier(), asList(ShippingRate.of(MoneyImpl.of(30, currencyUnit)))).build();
      final ShippingMethodDraft draft =
          ShippingMethodDraft.of("standard shipping", "description", taxCategory, asList(zoneRate));
      final ShippingMethod shippingMethod = client().executeBlocking(ShippingMethodCreateCommand.of(draft));
      //deletion
      client().executeBlocking(ShippingMethodDeleteCommand.of(shippingMethod));
    });
  }, COUNTRY_CODE);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void createShippingMethodWithPredicate() throws Exception {
  final CurrencyUnit currencyUnit = USD;
  final TaxRateDraft taxRate = TaxRateDraft.of("x20", 0.20, true, COUNTRY_CODE);
  withZone(client(), zone -> {
    withTaxCategory(client(), TaxCategoryDraft.of("taxcat", asList(taxRate)), taxCategory -> {
      final ZoneRateDraft zoneRateDraft = ZoneRateDraftBuilder.of(zone.toResourceIdentifier(), asList(ShippingRate.of(MoneyImpl.of(30, currencyUnit)))).build();
      final ShippingMethodDraft draft =
          ShippingMethodDraftBuilder.of("standard shipping", "description", taxCategory.toReference(), asList(zoneRateDraft), false)
              .predicate(CartPredicate.of("customer.email = \"john@example.com\""))
              .build();
      final ShippingMethod shippingMethod = client().executeBlocking(ShippingMethodCreateCommand.of(draft));
      //deletion
      client().executeBlocking(ShippingMethodDeleteCommand.of(shippingMethod));
    });
  }, COUNTRY_CODE);
}
io.sphere.sdk.taxcategoriesTaxCategoryDraftof

Popular methods of TaxCategoryDraft

  • getName
  • <init>
  • getDescription
  • getTaxRates
  • getKey

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • setRequestProperty (URLConnection)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Runner (org.openjdk.jmh.runner)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now