SWS CancelReservationV2 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. This method also lets you retain the refund, which was not possible in the original method.
Parameters
Name | DataType | 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. | |
ContactData | ContactInfo | Optional |
Description | The object containing the contact information. If no information is entered here, the primary contact info is used as default. | |
DenyDepositRefund | Boolean | Required |
Description | Indicates that a refund should be retain (“True”) or refunded (“False”). Defaults to false. Refunds are processed based on site rules in the form of cash, check or credit card. | |
DenyRefundReason | String | Required |
Description | The reason for denying a customer’s refund (i.e., Delinquent on other rentals). Max string length of 500. | |
LostDemandNotes | String | Required |
Description | The free text note as to why the customer terminated the rental. Max string length of 500. | |
LostDemandReason | String | Required |
Description | The lost demand reason as to why a customer terminated a rental. Available values:
|
|
QuoteIDs | Long | Optional |
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. | |
RentalIDs | Long | Optional |
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. |
Returned Parameters
Name | DataType |
---|---|
AvailableRefundAmount | Decimal |
Description | The amount that will be refunded to the customer, if any refund is due. |
ErrorMessage | Decimal |
Description | A message about any problem that occurred during the process, including details to locate errant code. |
HasDeposit | Boolean |
Description | Indicates if the deposit can be refunded (“True”) or not (“False”). |
ObjectID | Long |
Description | The unit’s ID number that is being cancelled. This is maintained through rentals. |
RefundMessage | String |
Description | The message associated with the success or failure of processing the refund. |
Succeeded | Decimal |
Description | Indicates if the cancellation was successful (“True”) or not (“False”). |
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. |
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 CancelReservationV2 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.CancelReservationV2_Request request = new SWS.CancelReservationV2_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 = SWS.Lost_Demand_Reasons.Availability; 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.CancelReservationV2(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.