Archive

Posts Tagged ‘Retail’

SWS VoidRetailAssessments Method

May 31, 2011 Leave a comment

Allows you to void an assessment for a retail item. A void can only be completed on the same day the item was assessed and prior to nightly processing.

Parameters

Name DataType Is Required
AssessID Long Required
Description The assessment’s ID number. This can be retrieved using the GetAssessments method.
SiteID Long Required
Description The site’s ID number. This can be found using the GetSiteList method.

Returned Parameters

Name DataType
AssessID Long
Description The assessment ID number of the item that was voided.
ErrorMessage Boolean
Description A message with details about why the void failed.
Success Boolean
Description Indicates if the retail item was voided successfully (“True”) or not (“False”).

Example

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

We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project.  At this point we need to our objects.  We’ll need the standard service object, a VoidRetailAssessment request object and a VoidRetailAssessment response object.  We can define and create those like this:

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

Here’s my sample code of the Request object.

// VoidRetailAssessments Request
request.SiteID = 123546;
request.AssessIDs = new long[] { 123456 };

Finally we can call the method and pass across the login object and the request object to void our retail assessment. 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.VoidRetailAssessments(user_request, request);
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.

For a full list of methods see SWS Methods.

SWS ReturnRetailItems Method

May 25, 2011 Leave a comment

Processes returns for retail items based on the site rules. If the credit card option is chosen but fails to process through the card processor, a check will be mailed to the contact instead based on refund approval rules.

Parameters

Name DataType Is Required
contactInfo:AccountID Long Optional
Description The account’s ID number.
contactInfo:Address1 String Optional*
Description The first line of the address where the refund check will be sent or the address on the credit card where the funds will be returned.
*This is required if using CHECK or CREDIT_CARD refund types.
contactInfo:Address2 String Optional
Description The second line of the address where the refund check will be sent or the address on the credit card where the funds will be returned.
contactInfo:City String Optional*
Description The city of the address where the refund check will be sent or the address on the credit card where the funds will be returned.
*This is required if using CHECK or CREDIT_CARD refund types.
contactInfo:ContactName String Required
Description The name to whom the check should be made out or the name on the credit card where the funds are being returned.
contactInfo:Country String Optional
Description The country of the address where the refund check will be sent or the address on the credit card where the funds will be returned.
contactInfo:PostalCode String Optional*
Description The postal/ZIP code of the address where the refund check will be sent or the address on the credit card where the funds will be returned.
*This is required if using CHECK or CREDIT_CARD refund types.
contactInfo:State String Optional*
Description The state/province of the address where the refund check will be sent or the address on the credit card where the funds will be returned.
*This is required if using CHECK or CREDIT_CARD refund types.
OrgID Long Required
Description The organization’s ID number.
ReturnRetailData ReturnRetailItem Required
Description The object containing the details about the retail item/s being returned. Create a collection for each RetailObjectID being returned.
RefundType RefundTypes Required
Description The refund type for reimbursing the customer.
Available values (Note: The site’s rules determine how a refund will be issued and not all values will be available for all refunds.):

  • CASH_CREDIT
  • CASH
  • CREDIT_CARD
  • CHECK
RentalID Long Optional
Description The rental item’s ID number. Depending on your xml parser, you may have to pass in a ‘0’ to avoid getting an error.
SiteID Long Required
Description The site’s ID number. This can be found using the GetSiteList method.
TransactionID Long Optional
Description The original transaction’s ID number. Transaction IDs are system generated for each payment transaction that occurs in the system. If there is no transaction ID the transaction failed. The transaction ID is returned when any MakePayment method is used.

Returned Parameters

Name DataType
TotalRefundAmount Decimal
Description The refund amount. This is automatically calculated by the Store application, based on the Refund rules for the site.
RefundMessage String
Description The message associated with the success or failure of processing the refund. This will provide additional information if needed.
NewReturnTransactionID Long
Description The transaction’s ID number. Transaction IDs are system generated for each payment transaction that occurs in the system. A blank or “0” response indicates the transaction failed.

Example

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

We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project.  At this point we need to our objects.  We’ll need the standard service object, a ReturnRetailItems request object and a ReturnRetailItems response object.  As part of the ReturnRetailItems request object we also need ContactInfo object and an array of ReturnRetailItem objects.  We can define and create those like this:

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

SWS.ContactInfo contactInfo = new SWS.ContactInfo ();
SWS.ReturnRetailItem returnItem = new SWS.ReturnRetailItem();

Here’s my sample code of the Request object.

// Requests
contactInfo.AccountID = 123456;
contactInfo.ContactName = "John Doe";
contactInfo.Address1 = "123 Main St";
contactInfo.City = "My Town";
contactInfo.State = "CA";
contactInfo.PostalCode = "12345";

returnItem.RetailObjectID = 123456;
returnItem.Quantity = 1;
returnItem.ReturnReason = SWS.RetailReturnReasons.DEFECTIVE_VENDOR_RETURN;

request.OrgID = 123456;
request.SiteID = 123456;
request.TransactionID = 123456;
request.RefundType = SWS.RefundTypes.CREDIT_CARD;
request.ContactData = contactInfo;
request.ReturnRetailData = new SWS.ReturnRetailItem[] { returnItem };

Finally we can call the method and pass across the login object and the request object to return our retail items. 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.ReturnRetailItems(user_request, request);
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.

For a full list of methods see SWS Methods.

SWS SellRetailWithAccountMultiple Method

Creates a retail assessment for multiple items and attaches it to an account. Once you have a response, you will need to call the GetTotalDue method. This will provide the total amount that needs to be paid using the MakePayment method. To add multiple different items to the account you will need to have an array of “SellRetailWithAccount” for each item that should be added to the account.

Parameters

Name DataType Is Required
AccountID Long Required
Description The account’s ID number to which the retail will be attached. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method.
Item AVAIL_SITE_RETAIL_ITEMS Required
Description The object containing the required item information.
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 assessments were added successfully 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 SellRetailWithAccountMultiple request object, and a SellRetailMultiple response object. We will also need SellRetailWithAccount request object as the above request takes an array of these items and we will need a response from the GetAvailableRetailItems method. We can define and create those like this:

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

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

Here is a sample code of the request object:

// SellRetailWithAccountMultiple Request
retailItemReq.SiteID = 123456;

requestItems[0].AccountID = 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.SellRetailWithAccountMultiple(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.

SWS SellRetailWithAccount Method

Creates a retail assessment and attaches it to an account. Once you have a response, you will need to call the GetTotalDue method. This will provide the total amount that needs to be paid using the MakePayment method.

Parameters

Name DataType Is Required
AccountID Long Required
Description The account’s ID number to which the retail will be attached. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method.
Item AVAIL_SITE_RETAIL_ITEMS Required
Description The object containing the required item information.
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.

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 SellRetailWithAccount request object, and a SellRetailWithAccount response object. We will also need a response from the GetAvailableRetailItems method. We can define and create those like this:

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

SWS.GetAvailableRetailItems_Request retailItemReq = 
                                 new SWS.GetAvailableRetailItems_Request();

Here is a sample code of the request object:

// SellRetailWithAccount Request
retailItemReq.SiteID = 123456;

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

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.SellRetailWithAccount(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.