Home > API General, Retail/Merchandise > SWS SellRetailNoAccountMultiple Method

SWS SellRetailNoAccountMultiple Method


Creates an assessment for the sale of multiple retail items without having a Store account. Once you have a response, you will need to call the GetTotalDue method. To add multiple different items to the account you will need to have an array of “SellRetailNoAccount” for each item that should be added to the account. You will need to contact SWS support in order to get the organizations “non-account sale” AcctID as this is currently not available in SWS.

Parameters

Name DataType Is Required
Item AVAIL_SITE_RETAIL_ITEMS Required
Description The object containing the required item information.
OrgID Long Required
Description The organization’s ID number.
Quantity Integer Required
Description The total number of items to be sold.
TaxExemptNumber String Optional
Description If the company or individual is tax exempt, enter their tax ID number here.

Returned Parameters

Name DataType
AssessmentID Long
Description An assessment ID is created for every assessment set up in store.
ErrorString String
Description If the creation of the assessment failed this will give details as to why.
RetailItemID Long
Description The retail item’s ID number.
Successful Boolean
Description Indicates if the item was successfully assessed to the account (“True”) or not (“False”).

Example

As with every method we need to pass in credentials. We do this with the LookupUser request object.

We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects.  We will need the standard service object, a SellRetailNoAccountMultiple request object, and a SellRetailMultiple response object. We will also need SellRetailNoAccount request object as an array of these objects is what the above request object uses. You will also need results from the GetAvailableRetailItems methods. We can define and create those like this:

// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.SellRetailNoAccountMultiple_Request request = 
                                   new SWS.SellRetailNoAccountMultiple_Request();
SWS.SellRetailMultiple_Response response;

SWS.SellRetailNoAccount_Request[] requestItems = 
                                new SWS.SellRetailNoAccount_Request[1];
SWS.GetAvailableRetailItems_Request retailItemReq = 
                                new SWS.GetAvailableRetailItems_Request();

Here is a sample code of the request object (including some optional parameters):

// SellRetailNoAccountMultiple Request
retailItemReq.SiteID = 123456;

requestItems[0].OrgID = 123456;
requestItems[0].Quantity = 2;
requestItems[0].Item = service.GetAvailableRetailItems(user_request, retailItemReq).Details[0];

request.RetailItems = requestItems;

Finally we can call the method and pass across the login object and the request object to retrieve our requested information. It’s a good idea to do this in a Try Catch block.

// Call the method that will load the response object
try
{
  response = service.SellRetailNoAccountMultiple(user_request, request);
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the exception so it can be debugged.

For a full list of methods see SWS Methods.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: