io.sphere.sdk.customers.Customer Maven / Gradle / Ivy
package io.sphere.sdk.customers;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.customergroups.CustomerGroup;
import io.sphere.sdk.models.Address;
import io.sphere.sdk.models.DefaultModel;
import io.sphere.sdk.models.Reference;
import java.util.List;
import java.util.Optional;
import java.time.LocalDate;
@JsonDeserialize(as = CustomerImpl.class)
public interface Customer extends DefaultModel {
Optional getCustomerNumber();
String getEmail();
String getFirstName();
String getLastName();
String getPassword();
Optional getMiddleName();
Optional getTitle();
List getAddresses();
Optional getDefaultShippingAddressId();
default Optional getDefaultShippingAddress() {
return getAddresses().stream()
.filter(address -> address.getId().isPresent() && address.getId().equals(getDefaultShippingAddressId()))
.findFirst();
}
Optional getDefaultBillingAddressId();
default Optional getDefaultBillingAddress() {
return getAddresses().stream()
.filter(address -> address.getId().isPresent() && address.getId().equals(getDefaultBillingAddressId()))
.findFirst();
}
boolean isEmailVerified();
Optional getExternalId();
Optional> getCustomerGroup();
default CustomerName getName() {
return CustomerName.of(getTitle(), getFirstName(), getMiddleName(), getLastName());
}
Optional getCompanyName();
Optional getVatId();
Optional getDateOfBirth();
@Override
default Reference toReference() {
return Reference.of(typeId(), getId(), this);
}
public static String typeId(){
return "customer";
}
public static TypeReference typeReference(){
return new TypeReference() {
@Override
public String toString() {
return "TypeReference";
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy