private CustomerPasswordResetCommand(final Versioned<Customer> customer, final String tokenValue, final String newPassword) { this.id = customer != null ? customer.getId() : null; this.version = customer != null ? customer.getVersion() : null; this.tokenValue = tokenValue; this.newPassword = newPassword; }
private CustomerPasswordResetCommand(final Versioned<Customer> customer, final String tokenValue, final String newPassword) { this.id = customer != null ? customer.getId() : null; this.version = customer != null ? customer.getVersion() : null; this.tokenValue = tokenValue; this.newPassword = newPassword; }
private CustomerPasswordResetCommand(final Versioned<Customer> customer, final String tokenValue, final String newPassword) { this.id = customer.getId(); this.version = customer.getVersion(); this.tokenValue = tokenValue; this.newPassword = newPassword; }
private CustomerPasswordResetCommand(final Versioned<Customer> customer, final String tokenValue, final String newPassword) { this.id = customer.getId(); this.version = customer.getVersion(); this.tokenValue = tokenValue; this.newPassword = newPassword; }
static OrderFromCartDraft of(final Versioned<Cart> cart, @Nullable final String orderNumber, @Nullable final PaymentState paymentState) { return OrderFromCartDraftDsl.of(cart.getId(), cart.getVersion(), orderNumber, paymentState); }
/** * Creates a command to verify the email of a customer. * @param customer unused * @param tokenValue the value of the token which customer email address should be confirmed * @return command * @deprecated use {@link #ofTokenValue(String)} or {@link #ofCustomerToken(CustomerToken)} */ @Deprecated//do not delete soon public static CustomerVerifyEmailCommand of(final Versioned<Customer> customer, final String tokenValue) { return new CustomerVerifyEmailCommand(customer.getId(), customer.getVersion(), tokenValue); }
/** * Creates a command to verify the email of a customer. * @param customer unused * @param tokenValue the value of the token which customer email address should be confirmed * @return command * @deprecated use {@link #ofTokenValue(String)} or {@link #ofCustomerToken(CustomerToken)} */ @Deprecated//do not delete soon public static CustomerVerifyEmailCommand of(final Versioned<Customer> customer, final String tokenValue) { return new CustomerVerifyEmailCommand(customer.getId(), customer.getVersion(), tokenValue); }
/** * Creates a versioned that only contains the id and the version. * @param versioned the template object to use its ID and version * @param <T> The type which has an ID and version. * @return versioned */ static <T> Versioned<T> of(final Versioned<T> versioned) { return of(versioned.getId(), versioned.getVersion()); }
/** * Creates a command object to create a token to verify a customer's email. * No optimistic version control is used. * @param customer customer * @param timeToLiveInMinutes the time in minutes the token is valid, platform limitation apply * @return command */ public static CustomerCreateEmailTokenCommand of(final Identifiable<Customer> customer, final Integer timeToLiveInMinutes) { final Long version = customer != null && customer instanceof Versioned ? ((Versioned<Customer>)customer).getVersion() :null; return new CustomerCreateEmailTokenCommand(customer.getId(), version, timeToLiveInMinutes); }
static OrderFromCartDraft of(final Versioned<Cart> cart) { return OrderFromCartDraftDsl.of(cart.getId(), cart.getVersion(), null, null); } }
@Override public HttpRequestIntent httpRequestIntent() { final String baseEndpointWithoutId = endpoint.endpoint(); if (!baseEndpointWithoutId.startsWith("/")) { throw new RuntimeException("By convention the paths start with a slash, see baseEndpointWithoutId()"); } return HttpRequestIntent.of(HttpMethod.DELETE, baseEndpointWithoutId + "/" + versioned.getId() + "?version=" + versioned.getVersion()); }
public static CustomerCreateEmailTokenCommand of(final Versioned<Customer> customer, final Integer timeToLiveInMinutes) { return new CustomerCreateEmailTokenCommand(customer.getId(), customer.getVersion(), timeToLiveInMinutes); }
static OrderFromCartDraft of(final Versioned<Cart> cart) { return OrderFromCartDraftDsl.of(cart.getId(), cart.getVersion(), null, null); } }
public static CustomerChangePasswordCommand of(final Versioned<Customer> customer, final String currentPassword, final String newPassword) { return new CustomerChangePasswordCommand(customer.getId(), customer.getVersion(), currentPassword, newPassword); }
public static OrderFromCartDraft of(final Versioned<Cart> cart) { return new OrderFromCartDraft(cart.getId(), cart.getVersion(), null, null); }
/** * Creates a command to verify the email of a customer. * @param customer unused * @param customerToken the token object * @return command * @deprecated use {@link #ofTokenValue(String)} or {@link #ofCustomerToken(CustomerToken)} */ @Deprecated//do not delete soon public static CustomerVerifyEmailCommand of(final Versioned<Customer> customer, final CustomerToken customerToken) { return new CustomerVerifyEmailCommand(customer.getId(), customer.getVersion(), customerToken.getValue()); }
/** * Creates a command to verify the email of a customer. * @param customer unused * @param customerToken the token object * @return command * @deprecated use {@link #ofTokenValue(String)} or {@link #ofCustomerToken(CustomerToken)} */ @Deprecated//do not delete soon public static CustomerVerifyEmailCommand of(final Versioned<Customer> customer, final CustomerToken customerToken) { return new CustomerVerifyEmailCommand(customer.getId(), customer.getVersion(), customerToken.getValue()); }
@Override public HttpRequestIntent httpRequestIntent() { final String baseEndpointWithoutId = endpoint; if (!baseEndpointWithoutId.startsWith("/")) { throw new RuntimeException("By convention the paths start with a slash"); } final UrlQueryBuilder builder = UrlQueryBuilder.of(); expansionPaths().forEach(path -> builder.add("expand", path.toSphereExpand(), true)); final String expansionPathParameters = builder.build(); return HttpRequestIntent.of(HttpMethod.DELETE, baseEndpointWithoutId + "/" + versioned.getId() + "?version=" + versioned.getVersion() + (expansionPathParameters.isEmpty() ? "" : "&" + expansionPathParameters) + (eraseData ? "&dataErasure=true" : "")); }
@Override public HttpRequestIntent httpRequestIntent() { if (!baseEndpointWithoutId.startsWith("/")) { throw new RuntimeException("By convention the paths start with a slash, see baseEndpointWithoutId()"); } final String path = baseEndpointWithoutId + "/" + getVersioned().getId(); return HttpRequestIntent.of(HttpMethod.POST, path, toJson(new UpdateCommandBody<>(getVersioned().getVersion(), getUpdateActions()))); }
@Override public HttpRequestIntent httpRequestIntent() { if (!baseEndpointWithoutId.startsWith("/")) { throw new RuntimeException("By convention the paths start with a slash, see baseEndpointWithoutId()"); } final String additions = queryParametersToString(true); final String path = baseEndpointWithoutId + "/" + getVersioned().getId() + (additions.length() > 1 ? additions : ""); return HttpRequestIntent.of(HttpMethod.POST, path, toJsonString(new UpdateCommandBody<>(getVersioned().getVersion(), getUpdateActions()))); }