All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.orders.OrderFromCartDraft Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.orders;

import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.models.Versioned;

import java.util.Optional;

public class OrderFromCartDraft extends Base {
    private final String id;
    private final long version;
    private final Optional orderNumber;
    private final Optional  paymentState;

    private OrderFromCartDraft(final String id, final long version, final Optional orderNumber, final Optional paymentState) {
        this.id = id;
        this.version = version;
        this.orderNumber = orderNumber;
        this.paymentState = paymentState;
    }

    public static OrderFromCartDraft of(final Versioned cart, final Optional orderNumber, final Optional paymentState) {
        return new OrderFromCartDraft(cart.getId(), cart.getVersion(), orderNumber, paymentState);
    }

    public static OrderFromCartDraft of(final Versioned cart) {
        return new OrderFromCartDraft(cart.getId(), cart.getVersion(), Optional.empty(), Optional.empty());
    }

    public String getId() {
        return id;
    }

    public long getVersion() {
        return version;
    }

    public Optional getOrderNumber() {
        return orderNumber;
    }

    public Optional getPaymentState() {
        return paymentState;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy