var dueFromBuyerSummaryCharge = <get charge>;
var dueToSellerSummaryCharge = <get charge>;
var lineK12 = GetLine("K.12");
var lineM13 = GetLine("K.13");
lineK12.Charges.Add(dueFromBuyerSummaryCharge);
lineM13.Charges.Add(dueToSellerSummaryCharge);
In the example below, I already created an endorsement and am changing the line the charge goes to. The trick is to set the "CDFLine" on the endorsement to the desired line. HUDs and Commercial (CSS) settlement types will have a different process to follow, but these are the CDF steps. Also, see the SDK for other variants of the "NextAvailableLine()" method if you need additional options.
// Open CDF order - will be slightly different for CSS and very different for HUD.
IOrderStore os = ss.GetService<IOrderStore>();
IOrderInfo orderInfo = os.Orders.Where(t => t.Number == orderNumber).First();
using (IOrder order = os.OpenOrder(orderInfo, OrderEditMode.ReadWrite))
{
// Get the desired line from the first CDF. If line doesn't exist, add a new one.
IList cdfs = (IList)order.GetProperty("CDFs");
IOrderItem cdf = (IOrderItem)cdfs[0];
var lines = cdf.GetProperty("Lines") as IEnumerable<IOrderItem>;
var line = lines.Where(t => (string)t.GetProperty("SectionNumber") == "H.05").FirstOrDefault();
if (line == null)
{
// No line - create it.
// NOTE: Endorsements may only be added to Section B, C, and H by default.
line = ((dynamic)cdf).NextAvailableLine(CDFSectionType.ServicesShoppedFor);
}
// Endorsement has already been created and is part of the order.
// Change its line property to your line.
IOrderItem title = (IOrderItem)order.GetProperty("Title");
IList endorsements = (IList)title.GetProperty("Endorsements");
IOrderItem endorsement = (IOrderItem)endorsements[0];
endorsement.SetProperty("CDFLine", line);
// Save order.
os.ApplyChanges(order);
}
I know this is old topic, but can you give me an example to get next credit/debit line using NextAvailableLine(). I looked at the SDK doc but dint find anything
Please see the topic Getting the NextAvailableLine() for your answer. I split it out since I have plans to add more settlement statment types as needed for the same functionality.
I was trying to get next credit debit like for Section K and L (Like give me next available credit/debit line for those sections) or just a regular line, is this possible with above method ?
As a general rule, if you can't do it from the Select UI, you can't do it from the API. After reviewing the code, it appears you cannot add to sections: K, L, M, and N.