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

com.shopify.model.ShopifyOrderCreationRequest Maven / Gradle / Ivy

package com.shopify.model;

import java.util.List;

import org.joda.time.DateTime;

public class ShopifyOrderCreationRequest {

	private final ShopifyOrder request;

	public static interface ProcessedAtStep {
		NameStep withProcessedAt(final DateTime processedAt);
	}

	public static interface NameStep {
		CustomerStep withName(final String name);
	}

	public static interface CustomerStep {
		LineItemsStep withCustomer(final ShopifyCustomer customer);

		LineItemsStep noCustomer();
	}

	public static interface LineItemsStep {
		ShippingAddressStep withLineItems(final List lineItems);
	}

	public static interface ShippingAddressStep {
		BillingAddressStep withShippingAddress(final ShopifyAddress shippingAddress);
	}

	public static interface BillingAddressStep {
		MetafieldsStep withBillingAddress(final ShopifyAddress billingAddress);
	}

	public static interface MetafieldsStep {

		ShippingLinesStep withMetafields(List metafields);
	}

	public static interface ShippingLinesStep {
		BuildStep withShippingLines(List shippingLines);
	}

	public static interface BuildStep {
		ShopifyOrderCreationRequest build();
	}

	public static ProcessedAtStep newBuilder() {
		return new Steps();
	}

	public ShopifyOrder getRequest() {
		return request;
	}

	private ShopifyOrderCreationRequest(final ShopifyOrder request) {
		this.request = request;
	}

	private static class Steps implements ProcessedAtStep, NameStep, CustomerStep, MetafieldsStep, LineItemsStep,
			ShippingAddressStep, BillingAddressStep, ShippingLinesStep, BuildStep {

		private final ShopifyOrder request = new ShopifyOrder();

		@Override
		public ShopifyOrderCreationRequest build() {
			return new ShopifyOrderCreationRequest(request);
		}

		@Override
		public ShippingAddressStep withLineItems(final List lineItems) {
			request.setLineItems(lineItems);
			return this;
		}

		@Override
		public LineItemsStep withCustomer(final ShopifyCustomer customer) {
			request.setCustomer(customer);
			return this;
		}

		@Override
		public LineItemsStep noCustomer() {
			request.setCustomer(null);
			return this;
		}

		@Override
		public NameStep withProcessedAt(final DateTime processedAt) {
			request.setProcessedAt(processedAt);
			return this;
		}

		@Override
		public MetafieldsStep withBillingAddress(final ShopifyAddress shippingAddress) {
			request.setBillingAddress(shippingAddress);
			return this;
		}

		@Override
		public BillingAddressStep withShippingAddress(final ShopifyAddress billingAddress) {
			request.setShippingAddress(billingAddress);
			return this;
		}

		@Override
		public ShippingLinesStep withMetafields(final List metafields) {
			request.setMetafields(metafields);
			return this;
		}

		@Override
		public CustomerStep withName(final String name) {
			request.setName(name);
			return this;
		}

		@Override
		public BuildStep withShippingLines(final List shippingLines) {
			request.setShippingLines(shippingLines);
			return this;
		}

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy