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.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * <p>Returned when the Tax Category of at least one of the <code>lineItems</code>, <code>customLineItems</code>, or <code>shippingInfo</code> in the Cart is missing the TaxRate matching <code>country</code> and <code>state</code> given in the <code>shippingAddress</code> of that Cart.</p> 018 * <p>The error is returned as a failed response to:</p> 019 * <ul> 020 * <li>Set Default Shipping Address, Add LineItem, Add CustomLineItem, Set Shipping Address, Add LineItem, Add LineItem, and Add CustomLineItem update actions</li> 021 * <li>Create Order from Cart and Create Order in Store from Cart requests.</li> 022 * </ul> 023 * 024 * <hr> 025 * Example to create an instance using the builder pattern 026 * <div class=code-example> 027 * <pre><code class='java'> 028 * GraphQLMissingTaxRateForCountryError graphQLMissingTaxRateForCountryError = GraphQLMissingTaxRateForCountryError.builder() 029 * .taxCategoryId("{taxCategoryId}") 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = GraphQLMissingTaxRateForCountryErrorImpl.class) 036public interface GraphQLMissingTaxRateForCountryError extends GraphQLErrorObject { 037 038 /** 039 * discriminator value for GraphQLMissingTaxRateForCountryError 040 */ 041 String MISSING_TAX_RATE_FOR_COUNTRY = "MissingTaxRateForCountry"; 042 043 /** 044 * 045 * @return code 046 */ 047 @NotNull 048 @JsonProperty("code") 049 public String getCode(); 050 051 /** 052 * <p>Unique identifier of the TaxCategory.</p> 053 * @return taxCategoryId 054 */ 055 @NotNull 056 @JsonProperty("taxCategoryId") 057 public String getTaxCategoryId(); 058 059 /** 060 * <p>Country code of the geographic location.</p> 061 * @return country 062 */ 063 064 @JsonProperty("country") 065 public String getCountry(); 066 067 /** 068 * <p>State within the country, such as Texas in the United States.</p> 069 * @return state 070 */ 071 072 @JsonProperty("state") 073 public String getState(); 074 075 /** 076 * <p>Unique identifier of the TaxCategory.</p> 077 * @param taxCategoryId value to be set 078 */ 079 080 public void setTaxCategoryId(final String taxCategoryId); 081 082 /** 083 * <p>Country code of the geographic location.</p> 084 * @param country value to be set 085 */ 086 087 public void setCountry(final String country); 088 089 /** 090 * <p>State within the country, such as Texas in the United States.</p> 091 * @param state value to be set 092 */ 093 094 public void setState(final String state); 095 096 /** 097 * factory method 098 * @return instance of GraphQLMissingTaxRateForCountryError 099 */ 100 public static GraphQLMissingTaxRateForCountryError of() { 101 return new GraphQLMissingTaxRateForCountryErrorImpl(); 102 } 103 104 /** 105 * factory method to create a shallow copy GraphQLMissingTaxRateForCountryError 106 * @param template instance to be copied 107 * @return copy instance 108 */ 109 public static GraphQLMissingTaxRateForCountryError of(final GraphQLMissingTaxRateForCountryError template) { 110 GraphQLMissingTaxRateForCountryErrorImpl instance = new GraphQLMissingTaxRateForCountryErrorImpl(); 111 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 112 instance.setTaxCategoryId(template.getTaxCategoryId()); 113 instance.setCountry(template.getCountry()); 114 instance.setState(template.getState()); 115 return instance; 116 } 117 118 /** 119 * factory method to create a deep copy of GraphQLMissingTaxRateForCountryError 120 * @param template instance to be copied 121 * @return copy instance 122 */ 123 @Nullable 124 public static GraphQLMissingTaxRateForCountryError deepCopy( 125 @Nullable final GraphQLMissingTaxRateForCountryError template) { 126 if (template == null) { 127 return null; 128 } 129 GraphQLMissingTaxRateForCountryErrorImpl instance = new GraphQLMissingTaxRateForCountryErrorImpl(); 130 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 131 instance.setTaxCategoryId(template.getTaxCategoryId()); 132 instance.setCountry(template.getCountry()); 133 instance.setState(template.getState()); 134 return instance; 135 } 136 137 /** 138 * builder factory method for GraphQLMissingTaxRateForCountryError 139 * @return builder 140 */ 141 public static GraphQLMissingTaxRateForCountryErrorBuilder builder() { 142 return GraphQLMissingTaxRateForCountryErrorBuilder.of(); 143 } 144 145 /** 146 * create builder for GraphQLMissingTaxRateForCountryError instance 147 * @param template instance with prefilled values for the builder 148 * @return builder 149 */ 150 public static GraphQLMissingTaxRateForCountryErrorBuilder builder( 151 final GraphQLMissingTaxRateForCountryError template) { 152 return GraphQLMissingTaxRateForCountryErrorBuilder.of(template); 153 } 154 155 /** 156 * accessor map function 157 * @param <T> mapped type 158 * @param helper function to map the object 159 * @return mapped value 160 */ 161 default <T> T withGraphQLMissingTaxRateForCountryError(Function<GraphQLMissingTaxRateForCountryError, T> helper) { 162 return helper.apply(this); 163 } 164 165 /** 166 * gives a TypeReference for usage with Jackson DataBind 167 * @return TypeReference 168 */ 169 public static com.fasterxml.jackson.core.type.TypeReference<GraphQLMissingTaxRateForCountryError> typeReference() { 170 return new com.fasterxml.jackson.core.type.TypeReference<GraphQLMissingTaxRateForCountryError>() { 171 @Override 172 public String toString() { 173 return "TypeReference<GraphQLMissingTaxRateForCountryError>"; 174 } 175 }; 176 } 177}