Home > Auction, End Rental/Moveout, Rental/Reservation > SWS AuctionEndRental Method

SWS AuctionEndRental Method


Terminates a rental item and processes a payment for the amount collected from the auction. The PaymentData object is required when making a payment. When making a payment, either the Credit Card Info, Check Info or Cash Info must be set and the TotalAmountPaid should be equal to the sum of any/all of those amounts used. If site rules are configured to refund auction overage amounts to tenant, a refund request will be automatically generated. Important: Any amount paid through this method cannot be reversed. Make sure to confirm this is a valid action.

Parameters

Name DataType Is Required
Request AuctionEndRentalInfo Required
Description Object containing the required information to end the rental.

Returned Parameters

Name DataType
AuctionID Long
Description The auction’s ID number.
ErrorMessage String
Description A message about any problem that occurred during the process, including details to locate errant code.
RentalID Long
Description The rental item’s ID number.
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, an AuctionEndRental request object and an AuctionEndRental response object.  We can define and create those like this:

// Create request and response objects 
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.AuctionEndRental_Request request = new SWS.AuctionEndRental_Request();
SWS.AuctionEndRental_Response response;

Here’s my sample code of the Request object.

// Fill in the request data
request.SiteID = 123456;
request.AuctionDetail[0].AuctionID = 123456;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].AcctID = 123456;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].RentalID = 123456;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].Status = SWS.AuctionObjsStatusValues.SOLD_AT_AUCTION;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].SoldAmount = 155;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].Tax = 15.5m;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].BuyerName = "First Buyer";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].BuyerAddress = "123 Main St, My Town, UT  84000";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].BuyerPhone = "800-555-1212";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].Notes = "Will pick later this week.";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.SiteID = 123456;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.AcctID = 123456;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.RentalIDs = new long[] { 123456 };
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.Cycles = new int[] { 1 };
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.TotalAmtDue = 170.5m;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.TotalAmtPaid = 170.5m;
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].CardHolderName = "First Buyer";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].CardNumber = "4000111122223333";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].ExpireMonth  = "08";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].ExpireYear = "2018";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].CVV2 = "111";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].Address = "123 Main St";
request.AuctionDetail[0].AuctionRentalsPayInfo[0].PaymentData.CreditCardInfo[0].PostalCode = "84000";

Finally we can call the method and pass across the login object and the request object for ending rentals from an auction. 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.AuctionEndRental(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.


UPDATED 08/23/2012

This method has been updated to automatically refund the tenant’s credit card when auction proceeds exceed the total amount due for the rental. The following criteria must be met in order for the credit card to be automatically refunded:

1)      The ‘Auto-Refund Auction’ rule must be set to ‘TRUE’ in the applications site rules.
2)      The tenant’s last payment must have been charged to a credit card and the amount charged must be >= the amount to be refunded; Otherwise, a check refund will be created.
3)      The amount to be refunded must be less than the amount defined in the ‘Auto-Approval Threshold’ in the applications site rules; Otherwise, the refund will require secondary approval before the refund can be completed.

  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 )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s