Example #1
0
        public static String SearchQuotes(Credentials credentials, String SearchCriteria = "")
        {
            string retVal = "";

            //http://help.webcomcpq.com/doku.php?id=appendixd:search_quotes
            // this method enables the external system to retrieve quotes from SAP CPQ based on provided search criteria.
            //This method is only available if SAP CPQ user account that is used to make a call is set as an administrative account.
            //The maximum number of quotes that can be returned is 2000.

//        Examples:

//            DATE_MODIFIED > '8/3/2011 13:50:20'
//        Returns all quotes that have been modified after this date / time
//    DATE_CREATED > '9/24/2011 00:00:00'
//        Returns all quotes that have been created after this date / time
//    DATE_MODIFIED > '8/3/2011 13:50:20' AND ORDER_STATUS = '2'
//        Returns all quotes that have been modified after this date / time that are in status ‘Order Placed’

//If Criteria for search is empty, SAP CPQ will return all quotes(top 2000 quotes).

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;
            retVal = cpq_service.SearchQuotes(credentials.Login, credentials.Password, SearchCriteria);
            return(retVal);
        }
Example #2
0
        public static String ValidateCatalogueCodes(Credentials credentials, ValidateCatalogueCodes catalogueCodes)
        {
            //http://help.webcomcpq.com/doku.php?id=appendixd:validatecataloguecodeswebmethod:validatecataloguecodeswebmethod

            //  <CatalogueCodes>
            //< CatalogueCode > A2223A </ CatalogueCode >
            //< CatalogueCode > A2223B </ CatalogueCode >
            //< CatalogueCode > A2223C </ CatalogueCode >
            //</ CatalogueCodes >

            //http://help.webcomcpq.com/doku.php?id=appendixd:validatecataloguecodeswebmethod:validatecataloguecodeswebmethod

            //Function description: ValidateCatalogueCodes function executes reverse search on supplied part numbers.
            //    Result of this function is validity status for each supplied catalogue code.
            //    If code is valid, result will also contain product name and item list price.

            //API parameters username / password identifies the API user

            //Maximum number of Catalogue codes per one call is limited to 5 in order to obtain optimal function and system resources
            //usability.

            string retVal = "";

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;
            XmlDocument xDoc = catalogueCodes.CreateXml();

            XmlNode response = cpq_service.ValidateCatalogueCodes(credentials.Login, credentials.Password, xDoc);

            retVal = response.InnerXml;
            Console.WriteLine("Validate Catalogue Codes response: " + retVal);

            return(retVal);
        }
Example #3
0
        public static Customer Customer(Customer customer, Credentials credentials)
        {
            //default return value
            Customer retVal = customer;

            //adding a customer

            //complete list of WsSrv operations: https://www.webcomcpq.com/wsAPI/wssrv.asmx

            //WsSrv.WsSrv service = new WsSrv.WsSrv();
            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            //wait 200 seconds:
            //service.Timeout = 200 * 1000;
            cpq_service.Timeout = 200 * 1000;
            //  < Customers >
            //    < Customer >
            //      < Id > 23 </ Id >
            //      < ExternalId ></ ExternalId >
            //      < Active > 0 </ Active >
            //      < FirstName > Harry </ FirstName >
            //      < LastName > Bruce </ LastName >
            //      < CustomerType ></ CustomerType >
            //      < Company > Procter & amp; Gamble Company, The</Company>
            //      <Address1>Procter &amp; Gamble Plaza</Address1>
            //      <Address2></Address2>
            //      <City>Cincinnati</City>
            //      <Province></Province>
            //      <StateAbbrev>OH</StateAbbrev>
            //      <ZipCode>45402</ZipCode>
            //      <CountryAbbrev>US</CountryAbbrev>
            //      <TerritoryName></TerritoryName>
            //      <BusinessPhone>(513) 698-6421</BusinessPhone>
            //      <BusinessFax>(513) 983-4381</BusinessFax>
            //      <EMail></EMail>
            //      <OwnerID>234</OwnerID>
            //      <OwnerUserName>MitchB</OwnerUserName>
            //      <CRMAccountId>0036000000Kq8eU</CRMAccountId>
            //      <CRMContactId>0016000000F0qvQ</CRMContactId>
            //      <CustomFields>
            //	<CustomField>
            //	   <Name>CustomCode</Name>
            //	   <Value>AAA111</Value>
            //	</CustomField>
            //      </CustomFields>
            //    </Customer>

            XmlDocument xDoc = customer.CreateXml();

            XmlNode response = cpq_service.CustomerAdministration(credentials.Login, credentials.Password, "ADDORUPDATE", xDoc);

            //XmlNode response = service.SimpleProductAdministration(credentials.Login, credentials.Password, "ADDORUPDATE", xDoc);
            Console.WriteLine(response.InnerXml);;
            return(retVal);
        }
Example #4
0
        public static String GetQuoteData(Credentials credentials, string cartCompositeNumber, int?revNumber)
        {
            //http://help.webcomcpq.com/doku.php?id=appendixd:get_quote_data:get_quote_data

            //returns general quote data (including main/line items), actions, key attributes, product types,
            //promo codes, additional discounts, markets, shippings, customer data and customer fields
            string retVal = "";

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;
            retVal = cpq_service.GetQuoteData(credentials.Login, credentials.Password, cartCompositeNumber, revNumber);
            return(retVal);
        }
Example #5
0
        //login issues persist for CPQQPI login attempts.

        public static String Catalogue(Credentials credentials)
        {
            //http://help.webcomcpq.com/doku.php?id=appendixd:get_catalogue:result_xml_examples

            //returns the XML of the entire Catalogue.
            //note, this can quickly exceed the limits of XML, and may not be the best method to get all items. A better way is likely to just export Products using the
            //CPQ native interface.
            string retVal = "";

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;
            retVal = cpq_service.GetCatalogue(credentials.Login, credentials.Password);
            return(retVal);
        }
Example #6
0
        public static String GetCartProperties(Credentials credentials, String QuotationNumber)
        {
            string retVal = "";

            //returns values for specified cart properties. If no cart property is explicitly specified values of all properties will be returned.
            //currently, response always returns all properties;
            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;

            XmlNode response = cpq_service.getCartProperties(credentials.Login, credentials.Password, QuotationNumber, null);

            retVal = response.InnerXml;
            Console.WriteLine("Get Cart Properties response " + retVal);
            return(retVal);
        }
Example #7
0
        public static String GetCartActions(Credentials credentials, String OrderID)
        {
            //gets the available actions for given quote and for supplied username, based on quote's status.
            string retVal = "";

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;

            XmlNode response = cpq_service.getActionList(credentials.Login, credentials.Password, OrderID);

            retVal = response.InnerXml;
            Console.WriteLine("Get Cart Actions response: " + retVal);

            return(retVal);
        }
        public bool DoYouSeeMe2()
        {
            //for use with CPQApi Web Reference
            bool retVal = false;

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;

            string      response = cpq_service.doUSeeMe(Login, Password);
            XmlDocument xdoc     = new XmlDocument();

            Console.WriteLine(response);
            xdoc.LoadXml(response);
            retVal = xdoc.FirstChild.Name.Equals("ICANSEEYOU");

            return(retVal);
        }
Example #9
0
        public static String GetQuoteItemsAttributes(Credentials credentials, String CartCompositeNumber)
        {
            string retVal = "";

            //returns attributes (all or specified ones) from desired quote
            //Important note: in XML, Line Items are stored in <PRODUCT> nodes, just like Main Items. They are not present in <ATTRIBUTE> node. Also, for Line Items,
            //following nodes are always empty: <ProductId>, <IsSimple>, <IsValid>, <DescriptionLong>

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            cpq_service.Timeout = 200 * 1000;
            bool   GetAllAttributes = true;
            string response         = cpq_service.GetQuoteItemsAttributes(credentials.Login, credentials.Password, CartCompositeNumber, null, null, GetAllAttributes);

            retVal = response;
            Console.WriteLine("Get Quote Items Attributes response " + response);

            return(retVal);
        }
Example #10
0
        public static LinkOpportunity LinkOpportunity(LinkOpportunity linkOpportunity, Credentials credentials, string orderId)
        {
            //< Crm >
            //  < OpportunityId > 892ADE6756HIX </ OpportunityId >
            //     < OpportunityName > Test Oppty </ OpportunityName >
            //      </ Crm >
            //push LinkOpportunity
            LinkOpportunity retVal = linkOpportunity;

            CpqApi.CpqApi cpq_service = new CpqApi.CpqApi();
            //wait 200 seconds:
            //service.Timeout = 200 * 1000;
            cpq_service.Timeout = 200 * 1000;

            XmlDocument xDoc     = linkOpportunity.CreateXml();
            XmlNode     response = cpq_service.LinkOpportunity(credentials.Login, credentials.Password, orderId, xDoc);

            Console.WriteLine(response.InnerXml);
            return(retVal);
        }