SWS GetAvailableCredits Method
Retrieves a collection of PCD data for any credits that are available for the organization and site.
Parameters
Name | DataType | Is Required |
---|---|---|
OrgID | Long | Required |
Description | The organization’s ID number. | |
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
ACTIVE | Boolean |
Description | Indicates if the credit is available to use (“True”) or not (“False”). |
AMT_TYPE | Integer |
Description | The numeric value that represents the type of credit. As account credits this will always be “1”. |
CREDIT_LEVEL | Integer |
Description | The credit level required to be able to apply the PCD. This is based on the credit level assigned to a user in the User Admin/Permissions feature in Store. |
DELINQUENCY_LIMIT | Integer |
Description | The maximum number of rental cycle periods an account can be delinquent, and still receive the credit. |
DISP_AMT | String |
Description | The minimum and maximum amounts that are available for the credit. |
EXPIRES | DateTime |
Description | The date that the credit can no longer be used towards assessments. |
LIMIT_ACTION | Integer |
Description | Not currently used. |
LIMIT_TYPE | Integer |
Description | Not currently used. |
LOS_REQ | Decimal |
Description | The minimum number of rental cycle periods that must be paid for to qualify for the credit. |
ORG_ID | Long |
Description | The organization’s ID number. |
PAY_LOGIC | String |
Description | Indicates how the credit can be applied to the rental. This will always be “occurs 1” for credits. |
PAYMENT_REQUIRED | Boolean |
Description | Indicates if payment is required immediately (“True”) or not (“False”). This should always be “False” for credits. |
PCD_AMT_DEFAULT | Decimal |
Description | The default amount of the credit, if no amount is specified. If this was not set by the admin when the credit was created, it will be the minimum amount. |
PCD_AMT_MAX | Decimal |
Description | The maximum credit amount that can be applied. |
PCD_AMT_MIN | Decimal |
Description | The minimum credit amount that can be applied. |
PCD_CLASS | Integer |
Description | The numeric value that represents the PCD class. Available values:
This should always be “Credit” for this method. |
PCD_DESC | String |
Description | The description of the credit as defined by the organization. |
PCD_ID | Long |
Description | The credit’s ID number. |
PCD_NAME | String |
Description | The name of the credit as defined by the organization. |
PCD_PERIODS | Integer |
Description | The number of rental cycle periods the credit is available to be applied. |
PCD_REV_CAT | Integer |
Description | The numeric value that represents the revenue category. This will always be “1” for a credit, but credits can be applied until no funds are left of the credit. |
REASON_PROMPT | Integer |
Description | Indicates if a reason for providing the credit is required and what form it will take. This can be customized by the organization. Contact the organization for available values. |
SITE_ID | Decimal |
Description | The site’s ID number. |
STARTS | DateTime |
Description | The date the credit was created and applied to the rental. |
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 GetAvailableCredits request object and a GetAvailableCredits response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.GetAvailableCredits_Request request = new SWS.GetAvailableCredits_Request();
SWS.GetAvailableCredits_Response response;
Here’s my sample code of the Request object.
// GetAvailableCredits Request
request.OrgID = 123456;
request.SiteID = 123456;
Finally we can call the method and pass across the login object and the request object to get our available credits. 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.GetAvailableCredits(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.