001 002package com.commercetools.api.models.order; 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.CartOrigin; 016import com.commercetools.api.models.cart.CartReference; 017import com.commercetools.api.models.cart.CustomLineItem; 018import com.commercetools.api.models.cart.DiscountCodeInfo; 019import com.commercetools.api.models.cart.InventoryMode; 020import com.commercetools.api.models.cart.LineItem; 021import com.commercetools.api.models.cart.RoundingMode; 022import com.commercetools.api.models.cart.Shipping; 023import com.commercetools.api.models.cart.ShippingInfo; 024import com.commercetools.api.models.cart.ShippingMode; 025import com.commercetools.api.models.cart.ShippingRateInput; 026import com.commercetools.api.models.cart.TaxCalculationMode; 027import com.commercetools.api.models.cart.TaxMode; 028import com.commercetools.api.models.cart.TaxedPrice; 029import com.commercetools.api.models.cart_discount.CartDiscountReference; 030import com.commercetools.api.models.common.Address; 031import com.commercetools.api.models.common.BaseResource; 032import com.commercetools.api.models.common.CreatedBy; 033import com.commercetools.api.models.common.LastModifiedBy; 034import com.commercetools.api.models.common.TypedMoney; 035import com.commercetools.api.models.customer_group.CustomerGroupReference; 036import com.commercetools.api.models.quote.QuoteReference; 037import com.commercetools.api.models.state.StateReference; 038import com.commercetools.api.models.store.StoreKeyReference; 039import com.commercetools.api.models.type.CustomFields; 040import com.fasterxml.jackson.annotation.*; 041import com.fasterxml.jackson.databind.annotation.*; 042 043import io.vrap.rmf.base.client.utils.Generated; 044 045/** 046 * Order 047 * 048 * <hr> 049 * Example to create an instance using the builder pattern 050 * <div class=code-example> 051 * <pre><code class='java'> 052 * Order order = Order.builder() 053 * .id("{id}") 054 * .version(0.3) 055 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 056 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 057 * .plusLineItems(lineItemsBuilder -> lineItemsBuilder) 058 * .plusCustomLineItems(customLineItemsBuilder -> customLineItemsBuilder) 059 * .totalPrice(totalPriceBuilder -> totalPriceBuilder) 060 * .shippingMode(ShippingMode.SINGLE) 061 * .plusShipping(shippingBuilder -> shippingBuilder) 062 * .orderState(OrderState.OPEN) 063 * .plusSyncInfo(syncInfoBuilder -> syncInfoBuilder) 064 * .origin(CartOrigin.CUSTOMER) 065 * .plusRefusedGifts(refusedGiftsBuilder -> refusedGiftsBuilder) 066 * .build() 067 * </code></pre> 068 * </div> 069 */ 070@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 071@JsonDeserialize(as = OrderImpl.class) 072public interface Order extends BaseResource, OrderMixin, com.commercetools.api.models.DomainResource<Order>, 073 com.commercetools.api.models.Referencable<Order>, com.commercetools.api.models.ResourceIdentifiable<Order>, 074 com.commercetools.api.models.Customizable<Order>, com.commercetools.api.models.order.OrderLike<Order> { 075 076 /** 077 * <p>Unique identifier of the Order.</p> 078 * @return id 079 */ 080 @NotNull 081 @JsonProperty("id") 082 public String getId(); 083 084 /** 085 * <p>The current version of the order.</p> 086 * @return version 087 */ 088 @NotNull 089 @JsonProperty("version") 090 public Long getVersion(); 091 092 /** 093 * 094 * @return createdAt 095 */ 096 @NotNull 097 @JsonProperty("createdAt") 098 public ZonedDateTime getCreatedAt(); 099 100 /** 101 * 102 * @return lastModifiedAt 103 */ 104 @NotNull 105 @JsonProperty("lastModifiedAt") 106 public ZonedDateTime getLastModifiedAt(); 107 108 /** 109 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 110 * @return lastModifiedBy 111 */ 112 @Valid 113 @JsonProperty("lastModifiedBy") 114 public LastModifiedBy getLastModifiedBy(); 115 116 /** 117 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 118 * @return createdBy 119 */ 120 @Valid 121 @JsonProperty("createdBy") 122 public CreatedBy getCreatedBy(); 123 124 /** 125 * <p>This field will only be present if it was set for Order Import</p> 126 * @return completedAt 127 */ 128 129 @JsonProperty("completedAt") 130 public ZonedDateTime getCompletedAt(); 131 132 /** 133 * <p>String that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique across a project. Once it's set it cannot be changed.</p> 134 * @return orderNumber 135 */ 136 137 @JsonProperty("orderNumber") 138 public String getOrderNumber(); 139 140 /** 141 * 142 * @return customerId 143 */ 144 145 @JsonProperty("customerId") 146 public String getCustomerId(); 147 148 /** 149 * 150 * @return customerEmail 151 */ 152 153 @JsonProperty("customerEmail") 154 public String getCustomerEmail(); 155 156 /** 157 * <p>Identifies carts and orders belonging to an anonymous session (the customer has not signed up/in yet).</p> 158 * @return anonymousId 159 */ 160 161 @JsonProperty("anonymousId") 162 public String getAnonymousId(); 163 164 /** 165 * <p>The Business Unit the Order belongs to.</p> 166 * @return businessUnit 167 */ 168 @Valid 169 @JsonProperty("businessUnit") 170 public BusinessUnitKeyReference getBusinessUnit(); 171 172 /** 173 * 174 * @return store 175 */ 176 @Valid 177 @JsonProperty("store") 178 public StoreKeyReference getStore(); 179 180 /** 181 * 182 * @return lineItems 183 */ 184 @NotNull 185 @Valid 186 @JsonProperty("lineItems") 187 public List<LineItem> getLineItems(); 188 189 /** 190 * 191 * @return customLineItems 192 */ 193 @NotNull 194 @Valid 195 @JsonProperty("customLineItems") 196 public List<CustomLineItem> getCustomLineItems(); 197 198 /** 199 * 200 * @return totalPrice 201 */ 202 @NotNull 203 @Valid 204 @JsonProperty("totalPrice") 205 public TypedMoney getTotalPrice(); 206 207 /** 208 * <p>The taxes are calculated based on the shipping address.</p> 209 * @return taxedPrice 210 */ 211 @Valid 212 @JsonProperty("taxedPrice") 213 public TaxedPrice getTaxedPrice(); 214 215 /** 216 * <p>Sum of <code>taxedPrice</code> of ShippingInfo across all Shipping Methods. For <code>Platform</code> TaxMode, it is set automatically only if shipping address is set or Shipping Method is added to the Cart.</p> 217 * @return taxedShippingPrice 218 */ 219 @Valid 220 @JsonProperty("taxedShippingPrice") 221 public TaxedPrice getTaxedShippingPrice(); 222 223 /** 224 * <p>Holds all shipping-related information per Shipping Method.</p> 225 * <p>For <code>Multi</code> ShippingMode, it is updated automatically after the Shipping Methods are added.</p> 226 * @return shippingAddress 227 */ 228 @Valid 229 @JsonProperty("shippingAddress") 230 public Address getShippingAddress(); 231 232 /** 233 * 234 * @return billingAddress 235 */ 236 @Valid 237 @JsonProperty("billingAddress") 238 public Address getBillingAddress(); 239 240 /** 241 * <p>Indicates whether one or multiple Shipping Methods are added to the Cart.</p> 242 * @return shippingMode 243 */ 244 @NotNull 245 @JsonProperty("shippingMode") 246 public ShippingMode getShippingMode(); 247 248 /** 249 * <p>User-defined unique identifier of the Shipping Method with <code>Single</code> ShippingMode.</p> 250 * @return shippingKey 251 */ 252 253 @JsonProperty("shippingKey") 254 public String getShippingKey(); 255 256 /** 257 * <p>Custom Fields of the Shipping Method for <code>Single</code> ShippingMode.</p> 258 * @return shippingCustomFields 259 */ 260 @Valid 261 @JsonProperty("shippingCustomFields") 262 public CustomFields getShippingCustomFields(); 263 264 /** 265 * <p>Holds all shipping-related information per Shipping Method for <code>Multi</code> ShippingMode.</p> 266 * <p>It is updated automatically after the Shipping Method is added.</p> 267 * @return shipping 268 */ 269 @NotNull 270 @Valid 271 @JsonProperty("shipping") 272 public List<Shipping> getShipping(); 273 274 /** 275 * 276 * @return taxMode 277 */ 278 279 @JsonProperty("taxMode") 280 public TaxMode getTaxMode(); 281 282 /** 283 * <p>When calculating taxes for <code>taxedPrice</code>, the selected mode is used for rouding.</p> 284 * @return taxRoundingMode 285 */ 286 287 @JsonProperty("taxRoundingMode") 288 public RoundingMode getTaxRoundingMode(); 289 290 /** 291 * <p>Set when the customer is set and the customer is a member of a customer group. Used for product variant price selection.</p> 292 * @return customerGroup 293 */ 294 @Valid 295 @JsonProperty("customerGroup") 296 public CustomerGroupReference getCustomerGroup(); 297 298 /** 299 * <p>A two-digit country code as per ISO 3166-1 alpha-2. Used for product variant price selection.</p> 300 * @return country 301 */ 302 303 @JsonProperty("country") 304 public String getCountry(); 305 306 /** 307 * <p>One of the four predefined OrderStates.</p> 308 * @return orderState 309 */ 310 @NotNull 311 @JsonProperty("orderState") 312 public OrderState getOrderState(); 313 314 /** 315 * <p>This reference can point to a state in a custom workflow.</p> 316 * @return state 317 */ 318 @Valid 319 @JsonProperty("state") 320 public StateReference getState(); 321 322 /** 323 * 324 * @return shipmentState 325 */ 326 327 @JsonProperty("shipmentState") 328 public ShipmentState getShipmentState(); 329 330 /** 331 * 332 * @return paymentState 333 */ 334 335 @JsonProperty("paymentState") 336 public PaymentState getPaymentState(); 337 338 /** 339 * <p>Set if the ShippingMethod is set.</p> 340 * @return shippingInfo 341 */ 342 @Valid 343 @JsonProperty("shippingInfo") 344 public ShippingInfo getShippingInfo(); 345 346 /** 347 * 348 * @return syncInfo 349 */ 350 @NotNull 351 @Valid 352 @JsonProperty("syncInfo") 353 public List<SyncInfo> getSyncInfo(); 354 355 /** 356 * 357 * @return returnInfo 358 */ 359 @Valid 360 @JsonProperty("returnInfo") 361 public List<ReturnInfo> getReturnInfo(); 362 363 /** 364 * <p>The Purchase Order Number is typically set by the Buyer on a QuoteRequest to track the purchase order during the quote and order flow.</p> 365 * @return purchaseOrderNumber 366 */ 367 368 @JsonProperty("purchaseOrderNumber") 369 public String getPurchaseOrderNumber(); 370 371 /** 372 * 373 * @return discountCodes 374 */ 375 @Valid 376 @JsonProperty("discountCodes") 377 public List<DiscountCodeInfo> getDiscountCodes(); 378 379 /** 380 * <p>Internal-only field.</p> 381 * @return lastMessageSequenceNumber 382 */ 383 @Deprecated 384 @JsonProperty("lastMessageSequenceNumber") 385 public Long getLastMessageSequenceNumber(); 386 387 /** 388 * <p>Set when this order was created from a cart. The cart will have the state <code>Ordered</code>.</p> 389 * @return cart 390 */ 391 @Valid 392 @JsonProperty("cart") 393 public CartReference getCart(); 394 395 /** 396 * <p>Set when this order was created from a quote.</p> 397 * @return quote 398 */ 399 @Valid 400 @JsonProperty("quote") 401 public QuoteReference getQuote(); 402 403 /** 404 * 405 * @return custom 406 */ 407 @Valid 408 @JsonProperty("custom") 409 public CustomFields getCustom(); 410 411 /** 412 * 413 * @return paymentInfo 414 */ 415 @Valid 416 @JsonProperty("paymentInfo") 417 public PaymentInfo getPaymentInfo(); 418 419 /** 420 * 421 * @return locale 422 */ 423 424 @JsonProperty("locale") 425 public String getLocale(); 426 427 /** 428 * 429 * @return inventoryMode 430 */ 431 432 @JsonProperty("inventoryMode") 433 public InventoryMode getInventoryMode(); 434 435 /** 436 * 437 * @return origin 438 */ 439 @NotNull 440 @JsonProperty("origin") 441 public CartOrigin getOrigin(); 442 443 /** 444 * <p>When calculating taxes for <code>taxedPrice</code>, the selected mode is used for calculating the price with LineItemLevel (horizontally) or UnitPriceLevel (vertically) calculation mode.</p> 445 * @return taxCalculationMode 446 */ 447 448 @JsonProperty("taxCalculationMode") 449 public TaxCalculationMode getTaxCalculationMode(); 450 451 /** 452 * <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> 453 * <ul> 454 * <li>If <code>CartClassification</code>, it is ClassificationShippingRateInput.</li> 455 * <li>If <code>CartScore</code>, it is ScoreShippingRateInput.</li> 456 * <li>If <code>CartValue</code>, it cannot be used.</li> 457 * </ul> 458 * @return shippingRateInput 459 */ 460 @Valid 461 @JsonProperty("shippingRateInput") 462 public ShippingRateInput getShippingRateInput(); 463 464 /** 465 * <p>Contains addresses for orders with multiple shipping addresses.</p> 466 * @return itemShippingAddresses 467 */ 468 @Valid 469 @JsonProperty("itemShippingAddresses") 470 public List<Address> getItemShippingAddresses(); 471 472 /** 473 * <p>Automatically filled when a line item with LineItemMode <code>GiftLineItem</code> is removed from this order.</p> 474 * @return refusedGifts 475 */ 476 @NotNull 477 @Valid 478 @JsonProperty("refusedGifts") 479 public List<CartDiscountReference> getRefusedGifts(); 480 481 /** 482 * <p>Unique identifier of the Order.</p> 483 * @param id value to be set 484 */ 485 486 public void setId(final String id); 487 488 /** 489 * <p>The current version of the order.</p> 490 * @param version value to be set 491 */ 492 493 public void setVersion(final Long version); 494 495 /** 496 * set createdAt 497 * @param createdAt value to be set 498 */ 499 500 public void setCreatedAt(final ZonedDateTime createdAt); 501 502 /** 503 * set lastModifiedAt 504 * @param lastModifiedAt value to be set 505 */ 506 507 public void setLastModifiedAt(final ZonedDateTime lastModifiedAt); 508 509 /** 510 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 511 * @param lastModifiedBy value to be set 512 */ 513 514 public void setLastModifiedBy(final LastModifiedBy lastModifiedBy); 515 516 /** 517 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 518 * @param createdBy value to be set 519 */ 520 521 public void setCreatedBy(final CreatedBy createdBy); 522 523 /** 524 * <p>This field will only be present if it was set for Order Import</p> 525 * @param completedAt value to be set 526 */ 527 528 public void setCompletedAt(final ZonedDateTime completedAt); 529 530 /** 531 * <p>String that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique across a project. Once it's set it cannot be changed.</p> 532 * @param orderNumber value to be set 533 */ 534 535 public void setOrderNumber(final String orderNumber); 536 537 /** 538 * set customerId 539 * @param customerId value to be set 540 */ 541 542 public void setCustomerId(final String customerId); 543 544 /** 545 * set customerEmail 546 * @param customerEmail value to be set 547 */ 548 549 public void setCustomerEmail(final String customerEmail); 550 551 /** 552 * <p>Identifies carts and orders belonging to an anonymous session (the customer has not signed up/in yet).</p> 553 * @param anonymousId value to be set 554 */ 555 556 public void setAnonymousId(final String anonymousId); 557 558 /** 559 * <p>The Business Unit the Order belongs to.</p> 560 * @param businessUnit value to be set 561 */ 562 563 public void setBusinessUnit(final BusinessUnitKeyReference businessUnit); 564 565 /** 566 * set store 567 * @param store value to be set 568 */ 569 570 public void setStore(final StoreKeyReference store); 571 572 /** 573 * set lineItems 574 * @param lineItems values to be set 575 */ 576 577 @JsonIgnore 578 public void setLineItems(final LineItem... lineItems); 579 580 /** 581 * set lineItems 582 * @param lineItems values to be set 583 */ 584 585 public void setLineItems(final List<LineItem> lineItems); 586 587 /** 588 * set customLineItems 589 * @param customLineItems values to be set 590 */ 591 592 @JsonIgnore 593 public void setCustomLineItems(final CustomLineItem... customLineItems); 594 595 /** 596 * set customLineItems 597 * @param customLineItems values to be set 598 */ 599 600 public void setCustomLineItems(final List<CustomLineItem> customLineItems); 601 602 /** 603 * set totalPrice 604 * @param totalPrice value to be set 605 */ 606 607 public void setTotalPrice(final TypedMoney totalPrice); 608 609 /** 610 * <p>The taxes are calculated based on the shipping address.</p> 611 * @param taxedPrice value to be set 612 */ 613 614 public void setTaxedPrice(final TaxedPrice taxedPrice); 615 616 /** 617 * <p>Sum of <code>taxedPrice</code> of ShippingInfo across all Shipping Methods. For <code>Platform</code> TaxMode, it is set automatically only if shipping address is set or Shipping Method is added to the Cart.</p> 618 * @param taxedShippingPrice value to be set 619 */ 620 621 public void setTaxedShippingPrice(final TaxedPrice taxedShippingPrice); 622 623 /** 624 * <p>Holds all shipping-related information per Shipping Method.</p> 625 * <p>For <code>Multi</code> ShippingMode, it is updated automatically after the Shipping Methods are added.</p> 626 * @param shippingAddress value to be set 627 */ 628 629 public void setShippingAddress(final Address shippingAddress); 630 631 /** 632 * set billingAddress 633 * @param billingAddress value to be set 634 */ 635 636 public void setBillingAddress(final Address billingAddress); 637 638 /** 639 * <p>Indicates whether one or multiple Shipping Methods are added to the Cart.</p> 640 * @param shippingMode value to be set 641 */ 642 643 public void setShippingMode(final ShippingMode shippingMode); 644 645 /** 646 * <p>User-defined unique identifier of the Shipping Method with <code>Single</code> ShippingMode.</p> 647 * @param shippingKey value to be set 648 */ 649 650 public void setShippingKey(final String shippingKey); 651 652 /** 653 * <p>Custom Fields of the Shipping Method for <code>Single</code> ShippingMode.</p> 654 * @param shippingCustomFields value to be set 655 */ 656 657 public void setShippingCustomFields(final CustomFields shippingCustomFields); 658 659 /** 660 * <p>Holds all shipping-related information per Shipping Method for <code>Multi</code> ShippingMode.</p> 661 * <p>It is updated automatically after the Shipping Method is added.</p> 662 * @param shipping values to be set 663 */ 664 665 @JsonIgnore 666 public void setShipping(final Shipping... shipping); 667 668 /** 669 * <p>Holds all shipping-related information per Shipping Method for <code>Multi</code> ShippingMode.</p> 670 * <p>It is updated automatically after the Shipping Method is added.</p> 671 * @param shipping values to be set 672 */ 673 674 public void setShipping(final List<Shipping> shipping); 675 676 /** 677 * set taxMode 678 * @param taxMode value to be set 679 */ 680 681 public void setTaxMode(final TaxMode taxMode); 682 683 /** 684 * <p>When calculating taxes for <code>taxedPrice</code>, the selected mode is used for rouding.</p> 685 * @param taxRoundingMode value to be set 686 */ 687 688 public void setTaxRoundingMode(final RoundingMode taxRoundingMode); 689 690 /** 691 * <p>Set when the customer is set and the customer is a member of a customer group. Used for product variant price selection.</p> 692 * @param customerGroup value to be set 693 */ 694 695 public void setCustomerGroup(final CustomerGroupReference customerGroup); 696 697 /** 698 * <p>A two-digit country code as per ISO 3166-1 alpha-2. Used for product variant price selection.</p> 699 * @param country value to be set 700 */ 701 702 public void setCountry(final String country); 703 704 /** 705 * <p>One of the four predefined OrderStates.</p> 706 * @param orderState value to be set 707 */ 708 709 public void setOrderState(final OrderState orderState); 710 711 /** 712 * <p>This reference can point to a state in a custom workflow.</p> 713 * @param state value to be set 714 */ 715 716 public void setState(final StateReference state); 717 718 /** 719 * set shipmentState 720 * @param shipmentState value to be set 721 */ 722 723 public void setShipmentState(final ShipmentState shipmentState); 724 725 /** 726 * set paymentState 727 * @param paymentState value to be set 728 */ 729 730 public void setPaymentState(final PaymentState paymentState); 731 732 /** 733 * <p>Set if the ShippingMethod is set.</p> 734 * @param shippingInfo value to be set 735 */ 736 737 public void setShippingInfo(final ShippingInfo shippingInfo); 738 739 /** 740 * set syncInfo 741 * @param syncInfo values to be set 742 */ 743 744 @JsonIgnore 745 public void setSyncInfo(final SyncInfo... syncInfo); 746 747 /** 748 * set syncInfo 749 * @param syncInfo values to be set 750 */ 751 752 public void setSyncInfo(final List<SyncInfo> syncInfo); 753 754 /** 755 * set returnInfo 756 * @param returnInfo values to be set 757 */ 758 759 @JsonIgnore 760 public void setReturnInfo(final ReturnInfo... returnInfo); 761 762 /** 763 * set returnInfo 764 * @param returnInfo values to be set 765 */ 766 767 public void setReturnInfo(final List<ReturnInfo> returnInfo); 768 769 /** 770 * <p>The Purchase Order Number is typically set by the Buyer on a QuoteRequest to track the purchase order during the quote and order flow.</p> 771 * @param purchaseOrderNumber value to be set 772 */ 773 774 public void setPurchaseOrderNumber(final String purchaseOrderNumber); 775 776 /** 777 * set discountCodes 778 * @param discountCodes values to be set 779 */ 780 781 @JsonIgnore 782 public void setDiscountCodes(final DiscountCodeInfo... discountCodes); 783 784 /** 785 * set discountCodes 786 * @param discountCodes values to be set 787 */ 788 789 public void setDiscountCodes(final List<DiscountCodeInfo> discountCodes); 790 791 /** 792 * <p>Internal-only field.</p> 793 * @param lastMessageSequenceNumber value to be set 794 */ 795 @Deprecated 796 public void setLastMessageSequenceNumber(final Long lastMessageSequenceNumber); 797 798 /** 799 * <p>Set when this order was created from a cart. The cart will have the state <code>Ordered</code>.</p> 800 * @param cart value to be set 801 */ 802 803 public void setCart(final CartReference cart); 804 805 /** 806 * <p>Set when this order was created from a quote.</p> 807 * @param quote value to be set 808 */ 809 810 public void setQuote(final QuoteReference quote); 811 812 /** 813 * set custom 814 * @param custom value to be set 815 */ 816 817 public void setCustom(final CustomFields custom); 818 819 /** 820 * set paymentInfo 821 * @param paymentInfo value to be set 822 */ 823 824 public void setPaymentInfo(final PaymentInfo paymentInfo); 825 826 /** 827 * set locale 828 * @param locale value to be set 829 */ 830 831 public void setLocale(final String locale); 832 833 /** 834 * set inventoryMode 835 * @param inventoryMode value to be set 836 */ 837 838 public void setInventoryMode(final InventoryMode inventoryMode); 839 840 /** 841 * set origin 842 * @param origin value to be set 843 */ 844 845 public void setOrigin(final CartOrigin origin); 846 847 /** 848 * <p>When calculating taxes for <code>taxedPrice</code>, the selected mode is used for calculating the price with LineItemLevel (horizontally) or UnitPriceLevel (vertically) calculation mode.</p> 849 * @param taxCalculationMode value to be set 850 */ 851 852 public void setTaxCalculationMode(final TaxCalculationMode taxCalculationMode); 853 854 /** 855 * <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> 856 * <ul> 857 * <li>If <code>CartClassification</code>, it is ClassificationShippingRateInput.</li> 858 * <li>If <code>CartScore</code>, it is ScoreShippingRateInput.</li> 859 * <li>If <code>CartValue</code>, it cannot be used.</li> 860 * </ul> 861 * @param shippingRateInput value to be set 862 */ 863 864 public void setShippingRateInput(final ShippingRateInput shippingRateInput); 865 866 /** 867 * <p>Contains addresses for orders with multiple shipping addresses.</p> 868 * @param itemShippingAddresses values to be set 869 */ 870 871 @JsonIgnore 872 public void setItemShippingAddresses(final Address... itemShippingAddresses); 873 874 /** 875 * <p>Contains addresses for orders with multiple shipping addresses.</p> 876 * @param itemShippingAddresses values to be set 877 */ 878 879 public void setItemShippingAddresses(final List<Address> itemShippingAddresses); 880 881 /** 882 * <p>Automatically filled when a line item with LineItemMode <code>GiftLineItem</code> is removed from this order.</p> 883 * @param refusedGifts values to be set 884 */ 885 886 @JsonIgnore 887 public void setRefusedGifts(final CartDiscountReference... refusedGifts); 888 889 /** 890 * <p>Automatically filled when a line item with LineItemMode <code>GiftLineItem</code> is removed from this order.</p> 891 * @param refusedGifts values to be set 892 */ 893 894 public void setRefusedGifts(final List<CartDiscountReference> refusedGifts); 895 896 /** 897 * factory method 898 * @return instance of Order 899 */ 900 public static Order of() { 901 return new OrderImpl(); 902 } 903 904 /** 905 * factory method to create a shallow copy Order 906 * @param template instance to be copied 907 * @return copy instance 908 */ 909 public static Order of(final Order template) { 910 OrderImpl instance = new OrderImpl(); 911 instance.setId(template.getId()); 912 instance.setVersion(template.getVersion()); 913 instance.setCreatedAt(template.getCreatedAt()); 914 instance.setLastModifiedAt(template.getLastModifiedAt()); 915 instance.setLastModifiedBy(template.getLastModifiedBy()); 916 instance.setCreatedBy(template.getCreatedBy()); 917 instance.setCompletedAt(template.getCompletedAt()); 918 instance.setOrderNumber(template.getOrderNumber()); 919 instance.setCustomerId(template.getCustomerId()); 920 instance.setCustomerEmail(template.getCustomerEmail()); 921 instance.setAnonymousId(template.getAnonymousId()); 922 instance.setBusinessUnit(template.getBusinessUnit()); 923 instance.setStore(template.getStore()); 924 instance.setLineItems(template.getLineItems()); 925 instance.setCustomLineItems(template.getCustomLineItems()); 926 instance.setTotalPrice(template.getTotalPrice()); 927 instance.setTaxedPrice(template.getTaxedPrice()); 928 instance.setTaxedShippingPrice(template.getTaxedShippingPrice()); 929 instance.setShippingAddress(template.getShippingAddress()); 930 instance.setBillingAddress(template.getBillingAddress()); 931 instance.setShippingMode(template.getShippingMode()); 932 instance.setShippingKey(template.getShippingKey()); 933 instance.setShippingCustomFields(template.getShippingCustomFields()); 934 instance.setShipping(template.getShipping()); 935 instance.setTaxMode(template.getTaxMode()); 936 instance.setTaxRoundingMode(template.getTaxRoundingMode()); 937 instance.setCustomerGroup(template.getCustomerGroup()); 938 instance.setCountry(template.getCountry()); 939 instance.setOrderState(template.getOrderState()); 940 instance.setState(template.getState()); 941 instance.setShipmentState(template.getShipmentState()); 942 instance.setPaymentState(template.getPaymentState()); 943 instance.setShippingInfo(template.getShippingInfo()); 944 instance.setSyncInfo(template.getSyncInfo()); 945 instance.setReturnInfo(template.getReturnInfo()); 946 instance.setPurchaseOrderNumber(template.getPurchaseOrderNumber()); 947 instance.setDiscountCodes(template.getDiscountCodes()); 948 instance.setLastMessageSequenceNumber(template.getLastMessageSequenceNumber()); 949 instance.setCart(template.getCart()); 950 instance.setQuote(template.getQuote()); 951 instance.setCustom(template.getCustom()); 952 instance.setPaymentInfo(template.getPaymentInfo()); 953 instance.setLocale(template.getLocale()); 954 instance.setInventoryMode(template.getInventoryMode()); 955 instance.setOrigin(template.getOrigin()); 956 instance.setTaxCalculationMode(template.getTaxCalculationMode()); 957 instance.setShippingRateInput(template.getShippingRateInput()); 958 instance.setItemShippingAddresses(template.getItemShippingAddresses()); 959 instance.setRefusedGifts(template.getRefusedGifts()); 960 return instance; 961 } 962 963 /** 964 * factory method to create a deep copy of Order 965 * @param template instance to be copied 966 * @return copy instance 967 */ 968 @Nullable 969 public static Order deepCopy(@Nullable final Order template) { 970 if (template == null) { 971 return null; 972 } 973 if (template instanceof com.commercetools.api.models.order_edit.StagedOrder) { 974 return com.commercetools.api.models.order_edit.StagedOrder 975 .deepCopy((com.commercetools.api.models.order_edit.StagedOrder) template); 976 } 977 OrderImpl instance = new OrderImpl(); 978 instance.setId(template.getId()); 979 instance.setVersion(template.getVersion()); 980 instance.setCreatedAt(template.getCreatedAt()); 981 instance.setLastModifiedAt(template.getLastModifiedAt()); 982 instance.setLastModifiedBy( 983 com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy())); 984 instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy())); 985 instance.setCompletedAt(template.getCompletedAt()); 986 instance.setOrderNumber(template.getOrderNumber()); 987 instance.setCustomerId(template.getCustomerId()); 988 instance.setCustomerEmail(template.getCustomerEmail()); 989 instance.setAnonymousId(template.getAnonymousId()); 990 instance.setBusinessUnit( 991 com.commercetools.api.models.business_unit.BusinessUnitKeyReference.deepCopy(template.getBusinessUnit())); 992 instance.setStore(com.commercetools.api.models.store.StoreKeyReference.deepCopy(template.getStore())); 993 instance.setLineItems(Optional.ofNullable(template.getLineItems()) 994 .map(t -> t.stream() 995 .map(com.commercetools.api.models.cart.LineItem::deepCopy) 996 .collect(Collectors.toList())) 997 .orElse(null)); 998 instance.setCustomLineItems(Optional.ofNullable(template.getCustomLineItems()) 999 .map(t -> t.stream() 1000 .map(com.commercetools.api.models.cart.CustomLineItem::deepCopy) 1001 .collect(Collectors.toList())) 1002 .orElse(null)); 1003 instance.setTotalPrice(com.commercetools.api.models.common.TypedMoney.deepCopy(template.getTotalPrice())); 1004 instance.setTaxedPrice(com.commercetools.api.models.cart.TaxedPrice.deepCopy(template.getTaxedPrice())); 1005 instance.setTaxedShippingPrice( 1006 com.commercetools.api.models.cart.TaxedPrice.deepCopy(template.getTaxedShippingPrice())); 1007 instance.setShippingAddress( 1008 com.commercetools.api.models.common.Address.deepCopy(template.getShippingAddress())); 1009 instance.setBillingAddress(com.commercetools.api.models.common.Address.deepCopy(template.getBillingAddress())); 1010 instance.setShippingMode(template.getShippingMode()); 1011 instance.setShippingKey(template.getShippingKey()); 1012 instance.setShippingCustomFields( 1013 com.commercetools.api.models.type.CustomFields.deepCopy(template.getShippingCustomFields())); 1014 instance.setShipping(Optional.ofNullable(template.getShipping()) 1015 .map(t -> t.stream() 1016 .map(com.commercetools.api.models.cart.Shipping::deepCopy) 1017 .collect(Collectors.toList())) 1018 .orElse(null)); 1019 instance.setTaxMode(template.getTaxMode()); 1020 instance.setTaxRoundingMode(template.getTaxRoundingMode()); 1021 instance.setCustomerGroup( 1022 com.commercetools.api.models.customer_group.CustomerGroupReference.deepCopy(template.getCustomerGroup())); 1023 instance.setCountry(template.getCountry()); 1024 instance.setOrderState(template.getOrderState()); 1025 instance.setState(com.commercetools.api.models.state.StateReference.deepCopy(template.getState())); 1026 instance.setShipmentState(template.getShipmentState()); 1027 instance.setPaymentState(template.getPaymentState()); 1028 instance.setShippingInfo(com.commercetools.api.models.cart.ShippingInfo.deepCopy(template.getShippingInfo())); 1029 instance.setSyncInfo(Optional.ofNullable(template.getSyncInfo()) 1030 .map(t -> t.stream() 1031 .map(com.commercetools.api.models.order.SyncInfo::deepCopy) 1032 .collect(Collectors.toList())) 1033 .orElse(null)); 1034 instance.setReturnInfo(Optional.ofNullable(template.getReturnInfo()) 1035 .map(t -> t.stream() 1036 .map(com.commercetools.api.models.order.ReturnInfo::deepCopy) 1037 .collect(Collectors.toList())) 1038 .orElse(null)); 1039 instance.setPurchaseOrderNumber(template.getPurchaseOrderNumber()); 1040 instance.setDiscountCodes(Optional.ofNullable(template.getDiscountCodes()) 1041 .map(t -> t.stream() 1042 .map(com.commercetools.api.models.cart.DiscountCodeInfo::deepCopy) 1043 .collect(Collectors.toList())) 1044 .orElse(null)); 1045 instance.setLastMessageSequenceNumber(template.getLastMessageSequenceNumber()); 1046 instance.setCart(com.commercetools.api.models.cart.CartReference.deepCopy(template.getCart())); 1047 instance.setQuote(com.commercetools.api.models.quote.QuoteReference.deepCopy(template.getQuote())); 1048 instance.setCustom(com.commercetools.api.models.type.CustomFields.deepCopy(template.getCustom())); 1049 instance.setPaymentInfo(com.commercetools.api.models.order.PaymentInfo.deepCopy(template.getPaymentInfo())); 1050 instance.setLocale(template.getLocale()); 1051 instance.setInventoryMode(template.getInventoryMode()); 1052 instance.setOrigin(template.getOrigin()); 1053 instance.setTaxCalculationMode(template.getTaxCalculationMode()); 1054 instance.setShippingRateInput( 1055 com.commercetools.api.models.cart.ShippingRateInput.deepCopy(template.getShippingRateInput())); 1056 instance.setItemShippingAddresses(Optional.ofNullable(template.getItemShippingAddresses()) 1057 .map(t -> t.stream() 1058 .map(com.commercetools.api.models.common.Address::deepCopy) 1059 .collect(Collectors.toList())) 1060 .orElse(null)); 1061 instance.setRefusedGifts(Optional.ofNullable(template.getRefusedGifts()) 1062 .map(t -> t.stream() 1063 .map(com.commercetools.api.models.cart_discount.CartDiscountReference::deepCopy) 1064 .collect(Collectors.toList())) 1065 .orElse(null)); 1066 return instance; 1067 } 1068 1069 /** 1070 * builder factory method for Order 1071 * @return builder 1072 */ 1073 public static OrderBuilder builder() { 1074 return OrderBuilder.of(); 1075 } 1076 1077 /** 1078 * create builder for Order instance 1079 * @param template instance with prefilled values for the builder 1080 * @return builder 1081 */ 1082 public static OrderBuilder builder(final Order template) { 1083 return OrderBuilder.of(template); 1084 } 1085 1086 /** 1087 * accessor map function 1088 * @param <T> mapped type 1089 * @param helper function to map the object 1090 * @return mapped value 1091 */ 1092 default <T> T withOrder(Function<Order, T> helper) { 1093 return helper.apply(this); 1094 } 1095 1096 public static com.commercetools.api.models.common.ReferenceTypeId referenceTypeId() { 1097 return com.commercetools.api.models.common.ReferenceTypeId.ORDER; 1098 } 1099 1100 /** 1101 * gives a TypeReference for usage with Jackson DataBind 1102 * @return TypeReference 1103 */ 1104 public static com.fasterxml.jackson.core.type.TypeReference<Order> typeReference() { 1105 return new com.fasterxml.jackson.core.type.TypeReference<Order>() { 1106 @Override 1107 public String toString() { 1108 return "TypeReference<Order>"; 1109 } 1110 }; 1111 } 1112}