/// <summary> /// Returns transactions related to adjustments from the current payment in cache. /// Returns empty collection in case an adjustment relates to multiple transactions with references to /// different projects or commitments. It is possible for a bill without Pay per line feature. /// </summary> public IEnumerable <APTran> GetTransactions() { var insertedAdjustments = graph.Caches <APAdjust>().Inserted.RowCast <APAdjust>().ToList(); var adjustments = SiteMapExtension.IsPreparePaymentsScreenId() ? PreparePaymentsAdjustmentsCache.GetStoredAdjustments().Where(adjust => IsRelatedAdjustment(insertedAdjustments.SingleOrDefault(), adjust)) : graph.Adjustments.Select().FirstTableItems.Concat(insertedAdjustments).ToList(); var transactions = adjustments.Select(GetTransaction).ToList(); return(transactions.Any(t => t == null) ? Enumerable.Empty <APTran>() : transactions); }
private void ProcessPayments(List <APAdjust> adjustments, PayBillsFilter filter, CurrencyInfo currencyInfo, PaymentMethod paymentMethod) { var jointAdjustments = adjustments.Where(IsJointPayment).ToList(); var defaultAdjustments = adjustments.Except(jointAdjustments).ToList(); PreparePaymentsAdjustmentsCache.Add(jointAdjustments); PreparePaymentsAdjustmentsCache.Add(defaultAdjustments); ProcessDefaultPayments(defaultAdjustments, filter, currencyInfo, paymentMethod); ProcessJointPayments(jointAdjustments, filter); PreparePaymentsAdjustmentsCache.ClearStoredAdjustments(); RedirectToResult(paymentMethod, filter, adjustments); }