public final class RemoveTaxRate extends UpdateActionImpl<TaxCategory>
See also TaxCategoryUpdateCommand.
withUpdateableTaxCategory(client(), taxCategory -> { //add tax rate final String name = "ag7"; final CountryCode countryCode = CountryCode.AG; final TaxRateDraft de7 = TaxRateDraftBuilder.of(name, 0.07, true, countryCode).build(); final TaxCategory taxCategoryWithTaRate = client().executeBlocking(TaxCategoryUpdateCommand.of(taxCategory, AddTaxRate.of(de7))); final TaxRate actual = taxCategoryWithTaRate.getTaxRates().stream().filter(rate -> name.equals(rate.getName())).findFirst().get(); assertThat(actual.getCountry()).isEqualTo(countryCode); assertThat(actual.getAmount()).isEqualTo(0.07); assertThat(actual.getId()) .overridingErrorMessage("the tax rate fetched from API has an id") .isNotNull(); assertThat(actual.getName()).isEqualTo(de7.getName()); //remove tax rate final TaxCategory updatedTaxCategory = client().executeBlocking(TaxCategoryUpdateCommand.of(taxCategoryWithTaRate, RemoveTaxRate.of(actual.getId()))); assertThat(updatedTaxCategory.getTaxRates()).matches(rates -> !rates.stream().anyMatch(rate -> name.equals(rate.getName()))); return updatedTaxCategory; });
See the test code.
Modifier and Type | Method and Description |
---|---|
String |
getTaxRateId() |
static RemoveTaxRate |
of(String taxRateId) |
getAction
public static RemoveTaxRate of(String taxRateId)
public String getTaxRateId()