Last active
December 17, 2020 17:31
-
-
Save ThiagoBarradas/356ccc3959bf3dc94d409b5611e20f14 to your computer and use it in GitHub Desktop.
SOLID [S] - Wrong Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Payment ProcessPayment(Payment payment) | |
{ | |
var transaction = this.BankService.CreateTransaction(payment); | |
payment.AddBankTransaction(transaction); | |
var mail = new MailMessage(); | |
mail.From = new MailAddress(payment.Merchant.Email); | |
mail.To.Add(payment.Customer.Email); | |
mail.Subject = "Bla bla bla"; | |
mail.Body = "bla bla bla"; | |
SmtpClient smtp = new SmtpClient("smtp.gmail.com"); | |
smtp.Send(mail); | |
// code code code | |
using (var sqlConnection = new SqlConnection(this.DatabaseConfiguration.ConnectionString)) | |
{ | |
var query = "INSERT INTO Payments (...)"; | |
var result = sqlConnection.ExecuteReader(query, payment); | |
// code code code | |
} | |
return payment; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment