/** * @input basket : dw.order.LineItemCtnr * @input ATPRequest : String * @input ATPCallType : Object * @output outputMessage : Object */ importPackage( dw.system ); importPackage( dw.rpc ); importPackage( dw.order ); importScript("ATPCall/ATPUtils.ds"); var ATP = require("ATP"); function execute( args : PipelineDictionary ) : Number { if(args.basket && args.ATPRequest ) { //Getting script variables if(isMultiWareHouse(args.basket) == true){ var ResponseMessage = new Object(); ResponseMessage.Statut = true; args.outputMessage = ResponseMessage; return PIPELET_NEXT; } var basket : Basket = args.basket; var atpRequest : String = args.ATPRequest; var atpCallType : String = args.ATPCallType; if(atpRequest) { var response = ATP.sendATPRequest(basket, atpRequest, atpCallType); args.outputMessage = response; if(!response.Statut){ Logger.error("Error in ATP send request"); return PIPELET_ERROR; } } else { Logger.error("Unable to get site preferences username & password to initialize web service call"); return PIPELET_ERROR; } return PIPELET_NEXT; } return PIPELET_ERROR; }