Archive
SWS CompleteUnitTransfer Method
Completes the rental item transfer from one rental item to another for the account. The InitiateUnitTransfer method must be called before calling this method. This method will also make a payment on the new rental item.
Parameters
Name | DataType | Is Required |
---|---|---|
OrgID | Long | Required |
Description | The organization’s ID number. | |
PaymentData | MakePayment | Required |
Description | The payment information to complete the transfer. Even if there is a $0 balance there must be a $0 payment to move the customer into the new rental. | |
TransferData:PersonID | Long | Do Not Use |
Description | The Store ID for the user making the change. Deprecated. | |
TransferData:EscrowID | Long | Required |
Description | The escrow’s ID number from the old rental. This is returned from the InitiateUnitTransfer method. | |
TransferData:FromRentals | RentalInfo | Required |
Description | An array of the rental item information for the vacating rental. This is returned from the InitiateUnitTransfer method. | |
TransferData:TnxID | Long | Required |
Description | The transaction’s ID number.Transaction IDs are system generated for each payment transaction that occurs in the system. This is returned from the InitiateUnitTransfer method. | |
TransferData:ToRentals | RentalInfo | Required |
Description | An array of the rental item information for the new rental. This is returned from the InitiateUnitTransfer method. |
Returned Parameters
Name | DataType |
---|---|
CashCreditApplied | Boolean |
Description | Indicates if the cash credit/escrow was applied successfully (“True”) or not (“False”). |
TranID | Long |
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. |
Succeeded | Boolean |
Description | Indicates if the transfer was completed 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 CompleteUnitTransfer request object and a CompleteUnitTransfer response object. We can define and create those like this:
// Create request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.CompleteUnitTransfer_Request request = new SWS.CompleteUnitTransfer_Request();
SWS.CompleteUnitTransfer_Response response;
SWS.MakePayment_Request pay_request = new SWS.MakePayment_Request();
SWS.TransferToCommit tran_request = new SWS.TransferToCommit();
Here’s my sample code of the Request object.
// pay request pay_request.AcctID = 123456; pay_request.RentalIDs = new long[] { 123456 }; pay_request.Cycles = new int[] { 1 }; pay_request.TotalAmtDue = 55.5m; pay_request.TotalAmtPaid = 55.5m; pay_request.CreditCardInfo[0].Amount = 55.5m; pay_request.CreditCardInfo[0].CardHolderName = "Last, First"; pay_request.CreditCardInfo[0].Address = "123 Main, My Town, UT"; pay_request.CreditCardInfo[0].CardNumber = "4111222233334444"; pay_request.CreditCardInfo[0].CVV2 = "123"; pay_request.CreditCardInfo[0].ExpireMonth = "04"; pay_request.CreditCardInfo[0].ExpireYear = "2018"; pay_request.CreditCardInfo[0].PostalCode = "00000"; // Transfer request tran_request.EscrowID = 123456; tran_request.TnxID = 123456; tran_request.FromRentals[0].RentalID = 123456; tran_request.FromRentals[0].Version = 23; tran_request.ToRentals[0].RentalID = 123456; tran_request.ToRentals[0].Version = 56; // Complete Transfer request request.OrgID = 123456; request.PaymentData = pay_request; request.TransferData = tran_request;
Finally we can call the method and pass across the login object and the request object for completing a unit transfer. 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.CompleteUnitTransfer(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.