001 002package com.commercetools.api.models.order_edit; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.commercetools.api.models.cart.ExternalLineItemTotalPrice; 013import com.commercetools.api.models.common.Money; 014import com.commercetools.api.models.order.StagedOrderUpdateAction; 015import com.fasterxml.jackson.annotation.*; 016import com.fasterxml.jackson.databind.annotation.*; 017 018import io.vrap.rmf.base.client.utils.Generated; 019 020/** 021 * <p>When multiple shipping addresses are set for a Line Item, use the Remove LineItem and Add LineItem update action to change the shipping details. Since it is not possible for the API to infer how the overall change in the Line Item quantity should be distributed over the sub-quantities, the <code>shippingDetails</code> field is kept in its current state to avoid data loss.</p> 022 * <p>To change the Line Item quantity and shipping details together, use this update action in combination with the Set LineItem ShippingDetails update action in a single Order update command.</p> 023 * <p>The LineItem price is updated as described in LineItem Price selection.</p> 024 * 025 * <hr> 026 * Example to create an instance using the builder pattern 027 * <div class=code-example> 028 * <pre><code class='java'> 029 * StagedOrderChangeLineItemQuantityAction stagedOrderChangeLineItemQuantityAction = StagedOrderChangeLineItemQuantityAction.builder() 030 * .quantity(0.3) 031 * .build() 032 * </code></pre> 033 * </div> 034 */ 035@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 036@JsonDeserialize(as = StagedOrderChangeLineItemQuantityActionImpl.class) 037public interface StagedOrderChangeLineItemQuantityAction extends StagedOrderUpdateAction { 038 039 /** 040 * discriminator value for StagedOrderChangeLineItemQuantityAction 041 */ 042 String CHANGE_LINE_ITEM_QUANTITY = "changeLineItemQuantity"; 043 044 /** 045 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 046 * @return lineItemId 047 */ 048 049 @JsonProperty("lineItemId") 050 public String getLineItemId(); 051 052 /** 053 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 054 * @return lineItemKey 055 */ 056 057 @JsonProperty("lineItemKey") 058 public String getLineItemKey(); 059 060 /** 061 * <p>New value to set. If <code>0</code>, the LineItem is removed from the Order.</p> 062 * @return quantity 063 */ 064 @NotNull 065 @JsonProperty("quantity") 066 public Long getQuantity(); 067 068 /** 069 * <p>Sets the LineItem <code>price</code> to the given value when changing the quantity of a Line Item with the <code>ExternalPrice</code> LineItemPriceMode.</p> 070 * <p>The LineItem price is updated as described in LineItem Price selection.</p> 071 * @return externalPrice 072 */ 073 @Valid 074 @JsonProperty("externalPrice") 075 public Money getExternalPrice(); 076 077 /** 078 * <p>Sets the LineItem <code>price</code> and <code>totalPrice</code> to the given value when changing the quantity of a Line Item with the <code>ExternalTotal</code> LineItemPriceMode.</p> 079 * @return externalTotalPrice 080 */ 081 @Valid 082 @JsonProperty("externalTotalPrice") 083 public ExternalLineItemTotalPrice getExternalTotalPrice(); 084 085 /** 086 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 087 * @param lineItemId value to be set 088 */ 089 090 public void setLineItemId(final String lineItemId); 091 092 /** 093 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 094 * @param lineItemKey value to be set 095 */ 096 097 public void setLineItemKey(final String lineItemKey); 098 099 /** 100 * <p>New value to set. If <code>0</code>, the LineItem is removed from the Order.</p> 101 * @param quantity value to be set 102 */ 103 104 public void setQuantity(final Long quantity); 105 106 /** 107 * <p>Sets the LineItem <code>price</code> to the given value when changing the quantity of a Line Item with the <code>ExternalPrice</code> LineItemPriceMode.</p> 108 * <p>The LineItem price is updated as described in LineItem Price selection.</p> 109 * @param externalPrice value to be set 110 */ 111 112 public void setExternalPrice(final Money externalPrice); 113 114 /** 115 * <p>Sets the LineItem <code>price</code> and <code>totalPrice</code> to the given value when changing the quantity of a Line Item with the <code>ExternalTotal</code> LineItemPriceMode.</p> 116 * @param externalTotalPrice value to be set 117 */ 118 119 public void setExternalTotalPrice(final ExternalLineItemTotalPrice externalTotalPrice); 120 121 /** 122 * factory method 123 * @return instance of StagedOrderChangeLineItemQuantityAction 124 */ 125 public static StagedOrderChangeLineItemQuantityAction of() { 126 return new StagedOrderChangeLineItemQuantityActionImpl(); 127 } 128 129 /** 130 * factory method to create a shallow copy StagedOrderChangeLineItemQuantityAction 131 * @param template instance to be copied 132 * @return copy instance 133 */ 134 public static StagedOrderChangeLineItemQuantityAction of(final StagedOrderChangeLineItemQuantityAction template) { 135 StagedOrderChangeLineItemQuantityActionImpl instance = new StagedOrderChangeLineItemQuantityActionImpl(); 136 instance.setLineItemId(template.getLineItemId()); 137 instance.setLineItemKey(template.getLineItemKey()); 138 instance.setQuantity(template.getQuantity()); 139 instance.setExternalPrice(template.getExternalPrice()); 140 instance.setExternalTotalPrice(template.getExternalTotalPrice()); 141 return instance; 142 } 143 144 /** 145 * factory method to create a deep copy of StagedOrderChangeLineItemQuantityAction 146 * @param template instance to be copied 147 * @return copy instance 148 */ 149 @Nullable 150 public static StagedOrderChangeLineItemQuantityAction deepCopy( 151 @Nullable final StagedOrderChangeLineItemQuantityAction template) { 152 if (template == null) { 153 return null; 154 } 155 StagedOrderChangeLineItemQuantityActionImpl instance = new StagedOrderChangeLineItemQuantityActionImpl(); 156 instance.setLineItemId(template.getLineItemId()); 157 instance.setLineItemKey(template.getLineItemKey()); 158 instance.setQuantity(template.getQuantity()); 159 instance.setExternalPrice(com.commercetools.api.models.common.Money.deepCopy(template.getExternalPrice())); 160 instance.setExternalTotalPrice( 161 com.commercetools.api.models.cart.ExternalLineItemTotalPrice.deepCopy(template.getExternalTotalPrice())); 162 return instance; 163 } 164 165 /** 166 * builder factory method for StagedOrderChangeLineItemQuantityAction 167 * @return builder 168 */ 169 public static StagedOrderChangeLineItemQuantityActionBuilder builder() { 170 return StagedOrderChangeLineItemQuantityActionBuilder.of(); 171 } 172 173 /** 174 * create builder for StagedOrderChangeLineItemQuantityAction instance 175 * @param template instance with prefilled values for the builder 176 * @return builder 177 */ 178 public static StagedOrderChangeLineItemQuantityActionBuilder builder( 179 final StagedOrderChangeLineItemQuantityAction template) { 180 return StagedOrderChangeLineItemQuantityActionBuilder.of(template); 181 } 182 183 /** 184 * accessor map function 185 * @param <T> mapped type 186 * @param helper function to map the object 187 * @return mapped value 188 */ 189 default <T> T withStagedOrderChangeLineItemQuantityAction( 190 Function<StagedOrderChangeLineItemQuantityAction, T> helper) { 191 return helper.apply(this); 192 } 193 194 /** 195 * gives a TypeReference for usage with Jackson DataBind 196 * @return TypeReference 197 */ 198 public static com.fasterxml.jackson.core.type.TypeReference<StagedOrderChangeLineItemQuantityAction> typeReference() { 199 return new com.fasterxml.jackson.core.type.TypeReference<StagedOrderChangeLineItemQuantityAction>() { 200 @Override 201 public String toString() { 202 return "TypeReference<StagedOrderChangeLineItemQuantityAction>"; 203 } 204 }; 205 } 206}