Source:
public void setClassificationShippingRateInput() { Map<String, LocalizedString> classificationMap = new HashMap<>(); classificationMap.put("Small", LocalizedString.of(Locale.ENGLISH, "Small", Locale.GERMANY, "Klein")); classificationMap.put("Medium", LocalizedString.of(Locale.ENGLISH, "Medium", Locale.GERMANY, "Mittel")); classificationMap.put("Heavy", LocalizedString.of(Locale.ENGLISH, "Heavy", Locale.GERMANY, "Schwergut")); ShippingRateInputType classificationInputType = CartClassification.of(classificationMap); final Project project = client().executeBlocking(ProjectGet.of()); final Project updatedProjectCartValue = client().executeBlocking(ProjectUpdateCommand.of(project, SetShippingRateInputType.of(classificationInputType))); assertThat(updatedProjectCartValue.getShippingRateInputType().getType()).isEqualTo(classificationInputType.getType()); final CartDraft draft = CartDraft.of(EUR) .withTaxMode(TaxMode.EXTERNAL) .withShippingAddress(Address.of(DE)); withCartDraft(client(), draft, (Cart cart) -> { final String taxRateName = "special tax"; final double taxRate = 0.20; final ExternalTaxRateDraft externalTaxRate = ExternalTaxRateDraftBuilder.ofAmount(taxRate, taxRateName, DE).build(); final ShippingRate shippingRate = ShippingRate.of(EURO_10, null, Arrays.asList( io.sphere.sdk.shippingmethods.CartClassification.of(EURO_1, "Small") )); final SetCustomShippingMethod action = SetCustomShippingMethod.ofExternalTaxCalculation("name", shippingRate, externalTaxRate); final Cart cartWithShippingMethod = client().executeBlocking(CartUpdateCommand.of(cart, action)); final ShippingRateInput shippingRateInput = ClassificationShippingRateInput.of("Small"); final Cart cartWithShippingMethodWithScore = client().executeBlocking(CartUpdateCommand.of(cartWithShippingMethod, SetShippingRateInput.of(shippingRateInput))); return cartWithShippingMethodWithScore; }); }

Target:
public void setClassificationShippingRateInput() { final Set<LocalizedEnumValue> set = new HashSet(); set.add(LocalizedEnumValue.of("Small", LocalizedString.of(Locale.ENGLISH, "Small", Locale.GERMANY, "Klein"))); set.add(LocalizedEnumValue.of("Medium", LocalizedString.of(Locale.ENGLISH, "Medium", Locale.GERMANY, "Mittel"))); set.add(LocalizedEnumValue.of("Heavy", LocalizedString.of(Locale.ENGLISH, "Heavy", Locale.GERMANY, "Schwergut"))); final ShippingRateInputTypeDraft classificationInputType = CartClassificationDraftBuilder.of(set).build(); final Project project = client().executeBlocking(ProjectGet.of()); final Project updatedProjectCartValue = client().executeBlocking(ProjectUpdateCommand.of(project, SetShippingRateInputType.of(classificationInputType))); assertThat(updatedProjectCartValue.getShippingRateInputType().getType()).isEqualTo("CartClassification"); final CartDraft draft = CartDraft.of(EUR) .withTaxMode(TaxMode.EXTERNAL) .withShippingAddress(Address.of(DE)); withCartDraft(client(), draft, (Cart cart) -> { final String taxRateName = "special tax"; final double taxRate = 0.20; final ExternalTaxRateDraft externalTaxRate = ExternalTaxRateDraftBuilder.ofAmount(taxRate, taxRateName, DE).build(); final ShippingRate shippingRate = ShippingRate.of(EURO_10, null, Arrays.asList( io.sphere.sdk.shippingmethods.CartClassificationBuilder.of("Small", EURO_1).build() )); final SetCustomShippingMethod action = SetCustomShippingMethod.ofExternalTaxCalculation("name", shippingRate, externalTaxRate); final Cart cartWithShippingMethod = client().executeBlocking(CartUpdateCommand.of(cart, action)); final ShippingRateInputDraft shippingRateInput = ClassificationShippingRateInputDraftBuilder.of("Small").build(); final Cart cartWithShippingMethodWithScore = client().executeBlocking(CartUpdateCommand.of(cartWithShippingMethod, SetShippingRateInput.of(shippingRateInput))); return cartWithShippingMethodWithScore; }); }