public interface ShippingMethodCreateCommand extends DraftBasedCreateCommandDsl<ShippingMethod,ShippingMethodDraft,ShippingMethodCreateCommand>, MetaModelReferenceExpansionDsl<ShippingMethod,ShippingMethodCreateCommand,ShippingMethodExpansionModel<ShippingMethod>>
ShippingMethod
.
final CurrencyUnit currencyUnit = USD; final TaxRateDraft taxRate = TaxRateDraft.of("x20", 0.20, true, COUNTRY_CODE); withZone(client(), zone -> { withTaxCategory(client(), TaxCategoryDraft.of("taxcat", asList(taxRate)), taxCategory -> { final ZoneRateDraft zoneRate = ZoneRateDraftBuilder.of(zone.toResourceIdentifier(), asList(ShippingRate.of(MoneyImpl.of(30, currencyUnit)))).build(); final ShippingMethodDraft draft = ShippingMethodDraft.of("standard shipping", "description", taxCategory, asList(zoneRate)); final ShippingMethod shippingMethod = client().executeBlocking(ShippingMethodCreateCommand.of(draft)); //deletion client().executeBlocking(ShippingMethodDeleteCommand.of(shippingMethod)); }); }, COUNTRY_CODE);
See the test code.
ShippingMethodDraft
,
ShippingMethod
Modifier and Type | Method and Description |
---|---|
static ShippingMethodCreateCommand |
of(ShippingMethodDraft draft)
Creates a command object to create a
ShippingMethod . |
getDraft, withDraft
canDeserialize, deserialize, httpRequestIntent
plusExpansionPaths, withExpansionPaths
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
expansionPaths
static ShippingMethodCreateCommand of(ShippingMethodDraft draft)
ShippingMethod
.draft
- template to create the new object