public class PaymentService
public required AccountType AccountType { get; set; }
public IPaymentProvider PaymentProvider { get; set; }
public INotificationService NotificationService { get; set; }
public class PaymentBuget : Payment {
public PaymentProvider(string email, string customerName, string matter, decimal amount) {
public async Task SendPaymentLink(string email, string customerName, string matter, decimal amount, decimal fee)
PaymentProvider = new PaymentProvider();
if (AccountType != AccountType.Operating)
fee = (matter == "SPECIAL") ? fee * 0.10m : fee;
await PaymentProvider.SendAchLink(email, matter, amount, fee);
await PaymentProvider.SendPayPalLink(email, customerName, amount);
await SendNotificationViaEmail(email, customerName, matter, amount, fee);
private async Task SendNotificationViaEmail(string email, string customerName, string matter, decimal amount, decimal fee)
NotificationService = new NotificationService();
await NotificationService.SendEmail(email, customerName, matter, amount, fee);
public interface IPaymentProvider
Task SendPayPalLink(string email, string name, decimal amount);
Task SendAchLink(string email, string matter, decimal amount, decimal fee);
public interface INotificationService
Task SendEmail(string email, string customerName, string matter, decimal amount, decimal fee);
public class NotificationService : INotificationService
public Task SendEmail(string email, string customerName, string matter, decimal amount, decimal fee)
throw new NotImplementedException();
public class PaymentProvider : IPaymentProvider
public Task SendAchLink(string email, string matter, decimal amount, decimal fee)
throw new NotImplementedException();
public Task SendPayPalLink(string email, string name, decimal amount)
throw new NotImplementedException();