
io.sphere.internal.command.OrderCommands Maven / Gradle / Ivy
package io.sphere.internal.command;
import com.google.common.base.Optional;
import io.sphere.client.model.Reference;
import io.sphere.client.shop.model.*;
import net.jcip.annotations.Immutable;
import org.joda.time.DateTime;
import java.util.List;
import static com.google.common.base.Strings.emptyToNull;
/** Commands issued against the HTTP endpoints for working with shopping orders. */
public class OrderCommands {
@Immutable
public static final class UpdateShipmentState extends UpdateAction {
private final ShipmentState shipmentState;
public UpdateShipmentState(ShipmentState shipmentState) {
super("changeShipmentState");
this.shipmentState = shipmentState;
}
public ShipmentState getShipmentState() { return shipmentState; }
}
@Immutable
public static final class UpdatePaymentState extends UpdateAction {
private final PaymentState paymentState;
public UpdatePaymentState(PaymentState paymentState) {
super("changePaymentState");
this.paymentState = paymentState;
}
public PaymentState getPaymentState() { return paymentState; }
}
@Immutable
public static final class AddDelivery extends UpdateAction {
private final List items;
public AddDelivery(List items) {
super("addDelivery");
this.items = items;
}
public List getItems() {
return items;
}
}
@Immutable
public static final class AddParcelToDelivery extends UpdateAction {
private final String deliveryId;
private final ParcelMeasurements measurements;
private final TrackingData trackingData;
public AddParcelToDelivery(String deliveryId, Optional measurements, Optional trackingData) {
super("addParcelToDelivery");
this.deliveryId = deliveryId;
this.measurements = measurements.orNull();
this.trackingData = trackingData.orNull();
}
public String getDeliveryId() {
return deliveryId;
}
public ParcelMeasurements getMeasurements() {
return measurements;
}
public TrackingData getTrackingData() {
return trackingData;
}
@Override
public String toString() {
return "AddParcelToDelivery{" +
"deliveryId='" + deliveryId + '\'' +
", measurements=" + measurements +
", trackingData=" + trackingData +
'}';
}
}
public static final class UpdateSyncInfo extends UpdateAction {
private final Reference channel;
private final String externalId;
private final DateTime syncedAt;
public UpdateSyncInfo(SyncInfo syncInfo) {
super("updateSyncInfo");
channel = syncInfo.getChannel();
externalId = syncInfo.getExternalId();
syncedAt = syncInfo.getSyncedAt();
}
public Reference getChannel() {
return channel;
}
public String getExternalId() {
return externalId;
}
public DateTime getSyncedAt() {
return syncedAt;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy