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

SWS CancelReservation 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.

Parameters

Name DataType Is Required
Request CancelReservation_Request Required
Description Request object that includes the required fields for the method.

Returned Parameters

Name DataType
AvailableRefundAmount Decimal
Description The processed refund amount, if warranted.
ErrorMessage String
Description A message about any problem that occurred during the process, including details to locate errant code.
HasDeposit Boolean
Description Indicates if a refund will be processed (“True”) or not (“False”).
ObjectID Long
Description The rental_id that was cancelled.
RefundMessage String
Description The message associated with the success or failure of processing the refund.
Succeeded Boolean
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 CancelReservation request object and a CancelReservation response object.  We can define and create those like this:

// Create a request and response objects and contact info object
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.CancelReservation_Request request = new SWS.CancelReservation_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 quote(s)
request.AcctID = 123456;
request.QuoteIDs = new long?[] { 123456, 654321 };
request.LostDemandReason = SWS.Lost_Demand_Reasons.Availability;
request.LostDemandNotes = "Unit size no longer available";
request.ContactData = contact_info;

// OR To cancel rentals(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;

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.CancelReservation(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.

Please check around Centershift DevX for additional articles about the vast methods available in Store Enterprise/Advantage SWS to power your application.

ATTN: As of 2/21/2013 There is no need to call a SWS method to process a refund after calling CancelReservation. The CancelReservation SWS method takes care of the refund.

Multiple reservations under one credit card transaction can now be canceled and refunded back to the credit card. For example, if three reservations were paid with one credit card payment, CancelReservation will now refund the full amount to the credit card. In this example, each reservation can also be canceled one at a time and all refunds will go back to the card.

Multiple reservations on the same account under separate transactions can also be refunded correctly to a credit card.

The CancelReservation optional parameter RefundData in the request object is no longer used. The RefundData.PaymentType is now determined by the payment type of the original transaction. If the payment type is credit card, then it will be refunded back to the credit card. If it is any other payment type, including cash, then the refund will default to a check. If a single reservation transaction has multiple payment types, then a check refund will be created.

For a full list of methods see SWS Methods.

  1. No comments yet.
  1. January 22, 2013 at 11:30 am

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: