コード例 #1
0
        public async Task <ActionResult> PostTransactionNotification([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTTransactionResponse> apiResponse)
        {
            //Stop timer
            var message = new Message
            {
                Response     = apiResponse.Response,
                SessionId    = session,
                Text         = apiResponse?.Response?.ResponseText?.Split("\n") ?? new string[] { "", "" },
                Type         = apiResponse?.Response?.ResponseType,
                CancelButton = true,
            };

            await sessionRepository.DeleteSession(session);

            await notifyHub.Clients.All.SendAsync("Message", message);

            return(Ok());
        }
コード例 #2
0
        public async Task <ActionResult> PostDisplayNotification([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTDisplayResponse> apiResponse)
        {
            if (apiResponse?.Response != null)
            {
                for (var i = 0; i < apiResponse.Response.DisplayText.Length; i++)
                {
                    apiResponse.Response.DisplayText[i] = apiResponse.Response.DisplayText[i].Trim();
                }

                var message = new Message
                {
                    SessionId    = session,
                    Text         = apiResponse.Response.DisplayText ?? new string[] { "", "" },
                    Type         = apiResponse.Response.ResponseType,
                    AuthButton   = apiResponse.Response.AuthoriseKeyFlag,
                    YesButton    = apiResponse.Response.AcceptYesKeyFlag,
                    NoButton     = apiResponse.Response.DeclineNoKeyFlag,
                    CancelButton = apiResponse.Response.CancelKeyFlag,
                    OkButton     = apiResponse.Response.OKKeyFlag,
                };

                await notifyHub.Clients.All.SendAsync("Message", message);

                return(Ok());
            }
            return(BadRequest());
        }
コード例 #3
0
        public async Task <ActionResult> PostStatusNotification([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTStatusResponse> apiResponse)
        {
            var message = new Message
            {
                Response     = apiResponse.Response,
                SessionId    = session,
                Text         = apiResponse?.Response?.ResponseText?.Split("\n") ?? new string[] { "", "" },
                Type         = apiResponse?.Response?.ResponseType,
                CancelButton = true,
            };

            await notifyHub.Clients.All.SendAsync("Message", message);

            return(Ok());
        }
コード例 #4
0
        public async Task <ActionResult> PostTransactionNotificationAsync([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTTransactionResponse> apiResponse)
        {
            await notificationRepository.AddMessageAsync(new Message
            {
                Response     = apiResponse.Response,
                SessionId    = session,
                Text         = apiResponse?.Response?.ResponseText.Split("\n") ?? new string[] { "", "" },
                Type         = apiResponse?.Response?.ResponseType,
                CancelButton = true,
            });

            await sessionRepository.DeleteSessionAsync(session);

            return(Ok());
        }
コード例 #5
0
        public async Task <ActionResult> PostStatusNotificationAsync([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTStatusResponse> apiResponse)
        {
            await notificationRepository.AddMessageAsync(new Message()
            {
                SessionId = apiResponse?.SessionId,
                Type      = "status",
                Response  = apiResponse?.Response
            });

            return(Ok());
        }
コード例 #6
0
        public async Task <ActionResult> PostReceiptNotificationAsync([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTReceiptResponse> apiResponse)
        {
            await notificationRepository.AddMessageAsync(new Message
            {
                Response     = apiResponse?.Response,
                SessionId    = session,
                Text         = apiResponse?.Response?.ReceiptText ?? new string[] { "", "" },
                Type         = apiResponse?.Response?.ResponseType,
                CancelButton = true,
            });

            return(Ok());
        }
コード例 #7
0
        public async Task <ActionResult> PostReceiptNotificationAsync([FromRoute] string session, [FromBody] ApiNotificationResponse <EFTReceiptResponse> apiResponse)
        {
            var message = new Message
            {
                SessionId    = session,
                Text         = apiResponse?.Response?.ReceiptText ?? (new string[] { "", "" }),
                Type         = apiResponse?.Response?.ResponseType,
                CancelButton = true,
            };

            await notifyHub.Clients.All.SendAsync("Message", message);

            return(Ok());
        }