Pre-Cameron ChargeSourceId

Discussions related to custom development with Select.
Post Reply
kwesterlage
Posts: 73
Joined: Thu May 21, 2015 2:28 pm

Pre-Cameron ChargeSourceId

Post by kwesterlage »

Is there a way to retrieve ChargeSourceId from a pre-cameron ledger transaction?
sindrapal
Posts: 42
Joined: Tue Oct 14, 2008 9:21 am

Re: Pre-Cameron ChargeSourceId

Post by sindrapal »

You should be able to get the ChargeSourceId from the IFeeDetail records corresponding to the transaction. The code sample below demonstrates this approach.

ILedgersManager lm = _sps.GetService<ILedgersManager>();
ILedgerInfo info = lm.GetLedgerForOrder(orderGuid);
IOrderLedger orderLedger = (IOrderLedger)lm.GetLedger(info);
IList<IFeeDetail> feeDetails = orderLedger.GetFeeDetails();
IEnumerable<IFeeDetail> tranFeeDetails = feeDetails
.Where(fd => fd.SequenceNumber == transaction.SequenceNumber);

foreach (var fd in tranFeeDetails)
{
Tag tg = fd.Tags
.Where(f => f.Name == SoftPro.Accounting.Client.Constants.FeeDetailChargeSourceProperty)
.FirstOrDefault();

Guid chargeSourceID;
if (tg != null && Guid.TryParse(tg.Value, out chargeSourceID))
{
// Do work
}
}
Post Reply