private PaymentEO GetPaymentEO(PaymentDTO paymentDTO) { PaymentEO paymentEO = Mapper.Map <PaymentEO>(paymentDTO); paymentEO.PaymentStatus = new PaymentStatusEO(); return(paymentEO); }
public bool ProcessPayment(PaymentDTO paymentDTO) { bool result = false; if (PaymentValidatorComponent.Validate(paymentDTO)) { PaymentEO paymentEO = GetPaymentEO(paymentDTO); UpdateStatus(paymentEO, PaymentStatus.Pending); try { result = ProcessPaymentWithGateway(paymentDTO); if (result) { UpdateStatus(paymentEO, PaymentStatus.Processed); } else { UpdateStatus(paymentEO, PaymentStatus.Failed); } } catch (Exception exe) { AddError(PaymentErrorCode.Internal_Error, exe.Message); } } return(result); }
public bool SavePaymentDetails(PaymentEO paymentEO, PaymentStatusEO paymentStatusEO) { bool isSaved = false; if (paymentEO != null) { paymentEO.PaymentDate = DateTime.Now; paymentEO.PaymentStatus = paymentStatusEO; isSaved = SavePaymentDetails(paymentEO); } return(isSaved); }
public bool SavePaymentDetails(PaymentEO paymentEO) { bool isSaved = false; if (paymentEO != null) { paymentEO.PaymentDate = DateTime.Now; if (paymentEO.PaymentId > 0) { _paymentDbContext.PaymentDbSet.Update(paymentEO); } else { _paymentDbContext.PaymentDbSet.Add(paymentEO); } isSaved = _paymentDbContext.SaveChanges() > 0; } return(isSaved); }
private void UpdateStatus(PaymentEO paymentEO, string paymentStatus) { paymentEO.PaymentStatus.PatmentStatus = paymentStatus; PaymentRepository.SavePaymentDetails(paymentEO); }