本文整理了Java中io.sphere.sdk.shippingmethods.ZoneRateDraftBuilder.build()
方法的一些代码示例,展示了ZoneRateDraftBuilder.build()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneRateDraftBuilder.build()
方法的具体详情如下:
包路径:io.sphere.sdk.shippingmethods.ZoneRateDraftBuilder
类名称:ZoneRateDraftBuilder
方法名:build
[英]Creates a new instance of ZoneRateDraftDsl with the values of this builder.
[中]使用此生成器的值创建ZonRateDraftDSL的新实例。
代码示例来源: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
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);
}
内容来源于网络,如有侵权,请联系作者删除!