Example 71 : Enabling a carrier service

Printer-friendly version

 This example shows you how to enable a carrier service.

package com.metapack.dm.test;
 
import com.metapack.deliverymanager.client.webservices.SetupService;
 
public class Example71 extends ExampleBase{
 
	public void run() throws Exception {
 
		SetupService service = createSetupService();
 
		/*
		 * In order to test please disable the following carrier services
		 * in your retailer setup before running this test case.
		 * 
		 * AMTRAK:  AMKDPAKPRE1000 for D-PAK PRE 1000 -- Disabled
		 * NF1MAN: NF1ON for OVERNIGHT, NF1ECO48 for TWO DAY -- Disabled
		 * 
		 */
 
		String[] carrierServiceCodes = new String[]{"AMKDPAKPRE1000", "NF1ON", "NF1ECO48"};
 
		/*
		 * In case of invalid carrier service code, test case will fail and return
		 * fault string as 'Invalid carrier service code'.
		 * 
		 * To test we can use carrier service code AMKDPDDDD0 which is not a valid.
		 * 
		 * String[] carrierServiceCodes = new String[]{"AMKDPDDDD0", "NF1ECO48"};
		 */		
 
		boolean result = service.enableCarrierServices(carrierServiceCodes);
 
		if (result) {
			System.out.println( "Carrier services have been successfully enabled");
		} else {
			System.out.println( "Problem enabling carrier services");
		}
	}
 
	public static void main(String[] args ){
		Example71 ex = new Example71();
		try {
			ex.run();
		} catch( Exception e ) {
			e.printStackTrace(); 
		}
	}
 
}