Home > API General, Refunds, Reports > SWS ExportRefundDetail Method

SWS ExportRefundDetail Method


Retrieves detailed refund information and resets the refund status to indicate the records have been exported. Data is gathered for specified site(s) for a given timeframe.

Parameters

Name DataType Is Required
EndDate DateTime Optional
Description The date to end a process. If start date is provided, then it is the end date of a range of dates. Technically, it’s one day beyond the end date. This will default to today’s date if left undefined.
OrgID Long Required
Description The organization’s ID number.
RefundStatusFilter Integer Optional
Description Selects refunds of given status. Defaults to 2 and 5 if left undefined.
Available values:

  • 1 – Pending Approval
  • 2 – Approved
  • 3 – Denied
  • 4 – Processed
  • 5 – Reset
  • 6 – Credit Fail
  • 7 – System Refund
  • 99 – Cancelled
SiteList Long Optional
Description A collection of limited site details for a specified site zip code(s), site names, or area codes. This will return all sites within the organization if left undefined.
StartDate DateTime Required
Description The date to start a process. If end date is provided, then it is the start date of a range of dates.

Returned Parameters

Name DataType
RefundDetail RefundDetail
Description The object containing all the values of the refund detail.

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’s name it SWS, in your Visual Studio project.  At this point we need to classify our objects.  We’ll need the standard service object, an ExportRefundDetail request object, and an ExportRefundDetail response object. We can define and create those like this:

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

Here’s a sample code of the Request object (including optional parameters):

// ExportRefunds Request
request.OrgID = 5005;
request.SiteList = new long[] { 123456, 456789 };
request.StartDate = DateTime.Today.AddDays(1);
request.EndDate = DateTime.Today;
request.RefundStatusFilter = new int[] { 1 };

 Finally we can call the method and pass across the login object and the request object to export the specified refunds. 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.ExportRefundDetail(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 returned in that exception so it can be debugged.

For a full list of methods see SWS Methods.

Categories: API General, Refunds, Reports
  1. swsBecky
    April 6, 2017 at 8:32 am

    Updated March 12, 2013: Currently this method uses the POST DATE of the refund when determining what data to pull or reset. The post date is the date of the initial request. We recently made upgrades to the code to track the date the refund is approved. Depending on your sites rules and the amount of the refund the approval date may be the same date as the post or may be day(s) later depending on when the item is manually approved (if manual approval was required). Please keep this in mind when requesting data from this method. These changes will go into effect with the April updates. Please check your email to verify the exact date.

  1. September 13, 2012 at 11:54 am

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: