Owners Policy Seller Paid Percent

Questions about and code samples for custom order rules and validation within Select.
Post Reply
bdutil
Posts: 122
Joined: Tue Jul 19, 2016 1:48 pm

Owners Policy Seller Paid Percent

Post by bdutil »

Okay I'm trying :) But having issues. I even stole from other rules but it's not working. Here's what I have so far just started the If CDF then need Seller Pay Percent of Owners Policy to be 100%. It doesn't seem to care though if it's a CDF or if it's a purchase. I did get the warning but that's also not caring what I do to the field though it does hotspot to the correct place. Also need to write it for HUD files to look at line 1103 in addition and make sure there is a value in the seller column but not the buyer column. Help

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *

##############################################################################
#
# Rule file name: 700-180 OP Must Be Paid By Seller Warning
#
# Fires on 2nd save
# Ignores Templates
# Only run on a purchase
# Ignore if file is a HUD file
# Require Seller Paid Percent on Owners Policy be 100% otherwise raise warning
# STILL NEED TO CODE TO LOOK AT 1103 IF A HUD
# Version
# 1: Original
#
##############################################################################

def OwnersPolicy_SellerPayPercent_Validate(args):

# This section is for the CDF version - if this is a HUD Order, Exit
order = args.Context.Root
if order.SettlementType == SettlementType.HUD1:
return

# Exit if this is a template.
if order.IsTemplate:
return

# Ignore rule if the Transaction type is something besides Purchase
if order.TransactionType != TransactionType.Purchase:
return


#Remaining Charges must have a HUD Line entered.
contextType = str(type(args.Context))
SellerPercent = args.Context.SellerPayPercent
if SellerPercent != 100:
args.RaiseWarning('WARNING: OWNER’S POLICY IS NOT BEING PAID BY SELLER. PLEASE CONFIRM THIS IS CORRECT.')
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Owners Policy Seller Paid Percent

Post by BobRichards »

The problem is that we didn't tell you everything you needed to know about fields holding percentages - a value of "1" read from the property equals "100 percent" (a value of "0.25" equals "25%"). You can debug this type of problem by setting a breakpoint just after you get the SellerPercent and look at the value in the variable in the Locals window (of the SoftPro Development Studio).

Code: Select all

# Get "Seller pay %" for this policy.  If is 100% (value = 1) then exit.
if SellerPercent != 1:
	args.RaiseWarning('WARNING: OWNER’S POLICY IS NOT ... IS CORRECT.')
Additionally, we will be introducing a new SettlementType next year and this will create a total of three. The easiest way to future-proof your code is as follows:

Code: Select all

# Exit if order is not CDF.
order = args.Context.Root
if order.SettlementType != SettlementType.CDF:
	return
Bob Richards, Senior Software Developer, SoftPro
bdutil
Posts: 122
Joined: Tue Jul 19, 2016 1:48 pm

Re: Owners Policy Seller Paid Percent

Post by bdutil »

Thank you :) Now is it possible to also have it look for the Owners Policy fee in the 1100 section of the HUD to be in the seller column not the buyer column?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Owners Policy Seller Paid Percent

Post by BobRichards »

You can examine HUD charges also. It is more of a pain than CDF lines and charges. If you look at the Select SDK topic "How-To/Order HUDs/Section 1100 - Title Charges", you will see that most lines and charges have unique names that must be used as the COR context. I this case, I am looking at the SellerPayPercent property for all Line 1103 charges (this COR will be called at least once per charge so you can validate each one).

Code: Select all

def HUD1103Charge_SellerPayPercent_Validate(args):
	args.RaiseInformation('Line 1103 Seller% = ' + str(args.Context.SellerPayPercent * 100))
If you don't have the Select SDK, below is a mapping to the contexts you would use in CORs. I also include the payee and payor context names if you need them.
  • Charge: HUD1101Charge (Payee/payor: HUD1101Payee / HUD1101Payor)
  • Charge: HUD1102Charge (Payee/payor: HUD1102Payee / HUD1102Payor)
  • (continues the same pattern...)
  • Charge: HUD1109Charge (Payee/payor: HUD1109Payee / HUD1109Payor)
  • Charge: HUD1110Charge (Payee/payor: HUD1110Payee / HUD1110Payor)
For lines 1111 and greater, you will use the same context and you will have to get the line number to make sure what line you are on. (The charge's parent is a line. Lines have a Number property that will give the line number to you.)
  • Charge: HUD1100CommonCharge (Payee/payor: HUD1100CommonPayee / HUD1100CommonPayor)
Bob Richards, Senior Software Developer, SoftPro
bdutil
Posts: 122
Joined: Tue Jul 19, 2016 1:48 pm

Re: Owners Policy Seller Paid Percent

Post by bdutil »

There is no Order HUDs/Section 1100 - Title Charges under the HowTo section in the SDK I have? Is there a newer one somewhere maybe?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Owners Policy Seller Paid Percent

Post by BobRichards »

Contact your SoftPro customer support for a current copy of the help file. They are updated over time.
Bob Richards, Senior Software Developer, SoftPro
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Owners Policy Seller Paid Percent

Post by BobRichards »

You can do a similar thing with CDFs. Here is an example of validating the Seller Pay Percentage for section C, line 1. Be aware that clicking on the message in the Errors and Warnings will not take the user to charge or payee/payor screens - just to the line.

Code: Select all

def CDFDetailCharge_SellerPayPercent_Validate(args):

	# A charge's parent is a line.  We can get the line number information
	#  from the "SectionNumber" property.  (i.e. "C.01")
	line = args.Context.Parent
	if not line or not line.SectionNumber.startswith('C.'):
		return

	# We know we are in Section C (Services Borrower Did Shop For)
	#  Get the line number from "line.Number" so we don't have to do
	#  a string to integer conversion.
	lineNumber = line.Number	
	
	args.RaiseInformation(type(args.Context).__name__ + ': Line ' + str(lineNumber))
	
	# Raise info message if Seller Pay Percent is not zero on line C.01.
	if lineNumber == 1 and args.Context.SellerPayPercent != 0:
		args.RaiseInformation('Seller may not pay a percentage.')
Bob Richards, Senior Software Developer, SoftPro
Post Reply