io.sphere.sdk.orders.commands.updateactions.AddParcelToDelivery Maven / Gradle / Ivy
package io.sphere.sdk.orders.commands.updateactions;
import io.sphere.sdk.commands.UpdateAction;
import io.sphere.sdk.orders.Delivery;
import io.sphere.sdk.orders.Order;
import io.sphere.sdk.orders.ParcelMeasurements;
import io.sphere.sdk.orders.TrackingData;
import java.util.Optional;
/**
{@include.example io.sphere.sdk.orders.commands.OrderUpdateCommandTest#addParcelToDelivery()}
*/
public class AddParcelToDelivery extends UpdateAction {
private final String deliveryId;
private final Optional measurements;
private final Optional trackingData;
private AddParcelToDelivery(final String deliveryId, final Optional measurements, final Optional trackingData) {
super("addParcelToDelivery");
this.deliveryId = deliveryId;
this.measurements = measurements;
this.trackingData = trackingData;
}
public static AddParcelToDelivery of(final String deliveryId, final ParcelDraft parcelDraft) {
return new AddParcelToDelivery(deliveryId, parcelDraft.getMeasurements(), parcelDraft.getTrackingData());
}
public static AddParcelToDelivery of(final Delivery delivery, final ParcelDraft parcelDraft) {
return of(delivery.getId(), parcelDraft);
}
public String getDeliveryId() {
return deliveryId;
}
public Optional getMeasurements() {
return measurements;
}
public Optional getTrackingData() {
return trackingData;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy