SWS UpdateInsurance Method
Changes the existing insurance coverage to a different insurance coverage. This will not add insurance if the customer doesn’t currently have existing coverage.
Parameters
Name | Data Type | Required |
---|---|---|
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. | |
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. | |
NewInsuranceOptionID | Long | Required |
Description | The id for the specific insurance option to which you are chaning the rental. Use the INS_OPTION_ID from the GetInsuranceProviders method. |
Returned Parameters
Name | Data Type |
---|---|
CreditsReturned | Decimal |
Description | The amount of funds returned to the customer due to the change of insurance. |
AmountDueAfterUpdate | Decimal |
Description | The amount of funds owed on the account due to the change of insurance. |
TransactionID | Long |
Description | The transaction’s ID number. Transaction IDs are system generated for each transaction that occurs in the system. A null or “0” response indicates the transaction failed. |
InsuranceRentalID | Long |
Description | The RentalID applicable to the new insurance assessment. |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects. We will need the standard service object, an UpdateInsurance request object, and an UpdateInsurance response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.UpdateInsurance_Request request = new SWS.UpdateInsurance_Request();
SWS.UpdateInsurance_Response response;
Here is a sample code of the request object:
// UpdateInsurance Request
request.SiteID = 123456;
request.RentalID = 126456;
request.NewInsuranceOptionID = 123456;
Finally we can call the method and pass across the login object and the request object to retrieve our requested information. 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.UpdateInsurance(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the exception so it can be debugged.
For a full list of methods see SWS Methods.
ATTN: As of 04/22/2013 the SWS method UpdateInsurance will prorate correctly. The fix was a change in the underlying logic and does not change the way this SWS method is used.