public interface ShippingMethodsByCartGet extends MetaModelGetDsl<List<ShippingMethod>,ShippingMethod,ShippingMethodsByCartGet,ShippingMethodExpansionModel<ShippingMethod>>
withShippingMethodForGermany(client(), shippingMethod -> { withCart(client(), cart -> { final Cart cartWithShippingAddress = client().executeBlocking(CartUpdateCommand.of(cart, SetShippingAddress.of(GERMAN_ADDRESS))); final SphereRequest<List<ShippingMethod>> sphereRequest = new VrapRequestDecorator<>(ShippingMethodsByCartGet.of(cartWithShippingAddress).plusExpansionPaths(exp -> exp.taxCategory()), "response", "queryParameter"); final List<ShippingMethod> shippingMethods = client().executeBlocking(sphereRequest); assertThat(shippingMethods).isNotEmpty(); for (final ShippingMethod cartShippingMethod : shippingMethods) { final List<ShippingRate> shippingRates = cartShippingMethod.getZoneRates().stream() .flatMap(zoneRate -> zoneRate.getShippingRates().stream()) .collect(Collectors.toList()); assertThat(shippingRates).areExactly(1, new Condition<>(ShippingRate::isMatching, "Shipping rate is matching")); assertThat(cartShippingMethod.getTaxCategory().getObj()).isNotNull(); } return cartWithShippingAddress; }); });
See the test code.
Modifier and Type | Method and Description |
---|---|
static ShippingMethodsByCartGet |
of(Referenceable<Cart> cart) |
static ShippingMethodsByCartGet |
of(String cartId) |
deserialize
canDeserialize, httpRequestIntent
plusExpansionPaths, withExpansionPaths
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
expansionPaths
static ShippingMethodsByCartGet of(Referenceable<Cart> cart)
static ShippingMethodsByCartGet of(String cartId)