public bool UpdateRefundStripe(RefundStripe RefundStripe) { _unitOfWork.Repository <RefundStripe>().Update(RefundStripe); return(_unitOfWork.Save()); }
public IActionResult RefundStripe(string TransId) { var trans = _TransactionsService.GetTransactionById(TransId); APIResponseData responseData = new APIResponseData(); responseData.StatusCode = 0; responseData.Message = "Failed."; responseData.Result.Data = new { TransactionId = TransId, Status = "Fail" }; try { if (trans != null) { var refund = StripeHelpers.RefundPayment(trans.ReferenceId); responseData.StatusCode = 1; responseData.Message = "Success"; responseData.Result.Data = new { TransactionId = TransId, Status = refund.Status }; var RefundStripe = new RefundStripe() { Reason = refund.Reason, Description = refund.Description, Status = refund.Status, ChargeId = trans.ReferenceId, Amount = refund.Amount, RefundID = refund.Id, FailureReason = refund.FailureReason, Currency = refund.Currency, TransID = TransId }; refundStripeService.InsertRefundStripe(RefundStripe); var PaymentLogs = new PaymentLogs() { Data = Newtonsoft.Json.JsonConvert.SerializeObject(refund), Error = "Success", PaymentType = "STRIPE", FunctionName = "RefundStripe", TransID = TransId }; _PaymentLogsService.InsertPaymentLogs(PaymentLogs); } } catch (Exception ex) { responseData.StatusCode = 0; responseData.Message = "Something went wrong, please try again."; var typeEx = ex.GetType(); var PaymentLogs = new PaymentLogs() { Data = Newtonsoft.Json.JsonConvert.SerializeObject(trans), Error = ex.Message, PaymentType = "STRIPE", FunctionName = "RefundStripe", TransID = TransId }; _PaymentLogsService.InsertPaymentLogs(PaymentLogs); EmailHelpers.SendEmail(new Common.DTO.ErrorInfo() { Section = $"AQ RefundStripe PaymentType: STRIPE <br /> TransactionID : {TransId}", Exception = ex }); } return(Ok(responseData)); }
public void InsertRefundStripe(RefundStripe RefundStripe) { _unitOfWork.Repository <RefundStripe>().Add(RefundStripe); }