Exemplo n.º 1
0
        private void ProcessPaymentRequest(Message message)
        {
            switch (message.MessageStatus)
            {
            case Domain.MessageStatus.Cancelled:
                break;

            case Domain.MessageStatus.Completed:
                break;

            case Domain.MessageStatus.Failed:
                break;

            case Domain.MessageStatus.Pending:
                break;

            case Domain.MessageStatus.Refunded:
                break;

            case Domain.MessageStatus.Submitted:
                _logger.Log(LogLevel.Error, String.Format("Starting Request Message Processor"));

                IMessageProcessor messageProcessor = new SocialPayments.Services.MessageProcessors.SubmittedRequestMessageProcessor(_ctx);
                messageProcessor.Process(message);

                break;

            case Domain.MessageStatus.RequestAccepted:

                //validate sender and recipient
                //create withdraw and deposit records and batch
                _transactionBatchService.BatchTransactions(message);

                message.MessageStatus   = Domain.MessageStatus.Pending;
                message.LastUpdatedDate = System.DateTime.Now;

                _ctx.SaveChanges();

                //send sms and email confirmations
                break;

            case Domain.MessageStatus.RequestRejected:

                //send sms and email to sender
                break;
            }
        }
Exemplo n.º 2
0
        public HttpResponseMessage AcceptPaymentRequest(string id, MessageModels.AcceptPaymentRequestModel request)
        {
            Domain.Message message;

            try
            {
                message = _messageServices.GetMessage(id);
            }
            catch (Exception ex)
            {
                var responseMessage = new HttpResponseMessage(HttpStatusCode.BadRequest);
                responseMessage.ReasonPhrase = ex.Message;

                return(responseMessage);
            }

            _transactionBatchService.BatchTransactions(message);

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }