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

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

Best Java code snippets using io.sphere.sdk.taxcategories.TaxCategoryDraft (Showing top 20 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: com.commercetools.sdk.jvm.core/commercetools-models

 /**
  * Creates a new object initialized with the fields of the template parameter.
  *
  * @param template the template
  * @return a new object initialized from the template
  */
 public static TaxCategoryDraftDsl of(final TaxCategoryDraft template) {
  return new TaxCategoryDraftDsl(template.getDescription(), template.getKey(), template.getName(), template.getTaxRates());
 }
}
origin: io.sphere.sdk.jvm/products

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

public static TaxCategoryBuilder of(final TaxCategoryDraft taxCategoryDraft) {
  return of(taxCategoryDraft.getName(), taxCategoryDraft.getTaxRates()).description(taxCategoryDraft.getDescription());
}
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

public static void withTaxCategory(final BlockingSphereClient client, final TaxCategoryDraft draft, final Consumer<TaxCategory> user) {
  requireNonNull(draft, "draft should not be null");
  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));
  user.accept(taxCategory);
  client.executeBlocking(TaxCategoryDeleteCommand.of(taxCategory));
}
origin: io.sphere.sdk.jvm/models

public static TaxCategoryBuilder of(final TaxCategoryDraft taxCategoryDraft) {
  return of(taxCategoryDraft.getName(), taxCategoryDraft.getTaxRates()).description(taxCategoryDraft.getDescription());
}
origin: commercetools/commercetools-jvm-sdk

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

 /**
  * Creates a new object initialized with the fields of the template parameter.
  *
  * @param template the template
  * @return a new object initialized from the template
  */
 public static TaxCategoryDraftBuilder of(final TaxCategoryDraft template) {
  return new TaxCategoryDraftBuilder(template.getDescription(), template.getKey(), template.getName(), template.getTaxRates());
 }
}
origin: io.sphere.sdk.jvm/models

public static TaxCategoryDraft of(final String name, final Optional<String> description, final List<TaxRate> taxRates) {
  return new TaxCategoryDraft(name, description, taxRates);
}
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/sphere-models

public static TaxCategoryDraft of(final String name, final List<TaxRate> taxRates, @Nullable final String description) {
  return new TaxCategoryDraft(name, description, taxRates);
}
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

  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);
        })
    );
  }
}
io.sphere.sdk.taxcategoriesTaxCategoryDraft

Javadoc

Draft for a new TaxCategory.

If you need to create a TaxCategory without tax rates, just provide an empty list as parameter for taxRates.

Most used methods

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

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • Kernel (java.awt.image)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Collectors (java.util.stream)
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Top plugins for WebStorm
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