Beispiel #1
0
        /// <summary>
        /// The delete applied payments.
        /// </summary>
        /// <param name="invoice">
        /// The invoice.
        /// </param>
        private void DeleteAppliedPayments(IInvoice invoice)
        {
            var appliedPayments = _appliedPaymentService.GetAppliedPaymentsByInvoiceKey(invoice.Key).ToArray();

            if (appliedPayments.Any())
            {
                _appliedPaymentService.Delete(appliedPayments);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets a collection of <see cref="IPayment"/> for a given invoice
        /// </summary>
        /// <param name="invoiceKey">The unique 'key' of the invoice</param>
        /// <returns>A collection of <see cref="IPayment"/></returns>
        public IEnumerable <IPayment> GetPaymentsByInvoiceKey(Guid invoiceKey)
        {
            var paymentKeys = _appliedPaymentService.GetAppliedPaymentsByInvoiceKey(invoiceKey).Select(x => x.PaymentKey).Distinct().ToArray();

            return(!paymentKeys.Any() ? new List <IPayment>() : GetByKeys(paymentKeys));
        }