Home > API General, Rental/Reservation > SWS CancelReservationCashCredit Method

SWS CancelReservationCashCredit Method


Cancels a reservation made for specified rental item(s) and/or quote(s) AND credits an alternate rental on the account with the refund amount. Note: If you are canceling a reservation and NOT crediting the refund to an alternate rental, use the CancelReservation method.

Parameters

Name DataType Is Required
RefundInfo RefundData Required
Description The object containing the refund information for the cancellation.
Request CancelReservation_Request Required
Description The object containing the cancellation information.

Returned Parameters

Name DataType
Succeeded Boolean
Description Indicates that the reservation was cancelled successfully (“True”) or not (“False”).

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 CancelReservationCashCredit request object and a CancelReservationCashCredit response object.  We can define and create those like this:

// Create a request and response objects and RefundData and ContactInfo objects.
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.CancelReservation_Request res_request = new SWS.CancelReservation_Request();
SWS.RefundData refund_request = new SWS.RefundData();
SWS.CancelReservationCashCredit_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";

// Refund Data
refund_request.ApplyRefundRentalID = 123456;
refund_request.RefundType = SWS.RefundTypes.CASH_CREDIT;

// To cancel reservations(s)
res_request.AcctID = 123456;
res_request.RentalIDs = new long?[] { 123456, 654321 };
res_request.LostDemandReason = SWS.Lost_Demand_Reasons.Availability;
res_request.LostDemandNotes = "Unit size no longer available";
res_request.ContactData = contact_info;

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.CancelReservationCashCredit(user_request, res_request, 
refund_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.

  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: