public final class ReplaceTaxRate extends UpdateActionImpl<TaxCategory>
See also TaxCategoryUpdateCommand.
withUpdateableTaxCategory(client(), taxCategory -> {
final TaxRate old = taxCategory.getTaxRates().get(0);
final double newAmount = old.getAmount() * 2;
final TaxRateDraft newTaxRate = TaxRateDraftBuilder.of(old).amount(newAmount).build();
final TaxCategory updatedTaxCategory = client().executeBlocking(TaxCategoryUpdateCommand.of(taxCategory, ReplaceTaxRate.of(old.getId(), newTaxRate)));
final TaxRate actual = updatedTaxCategory.getTaxRates().get(0);
assertThat(actual.getCountry()).isEqualTo(old.getCountry());
assertThat(actual.getAmount()).isEqualTo(newAmount);
assertThat(actual.getName()).isEqualTo(old.getName());
return updatedTaxCategory;
});
See the test code.
Modifier and Type | Method and Description |
---|---|
TaxRateDraft |
getTaxRate() |
String |
getTaxRateId() |
static ReplaceTaxRate |
of(String taxRateId,
TaxRateDraft taxRate) |
getAction
public static ReplaceTaxRate of(String taxRateId, TaxRateDraft taxRate)
public TaxRateDraft getTaxRate()
public String getTaxRateId()