Esempio n. 1
0
        public DonationBatchDTO CreatePaymentBatch(DonationBatchDTO batch)
        {
            var batchId = _paymentRepository.CreatePaymentBatch(batch.BatchName, batch.SetupDateTime, batch.BatchTotalAmount, batch.ItemCount, batch.BatchEntryType, batch.DepositId, batch.FinalizedDateTime, batch.ProcessorTransferId);

            batch.Id = batchId;

            foreach (var payment in batch.Payments)
            {
                _paymentRepository.AddPaymentToBatch(batchId, payment.PaymentId);
            }

            return(batch);
        }
Esempio n. 2
0
        public void AddPaymentToBatchShouldThrow()
        {
            var paymentId = 1;
            var batchId   = 2;
            var parms     = new Dictionary <string, object>
            {
                { "Payment_ID", paymentId },
                { "Batch_ID", batchId }
            };
            var parmList = new List <Dictionary <string, object> > {
                parms
            };
            var e = new Exception("bad things happened");

            _ministryPlatformRest.Setup(p => p.Put("Payments", parmList)).Throws(e);

            Assert.Throws <ApplicationException> (() => _fixture.AddPaymentToBatch(batchId, paymentId));
        }