本文整理了Java中io.sphere.sdk.shippingmethods.ZoneRateDraftBuilder
类的一些代码示例,展示了ZoneRateDraftBuilder
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneRateDraftBuilder
类的具体详情如下:
包路径:io.sphere.sdk.shippingmethods.ZoneRateDraftBuilder
类名称:ZoneRateDraftBuilder
[英]Builder for ZoneRateDraft.
[中]建筑商为你设计草图。
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
public ZoneRateDraftDsl withShippingRates(final List<ShippingRate> shippingRates) {
return newBuilder().shippingRates(shippingRates).build();
}
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
/**
* Creates a new object initialized with the given values.
*
* @param zone initial value for the {@link ZoneRateDraft#getZone()} property
* @param shippingRates initial value for the {@link ZoneRateDraft#getShippingRates()} property
* @return new object initialized with the given values
*/
public static ZoneRateDraftBuilder of(final ResourceIdentifier<Zone> zone,
final List<ShippingRate> shippingRates) {
return new ZoneRateDraftBuilder(shippingRates, zone);
}
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
public ZoneRateDraftDsl withZone(final ResourceIdentifier<Zone> zone) {
return newBuilder().zone(zone).build();
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Test
public void execution() throws Exception {
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);
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Test
public void createShippingMethodWithPredicate() throws Exception {
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 zoneRateDraft = ZoneRateDraftBuilder.of(zone.toResourceIdentifier(), asList(ShippingRate.of(MoneyImpl.of(30, currencyUnit)))).build();
final ShippingMethodDraft draft =
ShippingMethodDraftBuilder.of("standard shipping", "description", taxCategory.toReference(), asList(zoneRateDraft), false)
.predicate(CartPredicate.of("customer.email = \"john@example.com\""))
.build();
final ShippingMethod shippingMethod = client().executeBlocking(ShippingMethodCreateCommand.of(draft));
//deletion
client().executeBlocking(ShippingMethodDeleteCommand.of(shippingMethod));
});
}, COUNTRY_CODE);
}
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public ZoneRateDraftBuilder newBuilder() {
return new ZoneRateDraftBuilder(shippingRates, zone);
}
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
/**
* Creates a new object initialized with the fields of the template parameter.
*
* @param template the template
* @return a new object initialized from the template
*/
public static ZoneRateDraftBuilder of(final ZoneRateDraft template) {
return new ZoneRateDraftBuilder(template.getShippingRates(), template.getZone());
}
}
内容来源于网络,如有侵权,请联系作者删除!