public FastPayment GetFastPayment(
     OrderRegistrationResponseDTO orderRegistrationResponseDto,
     DateTime creationDate,
     Guid fastPaymentGuid,
     decimal orderSum,
     int externalId,
     FastPaymentPayType payType,
     Order order        = null,
     string phoneNumber = null,
     int?onlineOrderId  = null)
 {
     return(new FastPayment
     {
         Amount = orderSum,
         CreationDate = creationDate,
         Order = order,
         Ticket = orderRegistrationResponseDto.Ticket,
         QRPngBase64 = orderRegistrationResponseDto.QRPngBase64,
         ExternalId = externalId,
         PhoneNumber = phoneNumber,
         FastPaymentGuid = fastPaymentGuid,
         OnlineOrderId = onlineOrderId,
         FastPaymentPayType = payType
     });
 }
        public void SaveNewTicketForOrder(
            OrderRegistrationResponseDTO orderRegistrationResponseDto,
            int orderId,
            Guid fastPaymentGuid,
            FastPaymentPayType payType,
            string phoneNumber = null)
        {
            Order order;
            var   creationDate = DateTime.Now;

            try
            {
                order = _orderRepository.GetOrder(_uow, orderId);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"При загрузке заказа№ {orderId} произошла ошибка, записываю в файл...");
                CacheData(orderRegistrationResponseDto, orderId, creationDate, fastPaymentGuid, payType);
                return;
            }

            var fastPayment = _fastPaymentApiFactory.GetFastPayment(
                orderRegistrationResponseDto,
                creationDate,
                fastPaymentGuid,
                order.OrderSum,
                orderId,
                payType,
                order,
                phoneNumber);

            fastPayment.SetProcessingStatus();

            try
            {
                Save(fastPayment);
            }
            catch (Exception e)
            {
                _logger.LogError(e, "При сохранении платежа произошла ошибка, записываю в файл...");
                CacheData(orderRegistrationResponseDto, orderId, creationDate, fastPaymentGuid, payType);
            }
        }
        private void CacheData(
            OrderRegistrationResponseDTO orderRegistrationResponseDto,
            int orderId,
            DateTime creationDate,
            Guid fastPaymentGuid,
            FastPaymentPayType payType)
        {
            var fastPaymentDTO = new FastPaymentDTO
            {
                OrderId            = orderId,
                CreationDate       = creationDate,
                Ticket             = orderRegistrationResponseDto.Ticket,
                QRPngBase64        = orderRegistrationResponseDto.QRPngBase64,
                ExternalId         = orderId,
                FastPaymentGuid    = fastPaymentGuid,
                FastPaymentPayType = payType
            };

            _fastPaymentFileCache.WritePaymentCache(fastPaymentDTO);
        }
        public void SaveNewTicketForOnlineOrder(
            OrderRegistrationResponseDTO orderRegistrationResponseDto,
            Guid fastPaymentGuid,
            int onlineOrderId,
            decimal onlineOrderSum,
            FastPaymentPayType payType)
        {
            var creationDate = DateTime.Now;

            var fastPayment = _fastPaymentApiFactory.GetFastPayment(
                orderRegistrationResponseDto,
                creationDate,
                fastPaymentGuid,
                onlineOrderSum,
                onlineOrderId,
                payType,
                null,
                null,
                onlineOrderId);

            fastPayment.SetProcessingStatus();

            Save(fastPayment);
        }