public IHttpActionResult CreateDonationsForBatch([FromBody] CheckScannerBatch batch)
        {
            return(Authorized(token =>
            {
                if (!_asynchronous)
                {
                    return (Ok(_checkScannerService.CreateDonationsForBatch(batch)));
                }

                batch.MinistryPlatformContactId = _authenticationService.GetContactId(token);
                batch.MinistryPlatformUserId = _communicationService.GetUserIdFromContactId(token, batch.MinistryPlatformContactId.Value);

                var message = _messageFactory.CreateMessage(batch);
                _donationsQueue.Send(message);
                return (Ok(batch));
            }));
        }
Beispiel #2
0
        public void Execute(JobDetails <CheckScannerBatch> details)
        {
            var batch = details.Data;

            try
            {
                _logger.Debug(string.Format("Received check scanner batch {0} at {1} (queued at {2})", batch.Name, details.RetrievedDateTime, details.EnqueuedDateTime));
                var result = _checkScannerService.CreateDonationsForBatch(batch);
                result.MinistryPlatformContactId = batch.MinistryPlatformContactId;
                result.MinistryPlatformUserId    = batch.MinistryPlatformUserId;
                SendEmail(result, null);
            }
            catch (Exception e)
            {
                var msg = "Unexpected error processing check scanner batch " + batch.Name;
                _logger.Error(msg, e);

                SendEmail(batch, e);
            }
        }
Beispiel #3
0
        public IHttpActionResult CreateDonationsForBatch([FromBody] CheckScannerBatch batch)
        {
            return(Authorized(token =>
            {
                if (!_asynchronous)
                {
                    return (Ok(_checkScannerService.CreateDonationsForBatch(batch)));
                }

                // US6745 - Only finance person receives email instead of the user who imports the batch
                if (_crossroadsFinanceClerkContactId > 0)
                {
                    batch.MinistryPlatformContactId = _crossroadsFinanceClerkContactId;
                    batch.MinistryPlatformUserId = _communicationService.GetUserIdFromContactId(batch.MinistryPlatformContactId.Value);

                    var message = _messageFactory.CreateMessage(batch);

                    _donationsQueue.Send(message);
                }

                return (Ok(batch));
            }));
        }