SWS CancelReservationV3 Method
Cancels a reservation made for specified rental item(s) and/or quote(s). Returns data regarding possible refunds. Note: If the rental contact information is not supplied and the refund data indicates a refund should be processed, the contact information will default to the rental item(s)’ primary contact information. It also lets you retain the refund which was not possible in the original method. This method also allows you to use the organizations customized LostDemandReason, rather than using the applications presets.
Parameters
Name | Data Type | Is Required |
---|---|---|
AcctID | 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. | |
RentalIDS | Long | Required |
Description | The rental items id numbers. This can be an array if there are multiple rentals that need to be cancelled. This is returned when using the MakeReservation method or can be searched for using the SearchBy method. | |
QuoteIDs | Long | Required |
Description | The quote’s ID number. This can be an array of quotes if there are multiple quotes that need to be cancelled. This is returned when processing the MakeReservation method or can be retrieved using the GetReservations method. | |
LostDemandReason | Integer | Required |
Description | The lost demand reason as to why a potential customer failed to initiate a rental. You will need to contact the site for their customized list. | |
LostDemandNotes | String | Required |
Description | The free text note as to why a potential customer failed to initiate a rental. Max string length of 500. | |
DenyDepositRefund | Boolean | Required |
Description | Indicates if the refund should be retained. True retains the refund, false refunds with cash,credit or check. Defaults to false. | |
DenyRefundReason | String | Required |
Description | The reason for denying a customer’s refund (i.e., Delinquent on other rentals). Max string length of 500. | |
ContactData | ContactInfo | Optional |
Description | The object containing the contact information. If no information is entered here the primary contact info is used as default. |
Returned Parameters
Name | Data Type |
---|---|
ObjectId | Long |
Description | The rental item’s ID number. |
TranID | String |
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. |
HasDeposit | Boolean |
Description | Indicates if the reservation has a refundable deposit (“True”) or not (“False”). |
AvailableRefundAmount | Decimal |
Description | The processed refund amount, if warranted. |
Succeeded | Boolean |
Description | Indicates if the cancellation was succesful (“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. |
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 CancelReservationV3 request object and a CancelReservation response object. We can define and create those like this:
// Create a request and response objects and ContactInfo object.
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.CancelReservationV3_Request request = new SWS.CancelReservationV3_Request();
SWS.CancelReservation_Response response;
SWS.ContactInfo contact_info = new SWS.ContactInfo();
Here’s my sample code of the Request object.
// Contact Data contact_info.AccountID = 123456; contact_info.Address1 = "123 Main St."; contact_info.City = "My Town"; contact_info.State = "UT"; contact_info.PostalCode = "00000"; contact_info.ContactName = "First Last"; // To cancel reservations(s) request.AcctID = 123456; request.RentalIDs = new long[] { 123456, 654321 }; request.LostDemandReason = 10001; request.LostDemandNotes = "Unit size no longer available"; request.ContactData = contact_info; request.DenyDepositRefund = true; request.DenyRefundReason = "They were told the amount was non-refundable.";
Finally we can call the method and pass across the login object and the request object to cancel the reservation. 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.CancelReservationV3(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.