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
Setting Payee Code on Outgoing Wire
Re: Setting Payee Code on Outgoing Wire
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;
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;
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Setting Payee Code on Outgoing Wire
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?
Or am I misunderstanding what you said?
Re: Setting Payee Code on Outgoing Wire
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()));
}
}
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()));
}
}
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Setting Payee Code on Outgoing Wire
That worked. Thanks!