public async Task SendPayment(PaymentSystemType paymentSystemType, double value) { var fileLogger = new FileSystemLogger(@"C:\MisterPaymentLogger.txt"); switch (paymentSystemType) { case PaymentSystemType.Microsoft: var microsoftPaymentSystem = new MicrosoftPaymentSystem(fileLogger); var microsoftAccount = new MicrosoftAccountModel { Login = "******", Password = "******", Value = 666, }; await microsoftPaymentSystem.SendPayment(microsoftAccount); break; case PaymentSystemType.Google: var googlePaymentSystem = new GooglePaymentSystem(fileLogger); var googleAccount = new GoogleAccountModel { ApiKey = "my api key", Value = value, }; await googlePaymentSystem.SendPayment(googleAccount); break; case PaymentSystemType.Facebook: var facebookPaymentSystem = new FacebookPaymentSystem(fileLogger); var facebookAccount = new FacebookAccountModel { Ip = "127.0.0.1", Port = 666, Password = "******", Value = value, }; await facebookPaymentSystem.SendPayment(facebookAccount); break; default: break; } }
public MicrosoftPaymentSystem(FileSystemLogger logger) { _logger = logger; }
public FacebookPaymentSystem(FileSystemLogger logger) { _logger = logger; }
public GooglePaymentSystem(FileSystemLogger logger) { _logger = logger; }