Setting Payee Code on Outgoing Wire

Discussions related to custom development with Select.
Post Reply
PeterKelly
Posts: 92
Joined: Tue Feb 04, 2014 3:34 pm

Setting Payee Code on Outgoing Wire

Post by PeterKelly »

When you double click on an OutgoingWire in the register there is a Payee Code droplist that you can set.

How do you set this value via the API?

The IWireOutTransaction object doesn't appear to have a way to set it and when I debug transaction code to look at the Payee Code value I set in the UI I can't see where the code is either.

Any help appreciated.

Thanks,
Peter
sindrapal
Posts: 42
Joined: Tue Oct 14, 2008 9:21 am

Re: Setting Payee Code on Outgoing Wire

Post by sindrapal »

Peter,

You can get the list of order contacts if you have a reference to the OrderLedger. Please refer to the code sample below.

ILedgersManager lm = _sps.GetService<ILedgersManager>();
ILedgerInfo ledgerInfo = lm.GetLedgerForOrder(orderGuid);
IOrderLedger orderLedger = (IOrderLedger)lm.GetLedger(ledgerInfo);
IOrderInformation oi = orderLedger.GetOrderInformation();
IEnumerable<IOrderContact> contacts = oi.Contacts;
PeterKelly
Posts: 92
Joined: Tue Feb 04, 2014 3:34 pm

Re: Setting Payee Code on Outgoing Wire

Post by PeterKelly »

Yes, I know how to access the contacts on an order but how do I set the Payee Code on an OutgoingWire Transaction via the API like is possible in the UI?

Or am I misunderstanding what you said?
sindrapal
Posts: 42
Joined: Tue Oct 14, 2008 9:21 am

Re: Setting Payee Code on Outgoing Wire

Post by sindrapal »

The sample code that I provided yesterday gives you a list of order contacts using the ProTrust API (without opening the order). We use this list to populate the payee/payor code dropdown on the transaction dialog.

To set the payee/payor code on a transaction using the API, you will have to set a Tag on the Transaction. The sample code below illustrates this. Hope this helps!

IOrderLedger orderLedger = (IOrderLedger)lm.GetLedger(ledgerInfo);
IOrderInformation oi = orderLedger.GetOrderInformation();
IEnumerable<IOrderContact> contacts = oi.Contacts;

OrderContact settlementAgent = contacts.Where(c => c.Code == "A").SingleOrDefault();

if (settlementAgent != null)
{
Tag tag = transaction.Tags.Where(t => t.Name == "OrderContactID").SingleOrDefault();
if (tag != null)
{
tag.Value = settlementAgent.ID.ToString();
}
else
{
transaction.Tags.Add(new Tag("OrderContactID", settlementAgent.ID.ToString()));
}
}
PeterKelly
Posts: 92
Joined: Tue Feb 04, 2014 3:34 pm

Re: Setting Payee Code on Outgoing Wire

Post by PeterKelly »

That worked. Thanks!
Post Reply