Example 25 : Find delivery times

Printer-friendly version
package com.metapack.dm.test;
 
import com.metapack.deliverymanager.client.DeliveryTime;
import com.metapack.deliverymanager.client.FindDeliveryTimesParams;
import com.metapack.deliverymanager.client.webservices.DeliveryOptionsService;
 
public class Example25 extends ExampleBase{
 
	public void run() throws Exception {
 
		DeliveryOptionsService service = createDeliveryOptionsService();
 
		FindDeliveryTimesParams times = new FindDeliveryTimesParams();
 
		times.setCarrierServiceCode("PF24");
		times.setDateCount(6);  
		times.setRecipientAddress(createDefaultAddress());
		times.setSenderAddress(createDefaultAddress());
		times.setWarehouseCode("default");
 
		DeliveryTime[] deliveryTimes = service.findDeliveryTimes(times);
		System.out.println("Parcelforce:  ");
 
		for( DeliveryTime option : deliveryTimes ) {
			System.out.println( "cutoffDateTime: " + formatDateTimeNice(option.getCutoffDateTime()) 
					+ " despatchDateTime: " + formatDateTimeNice(option.getDespatchDateTime()) 
					+ " earliestDeliveryDateTime " + formatDateTimeNice(option.getEarliestDeliveryDateTime())
					+ " guaranteedDeliveryDateTime " + formatDateTimeNice(option.getGuaranteedDeliveryDateTime()) 
			);
		}
	}
}