Home > API General, End Rental/Moveout, Rental/Reservation > SWS2 CancelReservation Method

SWS2 CancelReservation Method


Allows you to cancel a reservation or an array of reservations.

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.
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.
Address1 String Required
Description The first address line of the contact’s address.
Address2 String Required
Description  The second address line of the contact’s address.
City String Required
Description  The city of the contact’s address.
ContactName String Required
Description The first and last name of the account contact.
Country String Required
Description The country of the contact’s address.
PostalCode String Required
Description The postal/ZIP code of the contact’s address.
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.
State String Required
Description The state/province of the contact’s address.
DenyDepositRefund Boolean Required
Description Indicates the deposit will be refunded (“True”) or retained (“False”).
DenyRefundReason String Required
Description An explanation of why the refund of the deposit was denied.
LostDemandNotes String Required
Description Explanation of why the customer chose to cancel the reservation rather than rent the unit.
LostDemandReason Integer Required
Description The reason the customer chose not to rent. This can be customized by the organization’s admin. Contact the organization for their list of reasons.
QuoteIds Long Required
Description The quote IDs that you wish to cancel. This can be a single quote id or an array. The quote ID is returned when you use the MakeReservation method.
RentalIDs Long Required
Description The rental IDs that you wish to cancel. This can be a single rental ID or an array. The rental ID is returned when you use the MakeReservation method. This array needs to match 1 to 1 with the QuoteIds array.
SiteID Long Required
Description The site’s ID number. This can be found using the SearchBy method.

Returned Parameters

Name Data Type
AvailableRefundAmount Decimal
Description The amount that is being refunded to the customer.
ErrorMessage String
Description The message explaining why the cancellation was unsuccessful.
HasDeposit Boolean
Description Indicates if there was a deposit on the reservation (“True”) or not (“False”).
ObjectID Long
Description The unit’s ID number. This is maintained through rentals.
RefundMessage String
Description
Succeeded Boolean
Description “True” indicates that the reservation/s were cancelled successfully, or “False” if not.
TranID 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

We’ll assume you’ve got a web reference, let’s name it Store, in your Visual Studio project. At this point we need to reference our objects. We’ll need the standard service object, a CancelReservation_Request request object and a SWS2ContactInfo object. You will also need to pass in credentials. We can define and create those like this:

// Create a request and response objects
StoreServiceClient client = new StoreServiceClient();
CancelReservation_Request request = new CancelReservation_Request();
SWS2ContactInfo thisCon = new SWS2ContactInfo();

As with every method we need to pass in credentials. We also set up the parameters for our request.

//Cancel reservation setup
client.ChannelFactory.Credentials.UserName.UserName = "user";
client.ChannelFactory.Credentials.UserName.Password = "pass";
client.ChannelFactory.Credentials.SupportInteractive = true;

thisCon.AccountID = 123456;
thisCon.RentalID = 123456;
thisCon.ContactName = "John Doe";

request.SiteID = 123456;
request.AcctID = 123456;
request.ContactData = thisCon;
request.RentalIDs = new long[] { 123456 };

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.

try
{
    // Call the method that will load the response object
    object resp;
    resp = client.CancelReservation(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 SWS2 Methods.

  1. No comments yet.
  1. No trackbacks yet.

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: