SWS EndRental Method
Vacates a rental item and processes a final payment if rent is due, or it processes a refund if rent is overpaid. The PaymentData object is required if a refund is warranted upon termination of rental; otherwise it is ignored. The TotalAmtDue object must be equal to either the total of the CreditCardInfo, CheckInfo or CashInfo object’s amount. The RefundData object is required if a refund is warranted upon termination of rental; otherwise it is ignored. The ContactData object is required for all refunds to Check or Credit Card; otherwise it is ignored. Use the GetMoveOutInfo SWS method prior to using this SWS method to determine whether rent is due, or a refund is warranted, for a specific rental item as well as the refund types that are available upon termination.
Parameters
Name | DataType | Is Required |
---|---|---|
AccountID | Long | Required |
Description | The account’s ID number. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method. | |
ContactData | ContactInfo | Required |
Description | The data object required to confirm the customer’s contact information at rental termination. | |
PaymentData | MakePayment_Request | Optional |
Description | The data object required to processing a payment if there is an amount due at the time of rental termination. | |
MoveOutDate | DateTime | Optional |
Description | The date applied when vacating a rental item. This defaults to today’s date unless otherwise specified. The date can be set in the past, based on the site’s End Rental rule settings. No future dates are allowed. | |
OrgID | Long | Required |
Description | The organization’s ID number. | |
RefundData | RefundData | Optional |
Description | Data object required if processing a refund a the time of rental termination. | |
RentalID | Long | Required |
Description | The rental item’s ID number. This is returned when using the MakeReservation method or can be searched for using the SearchBy method. | |
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
AppliedCashCredit | Boolean |
Description | Indicates that the cash credit/escrow was successfully applied (“True”) or not (“False”). |
ErrorMessage | String |
Description | A message about any problem that occurred during the process, including details to locate errant code. |
RefundMessage | String |
Description | The message associated with the success or failure of processing the refund. |
TransactionID | Long |
Description | The transaction’s ID number. Transaction IDs are system generated for each payment transaction that occurs in the system. A null 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 EndRental request object and a EndRental response object. We can define and create those like this:
// Create request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.EndRental_Request request = new SWS.EndRental_Request();
SWS.EndRental_Response response;
SWS.MakePayment_Request pay_request = new SWS.MakePayment_Request();
Here’s my sample code of the Request object.
// payment data pay_request.SiteID = 123456; pay_request.AcctID = 123456; pay_request.RentalIDs = new long[] { 123456 }; pay_request.Cycles = new int[] { 1 }; pay_request.TotalAmtDue = 50.50m; pay_request.TotalAmtPaid = 50.50m; pay_request.CashInfo= 50.50m; pay_request.IsRetail = false; pay_request.IsRetailAndRental = false; // end rental request with money owed request.OrgID = 123456; request.SiteID = 123456; request.AccountID = 123456; request.RentalID = 123546; request.MoveOutDate = DateTime.Today;
Finally we can call the method and pass across the login object and the request object to end our rental. 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.EndRental(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.