001 002package com.commercetools.api.models.cart; 003 004import java.time.*; 005import java.time.ZonedDateTime; 006import java.util.*; 007import java.util.function.Function; 008import java.util.stream.Collectors; 009 010import javax.annotation.Nullable; 011import javax.validation.Valid; 012import javax.validation.constraints.NotNull; 013 014import com.commercetools.api.models.business_unit.BusinessUnitKeyReference; 015import com.commercetools.api.models.cart_discount.CartDiscountReference; 016import com.commercetools.api.models.common.Address; 017import com.commercetools.api.models.common.BaseResource; 018import com.commercetools.api.models.common.CentPrecisionMoney; 019import com.commercetools.api.models.common.CreatedBy; 020import com.commercetools.api.models.common.LastModifiedBy; 021import com.commercetools.api.models.customer_group.CustomerGroupReference; 022import com.commercetools.api.models.order.PaymentInfo; 023import com.commercetools.api.models.store.StoreKeyReference; 024import com.commercetools.api.models.type.CustomFields; 025import com.fasterxml.jackson.annotation.*; 026import com.fasterxml.jackson.databind.annotation.*; 027 028import io.vrap.rmf.base.client.utils.Generated; 029 030/** 031 * Cart 032 * 033 * <hr> 034 * Example to create an instance using the builder pattern 035 * <div class=code-example> 036 * <pre><code class='java'> 037 * Cart cart = Cart.builder() 038 * .id("{id}") 039 * .version(0.3) 040 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 041 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 042 * .plusLineItems(lineItemsBuilder -> lineItemsBuilder) 043 * .plusCustomLineItems(customLineItemsBuilder -> customLineItemsBuilder) 044 * .totalPrice(totalPriceBuilder -> totalPriceBuilder) 045 * .taxMode(TaxMode.PLATFORM) 046 * .taxRoundingMode(RoundingMode.HALF_EVEN) 047 * .taxCalculationMode(TaxCalculationMode.LINE_ITEM_LEVEL) 048 * .inventoryMode(InventoryMode.NONE) 049 * .cartState(CartState.ACTIVE) 050 * .shippingMode(ShippingMode.SINGLE) 051 * .plusShipping(shippingBuilder -> shippingBuilder) 052 * .plusItemShippingAddresses(itemShippingAddressesBuilder -> itemShippingAddressesBuilder) 053 * .plusDiscountCodes(discountCodesBuilder -> discountCodesBuilder) 054 * .plusDirectDiscounts(directDiscountsBuilder -> directDiscountsBuilder) 055 * .plusRefusedGifts(refusedGiftsBuilder -> refusedGiftsBuilder) 056 * .origin(CartOrigin.CUSTOMER) 057 * .build() 058 * </code></pre> 059 * </div> 060 */ 061@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 062@JsonDeserialize(as = CartImpl.class) 063public interface Cart extends BaseResource, CartMixin, com.commercetools.api.models.DomainResource<Cart>, 064 com.commercetools.api.models.Referencable<Cart>, com.commercetools.api.models.ResourceIdentifiable<Cart>, 065 com.commercetools.api.models.Customizable<Cart>, com.commercetools.api.models.order.OrderLike<Cart>, 066 com.commercetools.api.models.WithKey { 067 068 /** 069 * <p>Unique identifier of the Cart.</p> 070 * @return id 071 */ 072 @NotNull 073 @JsonProperty("id") 074 public String getId(); 075 076 /** 077 * <p>Current version of the Cart.</p> 078 * @return version 079 */ 080 @NotNull 081 @JsonProperty("version") 082 public Long getVersion(); 083 084 /** 085 * <p>User-defined unique identifier of the Cart.</p> 086 * @return key 087 */ 088 089 @JsonProperty("key") 090 public String getKey(); 091 092 /** 093 * <p><code>id</code> of the Customer that the Cart belongs to.</p> 094 * @return customerId 095 */ 096 097 @JsonProperty("customerId") 098 public String getCustomerId(); 099 100 /** 101 * <p>Email address of the Customer that the Cart belongs to.</p> 102 * @return customerEmail 103 */ 104 105 @JsonProperty("customerEmail") 106 public String getCustomerEmail(); 107 108 /** 109 * <p>Reference to the Customer Group of the Customer that the Cart belongs to. Used for LineItem Price selection.</p> 110 * @return customerGroup 111 */ 112 @Valid 113 @JsonProperty("customerGroup") 114 public CustomerGroupReference getCustomerGroup(); 115 116 /** 117 * <p>Anonymous session associated with the Cart.</p> 118 * @return anonymousId 119 */ 120 121 @JsonProperty("anonymousId") 122 public String getAnonymousId(); 123 124 /** 125 * <p>Reference to a Business Unit the Cart belongs to.</p> 126 * @return businessUnit 127 */ 128 @Valid 129 @JsonProperty("businessUnit") 130 public BusinessUnitKeyReference getBusinessUnit(); 131 132 /** 133 * <p>Reference to a Store the Cart belongs to.</p> 134 * @return store 135 */ 136 @Valid 137 @JsonProperty("store") 138 public StoreKeyReference getStore(); 139 140 /** 141 * <p>Line Items added to the Cart.</p> 142 * @return lineItems 143 */ 144 @NotNull 145 @Valid 146 @JsonProperty("lineItems") 147 public List<LineItem> getLineItems(); 148 149 /** 150 * <p>Custom Line Items added to the Cart.</p> 151 * @return customLineItems 152 */ 153 @NotNull 154 @Valid 155 @JsonProperty("customLineItems") 156 public List<CustomLineItem> getCustomLineItems(); 157 158 /** 159 * <p>Sum of all LineItem quantities, excluding CustomLineItems. Only present when the Cart has at least one LineItem.</p> 160 * @return totalLineItemQuantity 161 */ 162 163 @JsonProperty("totalLineItemQuantity") 164 public Long getTotalLineItemQuantity(); 165 166 /** 167 * <p>Sum of the <code>totalPrice</code> field of all LineItems and CustomLineItems, and if available, the <code>price</code> field of ShippingInfo.</p> 168 * <p>Taxes are included if TaxRate <code>includedInPrice</code> is <code>true</code> for each price.</p> 169 * @return totalPrice 170 */ 171 @NotNull 172 @Valid 173 @JsonProperty("totalPrice") 174 public CentPrecisionMoney getTotalPrice(); 175 176 /** 177 * <ul> 178 * <li>For a Cart with <code>Platform</code> TaxMode, it is automatically set when a shipping address is set.</li> 179 * <li>For a Cart with <code>External</code> TaxMode, it is automatically set when the external Tax Rate for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set.</li> 180 * </ul> 181 * @return taxedPrice 182 */ 183 @Valid 184 @JsonProperty("taxedPrice") 185 public TaxedPrice getTaxedPrice(); 186 187 /** 188 * <p>Sum of the <code>taxedPrice</code> field of ShippingInfo across all Shipping Methods.</p> 189 * @return taxedShippingPrice 190 */ 191 @Valid 192 @JsonProperty("taxedShippingPrice") 193 public TaxedPrice getTaxedShippingPrice(); 194 195 /** 196 * <p>Indicates how Tax Rates are set.</p> 197 * @return taxMode 198 */ 199 @NotNull 200 @JsonProperty("taxMode") 201 public TaxMode getTaxMode(); 202 203 /** 204 * <p>Indicates how monetary values are rounded when calculating taxes for <code>taxedPrice</code>.</p> 205 * @return taxRoundingMode 206 */ 207 @NotNull 208 @JsonProperty("taxRoundingMode") 209 public RoundingMode getTaxRoundingMode(); 210 211 /** 212 * <p>Indicates how taxes are calculated when calculating taxes for <code>taxedPrice</code>.</p> 213 * @return taxCalculationMode 214 */ 215 @NotNull 216 @JsonProperty("taxCalculationMode") 217 public TaxCalculationMode getTaxCalculationMode(); 218 219 /** 220 * <p>Indicates how stock quantities are tracked for Line Items in the Cart.</p> 221 * @return inventoryMode 222 */ 223 @NotNull 224 @JsonProperty("inventoryMode") 225 public InventoryMode getInventoryMode(); 226 227 /** 228 * <p>Current status of the Cart.</p> 229 * @return cartState 230 */ 231 @NotNull 232 @JsonProperty("cartState") 233 public CartState getCartState(); 234 235 /** 236 * <p>Billing address associated with the Cart.</p> 237 * @return billingAddress 238 */ 239 @Valid 240 @JsonProperty("billingAddress") 241 public Address getBillingAddress(); 242 243 /** 244 * <p>Shipping address associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.</p> 245 * @return shippingAddress 246 */ 247 @Valid 248 @JsonProperty("shippingAddress") 249 public Address getShippingAddress(); 250 251 /** 252 * <p>Indicates whether the Cart has one or multiple Shipping Methods.</p> 253 * @return shippingMode 254 */ 255 @NotNull 256 @JsonProperty("shippingMode") 257 public ShippingMode getShippingMode(); 258 259 /** 260 * <p>User-defined unique identifier of the Shipping Method in a Cart with <code>Single</code> ShippingMode.</p> 261 * @return shippingKey 262 */ 263 264 @JsonProperty("shippingKey") 265 public String getShippingKey(); 266 267 /** 268 * <p>Shipping-related information of a Cart with <code>Single</code> ShippingMode. Automatically set when a Shipping Method is set.</p> 269 * @return shippingInfo 270 */ 271 @Valid 272 @JsonProperty("shippingInfo") 273 public ShippingInfo getShippingInfo(); 274 275 /** 276 * <p>Input used to select a ShippingRatePriceTier. The data type of this field depends on the <code>shippingRateInputType.type</code> configured in the Project:</p> 277 * <ul> 278 * <li>If <code>CartClassification</code>, it is ClassificationShippingRateInput.</li> 279 * <li>If <code>CartScore</code>, it is ScoreShippingRateInput.</li> 280 * <li>If <code>CartValue</code>, it cannot be used.</li> 281 * </ul> 282 * @return shippingRateInput 283 */ 284 @Valid 285 @JsonProperty("shippingRateInput") 286 public ShippingRateInput getShippingRateInput(); 287 288 /** 289 * <p>Custom Fields of the Shipping Method in a Cart with <code>Single</code> ShippingMode.</p> 290 * @return shippingCustomFields 291 */ 292 @Valid 293 @JsonProperty("shippingCustomFields") 294 public CustomFields getShippingCustomFields(); 295 296 /** 297 * <p>Shipping-related information of a Cart with <code>Multiple</code> ShippingMode. Updated automatically each time a new Shipping Method is added.</p> 298 * @return shipping 299 */ 300 @NotNull 301 @Valid 302 @JsonProperty("shipping") 303 public List<Shipping> getShipping(); 304 305 /** 306 * <p>Additional shipping addresses of the Cart as specified by LineItems using the <code>shippingDetails</code> field.</p> 307 * <p>Eligible Shipping Methods or applicable Tax Rates are determined by the address in <code>shippingAddress</code>, and not <code>itemShippingAddresses</code>.</p> 308 * @return itemShippingAddresses 309 */ 310 @NotNull 311 @Valid 312 @JsonProperty("itemShippingAddresses") 313 public List<Address> getItemShippingAddresses(); 314 315 /** 316 * <p>Discount Codes applied to the Cart. A Cart that has <code>directDiscounts</code> cannot have <code>discountCodes</code>.</p> 317 * @return discountCodes 318 */ 319 @NotNull 320 @Valid 321 @JsonProperty("discountCodes") 322 public List<DiscountCodeInfo> getDiscountCodes(); 323 324 /** 325 * <p>Direct Discounts added to the Cart. A Cart that has <code>discountCodes</code> cannot have <code>directDiscounts</code>.</p> 326 * @return directDiscounts 327 */ 328 @NotNull 329 @Valid 330 @JsonProperty("directDiscounts") 331 public List<DirectDiscount> getDirectDiscounts(); 332 333 /** 334 * <p>Automatically set when a Line Item with <code>GiftLineItem</code> LineItemMode is removed from the Cart.</p> 335 * @return refusedGifts 336 */ 337 @NotNull 338 @Valid 339 @JsonProperty("refusedGifts") 340 public List<CartDiscountReference> getRefusedGifts(); 341 342 /** 343 * <p>Payment information related to the Cart.</p> 344 * @return paymentInfo 345 */ 346 @Valid 347 @JsonProperty("paymentInfo") 348 public PaymentInfo getPaymentInfo(); 349 350 /** 351 * <p>Used for LineItem Price selection.</p> 352 * @return country 353 */ 354 355 @JsonProperty("country") 356 public String getCountry(); 357 358 /** 359 * <p>Languages of the Cart. Can only contain languages supported by the Project.</p> 360 * @return locale 361 */ 362 363 @JsonProperty("locale") 364 public String getLocale(); 365 366 /** 367 * <p>Indicates how the Cart was created.</p> 368 * @return origin 369 */ 370 @NotNull 371 @JsonProperty("origin") 372 public CartOrigin getOrigin(); 373 374 /** 375 * <p>Custom Fields of the Cart.</p> 376 * @return custom 377 */ 378 @Valid 379 @JsonProperty("custom") 380 public CustomFields getCustom(); 381 382 /** 383 * <p>Number of days after which an active Cart is deleted since its last modification. Configured in Project settings.</p> 384 * @return deleteDaysAfterLastModification 385 */ 386 387 @JsonProperty("deleteDaysAfterLastModification") 388 public Integer getDeleteDaysAfterLastModification(); 389 390 /** 391 * <p>Date and time (UTC) the Cart was initially created.</p> 392 * @return createdAt 393 */ 394 @NotNull 395 @JsonProperty("createdAt") 396 public ZonedDateTime getCreatedAt(); 397 398 /** 399 * <p>Date and time (UTC) the Cart was last updated.</p> 400 * @return lastModifiedAt 401 */ 402 @NotNull 403 @JsonProperty("lastModifiedAt") 404 public ZonedDateTime getLastModifiedAt(); 405 406 /** 407 * <p>Present on resources updated after 1 February 2019 except for events not tracked.</p> 408 * @return lastModifiedBy 409 */ 410 @Valid 411 @JsonProperty("lastModifiedBy") 412 public LastModifiedBy getLastModifiedBy(); 413 414 /** 415 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 416 * @return createdBy 417 */ 418 @Valid 419 @JsonProperty("createdBy") 420 public CreatedBy getCreatedBy(); 421 422 /** 423 * <p>Unique identifier of the Cart.</p> 424 * @param id value to be set 425 */ 426 427 public void setId(final String id); 428 429 /** 430 * <p>Current version of the Cart.</p> 431 * @param version value to be set 432 */ 433 434 public void setVersion(final Long version); 435 436 /** 437 * <p>User-defined unique identifier of the Cart.</p> 438 * @param key value to be set 439 */ 440 441 public void setKey(final String key); 442 443 /** 444 * <p><code>id</code> of the Customer that the Cart belongs to.</p> 445 * @param customerId value to be set 446 */ 447 448 public void setCustomerId(final String customerId); 449 450 /** 451 * <p>Email address of the Customer that the Cart belongs to.</p> 452 * @param customerEmail value to be set 453 */ 454 455 public void setCustomerEmail(final String customerEmail); 456 457 /** 458 * <p>Reference to the Customer Group of the Customer that the Cart belongs to. Used for LineItem Price selection.</p> 459 * @param customerGroup value to be set 460 */ 461 462 public void setCustomerGroup(final CustomerGroupReference customerGroup); 463 464 /** 465 * <p>Anonymous session associated with the Cart.</p> 466 * @param anonymousId value to be set 467 */ 468 469 public void setAnonymousId(final String anonymousId); 470 471 /** 472 * <p>Reference to a Business Unit the Cart belongs to.</p> 473 * @param businessUnit value to be set 474 */ 475 476 public void setBusinessUnit(final BusinessUnitKeyReference businessUnit); 477 478 /** 479 * <p>Reference to a Store the Cart belongs to.</p> 480 * @param store value to be set 481 */ 482 483 public void setStore(final StoreKeyReference store); 484 485 /** 486 * <p>Line Items added to the Cart.</p> 487 * @param lineItems values to be set 488 */ 489 490 @JsonIgnore 491 public void setLineItems(final LineItem... lineItems); 492 493 /** 494 * <p>Line Items added to the Cart.</p> 495 * @param lineItems values to be set 496 */ 497 498 public void setLineItems(final List<LineItem> lineItems); 499 500 /** 501 * <p>Custom Line Items added to the Cart.</p> 502 * @param customLineItems values to be set 503 */ 504 505 @JsonIgnore 506 public void setCustomLineItems(final CustomLineItem... customLineItems); 507 508 /** 509 * <p>Custom Line Items added to the Cart.</p> 510 * @param customLineItems values to be set 511 */ 512 513 public void setCustomLineItems(final List<CustomLineItem> customLineItems); 514 515 /** 516 * <p>Sum of all LineItem quantities, excluding CustomLineItems. Only present when the Cart has at least one LineItem.</p> 517 * @param totalLineItemQuantity value to be set 518 */ 519 520 public void setTotalLineItemQuantity(final Long totalLineItemQuantity); 521 522 /** 523 * <p>Sum of the <code>totalPrice</code> field of all LineItems and CustomLineItems, and if available, the <code>price</code> field of ShippingInfo.</p> 524 * <p>Taxes are included if TaxRate <code>includedInPrice</code> is <code>true</code> for each price.</p> 525 * @param totalPrice value to be set 526 */ 527 528 public void setTotalPrice(final CentPrecisionMoney totalPrice); 529 530 /** 531 * <ul> 532 * <li>For a Cart with <code>Platform</code> TaxMode, it is automatically set when a shipping address is set.</li> 533 * <li>For a Cart with <code>External</code> TaxMode, it is automatically set when the external Tax Rate for all Line Items, Custom Line Items, and Shipping Methods in the Cart are set.</li> 534 * </ul> 535 * @param taxedPrice value to be set 536 */ 537 538 public void setTaxedPrice(final TaxedPrice taxedPrice); 539 540 /** 541 * <p>Sum of the <code>taxedPrice</code> field of ShippingInfo across all Shipping Methods.</p> 542 * @param taxedShippingPrice value to be set 543 */ 544 545 public void setTaxedShippingPrice(final TaxedPrice taxedShippingPrice); 546 547 /** 548 * <p>Indicates how Tax Rates are set.</p> 549 * @param taxMode value to be set 550 */ 551 552 public void setTaxMode(final TaxMode taxMode); 553 554 /** 555 * <p>Indicates how monetary values are rounded when calculating taxes for <code>taxedPrice</code>.</p> 556 * @param taxRoundingMode value to be set 557 */ 558 559 public void setTaxRoundingMode(final RoundingMode taxRoundingMode); 560 561 /** 562 * <p>Indicates how taxes are calculated when calculating taxes for <code>taxedPrice</code>.</p> 563 * @param taxCalculationMode value to be set 564 */ 565 566 public void setTaxCalculationMode(final TaxCalculationMode taxCalculationMode); 567 568 /** 569 * <p>Indicates how stock quantities are tracked for Line Items in the Cart.</p> 570 * @param inventoryMode value to be set 571 */ 572 573 public void setInventoryMode(final InventoryMode inventoryMode); 574 575 /** 576 * <p>Current status of the Cart.</p> 577 * @param cartState value to be set 578 */ 579 580 public void setCartState(final CartState cartState); 581 582 /** 583 * <p>Billing address associated with the Cart.</p> 584 * @param billingAddress value to be set 585 */ 586 587 public void setBillingAddress(final Address billingAddress); 588 589 /** 590 * <p>Shipping address associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items.</p> 591 * @param shippingAddress value to be set 592 */ 593 594 public void setShippingAddress(final Address shippingAddress); 595 596 /** 597 * <p>Indicates whether the Cart has one or multiple Shipping Methods.</p> 598 * @param shippingMode value to be set 599 */ 600 601 public void setShippingMode(final ShippingMode shippingMode); 602 603 /** 604 * <p>User-defined unique identifier of the Shipping Method in a Cart with <code>Single</code> ShippingMode.</p> 605 * @param shippingKey value to be set 606 */ 607 608 public void setShippingKey(final String shippingKey); 609 610 /** 611 * <p>Shipping-related information of a Cart with <code>Single</code> ShippingMode. Automatically set when a Shipping Method is set.</p> 612 * @param shippingInfo value to be set 613 */ 614 615 public void setShippingInfo(final ShippingInfo shippingInfo); 616 617 /** 618 * <p>Input used to select a ShippingRatePriceTier. The data type of this field depends on the <code>shippingRateInputType.type</code> configured in the Project:</p> 619 * <ul> 620 * <li>If <code>CartClassification</code>, it is ClassificationShippingRateInput.</li> 621 * <li>If <code>CartScore</code>, it is ScoreShippingRateInput.</li> 622 * <li>If <code>CartValue</code>, it cannot be used.</li> 623 * </ul> 624 * @param shippingRateInput value to be set 625 */ 626 627 public void setShippingRateInput(final ShippingRateInput shippingRateInput); 628 629 /** 630 * <p>Custom Fields of the Shipping Method in a Cart with <code>Single</code> ShippingMode.</p> 631 * @param shippingCustomFields value to be set 632 */ 633 634 public void setShippingCustomFields(final CustomFields shippingCustomFields); 635 636 /** 637 * <p>Shipping-related information of a Cart with <code>Multiple</code> ShippingMode. Updated automatically each time a new Shipping Method is added.</p> 638 * @param shipping values to be set 639 */ 640 641 @JsonIgnore 642 public void setShipping(final Shipping... shipping); 643 644 /** 645 * <p>Shipping-related information of a Cart with <code>Multiple</code> ShippingMode. Updated automatically each time a new Shipping Method is added.</p> 646 * @param shipping values to be set 647 */ 648 649 public void setShipping(final List<Shipping> shipping); 650 651 /** 652 * <p>Additional shipping addresses of the Cart as specified by LineItems using the <code>shippingDetails</code> field.</p> 653 * <p>Eligible Shipping Methods or applicable Tax Rates are determined by the address in <code>shippingAddress</code>, and not <code>itemShippingAddresses</code>.</p> 654 * @param itemShippingAddresses values to be set 655 */ 656 657 @JsonIgnore 658 public void setItemShippingAddresses(final Address... itemShippingAddresses); 659 660 /** 661 * <p>Additional shipping addresses of the Cart as specified by LineItems using the <code>shippingDetails</code> field.</p> 662 * <p>Eligible Shipping Methods or applicable Tax Rates are determined by the address in <code>shippingAddress</code>, and not <code>itemShippingAddresses</code>.</p> 663 * @param itemShippingAddresses values to be set 664 */ 665 666 public void setItemShippingAddresses(final List<Address> itemShippingAddresses); 667 668 /** 669 * <p>Discount Codes applied to the Cart. A Cart that has <code>directDiscounts</code> cannot have <code>discountCodes</code>.</p> 670 * @param discountCodes values to be set 671 */ 672 673 @JsonIgnore 674 public void setDiscountCodes(final DiscountCodeInfo... discountCodes); 675 676 /** 677 * <p>Discount Codes applied to the Cart. A Cart that has <code>directDiscounts</code> cannot have <code>discountCodes</code>.</p> 678 * @param discountCodes values to be set 679 */ 680 681 public void setDiscountCodes(final List<DiscountCodeInfo> discountCodes); 682 683 /** 684 * <p>Direct Discounts added to the Cart. A Cart that has <code>discountCodes</code> cannot have <code>directDiscounts</code>.</p> 685 * @param directDiscounts values to be set 686 */ 687 688 @JsonIgnore 689 public void setDirectDiscounts(final DirectDiscount... directDiscounts); 690 691 /** 692 * <p>Direct Discounts added to the Cart. A Cart that has <code>discountCodes</code> cannot have <code>directDiscounts</code>.</p> 693 * @param directDiscounts values to be set 694 */ 695 696 public void setDirectDiscounts(final List<DirectDiscount> directDiscounts); 697 698 /** 699 * <p>Automatically set when a Line Item with <code>GiftLineItem</code> LineItemMode is removed from the Cart.</p> 700 * @param refusedGifts values to be set 701 */ 702 703 @JsonIgnore 704 public void setRefusedGifts(final CartDiscountReference... refusedGifts); 705 706 /** 707 * <p>Automatically set when a Line Item with <code>GiftLineItem</code> LineItemMode is removed from the Cart.</p> 708 * @param refusedGifts values to be set 709 */ 710 711 public void setRefusedGifts(final List<CartDiscountReference> refusedGifts); 712 713 /** 714 * <p>Payment information related to the Cart.</p> 715 * @param paymentInfo value to be set 716 */ 717 718 public void setPaymentInfo(final PaymentInfo paymentInfo); 719 720 /** 721 * <p>Used for LineItem Price selection.</p> 722 * @param country value to be set 723 */ 724 725 public void setCountry(final String country); 726 727 /** 728 * <p>Languages of the Cart. Can only contain languages supported by the Project.</p> 729 * @param locale value to be set 730 */ 731 732 public void setLocale(final String locale); 733 734 /** 735 * <p>Indicates how the Cart was created.</p> 736 * @param origin value to be set 737 */ 738 739 public void setOrigin(final CartOrigin origin); 740 741 /** 742 * <p>Custom Fields of the Cart.</p> 743 * @param custom value to be set 744 */ 745 746 public void setCustom(final CustomFields custom); 747 748 /** 749 * <p>Number of days after which an active Cart is deleted since its last modification. Configured in Project settings.</p> 750 * @param deleteDaysAfterLastModification value to be set 751 */ 752 753 public void setDeleteDaysAfterLastModification(final Integer deleteDaysAfterLastModification); 754 755 /** 756 * <p>Date and time (UTC) the Cart was initially created.</p> 757 * @param createdAt value to be set 758 */ 759 760 public void setCreatedAt(final ZonedDateTime createdAt); 761 762 /** 763 * <p>Date and time (UTC) the Cart was last updated.</p> 764 * @param lastModifiedAt value to be set 765 */ 766 767 public void setLastModifiedAt(final ZonedDateTime lastModifiedAt); 768 769 /** 770 * <p>Present on resources updated after 1 February 2019 except for events not tracked.</p> 771 * @param lastModifiedBy value to be set 772 */ 773 774 public void setLastModifiedBy(final LastModifiedBy lastModifiedBy); 775 776 /** 777 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 778 * @param createdBy value to be set 779 */ 780 781 public void setCreatedBy(final CreatedBy createdBy); 782 783 /** 784 * factory method 785 * @return instance of Cart 786 */ 787 public static Cart of() { 788 return new CartImpl(); 789 } 790 791 /** 792 * factory method to create a shallow copy Cart 793 * @param template instance to be copied 794 * @return copy instance 795 */ 796 public static Cart of(final Cart template) { 797 CartImpl instance = new CartImpl(); 798 instance.setId(template.getId()); 799 instance.setVersion(template.getVersion()); 800 instance.setCreatedAt(template.getCreatedAt()); 801 instance.setLastModifiedAt(template.getLastModifiedAt()); 802 instance.setKey(template.getKey()); 803 instance.setCustomerId(template.getCustomerId()); 804 instance.setCustomerEmail(template.getCustomerEmail()); 805 instance.setCustomerGroup(template.getCustomerGroup()); 806 instance.setAnonymousId(template.getAnonymousId()); 807 instance.setBusinessUnit(template.getBusinessUnit()); 808 instance.setStore(template.getStore()); 809 instance.setLineItems(template.getLineItems()); 810 instance.setCustomLineItems(template.getCustomLineItems()); 811 instance.setTotalLineItemQuantity(template.getTotalLineItemQuantity()); 812 instance.setTotalPrice(template.getTotalPrice()); 813 instance.setTaxedPrice(template.getTaxedPrice()); 814 instance.setTaxedShippingPrice(template.getTaxedShippingPrice()); 815 instance.setTaxMode(template.getTaxMode()); 816 instance.setTaxRoundingMode(template.getTaxRoundingMode()); 817 instance.setTaxCalculationMode(template.getTaxCalculationMode()); 818 instance.setInventoryMode(template.getInventoryMode()); 819 instance.setCartState(template.getCartState()); 820 instance.setBillingAddress(template.getBillingAddress()); 821 instance.setShippingAddress(template.getShippingAddress()); 822 instance.setShippingMode(template.getShippingMode()); 823 instance.setShippingKey(template.getShippingKey()); 824 instance.setShippingInfo(template.getShippingInfo()); 825 instance.setShippingRateInput(template.getShippingRateInput()); 826 instance.setShippingCustomFields(template.getShippingCustomFields()); 827 instance.setShipping(template.getShipping()); 828 instance.setItemShippingAddresses(template.getItemShippingAddresses()); 829 instance.setDiscountCodes(template.getDiscountCodes()); 830 instance.setDirectDiscounts(template.getDirectDiscounts()); 831 instance.setRefusedGifts(template.getRefusedGifts()); 832 instance.setPaymentInfo(template.getPaymentInfo()); 833 instance.setCountry(template.getCountry()); 834 instance.setLocale(template.getLocale()); 835 instance.setOrigin(template.getOrigin()); 836 instance.setCustom(template.getCustom()); 837 instance.setDeleteDaysAfterLastModification(template.getDeleteDaysAfterLastModification()); 838 instance.setLastModifiedBy(template.getLastModifiedBy()); 839 instance.setCreatedBy(template.getCreatedBy()); 840 return instance; 841 } 842 843 /** 844 * factory method to create a deep copy of Cart 845 * @param template instance to be copied 846 * @return copy instance 847 */ 848 @Nullable 849 public static Cart deepCopy(@Nullable final Cart template) { 850 if (template == null) { 851 return null; 852 } 853 CartImpl instance = new CartImpl(); 854 instance.setId(template.getId()); 855 instance.setVersion(template.getVersion()); 856 instance.setCreatedAt(template.getCreatedAt()); 857 instance.setLastModifiedAt(template.getLastModifiedAt()); 858 instance.setKey(template.getKey()); 859 instance.setCustomerId(template.getCustomerId()); 860 instance.setCustomerEmail(template.getCustomerEmail()); 861 instance.setCustomerGroup( 862 com.commercetools.api.models.customer_group.CustomerGroupReference.deepCopy(template.getCustomerGroup())); 863 instance.setAnonymousId(template.getAnonymousId()); 864 instance.setBusinessUnit( 865 com.commercetools.api.models.business_unit.BusinessUnitKeyReference.deepCopy(template.getBusinessUnit())); 866 instance.setStore(com.commercetools.api.models.store.StoreKeyReference.deepCopy(template.getStore())); 867 instance.setLineItems(Optional.ofNullable(template.getLineItems()) 868 .map(t -> t.stream() 869 .map(com.commercetools.api.models.cart.LineItem::deepCopy) 870 .collect(Collectors.toList())) 871 .orElse(null)); 872 instance.setCustomLineItems(Optional.ofNullable(template.getCustomLineItems()) 873 .map(t -> t.stream() 874 .map(com.commercetools.api.models.cart.CustomLineItem::deepCopy) 875 .collect(Collectors.toList())) 876 .orElse(null)); 877 instance.setTotalLineItemQuantity(template.getTotalLineItemQuantity()); 878 instance.setTotalPrice( 879 com.commercetools.api.models.common.CentPrecisionMoney.deepCopy(template.getTotalPrice())); 880 instance.setTaxedPrice(com.commercetools.api.models.cart.TaxedPrice.deepCopy(template.getTaxedPrice())); 881 instance.setTaxedShippingPrice( 882 com.commercetools.api.models.cart.TaxedPrice.deepCopy(template.getTaxedShippingPrice())); 883 instance.setTaxMode(template.getTaxMode()); 884 instance.setTaxRoundingMode(template.getTaxRoundingMode()); 885 instance.setTaxCalculationMode(template.getTaxCalculationMode()); 886 instance.setInventoryMode(template.getInventoryMode()); 887 instance.setCartState(template.getCartState()); 888 instance.setBillingAddress(com.commercetools.api.models.common.Address.deepCopy(template.getBillingAddress())); 889 instance.setShippingAddress( 890 com.commercetools.api.models.common.Address.deepCopy(template.getShippingAddress())); 891 instance.setShippingMode(template.getShippingMode()); 892 instance.setShippingKey(template.getShippingKey()); 893 instance.setShippingInfo(com.commercetools.api.models.cart.ShippingInfo.deepCopy(template.getShippingInfo())); 894 instance.setShippingRateInput( 895 com.commercetools.api.models.cart.ShippingRateInput.deepCopy(template.getShippingRateInput())); 896 instance.setShippingCustomFields( 897 com.commercetools.api.models.type.CustomFields.deepCopy(template.getShippingCustomFields())); 898 instance.setShipping(Optional.ofNullable(template.getShipping()) 899 .map(t -> t.stream() 900 .map(com.commercetools.api.models.cart.Shipping::deepCopy) 901 .collect(Collectors.toList())) 902 .orElse(null)); 903 instance.setItemShippingAddresses(Optional.ofNullable(template.getItemShippingAddresses()) 904 .map(t -> t.stream() 905 .map(com.commercetools.api.models.common.Address::deepCopy) 906 .collect(Collectors.toList())) 907 .orElse(null)); 908 instance.setDiscountCodes(Optional.ofNullable(template.getDiscountCodes()) 909 .map(t -> t.stream() 910 .map(com.commercetools.api.models.cart.DiscountCodeInfo::deepCopy) 911 .collect(Collectors.toList())) 912 .orElse(null)); 913 instance.setDirectDiscounts(Optional.ofNullable(template.getDirectDiscounts()) 914 .map(t -> t.stream() 915 .map(com.commercetools.api.models.cart.DirectDiscount::deepCopy) 916 .collect(Collectors.toList())) 917 .orElse(null)); 918 instance.setRefusedGifts(Optional.ofNullable(template.getRefusedGifts()) 919 .map(t -> t.stream() 920 .map(com.commercetools.api.models.cart_discount.CartDiscountReference::deepCopy) 921 .collect(Collectors.toList())) 922 .orElse(null)); 923 instance.setPaymentInfo(com.commercetools.api.models.order.PaymentInfo.deepCopy(template.getPaymentInfo())); 924 instance.setCountry(template.getCountry()); 925 instance.setLocale(template.getLocale()); 926 instance.setOrigin(template.getOrigin()); 927 instance.setCustom(com.commercetools.api.models.type.CustomFields.deepCopy(template.getCustom())); 928 instance.setDeleteDaysAfterLastModification(template.getDeleteDaysAfterLastModification()); 929 instance.setLastModifiedBy( 930 com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy())); 931 instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy())); 932 return instance; 933 } 934 935 /** 936 * builder factory method for Cart 937 * @return builder 938 */ 939 public static CartBuilder builder() { 940 return CartBuilder.of(); 941 } 942 943 /** 944 * create builder for Cart instance 945 * @param template instance with prefilled values for the builder 946 * @return builder 947 */ 948 public static CartBuilder builder(final Cart template) { 949 return CartBuilder.of(template); 950 } 951 952 /** 953 * accessor map function 954 * @param <T> mapped type 955 * @param helper function to map the object 956 * @return mapped value 957 */ 958 default <T> T withCart(Function<Cart, T> helper) { 959 return helper.apply(this); 960 } 961 962 /** 963 * gives a TypeReference for usage with Jackson DataBind 964 * @return TypeReference 965 */ 966 public static com.fasterxml.jackson.core.type.TypeReference<Cart> typeReference() { 967 return new com.fasterxml.jackson.core.type.TypeReference<Cart>() { 968 @Override 969 public String toString() { 970 return "TypeReference<Cart>"; 971 } 972 }; 973 } 974}