001 002package com.commercetools.api.models.error; 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.channel.ChannelReference; 013import com.commercetools.api.models.customer_group.CustomerGroupReference; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * <p>Returned when the Product Variant does not have a Price according to the Product <code>priceMode</code> value for a selected currency, country, Customer Group, or Channel.</p> 021 * <p>The error is returned as a failed response to:</p> 022 * <ul> 023 * <li>Add LineItem, Add CustomLineItem, and Add DiscountCode update actions on Carts.</li> 024 * <li>Add LineItem, Add CustomLineItem, and Add DiscountCode update actions on Order Edits.</li> 025 * <li>Create Order from Cart and Create Order in Store from Cart requests on Orders.</li> 026 * <li>Create Order from Cart and Create Order in Store from Cart requests on My Orders.</li> 027 * </ul> 028 * 029 * <hr> 030 * Example to create an instance using the builder pattern 031 * <div class=code-example> 032 * <pre><code class='java'> 033 * MatchingPriceNotFoundError matchingPriceNotFoundError = MatchingPriceNotFoundError.builder() 034 * .message("{message}") 035 * .productId("{productId}") 036 * .variantId(1) 037 * .build() 038 * </code></pre> 039 * </div> 040 */ 041@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 042@JsonDeserialize(as = MatchingPriceNotFoundErrorImpl.class) 043public interface MatchingPriceNotFoundError extends ErrorObject { 044 045 /** 046 * discriminator value for MatchingPriceNotFoundError 047 */ 048 String MATCHING_PRICE_NOT_FOUND = "MatchingPriceNotFound"; 049 050 /** 051 * 052 * @return code 053 */ 054 @NotNull 055 @JsonProperty("code") 056 public String getCode(); 057 058 /** 059 * <p><code>"The variant $variantId of product $productId does not contain a price for currency $currencyCode, $country, $customerGroup, $channel."</code></p> 060 * @return message 061 */ 062 @NotNull 063 @JsonProperty("message") 064 public String getMessage(); 065 066 /** 067 * <p>Unique identifier of a Product.</p> 068 * @return productId 069 */ 070 @NotNull 071 @JsonProperty("productId") 072 public String getProductId(); 073 074 /** 075 * <p>Unique identifier of a ProductVariant in the Product.</p> 076 * @return variantId 077 */ 078 @NotNull 079 @JsonProperty("variantId") 080 public Integer getVariantId(); 081 082 /** 083 * <p>Currency code of the country.</p> 084 * @return currency 085 */ 086 087 @JsonProperty("currency") 088 public String getCurrency(); 089 090 /** 091 * <p>Country code of the geographic location.</p> 092 * @return country 093 */ 094 095 @JsonProperty("country") 096 public String getCountry(); 097 098 /** 099 * <p>Customer Group associated with the Price.</p> 100 * @return customerGroup 101 */ 102 @Valid 103 @JsonProperty("customerGroup") 104 public CustomerGroupReference getCustomerGroup(); 105 106 /** 107 * <p>Channel associated with the Price.</p> 108 * @return channel 109 */ 110 @Valid 111 @JsonProperty("channel") 112 public ChannelReference getChannel(); 113 114 /** 115 * <p><code>"The variant $variantId of product $productId does not contain a price for currency $currencyCode, $country, $customerGroup, $channel."</code></p> 116 * @param message value to be set 117 */ 118 119 public void setMessage(final String message); 120 121 /** 122 * <p>Unique identifier of a Product.</p> 123 * @param productId value to be set 124 */ 125 126 public void setProductId(final String productId); 127 128 /** 129 * <p>Unique identifier of a ProductVariant in the Product.</p> 130 * @param variantId value to be set 131 */ 132 133 public void setVariantId(final Integer variantId); 134 135 /** 136 * <p>Currency code of the country.</p> 137 * @param currency value to be set 138 */ 139 140 public void setCurrency(final String currency); 141 142 /** 143 * <p>Country code of the geographic location.</p> 144 * @param country value to be set 145 */ 146 147 public void setCountry(final String country); 148 149 /** 150 * <p>Customer Group associated with the Price.</p> 151 * @param customerGroup value to be set 152 */ 153 154 public void setCustomerGroup(final CustomerGroupReference customerGroup); 155 156 /** 157 * <p>Channel associated with the Price.</p> 158 * @param channel value to be set 159 */ 160 161 public void setChannel(final ChannelReference channel); 162 163 /** 164 * factory method 165 * @return instance of MatchingPriceNotFoundError 166 */ 167 public static MatchingPriceNotFoundError of() { 168 return new MatchingPriceNotFoundErrorImpl(); 169 } 170 171 /** 172 * factory method to create a shallow copy MatchingPriceNotFoundError 173 * @param template instance to be copied 174 * @return copy instance 175 */ 176 public static MatchingPriceNotFoundError of(final MatchingPriceNotFoundError template) { 177 MatchingPriceNotFoundErrorImpl instance = new MatchingPriceNotFoundErrorImpl(); 178 instance.setMessage(template.getMessage()); 179 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 180 instance.setProductId(template.getProductId()); 181 instance.setVariantId(template.getVariantId()); 182 instance.setCurrency(template.getCurrency()); 183 instance.setCountry(template.getCountry()); 184 instance.setCustomerGroup(template.getCustomerGroup()); 185 instance.setChannel(template.getChannel()); 186 return instance; 187 } 188 189 /** 190 * factory method to create a deep copy of MatchingPriceNotFoundError 191 * @param template instance to be copied 192 * @return copy instance 193 */ 194 @Nullable 195 public static MatchingPriceNotFoundError deepCopy(@Nullable final MatchingPriceNotFoundError template) { 196 if (template == null) { 197 return null; 198 } 199 MatchingPriceNotFoundErrorImpl instance = new MatchingPriceNotFoundErrorImpl(); 200 instance.setMessage(template.getMessage()); 201 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 202 instance.setProductId(template.getProductId()); 203 instance.setVariantId(template.getVariantId()); 204 instance.setCurrency(template.getCurrency()); 205 instance.setCountry(template.getCountry()); 206 instance.setCustomerGroup( 207 com.commercetools.api.models.customer_group.CustomerGroupReference.deepCopy(template.getCustomerGroup())); 208 instance.setChannel(com.commercetools.api.models.channel.ChannelReference.deepCopy(template.getChannel())); 209 return instance; 210 } 211 212 /** 213 * builder factory method for MatchingPriceNotFoundError 214 * @return builder 215 */ 216 public static MatchingPriceNotFoundErrorBuilder builder() { 217 return MatchingPriceNotFoundErrorBuilder.of(); 218 } 219 220 /** 221 * create builder for MatchingPriceNotFoundError instance 222 * @param template instance with prefilled values for the builder 223 * @return builder 224 */ 225 public static MatchingPriceNotFoundErrorBuilder builder(final MatchingPriceNotFoundError template) { 226 return MatchingPriceNotFoundErrorBuilder.of(template); 227 } 228 229 /** 230 * accessor map function 231 * @param <T> mapped type 232 * @param helper function to map the object 233 * @return mapped value 234 */ 235 default <T> T withMatchingPriceNotFoundError(Function<MatchingPriceNotFoundError, T> helper) { 236 return helper.apply(this); 237 } 238 239 /** 240 * gives a TypeReference for usage with Jackson DataBind 241 * @return TypeReference 242 */ 243 public static com.fasterxml.jackson.core.type.TypeReference<MatchingPriceNotFoundError> typeReference() { 244 return new com.fasterxml.jackson.core.type.TypeReference<MatchingPriceNotFoundError>() { 245 @Override 246 public String toString() { 247 return "TypeReference<MatchingPriceNotFoundError>"; 248 } 249 }; 250 } 251}