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

How to use
of
method
in
io.sphere.sdk.products.commands.updateactions.SetTaxCategory

Best Java code snippets using io.sphere.sdk.products.commands.updateactions.SetTaxCategory.of (Showing top 15 results out of 315)

origin: io.sphere.sdk.jvm/sphere-models

  public static SetTaxCategory to(final Referenceable<TaxCategory> taxCategory) {
    return of(taxCategory);
  }
}
origin: io.sphere.sdk.jvm/products

  public static SetTaxCategory to(final Referenceable<TaxCategory> taxCategory) {
    return of(taxCategory);
  }
}
origin: com.commercetools.sdk.jvm.core/commercetools-models

public static SetTaxCategory to(final Referenceable<TaxCategory> taxCategory) {
  return of(taxCategory);
}
origin: io.sphere.sdk.jvm/sphere-models

public static SetTaxCategory unset() {
  return of(null);
}
origin: io.sphere.sdk.jvm/models

  public static SetTaxCategory to(final Referenceable<TaxCategory> taxCategory) {
    return of(taxCategory);
  }
}
origin: commercetools/commercetools-jvm-sdk

public static SetTaxCategory to(final Referenceable<TaxCategory> taxCategory) {
  return of(taxCategory);
}
origin: io.sphere.sdk.jvm/models

public static SetTaxCategory unset() {
  return of(Optional.<Reference<TaxCategory>>empty());
}
origin: io.sphere.sdk.jvm/products

public static SetTaxCategory unset() {
  return of(Optional.<Reference<TaxCategory>>empty());
}
origin: io.sphere.sdk.jvm/models

public static SetTaxCategory of(final Referenceable<TaxCategory> taxCategory) {
  return of(Optional.of(taxCategory.toReference()));
}
origin: io.sphere.sdk.jvm/products

public static SetTaxCategory of(final Referenceable<TaxCategory> taxCategory) {
  return of(Optional.of(taxCategory.toReference()));
}
origin: commercetools/commercetools-jvm-sdk

private static ProductUpdateCommand createSetTaxesCommand(final TaxCategory taxCategory, final Product product) {
  return ProductUpdateCommand.of(product, asList(AddPrice.of(MASTER_VARIANT_ID, PRICE), SetTaxCategory.of(taxCategory), Publish.of()));
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void setTaxCategory() throws Exception {
  TaxCategoryFixtures.withTransientTaxCategory(client(), taxCategory ->
      withUpdateableProduct(client(), product -> {
        assertThat(product.getTaxCategory()).isNotEqualTo(taxCategory);
        final ProductUpdateCommand command = ProductUpdateCommand.of(product, SetTaxCategory.of(taxCategory));
        final Product updatedProduct = client().executeBlocking(command);
        assertThat(updatedProduct.getTaxCategory()).isEqualTo(taxCategory.toReference());
        return updatedProduct;
      })
  );
}
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 taxCategory() throws Exception {
    TaxCategoryFixtures.withTransientTaxCategory(client(), taxCategory ->
      withProduct(client(), product -> {
        final Product productWithTaxCategory = client().executeBlocking(ProductUpdateCommand.of(product, SetTaxCategory.of(taxCategory)));
        assertThat(productWithTaxCategory.getTaxCategory()).isNotNull();
        final Query<Product> query = ProductQuery.of().
            bySlug(ProductProjectionType.CURRENT, Locale.ENGLISH, englishSlugOf(product.getMasterData().getStaged())).
            withExpansionPaths(ProductExpansionModel.of().taxCategory()).
            toQuery();
        final PagedQueryResult<Product> queryResult = client().executeBlocking(query);
        final Reference<TaxCategory> productTypeReference = firstOf(queryResult).getTaxCategory();
        assertThat(productTypeReference).is(expanded());
      })
    );
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void expandTaxCategory() throws Exception {
  TaxCategoryFixtures.withTransientTaxCategory(client(), taxCategory ->
          withProduct(client(), product -> {
            final Product productWithTaxCategory = client().executeBlocking(ProductUpdateCommand.of(product, SetTaxCategory.of(taxCategory)));
            final ProductProjectionQuery query = ProductProjectionQuery.of(STAGED)
                .withPredicates(m -> m.id().is(productWithTaxCategory.getId()))
                .withExpansionPaths(m -> m.taxCategory());
            final PagedQueryResult<ProductProjection> pagedQueryResult =
                client().executeBlocking(query);
            assertThat(pagedQueryResult.head().get().getTaxCategory()).is(expanded());
          })
  );
}
io.sphere.sdk.products.commands.updateactionsSetTaxCategoryof

Popular methods of SetTaxCategory

  • <init>

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • ImageIO (javax.imageio)
  • JTable (javax.swing)
  • 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