public async Task <NotificationDto> AddNotificationAsync(CallbackDto callback)
        {
            var notificationEntity = _unitOfWork.Notifications.Add(_mapper.Map <CallbackDto, Notification>(callback));

            await _unitOfWork.CommitAsync();

            return(_mapper.Map <Notification, NotificationDto>(notificationEntity));
        }
Exemple #2
0
        public async Task SendCallbackRequest(CallbackDto dto)
        {
            _logger.LogInformation("Callback request action sending request to caseflow.");

            await _caseflowApiProxy.SendCallbackRequest(dto);

            _logger.LogInformation("Callback request action has been sent to caseflow.");
        }
        public async Task SendCallbackRequest(CallbackDto dto)
        {
            try
            {
                var innerUrl = "v1/contact/callback-request";

                await PutwithNoReturnTypeAsync(innerUrl, dto);
            }
            catch (Exception ex)
            {
                Logger.LogError("An error occured.", ex);
            }
        }
Exemple #4
0
        public virtual void Resend(List <long> ids)
        {
            foreach (var id in ids)
            {
                var callbackMessage = Repository.Get(id);
                var message         = callbackMessage.Body;

                var input = new CallbackDto()
                {
                    Message   = message,
                    Signature = id.ToString()
                };

                backgroundJobManager.Enqueue <AlibabaCallbackJob, CallbackDto>(input);

                callbackMessage.Status = CallbackMessageStatus.Resend;
            }
        }
        public async Task <ResultDto> SendCallbackMessageAsync([FromBody] CallbackDto dto)
        {
            try
            {
                _logger.LogInformation("Request received to send Callback request.");

                await _callbackService.SendCallbackRequest(dto);

                _logger.LogInformation("Callback request has been successfully sent.");
                return(new ResultDto {
                    IsSuccessful = true
                });
            }
            catch (Exception ex)
            {
                return(new ResultDto
                {
                    IsSuccessful = false,
                    MessageForUser = $"An exception occured while sending callback request: Exception Details - {ex.Message}"
                });
            }
        }
Exemple #6
0
        public void Do()
        {
            HttpContext hcx            = this.httpContext.HttpContext;
            var         message        = hcx.Request.Form["message"];
            var         _aop_signature = hcx.Request.Form["_aop_signature"];

            var input = new CallbackDto()
            {
                Message   = message,
                Signature = _aop_signature
            };

            Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " Alibaba Callback: ");
            Console.WriteLine("\tSignature: " + input.Signature);
            Console.WriteLine("\tMessage: " + input.Message);

            // Wirte a log
            this.Logger.Info(message);

            // Create background job for save the callback/message.
            backgroundJobManager.Enqueue <AlibabaCallbackJob, CallbackDto>(input);
        }
Exemple #7
0
        public IActionResult Index([FromQuery(Name = "hash")] string hash, [FromForm] CallbackDto data)
        {
            if (!SecurityTools.VerifyPaymentHash(_jeebSetting.ApiKey, data.OrderNo, hash))
            {
                return(Unauthorized());
            }

            if (data.State == Constants.PaymentState.Expired)
            {
                return(View(data));
                // No transaction has occurred. it was either canceled or expiration due has passed. Display the corresponding view.
            }
            else if (data.State == Constants.PaymentState.PendingConfirmation)
            {
                // Payment has occurred and Jeeb is waiting for network/external confirmations.
                if (!data.Refund)
                {
                    // Refund flag is OFF. It means that rejection conditions haven't met.
                    // So the payment will be "Completed" after obtaining the required network/external confirmations.
                    // Display the corresponding view.
                    return(View(data));
                }
                else
                {
                    // Refund flag is ON. It means that rejection conditions have met.
                    // So the payment will be "Rejected" after obtaining the required network/external confirmations.
                    // Display the corresponding view.
                    return(View(data));
                }
            }
            else
            {
                // Payment has been failed on Jeeb. please contact Jeeb's support team.
                throw new Exception();
            }
        }