001 002package com.commercetools.api.models.customer; 003 004import java.util.*; 005import java.util.function.Function; 006 007import javax.annotation.Nullable; 008 009import io.vrap.rmf.base.client.Builder; 010import io.vrap.rmf.base.client.utils.Generated; 011 012/** 013 * CustomerBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * Customer customer = Customer.builder() 019 * .id("{id}") 020 * .version(0.3) 021 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 022 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 023 * .email("{email}") 024 * .plusAddresses(addressesBuilder -> addressesBuilder) 025 * .isEmailVerified(true) 026 * .authenticationMode(AuthenticationMode.PASSWORD) 027 * .build() 028 * </code></pre> 029 * </div> 030 */ 031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 032public class CustomerBuilder implements Builder<Customer> { 033 034 private String id; 035 036 private Long version; 037 038 private java.time.ZonedDateTime createdAt; 039 040 private java.time.ZonedDateTime lastModifiedAt; 041 042 @Nullable 043 private String key; 044 045 @Nullable 046 private String customerNumber; 047 048 @Nullable 049 private String externalId; 050 051 @Nullable 052 private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy; 053 054 @Nullable 055 private com.commercetools.api.models.common.CreatedBy createdBy; 056 057 private String email; 058 059 @Nullable 060 private String password; 061 062 @Nullable 063 private String firstName; 064 065 @Nullable 066 private String lastName; 067 068 @Nullable 069 private String middleName; 070 071 @Nullable 072 private String title; 073 074 @Nullable 075 private java.time.LocalDate dateOfBirth; 076 077 @Nullable 078 private String companyName; 079 080 @Nullable 081 private String vatId; 082 083 private java.util.List<com.commercetools.api.models.common.Address> addresses; 084 085 @Nullable 086 private String defaultShippingAddressId; 087 088 @Nullable 089 private java.util.List<String> shippingAddressIds; 090 091 @Nullable 092 private String defaultBillingAddressId; 093 094 @Nullable 095 private java.util.List<String> billingAddressIds; 096 097 private Boolean isEmailVerified; 098 099 @Nullable 100 private com.commercetools.api.models.customer_group.CustomerGroupReference customerGroup; 101 102 @Nullable 103 private com.commercetools.api.models.type.CustomFields custom; 104 105 @Nullable 106 private String locale; 107 108 @Nullable 109 private String salutation; 110 111 @Nullable 112 private java.util.List<com.commercetools.api.models.store.StoreKeyReference> stores; 113 114 private com.commercetools.api.models.customer.AuthenticationMode authenticationMode; 115 116 /** 117 * <p>Unique identifier of the Customer.</p> 118 * @param id value to be set 119 * @return Builder 120 */ 121 122 public CustomerBuilder id(final String id) { 123 this.id = id; 124 return this; 125 } 126 127 /** 128 * <p>Current version of the Customer.</p> 129 * @param version value to be set 130 * @return Builder 131 */ 132 133 public CustomerBuilder version(final Long version) { 134 this.version = version; 135 return this; 136 } 137 138 /** 139 * <p>Date and time (UTC) the Customer was initially created.</p> 140 * @param createdAt value to be set 141 * @return Builder 142 */ 143 144 public CustomerBuilder createdAt(final java.time.ZonedDateTime createdAt) { 145 this.createdAt = createdAt; 146 return this; 147 } 148 149 /** 150 * <p>Date and time (UTC) the Customer was last updated.</p> 151 * @param lastModifiedAt value to be set 152 * @return Builder 153 */ 154 155 public CustomerBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) { 156 this.lastModifiedAt = lastModifiedAt; 157 return this; 158 } 159 160 /** 161 * <p>User-defined unique identifier of the Customer.</p> 162 * @param key value to be set 163 * @return Builder 164 */ 165 166 public CustomerBuilder key(@Nullable final String key) { 167 this.key = key; 168 return this; 169 } 170 171 /** 172 * <p>User-defined unique identifier of the Customer.</p> 173 * <p>Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence).</p> 174 * @param customerNumber value to be set 175 * @return Builder 176 */ 177 178 public CustomerBuilder customerNumber(@Nullable final String customerNumber) { 179 this.customerNumber = customerNumber; 180 return this; 181 } 182 183 /** 184 * <p>Optional identifier for use in external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP).</p> 185 * @param externalId value to be set 186 * @return Builder 187 */ 188 189 public CustomerBuilder externalId(@Nullable final String externalId) { 190 this.externalId = externalId; 191 return this; 192 } 193 194 /** 195 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 196 * @param builder function to build the lastModifiedBy value 197 * @return Builder 198 */ 199 200 public CustomerBuilder lastModifiedBy( 201 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) { 202 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build(); 203 return this; 204 } 205 206 /** 207 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 208 * @param builder function to build the lastModifiedBy value 209 * @return Builder 210 */ 211 212 public CustomerBuilder withLastModifiedBy( 213 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) { 214 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()); 215 return this; 216 } 217 218 /** 219 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 220 * @param lastModifiedBy value to be set 221 * @return Builder 222 */ 223 224 public CustomerBuilder lastModifiedBy( 225 @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) { 226 this.lastModifiedBy = lastModifiedBy; 227 return this; 228 } 229 230 /** 231 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 232 * @param builder function to build the createdBy value 233 * @return Builder 234 */ 235 236 public CustomerBuilder createdBy( 237 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) { 238 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build(); 239 return this; 240 } 241 242 /** 243 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 244 * @param builder function to build the createdBy value 245 * @return Builder 246 */ 247 248 public CustomerBuilder withCreatedBy( 249 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) { 250 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()); 251 return this; 252 } 253 254 /** 255 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 256 * @param createdBy value to be set 257 * @return Builder 258 */ 259 260 public CustomerBuilder createdBy(@Nullable final com.commercetools.api.models.common.CreatedBy createdBy) { 261 this.createdBy = createdBy; 262 return this; 263 } 264 265 /** 266 * <p>Email address of the Customer that is unique for an entire Project or to a Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.</p> 267 * @param email value to be set 268 * @return Builder 269 */ 270 271 public CustomerBuilder email(final String email) { 272 this.email = email; 273 return this; 274 } 275 276 /** 277 * <p>Present only when <code>authenticationMode</code> is set to <code>Password</code>.</p> 278 * @param password value to be set 279 * @return Builder 280 */ 281 282 public CustomerBuilder password(@Nullable final String password) { 283 this.password = password; 284 return this; 285 } 286 287 /** 288 * <p>Given name (first name) of the Customer.</p> 289 * @param firstName value to be set 290 * @return Builder 291 */ 292 293 public CustomerBuilder firstName(@Nullable final String firstName) { 294 this.firstName = firstName; 295 return this; 296 } 297 298 /** 299 * <p>Family name (last name) of the Customer.</p> 300 * @param lastName value to be set 301 * @return Builder 302 */ 303 304 public CustomerBuilder lastName(@Nullable final String lastName) { 305 this.lastName = lastName; 306 return this; 307 } 308 309 /** 310 * <p>Middle name of the Customer.</p> 311 * @param middleName value to be set 312 * @return Builder 313 */ 314 315 public CustomerBuilder middleName(@Nullable final String middleName) { 316 this.middleName = middleName; 317 return this; 318 } 319 320 /** 321 * <p>Title of the Customer, for example, 'Dr.'.</p> 322 * @param title value to be set 323 * @return Builder 324 */ 325 326 public CustomerBuilder title(@Nullable final String title) { 327 this.title = title; 328 return this; 329 } 330 331 /** 332 * <p>Date of birth of the Customer.</p> 333 * @param dateOfBirth value to be set 334 * @return Builder 335 */ 336 337 public CustomerBuilder dateOfBirth(@Nullable final java.time.LocalDate dateOfBirth) { 338 this.dateOfBirth = dateOfBirth; 339 return this; 340 } 341 342 /** 343 * <p>Company name of the Customer.</p> 344 * @param companyName value to be set 345 * @return Builder 346 */ 347 348 public CustomerBuilder companyName(@Nullable final String companyName) { 349 this.companyName = companyName; 350 return this; 351 } 352 353 /** 354 * <p>Individual VAT ID of the Customer.</p> 355 * @param vatId value to be set 356 * @return Builder 357 */ 358 359 public CustomerBuilder vatId(@Nullable final String vatId) { 360 this.vatId = vatId; 361 return this; 362 } 363 364 /** 365 * <p>Addresses used by the Customer.</p> 366 * @param addresses value to be set 367 * @return Builder 368 */ 369 370 public CustomerBuilder addresses(final com.commercetools.api.models.common.Address... addresses) { 371 this.addresses = new ArrayList<>(Arrays.asList(addresses)); 372 return this; 373 } 374 375 /** 376 * <p>Addresses used by the Customer.</p> 377 * @param addresses value to be set 378 * @return Builder 379 */ 380 381 public CustomerBuilder addresses(final java.util.List<com.commercetools.api.models.common.Address> addresses) { 382 this.addresses = addresses; 383 return this; 384 } 385 386 /** 387 * <p>Addresses used by the Customer.</p> 388 * @param addresses value to be set 389 * @return Builder 390 */ 391 392 public CustomerBuilder plusAddresses(final com.commercetools.api.models.common.Address... addresses) { 393 if (this.addresses == null) { 394 this.addresses = new ArrayList<>(); 395 } 396 this.addresses.addAll(Arrays.asList(addresses)); 397 return this; 398 } 399 400 /** 401 * <p>Addresses used by the Customer.</p> 402 * @param builder function to build the addresses value 403 * @return Builder 404 */ 405 406 public CustomerBuilder plusAddresses( 407 Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.AddressBuilder> builder) { 408 if (this.addresses == null) { 409 this.addresses = new ArrayList<>(); 410 } 411 this.addresses.add(builder.apply(com.commercetools.api.models.common.AddressBuilder.of()).build()); 412 return this; 413 } 414 415 /** 416 * <p>Addresses used by the Customer.</p> 417 * @param builder function to build the addresses value 418 * @return Builder 419 */ 420 421 public CustomerBuilder withAddresses( 422 Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.AddressBuilder> builder) { 423 this.addresses = new ArrayList<>(); 424 this.addresses.add(builder.apply(com.commercetools.api.models.common.AddressBuilder.of()).build()); 425 return this; 426 } 427 428 /** 429 * <p>Addresses used by the Customer.</p> 430 * @param builder function to build the addresses value 431 * @return Builder 432 */ 433 434 public CustomerBuilder addAddresses( 435 Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.Address> builder) { 436 return plusAddresses(builder.apply(com.commercetools.api.models.common.AddressBuilder.of())); 437 } 438 439 /** 440 * <p>Addresses used by the Customer.</p> 441 * @param builder function to build the addresses value 442 * @return Builder 443 */ 444 445 public CustomerBuilder setAddresses( 446 Function<com.commercetools.api.models.common.AddressBuilder, com.commercetools.api.models.common.Address> builder) { 447 return addresses(builder.apply(com.commercetools.api.models.common.AddressBuilder.of())); 448 } 449 450 /** 451 * <p>ID of the address in <code>addresses</code> used as the default shipping address.</p> 452 * @param defaultShippingAddressId value to be set 453 * @return Builder 454 */ 455 456 public CustomerBuilder defaultShippingAddressId(@Nullable final String defaultShippingAddressId) { 457 this.defaultShippingAddressId = defaultShippingAddressId; 458 return this; 459 } 460 461 /** 462 * <p>IDs of addresses in <code>addresses</code> used as shipping addresses.</p> 463 * @param shippingAddressIds value to be set 464 * @return Builder 465 */ 466 467 public CustomerBuilder shippingAddressIds(@Nullable final String... shippingAddressIds) { 468 this.shippingAddressIds = new ArrayList<>(Arrays.asList(shippingAddressIds)); 469 return this; 470 } 471 472 /** 473 * <p>IDs of addresses in <code>addresses</code> used as shipping addresses.</p> 474 * @param shippingAddressIds value to be set 475 * @return Builder 476 */ 477 478 public CustomerBuilder shippingAddressIds(@Nullable final java.util.List<String> shippingAddressIds) { 479 this.shippingAddressIds = shippingAddressIds; 480 return this; 481 } 482 483 /** 484 * <p>IDs of addresses in <code>addresses</code> used as shipping addresses.</p> 485 * @param shippingAddressIds value to be set 486 * @return Builder 487 */ 488 489 public CustomerBuilder plusShippingAddressIds(@Nullable final String... shippingAddressIds) { 490 if (this.shippingAddressIds == null) { 491 this.shippingAddressIds = new ArrayList<>(); 492 } 493 this.shippingAddressIds.addAll(Arrays.asList(shippingAddressIds)); 494 return this; 495 } 496 497 /** 498 * <p>ID of the address in <code>addresses</code> used as the default billing address.</p> 499 * @param defaultBillingAddressId value to be set 500 * @return Builder 501 */ 502 503 public CustomerBuilder defaultBillingAddressId(@Nullable final String defaultBillingAddressId) { 504 this.defaultBillingAddressId = defaultBillingAddressId; 505 return this; 506 } 507 508 /** 509 * <p>IDs of addresses in <code>addresses</code> used as billing addresses.</p> 510 * @param billingAddressIds value to be set 511 * @return Builder 512 */ 513 514 public CustomerBuilder billingAddressIds(@Nullable final String... billingAddressIds) { 515 this.billingAddressIds = new ArrayList<>(Arrays.asList(billingAddressIds)); 516 return this; 517 } 518 519 /** 520 * <p>IDs of addresses in <code>addresses</code> used as billing addresses.</p> 521 * @param billingAddressIds value to be set 522 * @return Builder 523 */ 524 525 public CustomerBuilder billingAddressIds(@Nullable final java.util.List<String> billingAddressIds) { 526 this.billingAddressIds = billingAddressIds; 527 return this; 528 } 529 530 /** 531 * <p>IDs of addresses in <code>addresses</code> used as billing addresses.</p> 532 * @param billingAddressIds value to be set 533 * @return Builder 534 */ 535 536 public CustomerBuilder plusBillingAddressIds(@Nullable final String... billingAddressIds) { 537 if (this.billingAddressIds == null) { 538 this.billingAddressIds = new ArrayList<>(); 539 } 540 this.billingAddressIds.addAll(Arrays.asList(billingAddressIds)); 541 return this; 542 } 543 544 /** 545 * <p>Indicates whether the email address of the Customer is verified.</p> 546 * @param isEmailVerified value to be set 547 * @return Builder 548 */ 549 550 public CustomerBuilder isEmailVerified(final Boolean isEmailVerified) { 551 this.isEmailVerified = isEmailVerified; 552 return this; 553 } 554 555 /** 556 * <p>CustomerGroup to which the Customer belongs.</p> 557 * @param builder function to build the customerGroup value 558 * @return Builder 559 */ 560 561 public CustomerBuilder customerGroup( 562 Function<com.commercetools.api.models.customer_group.CustomerGroupReferenceBuilder, com.commercetools.api.models.customer_group.CustomerGroupReferenceBuilder> builder) { 563 this.customerGroup = builder 564 .apply(com.commercetools.api.models.customer_group.CustomerGroupReferenceBuilder.of()) 565 .build(); 566 return this; 567 } 568 569 /** 570 * <p>CustomerGroup to which the Customer belongs.</p> 571 * @param builder function to build the customerGroup value 572 * @return Builder 573 */ 574 575 public CustomerBuilder withCustomerGroup( 576 Function<com.commercetools.api.models.customer_group.CustomerGroupReferenceBuilder, com.commercetools.api.models.customer_group.CustomerGroupReference> builder) { 577 this.customerGroup = builder 578 .apply(com.commercetools.api.models.customer_group.CustomerGroupReferenceBuilder.of()); 579 return this; 580 } 581 582 /** 583 * <p>CustomerGroup to which the Customer belongs.</p> 584 * @param customerGroup value to be set 585 * @return Builder 586 */ 587 588 public CustomerBuilder customerGroup( 589 @Nullable final com.commercetools.api.models.customer_group.CustomerGroupReference customerGroup) { 590 this.customerGroup = customerGroup; 591 return this; 592 } 593 594 /** 595 * <p>Custom Fields for the Customer.</p> 596 * @param builder function to build the custom value 597 * @return Builder 598 */ 599 600 public CustomerBuilder custom( 601 Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFieldsBuilder> builder) { 602 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()).build(); 603 return this; 604 } 605 606 /** 607 * <p>Custom Fields for the Customer.</p> 608 * @param builder function to build the custom value 609 * @return Builder 610 */ 611 612 public CustomerBuilder withCustom( 613 Function<com.commercetools.api.models.type.CustomFieldsBuilder, com.commercetools.api.models.type.CustomFields> builder) { 614 this.custom = builder.apply(com.commercetools.api.models.type.CustomFieldsBuilder.of()); 615 return this; 616 } 617 618 /** 619 * <p>Custom Fields for the Customer.</p> 620 * @param custom value to be set 621 * @return Builder 622 */ 623 624 public CustomerBuilder custom(@Nullable final com.commercetools.api.models.type.CustomFields custom) { 625 this.custom = custom; 626 return this; 627 } 628 629 /** 630 * <p>Preferred language of the Customer.</p> 631 * @param locale value to be set 632 * @return Builder 633 */ 634 635 public CustomerBuilder locale(@Nullable final String locale) { 636 this.locale = locale; 637 return this; 638 } 639 640 /** 641 * <p>Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.</p> 642 * @param salutation value to be set 643 * @return Builder 644 */ 645 646 public CustomerBuilder salutation(@Nullable final String salutation) { 647 this.salutation = salutation; 648 return this; 649 } 650 651 /** 652 * <p>Stores to which the Customer is assigned to.</p> 653 * <ul> 654 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 655 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 656 * </ul> 657 * @param stores value to be set 658 * @return Builder 659 */ 660 661 public CustomerBuilder stores(@Nullable final com.commercetools.api.models.store.StoreKeyReference... stores) { 662 this.stores = new ArrayList<>(Arrays.asList(stores)); 663 return this; 664 } 665 666 /** 667 * <p>Stores to which the Customer is assigned to.</p> 668 * <ul> 669 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 670 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 671 * </ul> 672 * @param stores value to be set 673 * @return Builder 674 */ 675 676 public CustomerBuilder stores( 677 @Nullable final java.util.List<com.commercetools.api.models.store.StoreKeyReference> stores) { 678 this.stores = stores; 679 return this; 680 } 681 682 /** 683 * <p>Stores to which the Customer is assigned to.</p> 684 * <ul> 685 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 686 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 687 * </ul> 688 * @param stores value to be set 689 * @return Builder 690 */ 691 692 public CustomerBuilder plusStores(@Nullable final com.commercetools.api.models.store.StoreKeyReference... stores) { 693 if (this.stores == null) { 694 this.stores = new ArrayList<>(); 695 } 696 this.stores.addAll(Arrays.asList(stores)); 697 return this; 698 } 699 700 /** 701 * <p>Stores to which the Customer is assigned to.</p> 702 * <ul> 703 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 704 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 705 * </ul> 706 * @param builder function to build the stores value 707 * @return Builder 708 */ 709 710 public CustomerBuilder plusStores( 711 Function<com.commercetools.api.models.store.StoreKeyReferenceBuilder, com.commercetools.api.models.store.StoreKeyReferenceBuilder> builder) { 712 if (this.stores == null) { 713 this.stores = new ArrayList<>(); 714 } 715 this.stores.add(builder.apply(com.commercetools.api.models.store.StoreKeyReferenceBuilder.of()).build()); 716 return this; 717 } 718 719 /** 720 * <p>Stores to which the Customer is assigned to.</p> 721 * <ul> 722 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 723 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 724 * </ul> 725 * @param builder function to build the stores value 726 * @return Builder 727 */ 728 729 public CustomerBuilder withStores( 730 Function<com.commercetools.api.models.store.StoreKeyReferenceBuilder, com.commercetools.api.models.store.StoreKeyReferenceBuilder> builder) { 731 this.stores = new ArrayList<>(); 732 this.stores.add(builder.apply(com.commercetools.api.models.store.StoreKeyReferenceBuilder.of()).build()); 733 return this; 734 } 735 736 /** 737 * <p>Stores to which the Customer is assigned to.</p> 738 * <ul> 739 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 740 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 741 * </ul> 742 * @param builder function to build the stores value 743 * @return Builder 744 */ 745 746 public CustomerBuilder addStores( 747 Function<com.commercetools.api.models.store.StoreKeyReferenceBuilder, com.commercetools.api.models.store.StoreKeyReference> builder) { 748 return plusStores(builder.apply(com.commercetools.api.models.store.StoreKeyReferenceBuilder.of())); 749 } 750 751 /** 752 * <p>Stores to which the Customer is assigned to.</p> 753 * <ul> 754 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 755 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 756 * </ul> 757 * @param builder function to build the stores value 758 * @return Builder 759 */ 760 761 public CustomerBuilder setStores( 762 Function<com.commercetools.api.models.store.StoreKeyReferenceBuilder, com.commercetools.api.models.store.StoreKeyReference> builder) { 763 return stores(builder.apply(com.commercetools.api.models.store.StoreKeyReferenceBuilder.of())); 764 } 765 766 /** 767 * <p>Indicates whether the <code>password</code> is required for the Customer.</p> 768 * @param authenticationMode value to be set 769 * @return Builder 770 */ 771 772 public CustomerBuilder authenticationMode( 773 final com.commercetools.api.models.customer.AuthenticationMode authenticationMode) { 774 this.authenticationMode = authenticationMode; 775 return this; 776 } 777 778 /** 779 * <p>Unique identifier of the Customer.</p> 780 * @return id 781 */ 782 783 public String getId() { 784 return this.id; 785 } 786 787 /** 788 * <p>Current version of the Customer.</p> 789 * @return version 790 */ 791 792 public Long getVersion() { 793 return this.version; 794 } 795 796 /** 797 * <p>Date and time (UTC) the Customer was initially created.</p> 798 * @return createdAt 799 */ 800 801 public java.time.ZonedDateTime getCreatedAt() { 802 return this.createdAt; 803 } 804 805 /** 806 * <p>Date and time (UTC) the Customer was last updated.</p> 807 * @return lastModifiedAt 808 */ 809 810 public java.time.ZonedDateTime getLastModifiedAt() { 811 return this.lastModifiedAt; 812 } 813 814 /** 815 * <p>User-defined unique identifier of the Customer.</p> 816 * @return key 817 */ 818 819 @Nullable 820 public String getKey() { 821 return this.key; 822 } 823 824 /** 825 * <p>User-defined unique identifier of the Customer.</p> 826 * <p>Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence).</p> 827 * @return customerNumber 828 */ 829 830 @Nullable 831 public String getCustomerNumber() { 832 return this.customerNumber; 833 } 834 835 /** 836 * <p>Optional identifier for use in external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP).</p> 837 * @return externalId 838 */ 839 840 @Nullable 841 public String getExternalId() { 842 return this.externalId; 843 } 844 845 /** 846 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 847 * @return lastModifiedBy 848 */ 849 850 @Nullable 851 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 852 return this.lastModifiedBy; 853 } 854 855 /** 856 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 857 * @return createdBy 858 */ 859 860 @Nullable 861 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 862 return this.createdBy; 863 } 864 865 /** 866 * <p>Email address of the Customer that is unique for an entire Project or to a Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.</p> 867 * @return email 868 */ 869 870 public String getEmail() { 871 return this.email; 872 } 873 874 /** 875 * <p>Present only when <code>authenticationMode</code> is set to <code>Password</code>.</p> 876 * @return password 877 */ 878 879 @Nullable 880 public String getPassword() { 881 return this.password; 882 } 883 884 /** 885 * <p>Given name (first name) of the Customer.</p> 886 * @return firstName 887 */ 888 889 @Nullable 890 public String getFirstName() { 891 return this.firstName; 892 } 893 894 /** 895 * <p>Family name (last name) of the Customer.</p> 896 * @return lastName 897 */ 898 899 @Nullable 900 public String getLastName() { 901 return this.lastName; 902 } 903 904 /** 905 * <p>Middle name of the Customer.</p> 906 * @return middleName 907 */ 908 909 @Nullable 910 public String getMiddleName() { 911 return this.middleName; 912 } 913 914 /** 915 * <p>Title of the Customer, for example, 'Dr.'.</p> 916 * @return title 917 */ 918 919 @Nullable 920 public String getTitle() { 921 return this.title; 922 } 923 924 /** 925 * <p>Date of birth of the Customer.</p> 926 * @return dateOfBirth 927 */ 928 929 @Nullable 930 public java.time.LocalDate getDateOfBirth() { 931 return this.dateOfBirth; 932 } 933 934 /** 935 * <p>Company name of the Customer.</p> 936 * @return companyName 937 */ 938 939 @Nullable 940 public String getCompanyName() { 941 return this.companyName; 942 } 943 944 /** 945 * <p>Individual VAT ID of the Customer.</p> 946 * @return vatId 947 */ 948 949 @Nullable 950 public String getVatId() { 951 return this.vatId; 952 } 953 954 /** 955 * <p>Addresses used by the Customer.</p> 956 * @return addresses 957 */ 958 959 public java.util.List<com.commercetools.api.models.common.Address> getAddresses() { 960 return this.addresses; 961 } 962 963 /** 964 * <p>ID of the address in <code>addresses</code> used as the default shipping address.</p> 965 * @return defaultShippingAddressId 966 */ 967 968 @Nullable 969 public String getDefaultShippingAddressId() { 970 return this.defaultShippingAddressId; 971 } 972 973 /** 974 * <p>IDs of addresses in <code>addresses</code> used as shipping addresses.</p> 975 * @return shippingAddressIds 976 */ 977 978 @Nullable 979 public java.util.List<String> getShippingAddressIds() { 980 return this.shippingAddressIds; 981 } 982 983 /** 984 * <p>ID of the address in <code>addresses</code> used as the default billing address.</p> 985 * @return defaultBillingAddressId 986 */ 987 988 @Nullable 989 public String getDefaultBillingAddressId() { 990 return this.defaultBillingAddressId; 991 } 992 993 /** 994 * <p>IDs of addresses in <code>addresses</code> used as billing addresses.</p> 995 * @return billingAddressIds 996 */ 997 998 @Nullable 999 public java.util.List<String> getBillingAddressIds() { 1000 return this.billingAddressIds; 1001 } 1002 1003 /** 1004 * <p>Indicates whether the email address of the Customer is verified.</p> 1005 * @return isEmailVerified 1006 */ 1007 1008 public Boolean getIsEmailVerified() { 1009 return this.isEmailVerified; 1010 } 1011 1012 /** 1013 * <p>CustomerGroup to which the Customer belongs.</p> 1014 * @return customerGroup 1015 */ 1016 1017 @Nullable 1018 public com.commercetools.api.models.customer_group.CustomerGroupReference getCustomerGroup() { 1019 return this.customerGroup; 1020 } 1021 1022 /** 1023 * <p>Custom Fields for the Customer.</p> 1024 * @return custom 1025 */ 1026 1027 @Nullable 1028 public com.commercetools.api.models.type.CustomFields getCustom() { 1029 return this.custom; 1030 } 1031 1032 /** 1033 * <p>Preferred language of the Customer.</p> 1034 * @return locale 1035 */ 1036 1037 @Nullable 1038 public String getLocale() { 1039 return this.locale; 1040 } 1041 1042 /** 1043 * <p>Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.</p> 1044 * @return salutation 1045 */ 1046 1047 @Nullable 1048 public String getSalutation() { 1049 return this.salutation; 1050 } 1051 1052 /** 1053 * <p>Stores to which the Customer is assigned to.</p> 1054 * <ul> 1055 * <li>If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.</li> 1056 * <li>If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.</li> 1057 * </ul> 1058 * @return stores 1059 */ 1060 1061 @Nullable 1062 public java.util.List<com.commercetools.api.models.store.StoreKeyReference> getStores() { 1063 return this.stores; 1064 } 1065 1066 /** 1067 * <p>Indicates whether the <code>password</code> is required for the Customer.</p> 1068 * @return authenticationMode 1069 */ 1070 1071 public com.commercetools.api.models.customer.AuthenticationMode getAuthenticationMode() { 1072 return this.authenticationMode; 1073 } 1074 1075 /** 1076 * builds Customer with checking for non-null required values 1077 * @return Customer 1078 */ 1079 public Customer build() { 1080 Objects.requireNonNull(id, Customer.class + ": id is missing"); 1081 Objects.requireNonNull(version, Customer.class + ": version is missing"); 1082 Objects.requireNonNull(createdAt, Customer.class + ": createdAt is missing"); 1083 Objects.requireNonNull(lastModifiedAt, Customer.class + ": lastModifiedAt is missing"); 1084 Objects.requireNonNull(email, Customer.class + ": email is missing"); 1085 Objects.requireNonNull(addresses, Customer.class + ": addresses is missing"); 1086 Objects.requireNonNull(isEmailVerified, Customer.class + ": isEmailVerified is missing"); 1087 Objects.requireNonNull(authenticationMode, Customer.class + ": authenticationMode is missing"); 1088 return new CustomerImpl(id, version, createdAt, lastModifiedAt, key, customerNumber, externalId, lastModifiedBy, 1089 createdBy, email, password, firstName, lastName, middleName, title, dateOfBirth, companyName, vatId, 1090 addresses, defaultShippingAddressId, shippingAddressIds, defaultBillingAddressId, billingAddressIds, 1091 isEmailVerified, customerGroup, custom, locale, salutation, stores, authenticationMode); 1092 } 1093 1094 /** 1095 * builds Customer without checking for non-null required values 1096 * @return Customer 1097 */ 1098 public Customer buildUnchecked() { 1099 return new CustomerImpl(id, version, createdAt, lastModifiedAt, key, customerNumber, externalId, lastModifiedBy, 1100 createdBy, email, password, firstName, lastName, middleName, title, dateOfBirth, companyName, vatId, 1101 addresses, defaultShippingAddressId, shippingAddressIds, defaultBillingAddressId, billingAddressIds, 1102 isEmailVerified, customerGroup, custom, locale, salutation, stores, authenticationMode); 1103 } 1104 1105 /** 1106 * factory method for an instance of CustomerBuilder 1107 * @return builder 1108 */ 1109 public static CustomerBuilder of() { 1110 return new CustomerBuilder(); 1111 } 1112 1113 /** 1114 * create builder for Customer instance 1115 * @param template instance with prefilled values for the builder 1116 * @return builder 1117 */ 1118 public static CustomerBuilder of(final Customer template) { 1119 CustomerBuilder builder = new CustomerBuilder(); 1120 builder.id = template.getId(); 1121 builder.version = template.getVersion(); 1122 builder.createdAt = template.getCreatedAt(); 1123 builder.lastModifiedAt = template.getLastModifiedAt(); 1124 builder.key = template.getKey(); 1125 builder.customerNumber = template.getCustomerNumber(); 1126 builder.externalId = template.getExternalId(); 1127 builder.lastModifiedBy = template.getLastModifiedBy(); 1128 builder.createdBy = template.getCreatedBy(); 1129 builder.email = template.getEmail(); 1130 builder.password = template.getPassword(); 1131 builder.firstName = template.getFirstName(); 1132 builder.lastName = template.getLastName(); 1133 builder.middleName = template.getMiddleName(); 1134 builder.title = template.getTitle(); 1135 builder.dateOfBirth = template.getDateOfBirth(); 1136 builder.companyName = template.getCompanyName(); 1137 builder.vatId = template.getVatId(); 1138 builder.addresses = template.getAddresses(); 1139 builder.defaultShippingAddressId = template.getDefaultShippingAddressId(); 1140 builder.shippingAddressIds = template.getShippingAddressIds(); 1141 builder.defaultBillingAddressId = template.getDefaultBillingAddressId(); 1142 builder.billingAddressIds = template.getBillingAddressIds(); 1143 builder.isEmailVerified = template.getIsEmailVerified(); 1144 builder.customerGroup = template.getCustomerGroup(); 1145 builder.custom = template.getCustom(); 1146 builder.locale = template.getLocale(); 1147 builder.salutation = template.getSalutation(); 1148 builder.stores = template.getStores(); 1149 builder.authenticationMode = template.getAuthenticationMode(); 1150 return builder; 1151 } 1152 1153}