diff options
author | marcinzelent <marcin@zelent.net> | 2021-02-21 14:13:49 +0100 |
---|---|---|
committer | marcinzelent <marcin@zelent.net> | 2019-12-20 14:21:37 +0100 |
commit | b1eb36d3fbc5012b07489454a7452e8488507f6a (patch) | |
tree | f6a9e6e561eabde5b06366a6aeac78df123ca917 /Adapters |
Diffstat (limited to 'Adapters')
-rw-r--r-- | Adapters/IPayment.cs | 9 | ||||
-rw-r--r-- | Adapters/MastercardPayment.cs | 13 | ||||
-rw-r--r-- | Adapters/MastercardPaymentAdapter.cs | 13 | ||||
-rw-r--r-- | Adapters/VisaPayment.cs | 13 |
4 files changed, 48 insertions, 0 deletions
diff --git a/Adapters/IPayment.cs b/Adapters/IPayment.cs new file mode 100644 index 0000000..c07b7e5 --- /dev/null +++ b/Adapters/IPayment.cs @@ -0,0 +1,9 @@ +using KukaPizza.Models; + +namespace KukaPizza.Adapters +{ +public interface IPayment + { + void Pay(double price); + } +}
\ No newline at end of file diff --git a/Adapters/MastercardPayment.cs b/Adapters/MastercardPayment.cs new file mode 100644 index 0000000..d6b7953 --- /dev/null +++ b/Adapters/MastercardPayment.cs @@ -0,0 +1,13 @@ +using System; +using KukaPizza.Models; + +namespace KukaPizza.Adapters +{ + public class MasterCardPayment + { + public void PayWithMastercard(double price) + { + Console.WriteLine($"\nPaid {price} with Mastercard card."); + } + } +}
\ No newline at end of file diff --git a/Adapters/MastercardPaymentAdapter.cs b/Adapters/MastercardPaymentAdapter.cs new file mode 100644 index 0000000..8908315 --- /dev/null +++ b/Adapters/MastercardPaymentAdapter.cs @@ -0,0 +1,13 @@ +using KukaPizza.Models; + +namespace KukaPizza.Adapters +{ + public class MasterCardPaymentAdapter : IPayment + { + private MasterCardPayment _mastercardPayment = new MasterCardPayment(); + public void Pay(double price) + { + _mastercardPayment.PayWithMastercard(price); + } + } +}
\ No newline at end of file diff --git a/Adapters/VisaPayment.cs b/Adapters/VisaPayment.cs new file mode 100644 index 0000000..8042956 --- /dev/null +++ b/Adapters/VisaPayment.cs @@ -0,0 +1,13 @@ +using System; +using KukaPizza.Models; + +namespace KukaPizza.Adapters +{ + public class VisaPayment : IPayment + { + public void Pay(double price) + { + Console.WriteLine($"\nPaid {price} with Visa card."); + } + } +}
\ No newline at end of file |