001 002package com.commercetools.api.models.cart; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * <p>To set the Cart's Shipping Method the Cart must have the <code>Single</code> ShippingMode and a <code>shippingAddress</code>.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class CartSetShippingMethodActionImpl implements CartSetShippingMethodAction, ModelBase { 022 023 private String action; 024 025 private com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier shippingMethod; 026 027 private com.commercetools.api.models.cart.ExternalTaxRateDraft externalTaxRate; 028 029 /** 030 * create instance with all properties 031 */ 032 @JsonCreator 033 CartSetShippingMethodActionImpl( 034 @JsonProperty("shippingMethod") final com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier shippingMethod, 035 @JsonProperty("externalTaxRate") final com.commercetools.api.models.cart.ExternalTaxRateDraft externalTaxRate) { 036 this.shippingMethod = shippingMethod; 037 this.externalTaxRate = externalTaxRate; 038 this.action = SET_SHIPPING_METHOD; 039 } 040 041 /** 042 * create empty instance 043 */ 044 public CartSetShippingMethodActionImpl() { 045 this.action = SET_SHIPPING_METHOD; 046 } 047 048 /** 049 * 050 */ 051 052 public String getAction() { 053 return this.action; 054 } 055 056 /** 057 * <p>Value to set. If empty, any existing value is removed.</p> 058 * <p>If the referenced Shipping Method has a predicate that does not match the Cart, an InvalidOperation error is returned.</p> 059 */ 060 061 public com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier getShippingMethod() { 062 return this.shippingMethod; 063 } 064 065 /** 066 * <p>An external Tax Rate can be set if the Cart has the <code>External</code> TaxMode.</p> 067 */ 068 069 public com.commercetools.api.models.cart.ExternalTaxRateDraft getExternalTaxRate() { 070 return this.externalTaxRate; 071 } 072 073 public void setShippingMethod( 074 final com.commercetools.api.models.shipping_method.ShippingMethodResourceIdentifier shippingMethod) { 075 this.shippingMethod = shippingMethod; 076 } 077 078 public void setExternalTaxRate(final com.commercetools.api.models.cart.ExternalTaxRateDraft externalTaxRate) { 079 this.externalTaxRate = externalTaxRate; 080 } 081 082 @Override 083 public boolean equals(Object o) { 084 if (this == o) 085 return true; 086 087 if (o == null || getClass() != o.getClass()) 088 return false; 089 090 CartSetShippingMethodActionImpl that = (CartSetShippingMethodActionImpl) o; 091 092 return new EqualsBuilder().append(action, that.action) 093 .append(shippingMethod, that.shippingMethod) 094 .append(externalTaxRate, that.externalTaxRate) 095 .isEquals(); 096 } 097 098 @Override 099 public int hashCode() { 100 return new HashCodeBuilder(17, 37).append(action).append(shippingMethod).append(externalTaxRate).toHashCode(); 101 } 102 103}