public async Task <PayerDto> GetPatientPayerInfo(string payerId)
        {
            var _payerId = 0;

            try
            {
                _payerId = int.Parse(payerId);
            }
            catch
            {
                PayerDto payerDto = new PayerDto
                {
                    PayerType       = null,
                    dateadded       = null,
                    AccountCatId    = null,
                    AccountCategory = null
                };
                return(payerDto);
            }

            var result = await _context.Payer.Where(p => p.PayerId == _payerId)
                         .Select(c => new PayerDto()
            {
                AccountCategory = _context.AccountCategory.Where(ca => ca.Accountcatid == c.accountcatid).FirstOrDefault(),
                AccountCatId    = c.accountcatid,
                dateadded       = c.dateadded,
                PayerId         = c.PayerId,
                PayerType       = c.PayerType
            }).FirstOrDefaultAsync();

            return(result);
        }
예제 #2
0
        public IActionResult AddPayer([FromBody] PayerDto payerDto, Guid companyId)
        {
            var result = _storage.AddNewPayer(payerDto, companyId);

            if (result != Guid.Empty)
            {
                return(Ok());
            }
            else
            {
                return(Conflict());
            }
        }
예제 #3
0
        public IActionResult EditPayer([FromBody] PayerDto payerDto)
        {
            var result = _storage.EditPayer(payerDto);

            if (result)
            {
                return(Ok());
            }
            else
            {
                return(Conflict());
            }
        }
예제 #4
0
 public Guid AddNewPayer(PayerDto payerDto, Guid companyId)
 {
     using var transaction = _dbContext.Database.BeginTransaction();
     try
     {
         var id = AddPayerToCompany(payerDto, companyId);
         transaction.Commit();
         return(id);
     }
     catch (Exception e)
     {
         transaction.Rollback();
         return(Guid.Empty);
     }
 }
예제 #5
0
        private Guid AddPayerToCompany(PayerDto payerDto, Guid companyId)
        {
            var payer = _dbContext.Payers.FirstOrDefault(x => x.Id == payerDto.Id);

            if (payer == null)
            {
                var newPayer = new Payer
                {
                    CompanyId = companyId,
                    Name      = payerDto.Name
                };
                _dbContext.Payers.Add(newPayer);
                _dbContext.SaveChanges();

                return(newPayer.Id);
            }

            return(Guid.Empty);
        }
예제 #6
0
        public async Task <ActionResult> ProcessPayment([FromBody] PayerDto payerDto)
        {
            User user = await AuthenticateUser();

            Payment payment = await Get <InsertNewPaymentCommand>().Execute(user);

            PaymentDto paymentDto = new PaymentDto
            {
                Description = payment.Description,
                Control     = $"{payment.Id}:{payment.UserId}"
            };

            paymentDto.SetPayerAndUrls(payerDto, Get <EndpointConfig>());
            paymentDto.SetPaymentsConfiguration(Get <PaymentConfiguration>());

            string redirectUrl = await Get <CreatePaymentLinkCommand>().Execute(paymentDto);

            return(Json(redirectUrl));
        }
예제 #7
0
 public bool EditPayer(PayerDto payerDto)
 {
     using var transaction = _dbContext.Database.BeginTransaction();
     try
     {
         var payer = _dbContext.Payers.FirstOrDefault(x => x.Id == payerDto.Id);
         if (payer != null)
         {
             payer.Name = payerDto.Name;
             _dbContext.SaveChanges();
             transaction.Commit();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         transaction.Rollback();
         return(false);
     }
 }
예제 #8
0
 public PayerDto CreateNewPayer(PayerDto payer)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public PayerDto VerifyInsurance(PayerDto insurance, long patientId)
 {
     throw new NotImplementedException();
 }
예제 #10
0
 public PayerDto UpdatePayer(PayerDto updatedPayer)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public PayerDto.PayerStatusDto RequestPayerStatus(PayerDto payer, string recordNum)
 {
     throw new NotImplementedException();
 }