SWS AddDeposit Method
Adds a security deposit to a rental item using the GetAvailableDeposits method, and includes a price override option. Note: Deposits must be created by an admin in the Store application. The admin can also assign security deposits and reservation deposits to Site Revenue Classes for a site, so that the rental item has these deposits by default. Reservation deposits are only added/overridden through the MakeReservation SWS method.
Parameters
Name | DataType | Is Required |
---|---|---|
OverrideAmount | Decimal | Optional |
Description | Overrides the default security deposit amount with a user-defined dollar amount, but using the rest of the information from the DepositData parameter. | |
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. | |
DepositData | ORG_SECURITY_DEPOSITS | Required |
Description | The security deposit schedule data. Security deposit schedules are created by an admin in the application. This information is available from the GetAvailableDeposits SWS method. |
Returned Parameters
Name | DataType |
---|---|
Succeeded | Boolean |
Description | Indicates success (“True”) or failure (“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 create our objects. We’ll need the standard service object, an AddDeposit request object and an AddDeposit response object. We can define and create those like this:
// Create a request and response objects SWS.WSSoapClient service = new SWS.WSSoapClient(); SWS.AddDeposit_Request request = new SWS.AddDeposit_Request(); SWS.AddDeposit_Response response = new SWS.AddDeposit_Response(); // Our response from GetAvailableDeposits SWS.GetAvailableDeposits_Response get_dep_response = new SWS.GetAvailableDeposits_Response();
Now we set up the parameters for our request.
//Add deposit request object request.RentalID = 123456; request.DepositData = get_dep_response.Details[0]; //optionally request.OverrideAmount = 20;
Finally we can call the method and pass across the login object and the request object to add our deposit fee. It’s a good idea to do this in a Try Catch block.
try
{
// Call the method that will load the response object
response = service.AddDeposit(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.