Class PriceDraftImpl

java.lang.Object
com.commercetools.api.models.common.PriceDraftImpl
All Implemented Interfaces:
PriceDraft, CustomizableDraft<PriceDraft>, WithKey, io.vrap.rmf.base.client.Draft<PriceDraft>, io.vrap.rmf.base.client.ModelBase

public class PriceDraftImpl extends Object implements PriceDraft, io.vrap.rmf.base.client.ModelBase

The draft representation for prices to be embedded into ProductVariantDrafts when the ProductPriceMode is Embedded. For the Standalone ProductPriceMode use StandalonePriceDraft.

  • Constructor Details

    • PriceDraftImpl

      public PriceDraftImpl()
      create empty instance
  • Method Details

    • getKey

      public String getKey()

      User-defined identifier for the Price. It must be unique per ProductVariant.

      Specified by:
      getKey in interface PriceDraft
      Specified by:
      getKey in interface WithKey
      Returns:
      key
    • getValue

      public Money getValue()

      Money value of this Price.

      Specified by:
      getValue in interface PriceDraft
      Returns:
      value
    • getCountry

      public String getCountry()

      Set this field if this Price is only valid for the specified country.

      Specified by:
      getCountry in interface PriceDraft
      Returns:
      country
    • getCustomerGroup

      public CustomerGroupResourceIdentifier getCustomerGroup()

      Set this field if this Price is only valid for the referenced CustomerGroup.

      Specified by:
      getCustomerGroup in interface PriceDraft
      Returns:
      customerGroup
    • getChannel

      public ChannelResourceIdentifier getChannel()

      Set this field if this Price is only valid for the referenced ProductDistribution Channel.

      Specified by:
      getChannel in interface PriceDraft
      Returns:
      channel
    • getValidFrom

      public ZonedDateTime getValidFrom()

      Set this field if this Price is only valid from the specified date and time. Must be at least 1 ms earlier than validUntil.

      Specified by:
      getValidFrom in interface PriceDraft
      Returns:
      validFrom
    • getValidUntil

      public ZonedDateTime getValidUntil()

      Set this field if this Price is only valid until the specified date and time. Must be at least 1 ms later than validFrom. Prices that are no longer valid are not automatically removed, but they can be removed if necessary.

      Specified by:
      getValidUntil in interface PriceDraft
      Returns:
      validUntil
    • getDiscounted

      public DiscountedPriceDraft getDiscounted()

      Set this field to add a DiscountedPrice from an external service.

      Otherwise, Composable Commerce sets this field automatically if at least one ProductDiscount applies. The DiscountedPrice must reference a ProductDiscount with:

      • The isActive flag set to true.
      • A ProductDiscountValue of type external.
      • A predicate that matches the ProductVariant the Price is referenced from.
      Specified by:
      getDiscounted in interface PriceDraft
      Returns:
      discounted
    • getTiers

      public List<PriceTierDraft> getTiers()

      Set this field to specify different Prices for certain LineItem quantities.

      Specified by:
      getTiers in interface PriceDraft
      Returns:
      tiers
    • getCustom

      public CustomFieldsDraft getCustom()

      Custom Fields for the Price.

      Specified by:
      getCustom in interface CustomizableDraft<PriceDraft>
      Specified by:
      getCustom in interface PriceDraft
      Returns:
      custom
    • setKey

      public void setKey(String key)
      Description copied from interface: PriceDraft

      User-defined identifier for the Price. It must be unique per ProductVariant.

      Specified by:
      setKey in interface PriceDraft
      Parameters:
      key - value to be set
    • setValue

      public void setValue(Money value)
      Description copied from interface: PriceDraft

      Money value of this Price.

      Specified by:
      setValue in interface PriceDraft
      Parameters:
      value - value to be set
    • setCountry

      public void setCountry(String country)
      Description copied from interface: PriceDraft

      Set this field if this Price is only valid for the specified country.

      Specified by:
      setCountry in interface PriceDraft
      Parameters:
      country - value to be set
    • setCustomerGroup

      public void setCustomerGroup(CustomerGroupResourceIdentifier customerGroup)
      Description copied from interface: PriceDraft

      Set this field if this Price is only valid for the referenced CustomerGroup.

      Specified by:
      setCustomerGroup in interface PriceDraft
      Parameters:
      customerGroup - value to be set
    • setChannel

      public void setChannel(ChannelResourceIdentifier channel)
      Description copied from interface: PriceDraft

      Set this field if this Price is only valid for the referenced ProductDistribution Channel.

      Specified by:
      setChannel in interface PriceDraft
      Parameters:
      channel - value to be set
    • setValidFrom

      public void setValidFrom(ZonedDateTime validFrom)
      Description copied from interface: PriceDraft

      Set this field if this Price is only valid from the specified date and time. Must be at least 1 ms earlier than validUntil.

      Specified by:
      setValidFrom in interface PriceDraft
      Parameters:
      validFrom - value to be set
    • setValidUntil

      public void setValidUntil(ZonedDateTime validUntil)
      Description copied from interface: PriceDraft

      Set this field if this Price is only valid until the specified date and time. Must be at least 1 ms later than validFrom. Prices that are no longer valid are not automatically removed, but they can be removed if necessary.

      Specified by:
      setValidUntil in interface PriceDraft
      Parameters:
      validUntil - value to be set
    • setDiscounted

      public void setDiscounted(DiscountedPriceDraft discounted)
      Description copied from interface: PriceDraft

      Set this field to add a DiscountedPrice from an external service.

      Otherwise, Composable Commerce sets this field automatically if at least one ProductDiscount applies. The DiscountedPrice must reference a ProductDiscount with:

      • The isActive flag set to true.
      • A ProductDiscountValue of type external.
      • A predicate that matches the ProductVariant the Price is referenced from.
      Specified by:
      setDiscounted in interface PriceDraft
      Parameters:
      discounted - value to be set
    • setTiers

      public void setTiers(PriceTierDraft... tiers)
      Description copied from interface: PriceDraft

      Set this field to specify different Prices for certain LineItem quantities.

      Specified by:
      setTiers in interface PriceDraft
      Parameters:
      tiers - values to be set
    • setTiers

      public void setTiers(List<PriceTierDraft> tiers)
      Description copied from interface: PriceDraft

      Set this field to specify different Prices for certain LineItem quantities.

      Specified by:
      setTiers in interface PriceDraft
      Parameters:
      tiers - values to be set
    • setCustom

      public void setCustom(CustomFieldsDraft custom)
      Description copied from interface: PriceDraft

      Custom Fields for the Price.

      Specified by:
      setCustom in interface CustomizableDraft<PriceDraft>
      Specified by:
      setCustom in interface PriceDraft
      Parameters:
      custom - value to be set
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object