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

io.sphere.sdk.carts.LineItemDraftDsl Maven / Gradle / Ivy

There is a newer version: 2.16.0
Show newest version
package io.sphere.sdk.carts;

import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.models.ResourceIdentifier;
import io.sphere.sdk.taxcategories.ExternalTaxRateDraft;
import io.sphere.sdk.types.CustomFieldsDraft;

import javax.annotation.Nullable;
import javax.money.MonetaryAmount;
import java.time.ZonedDateTime;
import java.util.Optional;

public final class LineItemDraftDsl extends LineItemDraftDslBase{

    LineItemDraftDsl(@Nullable ZonedDateTime addedAt, @Nullable CustomFieldsDraft custom, @Nullable ResourceIdentifier distributionChannel, @Nullable MonetaryAmount externalPrice, @Nullable ExternalTaxRateDraft externalTaxRate, @Nullable ExternalLineItemTotalPrice externalTotalPrice, String productId, @Nullable Long quantity, @Nullable ItemShippingDetailsDraft shippingDetails, String sku, @Nullable ResourceIdentifier supplyChannel, Integer variantId) {
        super(addedAt, custom, distributionChannel, externalPrice, externalTaxRate, externalTotalPrice, productId, quantity, shippingDetails, sku, supplyChannel, variantId);
    }

    public LineItemDraftDsl withSupplyChannel(@Nullable Referenceable supplyChannel) {
        return super.withSupplyChannel(Optional.ofNullable(supplyChannel).map(Referenceable::toResourceIdentifier).orElse(null));
    }

    public LineItemDraftDsl withDistributionChannel(@Nullable Referenceable distributionChannel) {
        return super.withDistributionChannel(Optional.ofNullable(distributionChannel).map(Referenceable::toResourceIdentifier).orElse(null));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy